/* CLIPIT app UI. Style: true-black flat (dark first; light follows the same rules).
   Elevation by lightness alone, no shadows at rest, colour only on data and status.
   The one data hue is the caption yellow CLIPIT burns into every clip.

   Grid arithmetic (1440 wide): sidebar 220 + 1px rule; canvas 1219 with 29px gutters → 1161 content.
   Overview: 1fr + 384px rail + 14px gap → 763 + 14 + 384 = 1161.
   Clips: 344px list + 14px gap + 803px detail = 1161. */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-ext-400.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-ext-500.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-ext-600.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ground: #000000; --surface: #111111; --raised: #2a2a2a; --sunk: #0a0a0a;
  --border: #1a1a1a; --rule: #1d1d1d; --control: #444444; --active: #222222;
  --text: #ffffff; --muted: #b4b4b4; --faint: #949494; --nav: #bbbbbb;
  --primary: #ffffff; --primary-ink: #000000;
  --accent: #f5e04a;            /* caption yellow: the active word in every CLIPIT clip */
  --accent-soft: #3a3510;
  --positive: #3fc07a; --negative: #e5566f; --warning: #e5a93b;
  --pill-positive-bg: #172a1d; --pill-positive-ink: #3fc07a;
  --pill-negative-bg: #2c1a20; --pill-negative-ink: #e5566f;
  --pill-warning-bg: #2b2414; --pill-warning-ink: #e5a93b;
  --pill-neutral-bg: #222222; --pill-neutral-ink: #e6e6e6;
  --track: #1f1f1f; --track-done: #3d3d3d; --gap-hatch: #2a2a2a;
  --radius-card: 20px; --radius-inner: 12px; --radius-control: 999px; --radius-chip: 999px;
  --gap: 14px; --pad: 22px; --gutter: 29px; --control-h: 36px;
  --sidebar: 220px; --topbar: 64px; --rail: 384px;
  --fs-title: 20px; --fs-section: 16px; --fs-kpi: 24px; --fs-body: 14px; --fs-small: 12px;
  --font: "Inter", "Segoe UI", "Nirmala UI", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --ground: #f9fafb; --surface: #ffffff; --raised: #f2f3f5; --sunk: #f4f5f7;
  --border: #e8e8e8; --rule: #eeeeee; --control: #d1d5db; --active: #eeeeee;
  --text: #111111; --muted: #5f6368; --faint: #6b6b6b; --nav: #4b4d4f;
  --primary: #1d1f20; --primary-ink: #ffffff;
  --accent: #b89a00; --accent-soft: #fff6c2;
  --positive: #247b50; --negative: #c4242a; --warning: #92400e;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
  --pill-neutral-bg: #f0f0f0; --pill-neutral-ink: #333333;
  --track: #eceef1; --track-done: #c9cdd3; --gap-hatch: #e2e4e8;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground: #f9fafb; --surface: #ffffff; --raised: #f2f3f5; --sunk: #f4f5f7;
    --border: #e8e8e8; --rule: #eeeeee; --control: #d1d5db; --active: #eeeeee;
    --text: #111111; --muted: #5f6368; --faint: #6b6b6b; --nav: #4b4d4f;
    --primary: #1d1f20; --primary-ink: #ffffff;
    --accent: #b89a00; --accent-soft: #fff6c2;
    --positive: #247b50; --negative: #c4242a; --warning: #92400e;
    --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
    --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
    --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
    --pill-neutral-bg: #f0f0f0; --pill-neutral-ink: #333333;
    --track: #eceef1; --track-done: #c9cdd3; --gap-hatch: #e2e4e8;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ground); color: var(--text); font: 400 var(--fs-body)/20px var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── Shell: ruled T-frame ── */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: var(--topbar) 1fr; min-height: 100%; }
.side { grid-row: 1 / 3; border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; text-decoration: none; }
.brand svg { flex: none; }
.brand b { font-weight: 600; font-size: 16px; letter-spacing: .2px; }
.nav { display: flex; flex-direction: column; gap: 0; }
.nav a { display: flex; align-items: center; gap: 10px; height: 32px; margin-bottom: 2px; padding: 0 10px; border-radius: 8px; color: var(--nav); text-decoration: none; }
.nav a svg { flex: none; opacity: .85; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 500; }
.nav a[aria-current="page"] svg { opacity: 1; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding: 0 10px; color: var(--faint); font-size: 12px; line-height: 18px; }

.top { display: flex; align-items: center; gap: 16px; padding: 0 var(--gutter); border-bottom: 1px solid var(--border); min-width: 0; }
.engine { display: flex; align-items: center; gap: 10px; min-width: 0; }
.engine .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.engine.ok .dot { background: var(--positive); }
.engine.live .dot { background: var(--negative); animation: pulse 1.6s infinite; }
.engine.down .dot { background: var(--warning); }
.engine span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes pulse { 50% { opacity: .35; } }
.quick { margin-left: auto; display: flex; align-items: center; gap: 8px; height: 100%; padding-left: 16px; border-left: 1px solid var(--border); }
.quick input { width: 300px; }

.canvas { padding: 24px var(--gutter) 48px; min-width: 0; }
.view { max-width: 1400px; }

/* ── Title row ── */
.title-row { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.title-row h1 { margin: 0; font-size: var(--fs-title); line-height: 28px; font-weight: 600; }
.title-row p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.title-row .actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

/* ── Controls ── */
.btn { height: var(--control-h); padding: 0 16px; border-radius: var(--radius-control); border: 1px solid var(--control); background: transparent; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none; font-weight: 500; transition: background-color .12s, border-color .12s, transform .08s; }
.btn:hover { background: var(--active); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--negative); border-color: var(--control); }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--text); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
input[type=text], input[type=search], select, textarea { height: var(--control-h); padding: 0 14px; border-radius: 10px; border: 1px solid var(--control); background: var(--sunk); color: var(--text); min-width: 0; }
textarea { height: auto; padding: 10px 14px; resize: vertical; line-height: 20px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23949494' stroke-width='1.5'/%3E%3C/svg%3E"); background-position: right 13px center; background-repeat: no-repeat; }
label.field { display: flex; flex-direction: column; gap: 8px; font-weight: 500; }
label.field > span.hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: -4px; }

.seg { display: inline-flex; gap: 4px; padding: 3px; background: var(--surface); border-radius: 999px; }
.seg button { height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--text); }
.seg button .n { margin-left: 6px; color: inherit; font-variant-numeric: tabular-nums; }

.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: var(--radius-chip); font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.pill.live { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }

/* ── Panels ── */
.panel { background: var(--surface); border-radius: var(--radius-card); padding: var(--pad); min-width: 0; }
.panel > header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.panel > header h2 { margin: 0; font-size: var(--fs-section); font-weight: 500; }
.panel > header .meta { margin-left: auto; color: var(--faint); font-size: 12px; }
.rail-head { display: flex; align-items: baseline; margin: 0 0 8px 2px; }
.rail-head h2 { margin: 0; font-size: var(--fs-section); font-weight: 500; }
.rail-head a { margin-left: auto; color: var(--muted); font-size: 13px; text-decoration: none; }
.rail-head a:hover { color: var(--text); }
.empty { padding: 14px 16px; border: 1px dashed var(--control); border-radius: var(--radius-inner); color: var(--muted); }
.error-line { color: var(--muted); } .error-line b { color: var(--negative); font-weight: 500; }

/* ── KPI strip: one container split by dividers ── */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-radius: var(--radius-card); margin-bottom: var(--gap); }
.kpi { padding: 18px var(--pad); border-left: 1px solid var(--border); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: var(--fs-kpi); line-height: 32px; font-weight: 500; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 14px; color: var(--faint); font-weight: 400; margin-left: 3px; }
.kpi .cap { color: var(--faint); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.lead .value { color: var(--text); font-size: 30px; line-height: 36px; margin-top: 0; }
.kpi a { text-decoration: none; }

.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, var(--rail)); gap: var(--gap); align-items: start; }
.rail { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rail > section { min-width: 0; }

/* ── Stream timeline (the signature element) ── */
.streams { display: flex; flex-direction: column; gap: 22px; }
.stream { display: flex; flex-direction: column; gap: 10px; }
.stream-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stream-head .who { font-weight: 500; white-space: nowrap; }
.stream-head .what { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stream-head .when { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }
.tl { position: relative; height: 44px; }
.tl-track { position: absolute; left: 0; right: 0; top: 18px; height: 10px; border-radius: 3px; background: var(--track); overflow: hidden; }
.tl-done { position: absolute; top: 0; bottom: 0; left: 0; background: var(--track-done); }
.tl-gap { /* taste-skill-ignore: hatch is a chart mark (not recorded) */ position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, var(--gap-hatch) 0 2px, transparent 2px 5px); background-color: var(--surface); }
.tl-span { position: absolute; top: 14px; height: 18px; border-radius: 3px; background: var(--accent); opacity: .22; pointer-events: none; }
.tl-m { position: absolute; top: 8px; width: 14px; height: 30px; margin-left: -7px; border: 0; padding: 0; background: transparent; cursor: default; }
.tl-m::after { content: ""; position: absolute; left: 6px; top: 0; width: 2px; height: 30px; border-radius: 1px; background: var(--faint); opacity: .55; }
.tl-m.kept::after { background: var(--accent); opacity: 1; width: 3px; left: 5.5px; }
.tl-m.kept.approved::after { top: -5px; height: 35px; }
.tl-m.clip { cursor: pointer; }
.tl-m.clip:hover::after, .tl-m.clip:focus-visible::after { width: 5px; left: 4.5px; }
.tl-now { position: absolute; top: 4px; bottom: 2px; width: 2px; margin-left: -1px; background: var(--negative); border-radius: 1px; }
.tl-axis { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12px; }
.tl-legend i { display: inline-block; vertical-align: -2px; margin-right: 6px; }
.lg-done { width: 14px; height: 10px; border-radius: 2px; background: var(--track-done); }
.lg-todo { width: 14px; height: 10px; border-radius: 2px; background: var(--track); outline: 1px solid var(--control); outline-offset: -1px; }
.lg-gap { /* taste-skill-ignore: legend swatch of the hatch mark */ width: 14px; height: 10px; border-radius: 2px; background: repeating-linear-gradient(135deg, var(--gap-hatch) 0 2px, transparent 2px 5px); outline: 1px solid var(--control); outline-offset: -1px; }
.lg-kept { width: 3px; height: 12px; background: var(--accent); }
.lg-skip { width: 2px; height: 12px; background: var(--faint); opacity: .55; }
.stream-foot { display: flex; gap: 18px; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ── Lists ── */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); min-width: 0; }
.row:first-child { border-top: 0; padding-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .l1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .l2 { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.thumb { flex: none; width: 36px; height: 64px; border-radius: 6px; background: var(--raised) center / cover no-repeat; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
a.row { text-decoration: none; }
a.row:hover .l1 { text-decoration: underline; text-underline-offset: 3px; }
.ev { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--rule); }
.ev:first-child { border-top: 0; padding-top: 0; }
.ev time { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.ev.warn span { color: var(--warning); } .ev.error span { color: var(--negative); }

/* ── Clips: queue + detail ── */
.clips-layout { display: grid; grid-template-columns: 344px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.queue { background: var(--surface); border-radius: var(--radius-card); padding: 8px; max-height: calc(100vh - 210px); overflow: auto; position: sticky; top: 16px; }
.qitem { display: flex; gap: 12px; align-items: center; width: 100%; padding: 8px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; color: var(--text); }
.qitem:hover { background: var(--raised); }
.qitem[aria-selected="true"] { background: var(--active); outline: 1px solid var(--control); }
.qitem .grow { flex: 1; min-width: 0; }
.qitem .l1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.qitem .l2 { color: var(--faint); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qitem .score { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; flex: none; }
.qitem .thumb { width: 40px; height: 71px; }

.detail { background: var(--surface); border-radius: var(--radius-card); padding: var(--pad); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.player { width: min(340px, calc((100vh - 230px) * 9 / 16)); min-width: 220px; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #000; }
.player video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.player .rendering { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }
.meta { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.meta-top { display: flex; flex-direction: column; gap: 8px; }
.meta-top h2 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 13px; }
.facts span { white-space: nowrap; }
.decide { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.decide .keys { margin-left: auto; color: var(--faint); font-size: 12px; }
.decide kbd, .keys kbd { font: inherit; padding: 0 5px; border-radius: 4px; background: var(--raised); color: var(--muted); }
.reject-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; border-radius: var(--radius-inner); background: var(--raised); }
.block h3 { margin: 0 0 8px; font-size: 14px; font-weight: 500; }
.block p { margin: 0; }
.transcript { color: var(--muted); max-height: 160px; overflow: auto; line-height: 22px; }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.edit-grid select, .edit-grid input:not([type=checkbox]), .cset select { width: 100%; max-width: 100%; }
.chan > div { min-width: 0; }
.chan .l1 { overflow: hidden; text-overflow: ellipsis; }
.edit-grid .full { grid-column: 1 / -1; }
.save-row { display: flex; gap: 8px; align-items: center; }
.stamp { color: var(--positive); font-size: 13px; }
.scores { display: grid; grid-template-columns: 92px 1fr 28px; gap: 8px 10px; align-items: center; font-size: 13px; }
.scores .bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.scores .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.scores .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.checks { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.checks div { display: flex; gap: 8px; }
.checks .ok { color: var(--positive); } .checks .bad { color: var(--negative); }
details.more > summary { cursor: pointer; color: var(--muted); list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+ "; }
details.more[open] > summary::before { content: "− "; }
details.more > div { margin-top: 12px; display: flex; flex-direction: column; gap: 18px; }

/* ── Tables ── */
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-weight: 400; color: var(--faint); font-size: 12px; padding: 0 12px 10px; white-space: nowrap; }
table.data td { padding: 12px; border-top: 1px solid var(--rule); vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data .num { text-align: right; }
table.data tr.open td { border-bottom: 0; }
.chan { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mono-av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; background: var(--raised); }
.chan .l1 { font-weight: 500; white-space: nowrap; }
.chan .l2 { color: var(--faint); font-size: 12px; }
.chan-settings td { padding: 0 0 18px !important; border-top: 0 !important; }
.cset { background: var(--raised); border-radius: 16px; padding: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cset .full { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cset .full .stamp { margin-right: auto; }

.add-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px auto; gap: 8px; }
.msg { font-size: 13px; }
.msg:not(:empty) { margin-top: 10px; }
.msg.err { color: var(--negative); } .msg.good { color: var(--positive); }

/* ── Activity ── */
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters input { width: 280px; }
.log .ev { grid-template-columns: 150px 90px minmax(0, 1fr); }
.log { min-height: 240px; }
.log .scope { color: var(--faint); font-size: 12px; }

/* ── Settings ── */
.set { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; padding: 28px 0; border-top: 1px solid var(--border); }
.set:first-of-type { border-top: 0; padding-top: 4px; }
.set > div:first-child h2 { margin: 6px 0 4px; font-size: var(--fs-section); font-weight: 500; }
.set > div:first-child p { margin: 0; color: var(--muted); }
.set .panel { display: flex; flex-direction: column; gap: 16px; padding: 18px; border-radius: 16px; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 10px 14px; align-items: center; }
.kv > span:nth-child(3n+1) { color: var(--muted); }
.kv .val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--text); border-radius: 4px; }
.meter.warn i { background: var(--negative); }
.meter-cap { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.acct { display: flex; align-items: center; gap: 12px; }
.acct .grow { flex: 1; }
.acct .l2 { color: var(--faint); font-size: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.toast { /* taste-skill-ignore: floats over the page */ position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--primary); color: var(--primary-ink); padding: 10px 18px; border-radius: 999px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.35); z-index: 10; }

/* ── Accounts & notices ── */
.notice-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; padding: 12px 16px; border-radius: 14px; background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.notice-bar span { flex: 1 1 320px; }
.acct-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.acct-panel { display: flex; flex-direction: column; gap: 16px; }
.acct-row select { width: 120px; flex: none; }
.acct-row .l1 { display: flex; align-items: center; gap: 8px; }
.setup { display: flex; flex-direction: column; gap: 14px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.steps a { color: var(--text); }
.redirect { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--raised); }
.redirect code { font: 13px/1.4 Consolas, "Cascadia Mono", monospace; color: var(--text); word-break: break-all; }
.keys-form { display: grid; gap: 12px; }
input[type=password] { height: var(--control-h); padding: 0 14px; border-radius: 10px; border: 1px solid var(--control); background: var(--sunk); color: var(--text); min-width: 0; }
.inline-select { height: 32px; max-width: 220px; font-size: 13px; }

/* ── YouTube post preview ── */
.post { background: var(--raised); border-radius: var(--radius-inner); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-head h3 { margin: 0; }
.post-head .btn { margin-left: auto; }
.post-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.post-title > span:first-child { flex: 1; min-width: 0; }
.post-desc { margin: 0; white-space: pre-wrap; font: 13px/20px var(--font); color: var(--muted); }
.post-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12px; }
.brand-form .edit-grid { margin: 0; }

/* ── Posts ── */
.posting-set { display: flex; flex-direction: column; gap: 18px; margin-bottom: 14px; }
.posting-switch { display: flex; gap: 16px; align-items: flex-start; }
.posting-switch h2 { margin: 0 0 4px; font-size: var(--fs-section); font-weight: 500; }
.switch { position: relative; display: inline-block; flex: none; width: 40px; height: 22px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.slider { position: absolute; inset: 0; border-radius: 999px; background: var(--control); transition: background-color .15s; pointer-events: none; }
.slider::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .slider { background: var(--positive); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--text); outline-offset: 2px; }
.switch.big { width: 48px; height: 28px; margin-top: 2px; }
.switch.big .slider::before { width: 22px; height: 22px; }
.switch.big input:checked + .slider::before { transform: translateX(20px); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.post-status { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.post-status a { color: var(--text); }

.clip-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.title-row .actions { min-width: 0; max-width: 100%; }
.clip-filters { min-width: 0; max-width: 100%; }
.clip-filters .seg { max-width: 100%; overflow-x: auto; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; padding: 10px 14px; border-radius: 14px; background: var(--surface); }
.bulk-bar > span { flex: 1 1 260px; }

/* ── Tablet & phone ── */
@media (max-width: 1180px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  /* five figures: the lead across the top, then two rows of two (no orphan cell) */
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { border-left: 0; border-top: 1px solid var(--border); }
  .kpi.lead { grid-column: 1 / -1; border-top: 0; }
  .kpi:nth-child(odd):not(.lead) { border-left: 1px solid var(--border); }
  .quick input { width: 220px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 56px 1fr auto; }
  .side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; z-index: 5; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); background: var(--ground); }
  .side .brand, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; height: 48px; gap: 2px; justify-content: center; font-size: 11.5px; padding: 0 6px; }
  .nav .count { margin: 0; position: absolute; top: 3px; left: 50%; transform: translateX(-3px); font-size: 9px; line-height: 14px; min-width: 14px; padding: 0 4px; border-radius: 7px; background: var(--accent); color: #000; text-align: center; font-weight: 600; }
  .nav .count:empty { display: none; }
  .nav a { position: relative; }
  .top { padding: 0 16px; }
  .quick { display: none; }
  .canvas { padding: 18px 16px 96px; }
  .clips-layout { grid-template-columns: 1fr; }
  .queue { position: static; max-height: none; }
  .clips-layout.has-detail .queue { display: none; }
  .clips-layout:not(.has-detail) .detail { display: none; }
  .detail { grid-template-columns: 1fr; }
  .player { width: 100%; max-width: 380px; margin: 0 auto; }
  .back-link { display: inline-flex !important; }
  .set { grid-template-columns: 1fr; gap: 12px; }
  .cset { grid-template-columns: 1fr; }
  .acct-grid { grid-template-columns: 1fr; }
  .nav a { font-size: 11px; padding: 0 2px; letter-spacing: -0.2px; }
  .acct-row { flex-wrap: wrap; }
  .add-row { grid-template-columns: 1fr; }
  .log .ev { grid-template-columns: 1fr; gap: 2px; }
  .filters { flex-wrap: wrap; } .filters input { width: 100%; }
  .seg { max-width: 100%; overflow-x: auto; }
  .kv { grid-template-columns: 1fr auto; }
  .kv > span:nth-child(3n+1) { grid-column: 1 / -1; margin-bottom: -6px; }
  table.data .hide-sm { display: none; }
  table.data { table-layout: fixed; }
  table.data th:first-child { width: 46%; }
  table.data th:last-child { width: 30%; }
  .row-actions .btn { padding: 0 9px; }
  .title-row { flex-wrap: wrap; }
  .title-row .actions { margin-left: 0; }
}
@media (max-width: 560px) {
  .kpi { padding: 14px 16px; }
  .edit-grid { grid-template-columns: minmax(0, 1fr); }
  .stream-head .when { display: none; }
}
.back-link { display: none; margin-bottom: 12px; }
.show-sm { display: none !important; }
@media (max-width: 900px) { .show-sm { display: inline-flex !important; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
