/* JAIBOO Studio. A broadcast control room in JAIBOO's colours: one bold element (the On-air lamp), a quiet work surface around it. */

@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/atkinson-hyperlegible-next-latin-800-normal.woff2") format("woff2"); }

/* ---------- Tokens (ART_DIRECTION 2.2, brand-adjusted by the Director; contrast checked) ---------- */
:root {
  color-scheme: light dark;
  --page: #F5F8F6;          /* JAIBOO Background */
  --surface: #FFFFFF;
  --field: #EEF3F0;
  --ink: #10231B;           /* JAIBOO Ink */
  --ink-muted: #5C6D65;     /* JAIBOO Soft */
  --hairline: #D3DDD8;
  --edge: #76877F;
  --primary: #10231B;
  --on-primary: #FFFFFF;
  --primary-hover: #0B4D3B; /* JAIBOO Green deep */
  --brand: #00684D;         /* JAIBOO Green: wordmark, links, focus ring */
  --accent: #FB9911;        /* JAIBOO Orange: quiet edge accents only, never under text */
  --posted: #0A6B37;
  --posted-tint: #E7F3EE;   /* JAIBOO Mint */
  --wait: #8A4F00;
  --wait-tint: #FFF2DF;     /* JAIBOO Orange soft */
  --alarm: #B0122A;
  --alarm-tint: #FDE7EA;
  --alarm-count-ink: #FFFFFF;
  --info: #1D4FBF;
  --info-tint: #E8EEFB;
  --lamp: #E0142B;
  --lamp-glow: 224 20 43;
  --lamp-off: #76877F;
  --scrim: rgb(16 35 27 / .5);
  --lift: 0 12px 32px rgb(16 35 27 / .24);

  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
  --tap: 44px;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --t: 150ms;
  --header-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #111B17;
    --surface: #17241F;
    --field: #1E2D27;
    --ink: #E6EEEA;
    --ink-muted: #A2B2AA;
    --hairline: #2B3B35;
    --edge: #6B7F76;
    --primary: #E6EEEA;
    --on-primary: #10231B;
    --primary-hover: #C4D3CC;
    --brand: #5CCBA2;
    --posted: #4CC487;
    --posted-tint: #163126;
    --wait: #F0B54D;
    --wait-tint: #33290F;
    --alarm: #FF8A8A;
    --alarm-tint: #3A1C21;
    --alarm-count-ink: #10231B;
    --info: #8DB4FF;
    --info-tint: #1B2A44;
    --lamp: #FF3B47;
    --lamp-glow: 255 59 71;
    --lamp-off: #6B7F76;
    --scrim: rgb(4 10 8 / .66);
    --lift: 0 12px 32px rgb(0 0 0 / .5);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + var(--s4)); }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 24px; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { text-wrap: balance; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, label, summary, input, textarea, video, [role="tab"] { touch-action: manipulation; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: inherit; font-weight: 700; background: var(--field); border-radius: var(--r-sm); padding: 0 var(--s1); overflow-wrap: anywhere; }
.num, time, .counter, .count { font-variant-numeric: tabular-nums; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 16px; height: 16px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s4); top: -100px; z-index: 60; background: var(--primary); color: var(--on-primary); padding: var(--s3) var(--s4); border-radius: var(--r-md); font-weight: 700; text-decoration: none; }
.skip:focus { top: var(--s3); }
[hidden] { display: none !important; }
.small { font-size: 14px; line-height: 20px; }
.muted { color: var(--ink-muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s4); border-radius: var(--r-md);
  border: 1px solid var(--edge); background: var(--surface); color: var(--ink);
  font-weight: 700; line-height: 20px; text-align: center; cursor: pointer;
  transition: background-color var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease);
}
a.btn { text-decoration: none; }
.btn:hover { background: var(--field); border-color: var(--ink); }
.btn:active { background: var(--hairline); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { background: var(--primary-hover); }
.btn-quiet { border-color: transparent; background: transparent; padding: 0 var(--s3); }
.btn-quiet:hover { background: var(--field); border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
.btn-danger { color: var(--alarm); }
.btn-danger:hover { background: var(--alarm-tint); border-color: var(--alarm); }
.btn-icon { width: var(--tap); padding: 0; }
.btn-wide { min-height: 48px; }
.btn:disabled { cursor: not-allowed; color: var(--ink-muted); background: var(--field); border-color: var(--hairline); }
.btn[aria-busy="true"] { cursor: progress; color: var(--ink-muted); background: var(--field); border-color: var(--hairline); }
.btn[aria-busy="true"] > .ic { display: none; }
.btn[aria-busy="true"]::before { content: ""; width: 16px; height: 16px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .9s linear infinite; }
.spinner { display: inline-block; width: 18px; height: 18px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .9s linear infinite; }
.ic.spin { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--hairline); padding-top: env(safe-area-inset-top); }
.top-in {
  max-width: 1280px; margin: 0 auto; min-height: var(--header-h);
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s2) max(var(--s6), env(safe-area-inset-right)) var(--s2) max(var(--s6), env(safe-area-inset-left));
}
.brand { font-size: 21px; line-height: 28px; font-weight: 800; margin-right: auto; white-space: nowrap; }
.wm { color: var(--brand); }
.brand-sub { font-weight: 400; color: var(--ink); }
.inbox { display: flex; align-items: center; gap: var(--s3); min-width: 0; padding-right: var(--s4); border-right: 1px solid var(--hairline); }
.inbox-text { color: var(--ink-muted); font-size: 14px; line-height: 20px; display: inline-flex; align-items: center; gap: var(--s1); white-space: nowrap; }
.inbox-text.bad, .inbox-line.bad { color: var(--alarm); }
.inbox-narrow { display: none; flex: none; }

/* On-air unit: status light + words + one action button. */
.onair { display: flex; align-items: center; gap: var(--s3); }
.onair .btn { white-space: nowrap; }
.lamp {
  position: relative; width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: var(--field); box-shadow: inset 0 0 0 2px var(--lamp-off);
  transition: background-color 240ms var(--ease), box-shadow 240ms var(--ease);
}
.lamp-lock { display: none; }
.onair.lit .lamp {
  background: var(--lamp) radial-gradient(circle at 35% 35%, rgb(255 255 255 / .55) 0 2px, transparent 3px);
  box-shadow: 0 0 0 4px rgb(var(--lamp-glow) / .18), 0 0 12px rgb(var(--lamp-glow) / .45);
}
.onair.locked .lamp { width: 24px; height: 24px; display: grid; place-items: center; }
.onair.locked .lamp-lock { display: block; width: 14px; height: 14px; color: var(--ink-muted); }
.onair-words { display: grid; min-width: 0; }
.onair-state { font-size: 18px; line-height: 24px; font-weight: 800; white-space: nowrap; }
.onair-hint { font-size: 14px; line-height: 20px; color: var(--ink-muted); max-width: 34ch; }

/* ---------- Bars under the header ---------- */
.offline, .banner { border-bottom: 1px solid var(--hairline); }
.bar-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s3) max(var(--s6), env(safe-area-inset-right)) var(--s3) max(var(--s6), env(safe-area-inset-left)); }
.bar-in > p { flex: 1 1 280px; display: flex; gap: var(--s2); align-items: flex-start; }
.bar-in > p .ic { margin-top: 2px; }
.banner { background: var(--wait-tint); box-shadow: inset 4px 0 0 var(--accent); }
/* Posting locked with nothing waiting: only phones need this row (desktop shows the hint in the header). */
@media (min-width: 768px) { .banner.phone-only { display: none; } }
.banner .ic { color: var(--wait); }
.offline { background: var(--alarm-tint); }
.offline .ic { color: var(--alarm); }
.offline .when { color: var(--ink-muted); font-size: 14px; }

/* ---------- Page ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: var(--s5) max(var(--s6), env(safe-area-inset-right)) var(--s8) max(var(--s6), env(safe-area-inset-left)); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
.wrap > * { min-width: 0; }
main:focus, #panel:focus { outline: none; }
.inbox-line { display: none; font-size: 14px; line-height: 20px; color: var(--ink-muted); }

/* Setup checklist */
.setup { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: var(--s5); display: grid; gap: var(--s4); }
.setup h2 { font-size: 18px; line-height: 26px; font-weight: 700; }
/* Incomplete setup: the heading stays a heading; the Show/Hide setup disclosure sits beside it. */
.setup:not(.complete) { position: relative; }
.setup:not(.complete) > h2 { padding-right: 9rem; min-height: 26px; }
.setup-d > summary { position: absolute; top: calc(var(--s5) - 9px); right: var(--s5); font-size: 14px; color: var(--ink-muted); }
.setup-body-in { display: grid; gap: var(--s4); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: var(--s4) var(--s5); }
.check { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s1) var(--s3); align-content: start; }
.check-mark { grid-row: span 4; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; border: 2px solid var(--edge); color: var(--ink); }
.check.done .check-mark { border: 0; color: var(--posted); }
.check.done .check-mark .ic { width: 28px; height: 28px; }
.check.bad .check-mark { border: 0; color: var(--alarm); }
.check.bad .check-mark .ic { width: 26px; height: 26px; }
.check h3 { font-size: 16px; line-height: 24px; font-weight: 700; }
.check-detail { color: var(--ink-muted); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.check.bad .check-detail { color: var(--alarm); }
.check-fix { font-size: 14px; line-height: 20px; }
.check .btn { justify-self: start; margin-top: var(--s1); }
.check details summary { font-size: 14px; }
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--s2) var(--s5); margin: 0; padding-top: var(--s4); border-top: 1px solid var(--hairline); font-size: 14px; line-height: 20px; }
.health div { display: grid; gap: 2px; }
.health dt { color: var(--ink-muted); }
.health dd { margin: 0; display: flex; gap: var(--s1); align-items: flex-start; overflow-wrap: anywhere; }
.health dd .ic { margin-top: 0; width: 18px; height: 18px; }
.health .ok { color: var(--posted); }
.health .warn { color: var(--wait); }
.health .bad { color: var(--alarm); }
.setup.complete { background: transparent; border: 0; padding: 0; gap: var(--s3); }
.setup-line { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; color: var(--ink-muted); }
.setup-line .ic { color: var(--posted); }
.setup-line.bad { color: var(--alarm); }
.setup-line.bad .ic, .setup-line.warn .ic { color: inherit; }
.setup-line.warn { color: var(--wait); }
.setup.complete .setup-body { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: var(--s5); display: grid; gap: var(--s4); }

/* ---------- Tabs ---------- */
.tabs-wrap { margin: 0 calc(-1 * var(--s6)); }
.tabs { display: flex; gap: var(--s1); overflow-x: auto; padding: 0 var(--s6); border-bottom: 1px solid var(--hairline); scrollbar-width: none; overscroll-behavior-x: contain; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s3); border: 0; background: transparent; color: var(--ink-muted); font-weight: 400; white-space: nowrap; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 700; }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: var(--s3); right: var(--s3); bottom: -1px; height: 3px; background: var(--ink); }
.tab:focus-visible { outline-offset: -3px; }
.count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; display: inline-grid; place-items: center; font-size: 14px; line-height: 20px; font-weight: 700; background: var(--field); color: var(--ink); }
.count.alarm { background: var(--alarm); color: var(--alarm-count-ink); }

/* ---------- Lists and empty states ---------- */
.list { display: grid; gap: var(--s5); }
.loading { display: flex; gap: var(--s2); align-items: center; color: var(--ink-muted); padding: var(--s6) 0; }
.empty { padding: var(--s7) 0; max-width: 62ch; display: grid; gap: var(--s3); justify-items: start; }
.empty .display { font-size: 28px; line-height: 36px; font-weight: 700; }
.empty p { color: var(--ink-muted); }

/* ---------- Reel card (decision density) ---------- */
.reel { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); min-width: 0; }
.reel-head { padding: var(--s5); display: grid; gap: var(--s2); border-bottom: 1px solid var(--hairline); }
.reel-head h3 { font-size: 21px; line-height: 28px; font-weight: 700; overflow-wrap: anywhere; }
.reel-head h3:focus { outline: none; }
.reel-head h3:focus-visible { outline: 3px solid var(--brand); }
.source { display: flex; align-items: flex-start; gap: var(--s2); color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.source .ic { width: 16px; height: 16px; margin-top: 2px; }
.source.bad { color: var(--alarm); }
.statuses { list-style: none; margin: var(--s1) 0 0; padding: 0; display: grid; gap: var(--s2); }
.st { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--s1) var(--s3); align-items: start; padding: var(--s2) var(--s3); border-radius: var(--r-md); border: 1px solid transparent; }
.st > .ic { margin-top: 2px; }
.st-body { display: grid; gap: var(--s1); min-width: 0; }
.st-line { overflow-wrap: anywhere; }
.st-line b { font-weight: 700; margin-right: var(--s2); }
.st-more { font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.st-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.st-actions a { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--tap); font-weight: 700; }
.st.idle { color: var(--ink-muted); padding-top: var(--s1); padding-bottom: var(--s1); }
.st.idle b { color: var(--ink); }
.st.wait { background: var(--wait-tint); }
.st.wait > .ic { color: var(--wait); }
.st.info { background: var(--info-tint); }
.st.info > .ic { color: var(--info); }
.st.posted { background: var(--posted-tint); }
.st.posted > .ic { color: var(--posted); }
.st.alarm { background: var(--alarm-tint); border-color: var(--alarm); }
.st.alarm > .ic, .st.alarm .st-line { color: var(--alarm); }
.st.alarm .st-line b { color: var(--ink); }

.steps { display: grid; grid-template-columns: 240px minmax(0, 1fr) 340px; }
.step { padding: var(--s5); min-width: 0; display: flex; flex-direction: column; gap: var(--s4); }
.step + .step { border-left: 1px solid var(--hairline); }
.step h4 { font-size: 18px; line-height: 26px; font-weight: 700; }

/* Watch */
.frame { position: relative; width: 100%; max-width: 240px; aspect-ratio: 9 / 16; border-radius: var(--r-lg); background: #000; border: 1px solid var(--hairline); overflow: hidden; align-self: center; }
.list-more { display: flex; justify-content: center; margin-top: var(--s5); }
.frame video, .frame img { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.frame.missing { background: var(--field); display: grid; place-items: center; padding: var(--s4); text-align: center; color: var(--ink-muted); font-size: 14px; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s1) var(--s3); margin: 0; font-size: 14px; line-height: 20px; }
.facts dt { color: var(--ink-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.facts .ref { display: block; color: var(--ink-muted); }
.cover { display: grid; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--hairline); }
.cover-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.cover input[type="range"] { background: transparent; width: 100%; min-height: var(--tap); accent-color: var(--ink); margin: 0; cursor: pointer; }

/* details/summary */
details > summary { cursor: pointer; list-style: none; font-weight: 700; min-height: var(--tap); display: inline-flex; align-items: center; gap: var(--s2); border-radius: var(--r-sm); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--t) var(--ease); margin: 0 4px; }
details[open] > summary::before { transform: rotate(45deg); }

/* Fields */
.field { display: grid; gap: var(--s1); }
.field > label, .label { font-weight: 700; }
.hint { color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.field-error { color: var(--alarm); font-size: 14px; line-height: 20px; display: flex; gap: var(--s1); align-items: flex-start; }
.field-error .ic { width: 18px; height: 18px; margin-top: 1px; }
textarea, input[type="text"], input[type="url"], input[type="password"], input[type="datetime-local"] {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: var(--r-md);
  border: 1px solid var(--edge); background: var(--field); color: var(--ink); font-size: 16px; line-height: 24px;
  transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease);
}
textarea { resize: vertical; max-width: 62ch; overflow-y: auto; }
.caption-col .field input[type="text"] { max-width: 62ch; }
textarea:hover, input:hover { border-color: var(--ink); }
textarea:focus-visible, input:focus-visible { outline: 3px solid var(--brand); outline-offset: 1px; background: var(--surface); }
[aria-invalid="true"] { border-color: var(--alarm) !important; }
::placeholder { color: var(--ink-muted); opacity: 1; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; margin-bottom: var(--s2); }

/* Segmented control */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; gap: 3px; border-radius: var(--r-md); background: var(--field); border: 1px solid var(--edge); width: 100%; max-width: 360px; }
.seg label { position: relative; display: flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 40px; border-radius: 7px; font-weight: 700; color: var(--ink-muted); cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label:hover { color: var(--ink); }
.seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 1px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--wait); flex: none; }

.counter { font-size: 14px; line-height: 20px; color: var(--ink-muted); display: flex; gap: var(--s1); align-items: flex-start; }
.counter.over { color: var(--alarm); font-weight: 700; }
.counter .ic { width: 18px; height: 18px; margin-top: 1px; }
.preview { display: grid; gap: var(--s1); max-width: 62ch; }
.preview-text { background: var(--field); border-radius: var(--r-md); padding: var(--s3); white-space: pre-line; overflow-wrap: anywhere; }
.preview-text .more { color: var(--ink-muted); white-space: nowrap; }
.readview { display: grid; gap: var(--s2); max-width: 62ch; }
.readview .preview-text { max-height: 13.5em; overflow: auto; }
.readview .preview-text:focus-visible { outline-offset: 2px; }
.readview-note { display: flex; align-items: center; gap: var(--s2); color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.readview-note.busy { color: var(--info); font-weight: 700; font-size: 16px; }
.editor { display: grid; gap: var(--s4); }
.edit-toggle { justify-self: start; }
.rewrite-row { display: flex; gap: var(--s2); flex-wrap: wrap; max-width: 62ch; }
.rewrite-row input { flex: 1 1 200px; min-width: 0; }
.unsaved { display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: wrap; padding: var(--s2) var(--s3); background: var(--wait-tint); border-radius: var(--r-md); max-width: 62ch; }
.unsaved > .ic { color: var(--wait); }
.unsaved > b { margin-right: auto; }
.unsaved > .hint { flex-basis: 100%; color: var(--ink); }

/* Checkbox and radio, drawn from the tokens (no native chrome colours). */
input[type="checkbox"], input[type="radio"] { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; margin: 0; flex: none; display: inline-grid; place-items: center; border: 2px solid var(--edge); background: var(--surface); cursor: pointer; }
input[type="checkbox"] { border-radius: 5px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked { background: var(--ink); border-color: var(--ink); }
input[type="checkbox"]:checked::after { content: ""; width: 5px; height: 10px; border: solid var(--surface); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
input[type="radio"]:checked { border-color: var(--ink); }
input[type="radio"]:checked::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { background: var(--field); border-color: var(--hairline); cursor: not-allowed; }
input[type="checkbox"]:hover:not(:disabled), input[type="radio"]:hover:not(:disabled) { border-color: var(--ink); }

/* Post */
.tiles { display: grid; gap: var(--s2); }
.tile { display: flex; align-items: center; gap: var(--s3); min-height: 48px; padding: var(--s1) var(--s3); border: 1px solid var(--edge); border-radius: var(--r-md); background: var(--surface); cursor: pointer; font-weight: 700; transition: border-color var(--t) var(--ease), background-color var(--t) var(--ease); }
.tile:hover { border-color: var(--ink); background: var(--field); }
.tile input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); flex: none; cursor: pointer; }
.tile:has(input:checked) { border: 2px solid var(--ink); padding-left: 11px; }
.tile:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }
.tile input:focus-visible { outline: none; }
.tile-text { display: grid; line-height: 20px; min-width: 0; }
.tile small { font-weight: 400; color: var(--ink-muted); font-size: 14px; }
.tile.off { cursor: not-allowed; border-color: var(--hairline); background: var(--field); color: var(--ink-muted); }
.tile.off input { cursor: not-allowed; }
.tile.off:hover { background: var(--field); border-color: var(--hairline); }
.radios { display: grid; gap: var(--s1); }
.radio { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; column-gap: var(--s3); min-height: var(--tap); cursor: pointer; padding: var(--s1) var(--s2); border-radius: var(--r-md); }
.radio:hover { background: var(--field); }
.radio input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.radio small { grid-column: 2; color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.radio.off { cursor: not-allowed; color: var(--ink-muted); }
.radio.off:hover { background: transparent; }
.when-pick { padding-left: 40px; display: grid; gap: var(--s1); }
.decide { display: grid; gap: var(--s2); }
.decide .btn-primary { width: 100%; text-wrap: balance; padding: var(--s2) var(--s4); }
.helper { font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.helper.wait { color: var(--wait); font-weight: 700; }
.secondary-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.locked-note { color: var(--ink-muted); font-size: 14px; line-height: 20px; display: flex; gap: var(--s2); align-items: flex-start; }

/* History */
.history { padding: 0 var(--s5) var(--s2); border-top: 1px solid var(--hairline); }
.history summary { color: var(--ink); }
.history ol { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; gap: var(--s2); max-width: 80ch; font-size: 14px; line-height: 20px; }
.history li { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: var(--s3); }
.history time { color: var(--ink-muted); }

/* ---------- Compact rows (Posted, Archived) ---------- */
.row { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: var(--s4); display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.thumb { width: 64px; height: 114px; border-radius: var(--r-md); object-fit: cover; background: var(--field); border: 1px solid var(--hairline); display: block; }
.row-body { display: grid; gap: var(--s2); min-width: 0; }
.row-body h3 { font-size: 21px; line-height: 28px; font-weight: 700; overflow-wrap: anywhere; }
.row-body h3:focus { outline: none; }
.row .statuses { margin: 0; }
.row .btn { justify-self: start; }

/* ---------- Dialog ---------- */
dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--hairline); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--lift); }
dialog::backdrop { background: var(--scrim); }
dialog form { padding: var(--s5); display: grid; gap: var(--s4); }
dialog h2 { font-size: 18px; line-height: 26px; font-weight: 700; overflow-wrap: anywhere; }
.dlg-body { display: grid; gap: var(--s3); }
.dlg-body ul { margin: 0; padding-left: var(--s5); display: grid; gap: var(--s1); }
.dlg-body .was { color: var(--wait); }
.dlg-body .alarm { color: var(--alarm); display: flex; gap: var(--s2); align-items: flex-start; font-weight: 700; }
.dlg-body .alarm .ic { margin-top: 2px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap; }
dialog[open] { animation: pop var(--t) var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: max(var(--s5), calc(env(safe-area-inset-bottom) + var(--s3))); display: grid; gap: var(--s2); width: min(480px, calc(100vw - 32px)); pointer-events: none; }
.toasts-err { bottom: max(var(--s5), calc(env(safe-area-inset-bottom) + var(--s3))); }
.toasts:has(.toast) + .toasts-err:has(.toast) { bottom: calc(max(var(--s5), env(safe-area-inset-bottom)) + 72px); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--primary); color: var(--on-primary); font-weight: 700; box-shadow: var(--lift); animation: rise var(--t) var(--ease); }
.toast p { flex: 1; }
.toast.err { background: var(--surface); color: var(--ink); border: 1px solid var(--alarm); box-shadow: var(--lift), inset 4px 0 0 var(--alarm); }
.toast.err > .ic { color: var(--alarm); }
.toast .btn { min-height: 36px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  .steps { grid-template-columns: 200px minmax(0, 1fr) 300px; }
  .step { padding: var(--s4) var(--s5); }
  .frame { max-width: 200px; }
}
@media (max-width: 1023px) {
  .top-in, .bar-in { padding-left: max(var(--s5), env(safe-area-inset-left)); padding-right: max(var(--s5), env(safe-area-inset-right)); }
  .wrap { padding-left: max(var(--s5), env(safe-area-inset-left)); padding-right: max(var(--s5), env(safe-area-inset-right)); }
  .tabs-wrap { margin: 0 calc(-1 * var(--s5)); }
  .tabs { padding: 0 var(--s5); }
  .steps { grid-template-columns: 200px minmax(0, 1fr); }
  .step-post { grid-column: 1 / -1; border-left: 0 !important; border-top: 1px solid var(--hairline); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4) var(--s5); }
  .step-post > h4, .step-post > .decide, .step-post > .secondary-actions, .step-post > .locked-note, .step-post > .field-error { grid-column: 1 / -1; }
  .step-post .decide .btn-primary { width: auto; justify-self: start; }
  .inbox-text { display: none; }
  .inbox-line { display: block; }
  .inbox-line.bad { display: flex; gap: var(--s1); align-items: center; }
}
@media (max-width: 767px) {
  :root { --header-h: 56px; }
  .top-in { gap: var(--s2); min-height: var(--header-h); padding-left: max(var(--s4), env(safe-area-inset-left)); padding-right: max(var(--s4), env(safe-area-inset-right)); }
  .bar-in { padding-left: max(var(--s4), env(safe-area-inset-left)); padding-right: max(var(--s4), env(safe-area-inset-right)); }
  .brand-sub { display: none; }
  .inbox { border-right: 0; padding-right: 0; }
  .inbox-wide { display: none; }
  .inbox-narrow { display: inline-flex; }
  .onair { gap: var(--s2); }
  .onair-state { font-size: 16px; line-height: 18px; white-space: normal; max-width: 4.6em; }
  .onair .btn { padding: 0 var(--s3); }
  .brand { font-size: 19px; }
  .onair.locked .onair-hint { display: none; }
  .setup:not(.complete) > h2 { padding-right: 7.5rem; }
  .setup-d > summary { top: calc(var(--s4) - 9px); right: var(--s4); }
  .wrap { padding: var(--s4) max(var(--s4), env(safe-area-inset-right)) var(--s8) max(var(--s4), env(safe-area-inset-left)); gap: var(--s4); }
  .tabs-wrap { margin: 0 calc(-1 * var(--s4)); }
  .tabs { padding: 0 var(--s4); }
  .setup, .setup.complete .setup-body { padding: var(--s4); }
  .list { gap: var(--s4); }
  .reel-head { padding: var(--s4); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step { padding: var(--s4); }
  .step + .step { border-left: 0; border-top: 1px solid var(--hairline); }
  .step-post { display: flex; }
  .step-post .decide .btn-primary { width: 100%; }
  .frame { max-width: none; width: auto; height: min(56svh, 520px); }
  .facts { align-self: stretch; }
  .seg { max-width: none; }
  .caption-col.collapsed .editor { display: none; }
  .history { padding: 0 var(--s4) var(--s2); }
  .history li { grid-template-columns: 1fr; gap: 0; }
  .dlg-actions .btn { flex: 1 1 auto; }
}
@media (max-width: 359px) {
  .onair:not(.locked) .onair-words { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
}
@media (min-width: 768px) {
  .caption-col .readview.phone-only, .caption-col .edit-toggle { display: none; }
}
@media (max-width: 767px) {
  .caption-col:not(.collapsed) .readview.phone-only { display: none; }
}
@media (pointer: coarse) {
  .seg label { min-height: var(--tap); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .spinner, .btn[aria-busy="true"]::before { border-style: dotted; border-right-color: currentColor; }
}

/* ---------- Sign-in page (server-rendered, src/login.ts) ---------- */
.login { min-height: 100vh; display: grid; place-content: center; gap: var(--s5); padding: var(--s5); }
.login .brand { text-align: center; }
.login-card { width: min(100%, 380px); background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: var(--s5); display: grid; gap: var(--s4); }
.login-card h2 { margin: 0; font-size: 20px; }
.login-card input[type=password] { width: 100%; }
.session-actions { display: inline-flex; flex-wrap: wrap; gap: var(--s2); margin-left: var(--s2); }
