/* SleepForge — top bar + centred work area + settings with side nav,
   in SleepForge's own night palette. Dark-only by design. */
:root {
  --bg: #0d0b1e;
  --bg-2: #131030;
  --panel: #19153a;
  --panel-2: #211c48;
  --panel-3: #2a2457;
  --line: #2d2757;
  --line-2: #3e3676;
  --text: #f0edff;
  --muted: #a6a1cc;
  --faint: #6f6a9c;
  --accent: #ffc46b;
  --accent-2: #f4a24c;
  --accent-ink: #2a1600;
  --accent-soft: rgba(255, 196, 107, .14);
  --lav: #b9a6ff;
  --mint: #8fe3c6;
  --danger: #ff8d9e;
  --warn: #ffcb7d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 14px 40px -18px rgba(0, 0, 0, .7);
  --head: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--body); }
body { min-height: 100vh; background:
  radial-gradient(1100px 520px at 50% -180px, #2a2263 0%, transparent 70%),
  radial-gradient(800px 500px at 100% 100%, #1d1745 0%, transparent 60%), var(--bg); background-attachment: fixed; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
h1 { font-family: var(--head); font-size: 30px; line-height: 1.15; letter-spacing: -.01em; }
h2 { font-family: var(--head); font-size: 22px; line-height: 1.2; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.serif { font-family: var(--head); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.label-caps { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- top bar */
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); background: rgba(13, 11, 30, .82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.brand b { font-family: var(--head); font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.verchip { font-family: var(--mono); font-size: 10.5px; color: var(--faint); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 6px; }
.qpill { display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-weight: 600; font-size: 13px; }
.qpill:hover { text-decoration: none; border-color: var(--accent); }
.qpill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.qpill .dot.live { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 1.6s infinite; }
.qpill .count { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
@keyframes pulse { 50% { opacity: .45; } }
.topnav { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.topnav a.tab { color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid transparent; }
.topnav a.tab:hover { color: var(--text); text-decoration: none; }
.topnav a.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.iconbtn { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; border: 1px solid var(--line-2); background: var(--panel); color: var(--muted); cursor: pointer; padding: 0; }
.iconbtn:hover, .iconbtn.on { color: var(--text); border-color: var(--accent); }
.iconbtn svg { width: 17px; height: 17px; }
.bottomnav { display: none; }

/* ---------------- page frame */
.page { width: 100%; margin: 0 auto; padding: 32px max(20px, env(safe-area-inset-right)) 90px max(20px, env(safe-area-inset-left)); }
.w-create { max-width: 1240px; }
.w-wide { max-width: 1120px; }
.w-mid { max-width: 980px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.pagehead p { margin-top: 6px; max-width: 62ch; }
.mockbar { margin-bottom: 18px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); border: 1px solid rgba(255, 196, 107, .35); color: var(--accent); font-weight: 600; font-size: 13px; }

/* ---------------- surfaces */
.card { background: linear-gradient(180deg, rgba(33, 28, 72, .78), rgba(25, 21, 58, .78)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.inset { background: rgba(10, 8, 26, .45); box-shadow: none; }
.card h2 + p, .card h3 + p { margin-top: 4px; }
.sep { height: 1px; background: var(--line); border: 0; margin: 18px 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------------- controls */
button, .btn { font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; padding: 9px 16px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); line-height: 1.2; white-space: nowrap; text-decoration: none !important; }
button:hover, .btn:hover { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line-2); }
button svg, .btn svg { width: 15px; height: 15px; flex: none; }
.primary { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; box-shadow: 0 8px 24px -10px rgba(244, 162, 76, .7); }
.primary:hover { filter: brightness(1.05); border-color: transparent; }
.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 7px 10px; }
.ghost:hover { color: var(--text); border-color: var(--line-2); }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; border-radius: 4px; }
.link:hover { text-decoration: underline; }
.danger { color: var(--danger); }
.sm { padding: 6px 12px; font-size: 12.5px; }
.lg { padding: 12px 22px; font-size: 15px; }
.round { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.round.lg { width: 46px; height: 46px; }

input[type=text], input[type=password], input[type=number], input[type=url], input[type=search], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: rgba(8, 6, 22, .55); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 90px; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23a6a1cc' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select option { background: var(--panel); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > .lbl { font-weight: 600; font-size: 13px; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.help { font-size: 12.5px; color: var(--faint); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }

/* pill tabs (Library / Analytics) */
.pilltabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; border: 1px solid var(--line); background: rgba(8, 6, 22, .45); }
.pilltabs button { border: 0; background: transparent; color: var(--muted); padding: 7px 16px; font-size: 13px; }
.pilltabs button.on { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-ink); }
.pilltabs.subtle button.on { background: var(--panel-3); color: var(--text); }
/* underline tabs (Settings / job page) */
.utabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.utabs button { border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid transparent; }
.utabs button.on { color: var(--text); border-bottom-color: var(--accent); }
/* chips (filters, options) */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; background: rgba(8, 6, 22, .45); border: 1px solid var(--line-2); color: var(--muted); }
.chip:hover { color: var(--text); }
.chip.on { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.chip .n { color: var(--faint); font-weight: 500; margin-left: 4px; }
.chip small { display: block; font-size: 11px; color: var(--faint); font-weight: 500; }
/* sliders */
.slider { display: flex; align-items: center; gap: 14px; }
.slider input[type=range] { flex: 1; accent-color: var(--accent); height: 4px; }
.vbadge { min-width: 64px; text-align: center; padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(255, 196, 107, .4); color: var(--accent); background: var(--accent-soft); font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
/* switch */
.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: background .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent-2); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* badges / status */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--line-2); color: var(--muted); background: rgba(8, 6, 22, .4); white-space: nowrap; }
.badge.ok, .b-completed { color: var(--mint); border-color: rgba(143, 227, 198, .35); background: rgba(143, 227, 198, .08); }
.badge.warn, .b-running { color: var(--warn); border-color: rgba(255, 203, 125, .35); background: rgba(255, 203, 125, .08); }
.badge.err, .b-failed { color: var(--danger); border-color: rgba(255, 141, 158, .35); background: rgba(255, 141, 158, .08); }
.badge.lav, .b-queued { color: var(--lav); border-color: rgba(185, 166, 255, .35); background: rgba(185, 166, 255, .08); }
.b-canceled { color: var(--faint); }
.badge.accent { color: var(--accent); border-color: rgba(255, 196, 107, .4); background: var(--accent-soft); }
.sdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--faint); }
.sdot.ok { background: var(--mint); } .sdot.warn { background: var(--warn); } .sdot.err { background: var(--danger); } .sdot.off { background: var(--line-2); }
.progress { height: 6px; border-radius: 99px; background: rgba(8, 6, 22, .7); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .6s ease; }
.progress.done > i { background: var(--mint); }

/* ---------------- Create */
.create-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 0 0 26px; }
.stepper button { border: 0; background: transparent; padding: 4px 2px; color: var(--faint); font-weight: 600; gap: 9px; }
.stepper .n { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; border: 1px solid var(--line-2); color: var(--faint); }
.stepper button.on { color: var(--text); }
.stepper button.on .n { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.stepper button.done { color: var(--muted); }
.stepper button.done .n { background: var(--accent-soft); border-color: rgba(255, 196, 107, .45); color: var(--accent); }
.stepper .bar { width: 30px; height: 1px; background: var(--line-2); }
.hero { text-align: center; font-size: 36px; margin-bottom: 22px; }
.composer { padding: 16px; }
.composer .pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.npill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 8px 5px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(8, 6, 22, .4); }
.npill .k { color: var(--muted); font-size: 12.5px; }
.npill input { width: 56px; padding: 4px 6px; border: 0; background: transparent; font-weight: 700; text-align: right; box-shadow: none !important; }
.npill .sfx { color: var(--faint); font-size: 12.5px; padding-right: 6px; }
.composer .titlein { font-family: var(--head); font-size: 22px; font-weight: 500; border: 0; background: transparent; padding: 10px 4px 2px; box-shadow: none !important; }
.composer .briefin { border: 0; background: transparent; min-height: 120px; padding: 6px 4px; box-shadow: none !important; resize: none; color: var(--text); }
.composer input::placeholder, .composer textarea::placeholder { color: var(--faint); }
.composer .titlein::placeholder { color: #8d84b8; }
.composer .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.attach { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.attchip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(8, 6, 22, .4); font-size: 12.5px; }
.attchip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.attchip button { padding: 2px 6px; border: 0; background: transparent; color: var(--faint); }
.selpill { display: inline-flex; align-items: center; gap: 10px; padding: 7px 12px 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); color: var(--muted); font-weight: 500; margin-top: 12px; }
.selpill b { color: var(--text); font-weight: 600; }
.selpill img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.menu { position: absolute; z-index: 30; min-width: 230px; padding: 6px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.menu button { width: 100%; justify-content: flex-start; border: 0; background: transparent; border-radius: 8px; padding: 9px 10px; font-weight: 500; color: var(--text); }
.menu button:hover { background: var(--panel-3); }
.menu button small { color: var(--faint); font-weight: 400; margin-left: auto; }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 0; }
.stepcard { padding: 24px; }
.stepcard > .head { margin-bottom: 18px; }
.stepcard > .head p { color: var(--muted); margin-top: 4px; }
.fsec { display: flex; flex-direction: column; gap: 9px; padding: 14px 0; border-top: 1px solid var(--line); }
.fsec:first-of-type { border-top: 0; padding-top: 0; }
.fsec > .lbl { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fsec.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.scard { padding: 0; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); text-align: left; display: flex; flex-direction: column; align-items: stretch; white-space: normal; }
.scard .sw { aspect-ratio: 16 / 9; display: block; position: relative; }
.scard .sw::after { content: ''; position: absolute; right: 12%; top: 18%; width: 16%; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 239, 196, .9); box-shadow: 0 0 22px rgba(255, 220, 150, .6); }
.scard .t { padding: 10px 12px 2px; font-weight: 600; font-size: 13px; }
.scard .h { padding: 0 12px 11px; font-size: 11.5px; color: var(--faint); font-weight: 400; }
.scard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.methods { display: flex; gap: 10px; flex-wrap: wrap; }
.method { min-width: 180px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(8, 6, 22, .4); text-align: left; flex-direction: column; align-items: flex-start; gap: 2px; white-space: normal; }
.method small { color: var(--faint); font-weight: 500; font-size: 12px; }
.method.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.method.off { opacity: .45; }
.stepfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.upload { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; border: 1.5px dashed var(--line-2); background: rgba(8, 6, 22, .35); cursor: pointer; color: var(--muted); }
.upload:hover { border-color: var(--accent); color: var(--text); }
.upload img { width: 96px; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.thumbprev { aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; position: relative; display: grid; align-items: end; justify-items: center; padding-bottom: 7%; background-size: cover; background-position: center; }
.thumbprev span { font-family: 'Inter', sans-serif; font-weight: 800; font-size: clamp(16px, 3.2vw, 34px); color: #fff; text-transform: uppercase; text-align: center; padding: 0 6%; -webkit-text-stroke: 1px #1b1440; text-shadow: 0 4px 0 rgba(27, 20, 64, .85), 0 0 14px rgba(0, 0, 0, .35); line-height: 1.1; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }

/* render queue side card */
.queue h2 { font-size: 20px; margin-bottom: 14px; }
.qitem { display: flex; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(8, 6, 22, .35); }
.qitem + .qitem { margin-top: 10px; }
.qitem .spin { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line-2); display: grid; place-items: center; flex: none; }
.qitem .spin i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin 1s linear infinite; }
.qitem .t { font-weight: 600; line-height: 1.3; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Library */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 18px; }
.toolbar .search { max-width: 260px; }
.section-label { margin: 18px 0 10px; }
.vrow { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 16px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(25, 21, 58, .7); align-items: start; }
.vrow + .vrow { margin-top: 10px; }
.vrow .thumb, .vcard .thumb { aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: linear-gradient(135deg, #2a2360, #17133a); display: grid; place-items: center; color: var(--faint); position: relative; }
.vrow .thumb img, .vcard .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .7); color: #fff; padding: 1px 6px; border-radius: 5px; font-size: 11px; font-weight: 700; }
.vrow .t { font-weight: 600; font-size: 15px; line-height: 1.3; color: var(--text); }
.vrow .meta { color: var(--faint); font-size: 12.5px; margin-top: 4px; }
.vrow .chan { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.vrow .chan img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.vrow .side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.countdown { color: var(--warn); font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.vcard { border-radius: 14px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; display: flex; flex-direction: column; }
.vcard .thumb { border-radius: 0; }
.vcard .body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ctable { width: 100%; border-collapse: collapse; }
.ctable td, .ctable th { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
.ctable th { color: var(--faint); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; }
.ctable td.r, .ctable th.r { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
.selbox { width: 18px; height: 18px; accent-color: var(--accent); }
.bulkbar { position: sticky; bottom: 16px; z-index: 10; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-top: 16px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { width: 54px; height: 54px; color: var(--faint); margin-bottom: 10px; }
.feed { max-height: 520px; overflow: auto; }
.feed .ln { display: grid; grid-template-columns: 92px 58px minmax(0, 1fr); gap: 10px; padding: 7px 4px; align-items: baseline; border-bottom: 1px solid rgba(45, 39, 87, .6); font-size: 12.5px; }
.feed .ln:last-child { border-bottom: 0; }
.lv { font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 1px 6px; border-radius: 5px; height: fit-content; text-align: center; background: rgba(185, 166, 255, .1); color: var(--lav); }
.lv.warn { background: rgba(255, 203, 125, .1); color: var(--warn); }
.lv.error { background: rgba(255, 141, 158, .1); color: var(--danger); }

/* ---------------- Job */
.backpill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 14px; }
.backpill:hover { color: var(--text); text-decoration: none; }
.backpill svg { width: 15px; height: 15px; flex: none; }
.stages { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin-top: 18px; position: relative; }
.stages::before { content: ''; position: absolute; left: 8%; right: 8%; top: 11px; height: 2px; background: var(--line-2); }
.stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }
.stage i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 2px solid var(--line-2); font-style: normal; font-size: 12px; z-index: 1; }
.stage.done { color: var(--muted); } .stage.done i { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stage.on { color: var(--accent); } .stage.on i { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.player { width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: #000; display: block; object-fit: cover; }
.copybox { white-space: pre-wrap; background: rgba(8, 6, 22, .5); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 260px; overflow: auto; font-size: 13px; }
.tracks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.trk { padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 6, 22, .35); font-size: 12.5px; }
.trk b { display: block; font-size: 13px; }
.trk.warn { border-color: rgba(255, 203, 125, .4); }
.lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.lane { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 6, 22, .35); }
.lane b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tags span { padding: 3px 9px; border-radius: 999px; background: var(--panel-3); color: var(--muted); font-size: 12px; }

/* ---------------- Channels */
.chgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.chcard { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; color: var(--text); position: relative; }
.chcard:hover { border-color: var(--line-2); text-decoration: none; }
.chcard .img { aspect-ratio: 4 / 3; background-size: cover; background-position: center; display: block; }
.chcard .b { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.chcard .d { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chcard .m { color: var(--faint); font-size: 11.5px; display: flex; justify-content: space-between; margin-top: 6px; }
.chcard .more { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; }

.chedit { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); }
@media (max-width: 860px) { .chedit { grid-template-columns: 1fr; } }

/* ---------------- Analytics */
.bignum { font-family: var(--head); font-size: 34px; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; margin-top: 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------------- Settings */
.setlayout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 26px; align-items: start; }
.sidenav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 4px; }
.sidenav .search { margin-bottom: 8px; }
.sidenav button { justify-content: flex-start; border: 1px solid transparent; background: transparent; color: var(--muted); padding: 9px 12px; border-radius: 10px; font-weight: 500; gap: 10px; }
.sidenav button:hover { color: var(--text); }
.sidenav button.on { color: var(--text); background: var(--panel-2); border-color: var(--line-2); }
.sidenav button .sdot { margin-left: auto; }
.sidenav button svg { width: 16px; height: 16px; }
.sechead { margin-bottom: 16px; }
.sechead p { color: var(--muted); margin-top: 6px; max-width: 70ch; }
.optcard { padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: rgba(25, 21, 58, .7); display: flex; flex-direction: column; gap: 10px; }
.optcard + .optcard { margin-top: 12px; }
.optcard .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.savehint { color: var(--faint); font-size: 12.5px; margin-top: 14px; }
.savehint.on { color: var(--mint); }
/* providers */
.provgroup { margin-top: 18px; }
.provgroup > .label-caps { display: block; margin-bottom: 8px; }
.prov { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(8, 6, 22, .35); flex-wrap: wrap; }
.prov + .prov { margin-top: 8px; }
.prov .name { font-weight: 600; display: flex; align-items: center; gap: 10px; min-width: 150px; }
.prov .caps { display: flex; gap: 6px; color: var(--faint); }
.prov .caps span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: rgba(255, 255, 255, .03); }
.prov .caps svg { width: 14px; height: 14px; }
.prov .dots { color: var(--faint); letter-spacing: 2px; font-size: 12px; }
.prov .keyin { flex-basis: 100%; display: flex; gap: 8px; margin-top: 6px; }
.prov .routes { flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap; padding-left: 20px; }
.prov .routes button { padding: 2px 9px; font-size: 11.5px; font-weight: 500; color: var(--muted); background: transparent; }
/* routing */
.routepanel { padding: 22px; }
.chain { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; row-gap: 14px; margin-top: 16px; }
.step { width: 220px; padding: 14px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(8, 6, 22, .45); display: flex; flex-direction: column; gap: 8px; position: relative; }
.step.off { opacity: .5; }
.step.ok-test { border-color: var(--mint); } .step.bad-test { border-color: var(--danger); }
.step.dragging { opacity: .4; }
.step.dropbefore { box-shadow: -3px 0 0 var(--accent); }
.step .hd { display: flex; align-items: center; gap: 8px; }
.step .no { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line-2); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.step .pv { min-width: 0; font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step .st { font-size: 12.5px; font-weight: 600; }
.st.ready { color: var(--mint); } .st.untested { color: var(--lav); } .st.nokey, .st.rejected { color: var(--warn); } .st.off { color: var(--faint); }
.step .model { font-size: 12.5px; color: var(--text); }
.step .note { font-size: 11.5px; color: var(--faint); line-height: 1.45; }
.step .ft { display: flex; align-items: center; justify-content: space-between; margin-top: auto; color: var(--faint); }
.step .ft .handle { cursor: grab; padding: 2px 4px; }
.step .ft button { width: 26px; height: 26px; padding: 0; border-radius: 7px; font-size: 13px; }
.link-line { width: 22px; align-self: center; height: 1px; background: var(--line-2); }
.addstep { width: 220px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: transparent; color: var(--muted); font-size: 14px; min-height: 160px; }
.addstep:hover { color: var(--text); }
.pickrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(8, 6, 22, .35); width: 100%; text-align: left; font-weight: 500; white-space: normal; }
.pickrow + .pickrow { margin-top: 8px; }
.pickrow:hover { border-color: var(--accent); }
/* team */
.acct { padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: rgba(8, 6, 22, .35); }
.acct + .acct { margin-top: 12px; }
.permrow { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 9px 0; border-top: 1px solid rgba(45, 39, 87, .6); }
.permrow:first-child { border-top: 0; }

/* ---------------- modal + toast */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(5, 4, 14, .7); display: grid; place-items: center; padding: 20px; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.modal .mh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal .ma { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 30px); opacity: 0; transition: all .25s; z-index: 70; padding: 11px 18px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-weight: 600; max-width: calc(100vw - 32px); pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { color: var(--danger); border-color: rgba(255, 141, 158, .5); }

/* ---------------- auth */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.authcard { width: min(400px, 100%); }

/* ---------------- responsive */
@media (max-width: 1060px) {
  .create-grid { grid-template-columns: 1fr; }
  .setlayout { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: static; flex-direction: row; flex-wrap: wrap; }
  .sidenav .search { flex-basis: 100%; }
}
@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; height: 56px; }
  .topnav { display: none; }
  .qpill .lbl { display: none; }
  .verchip { display: none; }
  .bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(13, 11, 30, .95); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--faint); font-size: 11px; font-weight: 600; text-decoration: none; padding: 4px; }
  .bottomnav a.on { color: var(--accent); }
  .bottomnav svg { width: 20px; height: 20px; }
  .page { padding-top: 20px; padding-bottom: 100px; }
  .hero { font-size: 27px; }
  h1 { font-size: 25px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .vrow { grid-template-columns: 96px minmax(0, 1fr); }
  .vrow .side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; }
  .step, .addstep { width: 100%; }
  .link-line { width: 1px; height: 14px; margin-left: 26px; }
  .chain { flex-direction: column; }
  #toast { bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.small.warn { color: var(--warn); }
.scenes { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow: auto; }
.scene { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(8, 6, 22, .35); }
.scene img, .scene .noimg { width: 72px; height: 41px; border-radius: 6px; object-fit: cover; flex: none; background: var(--line); }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
/* Routing step editor (Change → Model box, Thinking, Quality) */
.step.editing { width: 270px; border-color: var(--accent); }
.stepedit { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.stepedit .lbl { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 4px; }
.stepedit select { font-size: 13px; padding: 7px 10px; }
.combo { position: relative; }
.combo input { width: 100%; font-size: 14px; font-weight: 600; padding: 9px 11px; border-color: var(--accent); }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 240px; overflow: auto; background: #17132f; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); padding: 4px; }
.combo-opt { padding: 7px 9px; border-radius: 7px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.combo-opt b { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-all; }
.combo-opt span { font-size: 11px; color: var(--faint); }
.combo-opt:hover, .combo-opt.hi { background: rgba(185, 166, 255, .12); }
.combo-opt.cur { background: rgba(255, 196, 107, .12); }
.combo-opt.cur b { color: var(--accent); }
.combo-empty { padding: 9px; font-size: 12px; color: var(--faint); }
/* song library picker */
.songlist { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.song { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: rgba(8, 6, 22, .35); }
.song.on { border-color: var(--accent); background: rgba(255, 196, 107, .07); }
.song b { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.chip.sm { padding: 3px 10px; font-size: 12px; }
/* Packaging studio */
.pkpage { padding-bottom: 190px; }
.pkday { margin-bottom: 22px; }
.pkday h3 { font-family: var(--serif, inherit); font-size: 18px; margin-bottom: 10px; }
.pkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pkcard { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; white-space: normal; height: auto; text-align: left; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: rgba(8, 6, 22, .45); cursor: pointer; color: var(--text); }
.pkcard:hover { border-color: var(--line-2); }
.pkcard img, .pkcard .ph { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--line); }
.pkcard .b { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.pkcard .b { min-width: 0; }
.pkcard .b b { font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pkdetail { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 960px) { .pkdetail { grid-template-columns: minmax(0, 1fr); } }
.pkopt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.pkopt.on { border-color: var(--accent); background: rgba(255, 196, 107, .07); }
.pkopt b { display: block; font-size: 14.5px; color: var(--text); line-height: 1.35; }
.pkopt input { margin-top: 3px; accent-color: var(--accent); }
.pktrends { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 900px; overflow: auto; }
.pktrend { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 10px; color: var(--text); text-decoration: none; }
.pktrend:hover { background: rgba(185, 166, 255, .08); text-decoration: none; }
.pktrend img, .pktrend .ph { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 7px; flex: none; background: var(--line); }
.pktrend b { display: block; font-size: 13px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pkcomposer { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; width: min(900px, calc(100% - 32px)); z-index: 25; padding: 12px 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.pkcomposer textarea { flex: 1; resize: none; min-height: 40px; border: 0; background: transparent; font-size: 15px; padding: 9px 4px; }
.pkcomposer textarea:focus { outline: none; box-shadow: none; }
.pillsel { width: auto; padding: 5px 30px 5px 12px; font-size: 12.5px; border-radius: 999px; background-position: right 10px center; }
.pillin { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--line-2); border-radius: 999px; }
.pillin input { width: 150px; border: 0; background: transparent; padding: 3px 4px; font-size: 12.5px; }
@media (max-width: 860px) { .pkcomposer { bottom: 74px; } }
/* segmented switch (Packaging: Most popular / Recent outliers) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: rgba(8, 6, 22, .45); border: 1px solid var(--line-2); }
.seg button { border: 0; background: transparent; box-shadow: none; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--muted); min-height: 0; }
.seg button:hover { color: var(--text); }
.seg button.on { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.seg.sm button { padding: 5px 12px; font-size: 12px; }
.badge svg { width: 11px; height: 11px; vertical-align: -1px; }
/* Music library */
.mstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.mstats .card { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.mstats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.dropzone { display: flex; align-items: center; gap: 16px; padding: 22px; border: 1.5px dashed var(--line-2); cursor: pointer; position: relative; flex-wrap: wrap; }
.dropzone > svg { width: 30px; height: 30px; color: var(--accent); flex: none; }
.dropzone > div:not(.progress) { display: flex; flex-direction: column; gap: 4px; flex: 1 1 260px; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .progress { flex: 1 1 100%; margin: 0; }
.mtable { margin-top: 12px; display: flex; flex-direction: column; }
.mrow { display: grid; grid-template-columns: 28px minmax(0, 1fr) 64px minmax(0, 150px) 110px 36px; gap: 10px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.mrow.mhead { font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.mrow.on { background: var(--accent-soft); }
.mrow .mt { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mrow .mt b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.mrow .mt .tiny { display: block; }
.mchk input { width: 16px; height: 16px; accent-color: var(--accent); }
@media (max-width: 760px) {
  .mstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mrow { grid-template-columns: 28px minmax(0, 1fr) 56px 36px; }
  .mrow > :nth-child(4), .mrow > :nth-child(5) { display: none; }
}
#rtestout .ok { color: var(--mint); font-weight: 600; } #rtestout .warn { color: var(--warn); }
#songcount { accent-color: var(--accent); }
.attchip > svg { width: 16px; height: 16px; flex: none; }
.stowhere { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(8,6,22,.35); }
