/* ReelForge — light-table UI. Every render is a 9:16 frame that fills as it renders. */
:root {
  --paper: #eceef2;
  --surface: #ffffff;
  --sunken: #f5f6f8;
  --ink: #16181d;
  --ink-2: #3a3f4a;
  --muted: #656c79;
  --line: #d9dde4;
  --line-strong: #c4c9d2;
  --accent: #4f3bff;
  --accent-ink: #ffffff;
  --accent-soft: #ebe8ff;
  --amber: #e89a0c;
  --amber-soft: #fff3dc;
  --ok: #0f9b6c;
  --ok-soft: #e1f5ec;
  --err: #d93f45;
  --err-soft: #fde8e8;
  --frame-bg: #e3e6ec;
  --shadow: 0 1px 2px rgba(22, 24, 29, .06), 0 8px 24px -12px rgba(22, 24, 29, .18);
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 9px;
  --display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1014; --surface: #171a20; --sunken: #12151a; --ink: #eceef2; --ink-2: #c9cdd5; --muted: #8c93a0;
    --line: #262a33; --line-strong: #353a45; --accent: #7c6cff; --accent-ink: #0e1014; --accent-soft: #221d4a;
    --amber: #f2b13a; --amber-soft: #2e2410; --ok: #2fc48f; --ok-soft: #0f2a20; --err: #ff6b6f; --err-soft: #331517;
    --frame-bg: #1f232b; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1014; --surface: #171a20; --sunken: #12151a; --ink: #eceef2; --ink-2: #c9cdd5; --muted: #8c93a0;
  --line: #262a33; --line-strong: #353a45; --accent: #7c6cff; --accent-ink: #0e1014; --accent-soft: #221d4a;
  --amber: #f2b13a; --amber-soft: #2e2410; --ok: #2fc48f; --ok-soft: #0f2a20; --err: #ff6b6f; --err-soft: #331517;
  --frame-bg: #1f232b; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15.5px/1.55 var(--body); font-feature-settings: "tnum" 1; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 16.5px; font-weight: 700; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 22px;
  padding: 10px clamp(14px, 3vw, 28px); background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font: 800 19px var(--display); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.logo-mark { color: var(--ink); flex: none; }
.mainnav { display: flex; gap: 4px; }
.mainnav a { color: var(--ink-2); padding: 7px 13px; border-radius: 999px; font-weight: 600; font-size: 14.5px; }
.mainnav a:hover { background: var(--surface); text-decoration: none; }
.mainnav a.on { background: var(--ink); color: var(--paper); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.queue-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.queue-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.queue-pill.live i { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.queue-pill.down i { background: var(--err); box-shadow: 0 0 0 4px var(--err-soft); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 700 14px var(--display); }
.uname { font-weight: 600; font-size: 14px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 6px; z-index: 40; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; }
.menu-head small { overflow: hidden; text-overflow: ellipsis; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; color: var(--ink); background: none; border: 0; font: 500 14.5px var(--body); cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--sunken); text-decoration: none; }
.menu form { margin: 0; }
.announce { background: var(--ink); color: var(--paper); text-align: center; padding: 9px 16px; font-weight: 500; font-size: 14px; }

/* ---------- page ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 28px clamp(14px, 3vw, 28px) 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin: 6px 0 0; max-width: 60ch; }
.flash { padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-error { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.flash-info { background: var(--accent-soft); color: var(--accent); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.panel + .panel { margin-top: 18px; }
.studio > .panel, .two > .panel, .two > form.panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--r-sm); padding: 10px 16px; font: 600 14.5px var(--body); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); border-color: transparent; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--sunken); border-color: transparent; }
.btn-danger { color: var(--err); }
.btn-danger:hover { border-color: var(--err); background: var(--err-soft); }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: var(--r-md); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--muted); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; font: 500 15px var(--body); color: var(--ink); background: var(--sunken); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px; transition: border-color .15s, background .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 90px; resize: vertical; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }

/* segmented control */
.seg { display: inline-grid; grid-auto-flow: column; background: var(--sunken); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------- auth pages ---------- */
body.bare { background: var(--paper); }
.page-bare { max-width: none; padding: 0; }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px); }
.auth-art { position: relative; overflow: hidden; background: var(--ink); color: var(--paper); padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; }
.auth-art .brand { color: var(--paper); }
.auth-art .logo-mark { color: var(--paper); }
.auth-art h1 { font-size: clamp(34px, 5vw, 64px); max-width: 12ch; color: var(--paper); }
.auth-art p { color: color-mix(in srgb, var(--paper) 70%, transparent); max-width: 42ch; font-size: 17px; margin-top: 16px; }
.reel-strip { display: flex; gap: 14px; align-items: flex-end; margin: 34px 0; }
.reel-strip .frame { width: clamp(54px, 7vw, 92px); border-color: color-mix(in srgb, var(--paper) 55%, transparent); background: color-mix(in srgb, var(--paper) 7%, transparent); }
.reel-strip .frame:nth-child(2) { width: clamp(64px, 8.5vw, 112px); }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 5vw, 56px); background: var(--surface); }
.auth-form h2 { font-size: 28px; margin-bottom: 6px; }
.auth-form > p { color: var(--muted); margin-bottom: 26px; }
.auth-switch { margin-top: 18px; font-size: 14.5px; color: var(--muted); }

/* ---------- the frame (signature element) ---------- */
.frame { --p: 0%; position: relative; aspect-ratio: 9 / 16; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--frame-bg); flex: none; }
.frame .fill { position: absolute; left: 0; right: 0; bottom: 0; height: var(--p); background: var(--accent); transition: height .8s cubic-bezier(.2,.7,.2,1); }
.frame .fill::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: color-mix(in srgb, var(--accent) 60%, #fff); }
.frame .label { position: absolute; inset: 0; display: grid; place-items: center; font: 800 15px var(--display); color: var(--ink); mix-blend-mode: normal; z-index: 2; text-align: center; padding: 4px; line-height: 1.1; }
.frame.processing .label { color: var(--ink); }
.frame.queued { border-style: dashed; border-color: var(--amber); }
.frame.queued .fill { height: 100%; background: repeating-linear-gradient(-45deg, var(--amber-soft) 0 8px, transparent 8px 16px); }
.frame.queued .fill::after { display: none; }
.frame.done { border-color: var(--ok); }
.frame.failed, .frame.canceled { border-color: var(--err); }
.frame.failed .fill, .frame.canceled .fill { height: 100%; background: var(--err-soft); }
.frame.failed .fill::after, .frame.canceled .fill::after { display: none; }
.frame img, .frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame .play { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(transparent 55%, rgba(0,0,0,.45)); color: #fff; opacity: 0; transition: opacity .15s; border: 0; cursor: pointer; padding: 0; }
.frame:hover .play, .frame .play:focus-visible { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .frame.processing .fill::after { animation: scan 1.6s ease-in-out infinite; }
}
@keyframes scan { 50% { opacity: .2; } }

/* ---------- studio layout ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .9fr); gap: 22px; align-items: start; }
.usage { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 22px; overflow: hidden; }
.usage > div { padding: 16px 20px; border-right: 1px solid var(--line); }
.usage > div:last-child { border-right: 0; }
.usage .num { font: 800 26px var(--display); letter-spacing: -.02em; }
.usage .num small { font: 600 14px var(--body); color: var(--muted); }
.usage .what { font-size: 13.5px; color: var(--muted); }
.meter { height: 5px; background: var(--sunken); border-radius: 9px; margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 9px; }
.meter.warn i { background: var(--amber); }
.meter.full i { background: var(--err); }

/* dropzone */
.drop { display: block; position: relative; border: 2px dashed var(--line-strong); border-radius: var(--r-lg); padding: 30px 20px; text-align: center; background: var(--sunken); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop strong { display: block; font: 700 18px var(--display); margin-bottom: 4px; }
.drop .muted { font-size: 14px; }
.drop-frames { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.drop-frames .frame { width: 26px; border-width: 1.6px; border-radius: 5px; }

/* scene list */
.scenes { margin-top: 18px; display: grid; gap: 10px; }
.scene { display: grid; grid-template-columns: auto 38px minmax(0, 1fr) 132px auto; align-items: center; gap: 12px; padding: 10px 12px 10px 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.scene.dragging { opacity: .5; }
.scene.drop-target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grip { cursor: grab; color: var(--muted); padding: 4px; border: 0; background: none; display: grid; place-items: center; }
.scene .frame { width: 38px; border-width: 1.8px; border-radius: 6px; }
.scene .frame .label { font-size: 13px; }
.scene-main { min-width: 0; display: grid; gap: 4px; }
.scene-main input { padding: 6px 9px; font-weight: 600; background: transparent; border-color: transparent; }
.scene-main input:hover { border-color: var(--line); }
.scene-meta { font-size: 12.5px; color: var(--muted); padding-left: 9px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.scene-meta .warn { color: var(--amber); font-weight: 600; }
.scene-meta label.audio-pick { color: var(--accent); cursor: pointer; font-weight: 600; }
.scene-meta label.audio-pick input { display: none; }
.dur { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); overflow: hidden; }
.dur input { border: 0; background: transparent; text-align: center; padding: 8px 2px; font-weight: 700; min-width: 0; box-shadow: none !important; -moz-appearance: textfield; }
.dur input::-webkit-outer-spin-button, .dur input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dur span { font-size: 13px; color: var(--muted); padding-right: 6px; }
.dur button { border: 0; background: none; width: 30px; align-self: stretch; cursor: pointer; color: var(--ink-2); font-size: 17px; }
.dur button:hover { background: var(--line); }
.scene-actions { display: flex; gap: 2px; }
.totals { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--sunken); font-size: 14.5px; flex-wrap: wrap; }
.totals strong { font: 800 18px var(--display); }
.options { display: grid; gap: 16px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.opt-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; }
.opt-row .field { margin: 0; flex: 1 1 160px; }
.submit-row { display: flex; gap: 12px; align-items: center; margin-top: 22px; flex-wrap: wrap; }
.upload-bar { flex: 1 1 200px; height: 8px; border-radius: 9px; background: var(--sunken); overflow: hidden; }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.form-error { color: var(--err); font-weight: 600; font-size: 14.5px; margin-top: 12px; }

/* ---------- job list ---------- */
.jobs { display: grid; }
.job { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.job:first-child { border-top: 0; padding-top: 4px; }
.job .frame { width: 64px; }
.job.big { grid-template-columns: 96px minmax(0, 1fr); }
.job.big .frame { width: 96px; }
.job-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.job-name { font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.job-state { margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.job-state strong { font-family: var(--display); }
.job-err { color: var(--err); font-size: 13.5px; margin-top: 6px; overflow-wrap: anywhere; }
.job-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.queued { background: var(--amber-soft); color: var(--amber); }
.chip.processing { background: var(--accent-soft); color: var(--accent); }
.chip.done { background: var(--ok-soft); color: var(--ok); }
.chip.failed, .chip.canceled { background: var(--err-soft); color: var(--err); }
.chip.neutral { background: var(--sunken); color: var(--muted); }
.chip.neutral::before { display: none; }
.empty { text-align: center; padding: 34px 14px; color: var(--muted); }
.empty .frame { width: 44px; margin: 0 auto 14px; border-style: dashed; border-color: var(--line-strong); }
.empty strong { display: block; color: var(--ink); font: 700 17px var(--display); margin-bottom: 4px; }

/* queue rail (who is ahead) */
.rail { display: flex; gap: 6px; align-items: flex-end; margin: 4px 0 2px; overflow: hidden; }
.rail .frame { width: 14px; border-width: 1.5px; border-radius: 3px; }
.rail .frame.mine { border-color: var(--accent); border-style: solid; background: var(--accent); }
.rail small { margin-left: 6px; white-space: nowrap; }

/* tabs + toolbar */
.toolbar { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a, .tabs button { padding: 7px 13px; border-radius: 999px; color: var(--ink-2); font: 600 14px var(--body); border: 1px solid transparent; background: none; cursor: pointer; }
.tabs a:hover, .tabs button:hover { background: var(--surface); text-decoration: none; }
.tabs .on { background: var(--surface); border-color: var(--line); color: var(--ink); }
.tabs .count { color: var(--muted); font-weight: 500; margin-left: 4px; }
.search { max-width: 260px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }

/* grid of finished videos (renders page) */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
.vcard { display: grid; gap: 10px; }
.vcard .frame { width: 100%; border-radius: 14px; }
.vcard .frame.processing .label, .vcard .frame.queued .label { font-size: 30px; }
.vcard .job-name { font-size: 15px; }
.vcard .job-actions { margin-top: 2px; }

/* ---------- modal ---------- */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); max-width: min(92vw, 560px); width: 100%; }
dialog::backdrop { background: rgba(10, 12, 16, .55); backdrop-filter: blur(3px); }
.modal-body { padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }
dialog.player { max-width: min(94vw, 460px); background: #000; }
dialog.player video { width: 100%; max-height: 82vh; aspect-ratio: 9/16; background: #000; }
dialog.player .modal-foot { background: var(--surface); }

/* toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 90; width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; font-size: 14.5px; }
.toast.err { background: var(--err); color: #fff; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: toast-in .25s ease-out; } }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ---------- owner panel ---------- */
.admin-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 57px); }
.side { border-right: 1px solid var(--line); padding: 22px 12px; position: sticky; top: 57px; height: calc(100vh - 57px); overflow: auto; }
.side nav { display: grid; gap: 2px; }
.side a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; }
.side a:hover { background: var(--surface); text-decoration: none; }
.side a.on { background: var(--surface); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.side .count { background: var(--amber); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.admin-page { max-width: 1180px; margin: 0; width: 100%; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 18px; }
.kpis > div { padding: 18px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.kpis .num { font: 800 30px var(--display); letter-spacing: -.02em; }
.kpis .what { color: var(--muted); font-size: 13.5px; }
.two { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar i { width: 100%; max-width: 30px; background: var(--accent); border-radius: 5px 5px 2px 2px; min-height: 2px; }
.bars .bar i.fail { background: var(--err); }
.bars .bar small { font-size: 11px; }
.bars .bar b { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
table.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--sunken); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; margin: 0 -22px -22px; }
.table-wrap .table th:first-child, .table-wrap .table td:first-child { padding-left: 22px; }
.table-wrap .table th:last-child, .table-wrap .table td:last-child { padding-right: 22px; }
.who { display: grid; }
.who small { font-size: 12.5px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.off { background: var(--err); }

/* server cards */
.servers { display: grid; gap: 14px; }
.server { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.server-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.server-stats b { color: var(--ink); font-weight: 600; }
.cmd { position: relative; display: flex; align-items: stretch; background: var(--ink); color: var(--paper); border-radius: var(--r-md); overflow: hidden; margin: 12px 0; }
.cmd code { flex: 1; padding: 14px 16px; font: 13.5px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-x: auto; white-space: nowrap; }
.cmd button { border: 0; background: var(--accent); color: var(--accent-ink); font: 700 14px var(--body); padding: 0 18px; cursor: pointer; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.steps li { padding-left: 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
pre.logs { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; max-height: 260px; overflow: auto; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .studio, .two { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .side nav { display: flex; overflow-x: auto; gap: 4px; }
  .side a { white-space: nowrap; }
  .side a.on { box-shadow: inset 0 -3px 0 var(--accent); }
}
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: auto; }
  .reel-strip { display: none; }
  .usage { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage > div:nth-child(2) { border-right: 0; }
  .usage > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .mainnav { display: none; }
  .uname { display: none; }
  .page { padding-bottom: 110px; }
  .scene { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; padding: 10px; }
  .scene .grip { display: none; }
  .scene .dur { grid-column: 2 / 4; grid-row: 2; width: 150px; }
  .scene-actions { grid-row: 1; grid-column: 3; }
  .scene-main input { padding-left: 4px; }
  .scene-meta { padding-left: 4px; }
  .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .vcard .job-actions .btn-ghost { display: none; }
  .panel { padding: 18px; }
  .table-wrap { margin: 0 -18px -18px; }
  .seg { width: 100%; grid-auto-columns: 1fr; }
  .seg span { text-align: center; padding: 8px 6px; font-size: 13px; }
  .topbar { gap: 10px; }
  .queue-pill span { display: none; }
  .mobilenav { display: flex !important; }
}
.mobilenav { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); justify-content: space-around; padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); }
.mobilenav a { color: var(--ink-2); font-weight: 600; font-size: 13px; padding: 6px 12px; border-radius: 999px; }
.mobilenav a.on { background: var(--ink); color: var(--paper); }

/* ---------- public landing page ---------- */
.landing { max-width: 1160px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.land-top { display: flex; justify-content: space-between; align-items: center; padding: 22px 0; }
.land-top nav { display: flex; gap: 8px; }
.land-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 48px; align-items: center; padding: clamp(30px, 7vw, 90px) 0 clamp(40px, 7vw, 80px); }
.land-hero h1 { font-size: clamp(40px, 6.4vw, 80px); line-height: 1.02; letter-spacing: -.035em; max-width: 13ch; }
.land-hero p { font-size: 18.5px; color: var(--ink-2); max-width: 52ch; margin-top: 22px; }
.land-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.land-status { font-size: 14px !important; color: var(--muted) !important; margin-top: 22px !important; }
.land-visual { display: flex; gap: clamp(10px, 2vw, 22px); align-items: flex-end; justify-content: center; }
.land-visual .frame { width: clamp(70px, 9vw, 112px); border-width: 2.5px; border-radius: 14px; }
.land-visual .frame.big { width: clamp(110px, 14vw, 176px); border-radius: 18px; }
.land-visual .frame .label { font-size: clamp(16px, 2vw, 26px); }
.land-steps { border-top: 1px solid var(--line); padding: 50px 0; }
.land-steps h2 { font-size: 28px; margin-bottom: 26px; }
.land-steps ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; counter-reset: step; }
.land-steps li { counter-increment: step; display: grid; gap: 6px; }
.land-steps li::before { content: counter(step); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 800 15px var(--display); margin-bottom: 8px; }
.land-steps strong { font: 700 19px var(--display); }
.land-steps span { color: var(--muted); }
.land-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; margin-bottom: 50px; }
.land-features > div { padding: 26px 28px; border-bottom: 1px solid var(--line); }
.land-features > div:nth-child(odd) { border-right: 1px solid var(--line); }
.land-features > div:nth-last-child(-n+2) { border-bottom: 0; }
.land-features p { color: var(--muted); margin: 8px 0 0; }
.land-foot { display: flex; justify-content: space-between; gap: 12px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; flex-wrap: wrap; }
@media (max-width: 820px) {
  .land-hero { grid-template-columns: 1fr; gap: 36px; }
  .land-visual { justify-content: flex-start; }
  .land-steps ol, .land-features { grid-template-columns: 1fr; }
  .land-features > div:nth-child(odd) { border-right: 0; }
  .land-features > div:nth-last-child(2) { border-bottom: 1px solid var(--line); }
}
