/* Recorder — Phase 4 website mockup stylesheet (one file, no CDN, no web fonts).
   Design tokens are shared with ios/ios.css; keep the two in step.
   Light mode only: dark mode is out of scope for Phase 4 (the plan defines none). */

:root {
  /* colour */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --ink: #1b2130;
  --ink-2: #3a4256;
  --muted: #667085;
  --line: #e2e5eb;
  --brand: #3f51d8;
  --brand-ink: #ffffff;
  --brand-soft: #eceffd;
  --rec: #e5484d;
  --gold: #f2a91a;
  --focus: #3f51d8;

  /* status pills: background / text */
  --queued-bg: #eef1f6;   --queued-fg: #46506a;
  --running-bg: #e4eeff;  --running-fg: #1d5bd3;
  --review-bg: #fff3dc;   --review-fg: #925400;
  --delivered-bg: #e3f5ea;--delivered-fg: #17703f;
  --failed-bg: #fde8e7;   --failed-fg: #b42318;
  --held-bg: #f0eafd;     --held-fg: #6a3fc2;
  --cancelled-bg: #f1f1f3;--cancelled-fg: #6b6f7a;

  /* type scale */
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 28px;
  /* spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: var(--fs-md); color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: var(--fs-2xl); margin: 0 0 var(--s1); letter-spacing: -.01em; }
h2 { font-size: var(--fs-lg); margin: 0 0 var(--s3); }
h3 { font-size: var(--fs-md); margin: 0 0 var(--s2); }
p { margin: 0 0 var(--s3); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.mono { font-family: var(--mono); font-size: var(--fs-sm); }
.row { display: flex; align-items: center; gap: var(--s2); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.grow { flex: 1; }
.hide-phone { }

/* ---------- header ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: var(--s5); padding: 0 var(--s5); height: 60px; }
.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: var(--fs-lg); color: var(--ink); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); display: grid; place-items: center; }
.brand-mark::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--rec); }
.nav { display: flex; gap: var(--s1); flex: 1; }
.nav a { color: var(--ink-2); padding: 8px 12px; border-radius: 8px; font-size: var(--fs-md); font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.head-tools { display: flex; align-items: center; gap: var(--s3); }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); }
.icon-btn svg { width: 20px; height: 20px; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rec); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.user-chip { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); font-weight: 600; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; background: #7a5af8; flex: none; }

.subnav { max-width: 1200px; margin: 0 auto; padding: 0 var(--s5); display: flex; gap: var(--s4); border-top: 1px solid var(--line); height: 44px; align-items: stretch; }
.subnav a { display: flex; align-items: center; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a.active { color: var(--ink); border-color: var(--brand); }
.subnav a:hover { text-decoration: none; color: var(--ink); }

/* ---------- banners ---------- */
.banner { max-width: 1200px; margin: var(--s4) auto 0; padding: 10px var(--s4); border-radius: var(--radius); display: block; font-size: var(--fs-sm); }
.banner-info { background: #fff8e6; color: #7a4b00; border: 1px solid #f6dfa6; }
.banner-err { background: var(--failed-bg); color: var(--failed-fg); border: 1px solid #f7c7c3; }
.wrap-banner { padding: 0 var(--s5); }

/* ---------- layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: var(--s5); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s4); }
.card + .card { margin-top: var(--s4); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.split { display: grid; grid-template-columns: 240px 1fr; gap: var(--s5); align-items: start; }
.split-r { display: grid; grid-template-columns: 1fr 340px; gap: var(--s5); align-items: start; }
.section-title { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: var(--s5) 0 var(--s2); display: flex; gap: var(--s2); align-items: center; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 var(--fs-sm) var(--font); white-space: nowrap; cursor: pointer; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-danger { color: var(--failed-fg); }
.btn-solid-danger { background: var(--failed-fg); border-color: var(--failed-fg); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
.btn-icon { width: 28px; padding: 0; justify-content: center; }
.btn[disabled] { opacity: .45; }
.input, .select, textarea.input { height: 36px; border: 1px solid #cfd4dd; border-radius: 8px; padding: 0 12px; font: var(--fs-md) var(--font); color: var(--ink); background: #fff; width: 100%; }
textarea.input { height: auto; padding: 10px 12px; resize: none; }
.select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px; background-repeat: no-repeat; width: auto; }
.select-sm { height: 28px; font-size: var(--fs-xs); padding: 0 26px 0 8px; background-position: calc(100% - 14px) 12px, calc(100% - 9px) 12px; }
label.field { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: var(--s3); }
label.field > span { display: block; margin-bottom: 6px; }
.help { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; margin-top: 4px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); }
.search-box .input { padding-left: 38px; height: 44px; font-size: var(--fs-lg); }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.segmented a, .segmented span { padding: 5px 14px; border-radius: 7px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.segmented .on { background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }
.toggle { width: 40px; height: 24px; border-radius: 12px; background: #cfd4dd; position: relative; flex: none; display: inline-block; }
.toggle::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 2px; left: 2px; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle.on { background: #2fb36a; }
.toggle.on::after { left: 18px; }
.checkbox { width: 16px; height: 16px; border: 1.5px solid #b6bcc8; border-radius: 4px; display: inline-grid; place-items: center; background: #fff; flex: none; }
.checkbox.on { background: var(--brand); border-color: var(--brand); }
.checkbox.on::after { content: "✓"; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.daychips { display: flex; gap: 4px; flex-wrap: wrap; }
.daychip { width: 34px; height: 28px; border-radius: 6px; border: 1px solid var(--line); display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); background: #fff; }
.daychip.on { background: var(--brand-soft); color: var(--brand); border-color: #c8cff8; }

/* ---------- tags, pills, badges ---------- */
.tag-admin { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; background: #1b2130; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; vertical-align: middle; flex: none; }
.tag-proposed { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; border: 1px dashed #b06b00; color: #b06b00; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.admin-zone { border: 1px dashed #b9bfcc; border-radius: var(--radius-sm); padding: 6px 8px; position: relative; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.queued { background: var(--queued-bg); color: var(--queued-fg); }
.pill.running { background: var(--running-bg); color: var(--running-fg); }
.pill.review { background: var(--review-bg); color: var(--review-fg); }
.pill.delivered { background: var(--delivered-bg); color: var(--delivered-fg); }
.pill.failed { background: var(--failed-bg); color: var(--failed-fg); }
.pill.held { background: var(--held-bg); color: var(--held-fg); }
.pill.cancelled { background: var(--cancelled-bg); color: var(--cancelled-fg); }
.pill.fulfilled { background: #fff; color: var(--delivered-fg); box-shadow: inset 0 0 0 1.5px #9fd8b5; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip.ours { background: var(--delivered-bg); color: var(--delivered-fg); }
.chip.plex { background: #fff1d6; color: #8a5a00; }
.chip.queuedc { background: var(--running-bg); color: var(--running-fg); }
.chip.off { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- stars ---------- */
.rating { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); font-weight: 600; }
.stars { position: relative; display: inline-block; font-size: 14px; letter-spacing: 1px; line-height: 1; color: #d7dbe3; }
.stars::before { content: "★★★★★"; }
.stars::after { content: "★★★★★"; position: absolute; left: 0; top: 0; color: var(--gold); width: calc(var(--r) / 5 * 100%); overflow: hidden; white-space: nowrap; }
/* Half-star steps as classes (r7 = 3.5 stars): the CSP forbids inline style="--r:..". */
.stars.r0 { --r: 0; } .stars.r1 { --r: .5; } .stars.r2 { --r: 1; } .stars.r3 { --r: 1.5; } .stars.r4 { --r: 2; }
.stars.r5 { --r: 2.5; } .stars.r6 { --r: 3; } .stars.r7 { --r: 3.5; } .stars.r8 { --r: 4; } .stars.r9 { --r: 4.5; }
.stars.r10 { --r: 5; }

/* ---------- posters, thumbnails ---------- */
.poster { aspect-ratio: 2 / 3; border-radius: 8px; background: linear-gradient(160deg, hsl(var(--h) 45% 60%), hsl(calc(var(--h) + 35) 45% 28%)); position: relative; overflow: hidden; color: rgba(255,255,255,.92); display: flex; align-items: flex-end; padding: 8px; font-size: 11px; font-weight: 700; line-height: 1.2; flex: none; }
.poster::before { content: "POSTER"; position: absolute; top: 8px; left: 8px; font-size: 9px; letter-spacing: .12em; opacity: .55; }
.poster.sm { width: 40px; padding: 0; }
.poster.sm::before, .poster.md::before { display: none; }
.poster.md { width: 64px; font-size: 0; }
.poster.lg { width: 120px; }
.thumb { aspect-ratio: 16 / 9; border-radius: 8px; background: repeating-linear-gradient(135deg, #1f2433 0 14px, #252b3c 14px 28px); color: #c6cbd8; display: grid; place-items: center; font-size: var(--fs-sm); position: relative; overflow: hidden; }
.thumb .live { position: absolute; top: 8px; left: 8px; background: var(--rec); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 4px; letter-spacing: .06em; }
.thumb .stamp { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 4px; font-family: var(--mono); }
.thumb.removed { background: var(--surface-2); color: var(--muted); border: 1.5px dashed #c3c8d2; font-size: var(--fs-xs); text-align: center; }
.thumb.redacted { background: #2a2f3d; }
.frame-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s2); }
.frame-strip .cap { font-size: 11px; color: var(--muted); margin-top: 3px; text-align: center; font-family: var(--mono); }

/* ---------- results grid ---------- */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); }
.result { display: grid; grid-template-columns: 92px 1fr; gap: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); box-shadow: var(--shadow); }
.result .poster { width: 92px; }
.result .t { font-weight: 700; line-height: 1.25; }
.result .y { color: var(--muted); font-weight: 500; }
.result .body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.result .actions { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s4); }
.tile .poster { width: 100%; }
.tile .t { font-weight: 600; font-size: var(--fs-sm); margin-top: 6px; line-height: 1.25; }
.tile .sub { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }

/* ---------- lists ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.li { display: grid; align-items: center; gap: var(--s3); padding: 12px var(--s4); border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .t { font-weight: 600; }
.li .meta { font-size: var(--fs-sm); color: var(--muted); }
.li-group { flex-wrap: wrap; gap: 4px 12px; padding: 8px var(--s4); background: var(--surface-2); font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); }
.li-group:first-child { border-top: 0; }
.q-row { grid-template-columns: 28px 40px 1fr 170px 190px 290px; }
.q-row.member { grid-template-columns: 28px 40px 1fr 170px 120px; }
.qpos { font-weight: 700; color: var(--muted); text-align: center; }
.req-row { grid-template-columns: 40px 1fr 170px 470px; }
.hist-row { grid-template-columns: 96px 40px 1fr 180px 130px; }
.user-row { grid-template-columns: 36px 1.2fr 1fr 1fr 90px 80px auto; }
.dev-row { grid-template-columns: 36px 1fr auto; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hint { font-size: var(--fs-xs); color: var(--muted); display: flex; gap: 6px; align-items: center; }

/* ---------- live status ---------- */
.status-card { display: grid; grid-template-columns: 320px 1fr; gap: var(--s5); }
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: var(--p); background: var(--brand); border-radius: 4px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px var(--s3); font-size: var(--fs-sm); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.callout { border-radius: 8px; padding: 10px 12px; font-size: var(--fs-sm); background: var(--surface-2); color: var(--ink-2); }
.callout.warn { background: var(--review-bg); color: var(--review-fg); }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 0 0 var(--s4) 34px; }
.tl::before { content: ""; position: absolute; left: 4px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--running-fg); }
.tl.ok::before { border-color: var(--delivered-fg); }
.tl.bad::before { border-color: var(--failed-fg); }
.tl.wait::before { border-color: var(--held-fg); }
.tl.now::before { background: var(--running-fg); box-shadow: 0 0 0 4px var(--running-bg); }
.tl .when { font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); }
.tl .what { font-weight: 600; }
.tl .kind { font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.tl .frames { display: grid; grid-template-columns: repeat(3, 140px); gap: var(--s2); margin-top: 6px; }
details.raw { margin-top: 6px; font-size: var(--fs-xs); }
details.raw summary { color: var(--muted); cursor: pointer; display: flex; gap: 6px; align-items: center; }
details.raw pre { background: #1b2130; color: #d6dbe7; padding: 8px 10px; border-radius: 6px; margin: 6px 0 0; font-size: 11px; overflow: auto; }

/* ---------- dialog / sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(16,20,32,.45); display: flex; align-items: center; justify-content: center; gap: var(--s5); padding: var(--s5); z-index: 20; }
.dialog { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 460px; max-width: 100%; max-height: calc(100vh - 48px); overflow: auto; }
.dialog-head { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.dialog-body { padding: var(--s5); }
.dialog-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: var(--s2); background: #fafbfc; border-radius: 0 0 14px 14px; }
.radio-card { display: flex; align-items: center; gap: var(--s3); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.radio-card.on { border-color: var(--brand); background: var(--brand-soft); }
.radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #b6bcc8; flex: none; }
.radio-card.on .radio { border: 5px solid var(--brand); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%; background: var(--surface); box-shadow: var(--shadow-lg); z-index: 21; display: flex; flex-direction: column; }
.drawer .dialog-body { flex: 1; overflow: auto; }
.note { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 84px 1fr; gap: 10px; margin-bottom: 8px; }
.note .shot { aspect-ratio: 16 / 10; border-radius: 6px; background: linear-gradient(180deg, #fff 0 18%, #eef0f4 18%); border: 1px solid var(--line); position: relative; }
.note .shot::after { content: ""; position: absolute; left: 8%; right: 8%; top: 30%; height: 30%; background: repeating-linear-gradient(90deg, #d8dce4 0 18%, transparent 18% 22%); border-radius: 3px; }
.note .shot.withheld { background: var(--held-bg); border-style: dashed; }
.note .shot.withheld::after { display: none; }
.ctx { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1b2130; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: var(--fs-sm); box-shadow: var(--shadow-lg); z-index: 30; display: flex; gap: var(--s3); align-items: center; }

/* ---------- sign-in, error pages ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.auth-card { width: 380px; max-width: 100%; }
.qr { width: 150px; aspect-ratio: 1; border-radius: 8px; background:
  conic-gradient(from 90deg at 18% 18%, #1b2130 0 25%, transparent 0) 0 0 / 34% 34% no-repeat,
  conic-gradient(from 90deg at 18% 18%, #1b2130 0 25%, transparent 0) 100% 0 / 34% 34% no-repeat,
  conic-gradient(from 90deg at 18% 18%, #1b2130 0 25%, transparent 0) 0 100% / 34% 34% no-repeat,
  repeating-conic-gradient(#1b2130 0 25%, #fff 0 50%) 0 0 / 14px 14px; border: 8px solid #fff; box-shadow: inset 0 0 0 1px var(--line), 0 0 0 1px var(--line); }
.code { font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: .12em; background: var(--surface-2); padding: 6px 14px; border-radius: 8px; display: inline-block; }
.health { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.hc { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-sm); background: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: #2fb36a; } .dot.warn { background: var(--gold); } .dot.bad { background: var(--failed-fg); } .dot.idle { background: #b6bcc8; }
.browser-err { width: 640px; max-width: 100%; }
.browser-err .glyph { width: 56px; height: 56px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 28px; color: var(--muted); margin-bottom: var(--s4); }

/* ---------- phone width (390) ---------- */
@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 24px; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px var(--s4) 0; gap: var(--s2); }
  .brand { flex: 1; }
  .nav { order: 3; flex: 0 0 100%; overflow-x: auto; padding-bottom: 8px; margin: 0 -4px; }
  .nav a { padding: 6px 10px; font-size: 14px; }
  .user-chip .uname { display: none; }
  .subnav { padding: 0 var(--s4); overflow-x: auto; gap: var(--s4); }
  .wrap-banner { padding: 0 var(--s4); }
  main { padding: var(--s4); }
  .page-head { margin-bottom: var(--s4); }
  .grid-2, .grid-3, .split, .split-r, .status-card, .health { grid-template-columns: 1fr; }
  .results { grid-template-columns: 1fr; }
  .result { grid-template-columns: 76px 1fr; }
  .result .poster { width: 76px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
  .li { grid-template-columns: 1fr !important; gap: 8px 12px; }
  .q-row, .req-row, .hist-row, .user-row, .dev-row { grid-template-columns: 40px 1fr !important; }
  .rec-row { grid-template-columns: 20px 40px 1fr !important; }
  .rec-row > :nth-child(n+4) { grid-column: 3; }
  .li > .qpos { display: none; }
  .q-row > :nth-child(n+3), .req-row > :nth-child(n+3), .hist-row > :nth-child(n+3), .user-row > :nth-child(n+3), .dev-row > :nth-child(n+3) { grid-column: 2; }
  .hist-row > .hdate { grid-column: 1 / -1 !important; }
  .user-row > .avatar { grid-row: span 2; }
  .actions { justify-content: flex-start; }
  .frame-strip { grid-template-columns: repeat(3, 1fr); }
  .tl .frames { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 110px 1fr; }
  .scrim { align-items: flex-end; padding: 0; }
  .scrim .dialog { width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .scrim .dialog.secondary { display: none; }
  .drawer { width: 100%; top: 40px; border-radius: 16px 16px 0 0; }
  .hide-phone { display: none !important; }
  .toast { width: calc(100% - 32px); }
}

/* ---------- B1 shell additions ---------- */
.inline-form { display: inline; margin: 0; }
.btn-link { background: none; border: 0; padding: 8px 12px; font: inherit; font-weight: 500; color: var(--ink-2); cursor: pointer; border-radius: 8px; }
.btn-link:hover { background: var(--surface-2); }
.auth-brand { justify-content: center; margin-bottom: var(--s5); font-size: var(--fs-xl); }
.auth-card .card { padding: 28px; }
.btn-block { width: 100%; height: 40px; justify-content: center; }
.banner-flush { margin-top: 0; margin-bottom: var(--s4); }
.center-text { text-align: center; }
.mt-top { margin-top: var(--s4); }
.auth-foot { text-align: center; margin-top: var(--s4); }
img.img-missing { visibility: hidden; }

/* ---------- search, browse, request dialog (B2) ---------- */
.poster { --h: 220; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster.has-img::before { display: none; }
.poster.has-img { font-size: 0; }
.search-form { max-width: 640px; margin-bottom: var(--s5); }
.filters { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.filters .search-box { width: 260px; }
.filters .search-box .input { height: 36px; font-size: var(--fs-md); }
.tile .actions { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.err-inline { margin: 0 0 var(--s4); }
#dialog-slot:empty { display: none; }
.scrim.clean { gap: 0; }
.dialog-title { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
/* spacing utilities for the B2 templates (no inline style: CSP) */
.m0 { margin: 0; } .mt0 { margin-top: 0; } .mt6 { margin-top: 6px; } .mt14 { margin-top: 14px; }
.mb6 { margin-bottom: 6px; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.fw6 { font-weight: 600; } .fw7 { font-weight: 700; }

/* ---------- B3a: live status, queue, my requests (CSP forbids inline style, so these are classes) ---------- */
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb .ph { display: none; }
.thumb.frame-missing .ph { display: block; }
.thumb.frame-missing { background: var(--surface-2); color: var(--muted); border: 1.5px dashed #c3c8d2; }
.thumb.frame-missing .live { display: none; }
progress.progress { display: block; width: 100%; appearance: none; -webkit-appearance: none; border: 0; margin: 12px 0 6px; }
progress.progress::-webkit-progress-bar { background: var(--surface-2); }
progress.progress::-webkit-progress-value { background: var(--brand); border-radius: 4px; }
progress.progress::-moz-progress-bar { background: var(--brand); border-radius: 4px; }
.ctl-row { padding: 3px 6px; justify-content: space-between; }
.held-note { color: var(--held-fg); }
.note-line { margin-top: 4px; color: var(--ink-2); }
.fw4 { font-weight: 400; }
.pad { padding: var(--s4); }

/* ---------- B3b: history and job detail (no inline style: CSP) ---------- */
.tl-poll { list-style: none; height: 0; padding: 0; margin: 0; }
.tl .frames .thumb img, .frame-strip .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame-strip .thumb .ph, .tl .frames .thumb .ph { display: none; }
.frame-strip .thumb.frame-missing .ph, .tl .frames .thumb.frame-missing .ph { display: block; font-size: var(--fs-xs); text-align: center; }
.crumb { margin-bottom: 8px; }
.job-title-row { gap: 16px; }
.job-reason { margin-top: 8px; }
.stack > * + * { margin-top: var(--s4); }

/* ---------- admin pages (B4) ---------- */
button.toggle { border: 0; padding: 0; cursor: pointer; }
.mb12 { margin-bottom: 12px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt14 { margin-top: 14px; }
.actions.start { justify-content: flex-start; align-items: center; gap: var(--s3); }
.frame-w { width: 220px; max-width: 100%; margin-top: 8px; }
.card-held { border-color: #d9c8fb; }
.signin-row { gap: 20px; align-items: flex-start; }
.signin-shot { width: 220px; max-width: 100%; }
.sign-url { font-size: 16px; }
.sched-row { grid-template-columns: 1fr 120px 120px 170px 40px; }
.dc { position: relative; cursor: pointer; }
.dc input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.dc input:checked + .daychip { background: var(--brand-soft); color: var(--brand); border-color: #c8cff8; }
.dc input:focus-visible + .daychip { outline: 2px solid var(--brand); outline-offset: 1px; }
details.mc { display: inline-block; position: relative; }
details.mc > summary { list-style: none; cursor: pointer; }
details.mc > summary::-webkit-details-marker { display: none; }
.mc-pop { position: absolute; right: 0; z-index: 5; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; gap: 8px; width: 380px; max-width: 80vw; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.mc-pop .input { flex: 1; }
@media (max-width: 720px) { .sched-row { grid-template-columns: 1fr 1fr; } .sched-row .daychips { grid-column: 1 / -1; } }
.mt24 { margin-top: 24px; } .w100 { width: 100%; justify-content: center; }
.me-head { display: flex; gap: var(--s3); align-items: center; }

/* Investigate (admin job forensics) */
.inv-group { margin-top: var(--s3); }
.inv-group h4 { margin: 0 0 6px; font-size: var(--fs-sm); }
.inv-item { border-left: 3px solid var(--line); padding: 4px 0 6px 10px; margin-bottom: 8px; }
.inv-item.likely { border-left-color: var(--failed-fg); }
.inv-item.possible { border-left-color: var(--review-fg); }
.inv-item.ruled_out { border-left-color: var(--delivered-fg); }
.inv-item ul { margin: 4px 0 0; padding-left: 18px; font-size: var(--fs-xs); color: var(--ink-2); }
.inv-t { font-variant-numeric: tabular-nums; color: var(--muted); }
