:root {
  --paper: #faf7f2;
  --card: #ffffff;
  --ink: #1d1a16;
  --ink-soft: #6f6a61;
  --line: #e9e2d6;
  --accent: #ff6b4a;
  --accent-soft: #ffe9e2;
  --good: #1f9d63;
  --radius: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--paper); color: var(--ink); }

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar { background: #fffdf9; border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 24px; font-weight: 800; letter-spacing: -.5px; padding: 0 8px; }
.brand span { color: var(--accent); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 10px; font-size: 15px; color: var(--ink-soft); cursor: pointer; }
.nav-item:hover { background: var(--accent-soft); color: var(--ink); }
.nav-item.active { background: var(--ink); color: #fff; font-weight: 600; }
.plan-box { margin-top: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.plan-name { font-weight: 700; margin-bottom: 8px; }
.plan-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.plan-bar i { display: block; height: 100%; background: var(--accent); }
.plan-note { font-size: 13px; color: var(--ink-soft); margin: 8px 0 12px; }
.user-chip { display: flex; gap: 10px; align-items: center; padding: 4px 8px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.user-name { font-size: 13px; font-weight: 600; }
.user-sub { font-size: 12px; color: var(--ink-soft); }

/* ---------- main ---------- */
.main { padding: 22px 28px 48px; max-width: 1180px; width: 100%; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.topbar h1 { font-size: 26px; margin: 0; letter-spacing: -.5px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.credits-pill { background: var(--accent-soft); color: #b23c1d; font-weight: 700; padding: 8px 14px; border-radius: 99px; font-size: 14px; }

.view { display: none; flex-direction: column; gap: 16px; }
.view.active { display: flex; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card h2 { font-size: 17px; margin: 0; }
.muted { color: var(--ink-soft); font-size: 14px; line-height: 1.55; }

.badge { background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; }
.badge-live { background: #e5f6ec; border-color: #bfe8cf; color: var(--good); }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; font-size: 14px; }

/* ---------- buttons ---------- */
.btn { border: 1px solid transparent; border-radius: 12px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-danger { background: #fff; border-color: #f3c2b8; color: #c93a22; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px; font-size: 16px; }

/* ---------- overview ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-num { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat-label { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }

.job-row { display: flex; gap: 14px; align-items: center; }
.job-info { flex: 1; }
.job-title { font-weight: 600; }
.job-sub { color: var(--ink-soft); font-size: 13px; margin: 3px 0 8px; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; max-width: 420px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.thumb { width: 54px; height: 72px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; color: rgba(0,0,0,.45); flex: none; }
.t-detail { background: linear-gradient(150deg, #ffe3b3, #ffb59e); }
.t-line { background: linear-gradient(150deg, #dfe9ff, #bcd0ff); }
.t-flat { background: linear-gradient(150deg, #e6f5d9, #bfe3ae); }

.outputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.outputs-lg { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.output { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.output .art { aspect-ratio: 3/4; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; color: rgba(0,0,0,.35); }
.output .meta { padding: 10px 12px; }
.output .meta b { display: block; font-size: 13px; }
.output .meta span { font-size: 12px; color: var(--ink-soft); }
.output .ops { display: flex; gap: 6px; padding: 0 12px 12px; }
.output .ops button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 0; font-size: 12px; font-weight: 600; cursor: pointer; }

/* ---------- create ---------- */
.create-grid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.create-main { display: flex; flex-direction: column; gap: 26px; }
.step-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.step-head h2 { font-size: 16px; margin: 0; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; transform: translateY(3px); }
.step-hint { font-size: 12px; color: var(--ink-soft); }

.char-chips, .chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: 8px 14px; font-size: 14px; cursor: pointer; font-weight: 500; }
.chip:hover { border-color: var(--accent); }
.chip.active { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.chip.dashed { border-style: dashed; color: var(--ink-soft); }

.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.style-tile { border: 2px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; background: #fff; text-align: left; padding: 0; }
.style-tile:hover { border-color: #d8cdb8; }
.style-tile.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.style-tile .art { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: rgba(0,0,0,.35); }
.style-tile .s-meta { padding: 8px 10px 10px; }
.style-tile .s-meta b { display: block; font-size: 12.5px; line-height: 1.3; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-top: 5px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft); }
.tag.stages { color: #b23c1d; border-color: #f3c2b8; background: #fff5f1; }

.pose-groups { display: flex; flex-direction: column; gap: 10px; }
.pose-group .g-name { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }

.segmented { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-right: 10px; }
.seg { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 500; cursor: pointer; }
.seg.active { background: var(--ink); color: #fff; font-weight: 700; }

.summary { position: sticky; top: 22px; }
.sum-list { margin: 12px 0; }
.sum-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.sum-list dt { color: var(--ink-soft); }
.sum-list dd { margin: 0; font-weight: 600; text-align: right; }
.sum-cost { display: flex; justify-content: space-between; align-items: center; background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; margin: 14px 0 8px; }
.sum-cost strong { font-size: 20px; color: #b23c1d; }
.sum-note { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 14px; }
.sum-fine { font-size: 12px; color: var(--ink-soft); line-height: 1.5; margin: 10px 0 0; }

/* ---------- characters ---------- */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.char-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: center; }
.char-card .thumb { width: 62px; height: 82px; }
.char-card b { font-size: 16px; }
.slot-status { font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; }
.slot-status .ok { color: var(--good); font-weight: 700; }

.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.slot { border: 2px dashed var(--line); border-radius: 12px; padding: 22px 14px; text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.slot:hover { border-color: var(--accent); }
.slot-title { font-weight: 700; }
.slot-sub { font-size: 12px; color: var(--ink-soft); }
.consent { display: flex; gap: 8px; font-size: 13.5px; margin: 6px 0 14px; align-items: flex-start; }

/* ---------- credits ---------- */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.plan-card .price { font-size: 30px; font-weight: 800; margin: 8px 0; }
.plan-card .price span { font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.plan-card ul { padding-left: 18px; color: var(--ink-soft); font-size: 14px; line-height: 1.8; margin: 0 0 16px; }
.plan-card.featured { border-color: var(--accent); box-shadow: 0 8px 30px rgba(255, 107, 74, .12); }
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th, .ledger td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); }
.ledger th { color: var(--ink-soft); font-weight: 600; }
.plus { color: var(--good); font-weight: 700; }
.minus { color: #c93a22; font-weight: 700; }

/* ---------- settings ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.field input { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; background: #fff; }
.danger-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .create-grid, .plans { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .slots { grid-template-columns: 1fr; }
}
