/* Naudina. Tokens first (light, then dark); the signed-in pages are an operations console:
   a top bar, what needs a person first, then dense lists (Phase 11, ADR-012). No inline
   styles: the CSP allows only this file (web/security.py).
   16.5, "minimalistic but clear, functional": one type scale (--fs-*), one spacing scale
   (--sp-*), a light top bar, calm surfaces; colour is kept for state (live, needs you, ok). */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --sunk: #f0f2f5; --line: #e3e6eb;
  --ink: #171a21; --ink-2: #4b5263; --ink-3: #646c7e;
  --accent: #3446d4; --accent-ink: #ffffff; --accent-soft: #eceffd;
  --bar: #ffffff; --bar-ink: #171a21; --bar-dim: #4b5263;
  --tip-bg: #1d2130; --tip-ink: #f1f3f7;
  --live: #d11f29; --live-soft: #fdecec; --ok: #12805c; --ok-soft: #e4f4ec;
  --warn: #935400; --warn-soft: #fff3e0; --need: #b93c09; --need-soft: #fff0e8;
  --idle: #5b6272; --idle-soft: #edeff3;
  --n-rare_photos: #8a5a2b; --n-music: #5b3fd1; --n-videos: #b5306b; --n-other: #0f7b8c;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  /* The type scale: small print, meta, body, section heading, page heading, figures. */
  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 15px; --fs-md: 16px; --fs-lg: 20px; --fs-xl: 24px;
  /* The spacing scale. */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --r: 10px; --r-sm: 7px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101318; --surface: #171b22; --sunk: #1e232c; --line: #2b313c;
    --ink: #e8ebf1; --ink-2: #b4bbca; --ink-3: #8e96a7;
    --accent: #8f9bff; --accent-ink: #0f1218; --accent-soft: #242a4d;
    --bar: #14181e; --bar-ink: #e8ebf1; --bar-dim: #a9b0bf;
    --tip-bg: #2a303c; --tip-ink: #f1f3f7;
    --live: #ff6168; --live-soft: #391b1e; --ok: #45cf9c; --ok-soft: #13302a;
    --warn: #f0b14a; --warn-soft: #362913; --need: #ff8f55; --need-soft: #392216;
    --idle: #a0a7b6; --idle-soft: #242933;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { font: 17px/1.5 var(--font); background: var(--bg); color: var(--ink); margin: 0; padding: 48px 16px;
       -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { text-wrap: balance; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: var(--fs-xl); margin: 0 0 var(--sp-3); }
p { margin: 0 0 var(--sp-3); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--live); }
.muted { color: var(--ink-3); font-size: var(--fs-sm); }
.small { font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }
code { font: var(--fs-sm) var(--mono); background: var(--sunk); padding: 2px 6px; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Signed-out pages (sign in, invite, connect): one card */
main { max-width: 520px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line);
       border-radius: 12px; padding: var(--sp-6); }
.qr svg { display: block; margin: 8px auto 16px; }
a.button { display: inline-block; margin-top: 12px; padding: 11px 20px; border-radius: 8px;
           background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 600; }
form label { display: block; margin: 0 0 12px; font-weight: 600; }
form input { display: block; width: 100%; margin-top: 4px; padding: 10px; font: inherit; color: inherit;
             background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
form button, button.primary { padding: 11px 20px; border: 0; border-radius: 8px; background: var(--accent);
              color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; }

/* ---- Signed-in pages ------------------------------------------------------------------ */
body.app { padding: 0; font-size: var(--fs-base); }
.bar { background: var(--bar); color: var(--bar-ink); position: sticky; top: 0; z-index: 5;
       border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1240px; margin: 0 auto; padding: var(--sp-2) var(--sp-4); display: flex; align-items: center;
          gap: var(--sp-5); flex-wrap: wrap; }
.bar a.brand { color: var(--bar-ink); font-weight: 750; font-size: 17px; text-decoration: none; letter-spacing: -.01em; }
.bar nav { display: flex; gap: var(--sp-1); flex: 1; flex-wrap: wrap; }
.bar nav a { color: var(--bar-dim); padding: 6px 10px; border-radius: var(--r-sm); font-weight: 600; font-size: 14px;
             text-decoration: none; }
.bar nav a:hover { color: var(--bar-ink); background: var(--sunk); }
.bar nav a.on { color: var(--bar-ink); background: var(--sunk); }
.bar nav .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--need);
                margin-left: 6px; vertical-align: 1px; }
.bar .who { display: flex; gap: var(--sp-3); align-items: center; color: var(--bar-dim); font-size: 14px; }
form.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.page { max-width: 1240px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) 64px; display: grid; gap: var(--sp-5); }
.page > * { min-width: 0; }
.page h1 { font-size: var(--fs-xl); margin: 0; }
.page h2 { font-size: var(--fs-md); margin: var(--sp-2) 0 0; }
.page a { color: var(--accent); }
.page p { margin: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.head p { margin-top: var(--sp-1); }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
       color: var(--ink); padding: 7px 14px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600;
       line-height: 1.4; cursor: pointer; white-space: nowrap; text-decoration: none; }
.page a.btn { color: var(--ink); }
.btn:hover { border-color: var(--ink-3); }
.btn.primary, .page a.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 4px 10px; font-size: var(--fs-sm); }

/* Tables */
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line);
                               vertical-align: top; }
table.grid th { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); white-space: nowrap; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid .num { text-align: right; white-space: nowrap; }
table.grid a { color: var(--accent); font-weight: 600; text-decoration: none; }
table.grid a:hover { text-decoration: underline; }

/* Tags and pills */
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--live-soft); color: var(--live); }
.tag:not(.ok):not(.warn):not(.bad) { background: var(--idle-soft); color: var(--idle); text-transform: capitalize; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px;
        font-weight: 600; white-space: nowrap; }
.pill.live { background: var(--live-soft); color: var(--live); }
.pill.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); }
.pill.start { background: var(--warn-soft); color: var(--warn); }
.pill.need { background: var(--need-soft); color: var(--need); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.idle { background: var(--idle-soft); color: var(--idle); }
@media (prefers-reduced-motion: no-preference) {
  .pill.live::before { animation: pulse 1.8s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .35; } }
}
.state { text-transform: capitalize; }
.clip { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        vertical-align: bottom; }
.nowrap { white-space: nowrap; }

/* Niche colours: an avatar and a label */
.av { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff;
      font-weight: 700; font-size: 13px; flex: none; background: var(--n-other); }
.av.n-rare_photos { background: var(--n-rare_photos); } .av.n-music { background: var(--n-music); }
.av.n-videos { background: var(--n-videos); }
.av.big { width: 48px; height: 48px; font-size: 17px; }

/* Panels, notices, empty states */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp-4) var(--sp-5); }
.notice { padding: var(--sp-3) var(--sp-4); background: var(--accent-soft); border-radius: var(--r); }
.notice.bad { background: var(--live-soft); }
.empty { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp-5); display: grid; gap: var(--sp-3); }
code.copy { display: block; padding: 8px; overflow-wrap: anywhere; user-select: all; }

/* Summary tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--surface);
        border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kpi { background: var(--surface); padding: var(--sp-3) var(--sp-4); display: grid; gap: 2px; min-width: 0; align-content: start;
       box-shadow: 1px 1px 0 var(--line); }
.kpi .lbl { font-size: var(--fs-sm); color: var(--ink-3); font-weight: 600; display: flex; align-items: center; }
.kpi .val { font-size: var(--fs-xl); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: var(--fs-xs); color: var(--ink-3); }

/* System list */
.syslist { display: grid; gap: 10px; }
.sysitem { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
           display: grid; gap: 6px; }
.sysitem h2 { font-size: var(--fs-md); margin: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sysitem p { color: var(--ink-2); font-size: var(--fs-sm); }

/* Readiness checks (the channel page's long list) */
ul.checks { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line);
            border-radius: var(--r); }
ul.checks li { padding: 8px 12px 8px 36px; border-bottom: 1px solid var(--line); position: relative; }
ul.checks li:last-child { border-bottom: 0; }
ul.checks .mark { position: absolute; left: 12px; font-weight: 700; }
ul.checks li.check-ok .mark { color: var(--ok); } ul.checks li.check-warn .mark { color: var(--warn); }
ul.checks li.check-fail .mark { color: var(--live); } ul.checks li.check-fail { background: var(--live-soft); }

/* Alerts */
ul.alerts { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line);
            border-radius: var(--r); }
ul.alerts li { padding: 10px 14px; border-bottom: 1px solid var(--line); }
ul.alerts li:last-child { border-bottom: 0; }
ul.alerts li.alert-error { background: var(--live-soft); }

/* Forms on the signed-in pages */
label.check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 12px 0; }
label.check input { width: auto; margin: 0; }
button.danger { padding: 10px 18px; border: 0; border-radius: 8px; background: var(--live); color: #fff; font: inherit;
                font-weight: 600; cursor: pointer; }
a.danger-link { color: var(--live); margin-left: 12px; }
form.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
form.row label.check { margin: 0; font-weight: 400; }
form.row select, form.search input, .page select, .page input[type="date"] {
  padding: 6px 8px; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
form.search input { width: min(420px, 100%); }
button.small { padding: 6px 12px; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-ink);
               font: inherit; font-weight: 600; cursor: pointer; }
.page form label { margin: 0; }
.page form input[type="date"] { display: inline-block; width: auto; margin: 0 8px 0 4px; }
form.export { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.export label { display: inline-flex; align-items: center; font-weight: 500; }

/* Servers panel (6.10): one series per chart, alert line dashed, hover via SVG <title> */
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
figure.chart { margin: 0; padding: 10px 12px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
figure.chart figcaption { font-weight: 600; font-size: 14px; }
figure.chart figcaption .muted { font-weight: 400; font-size: 13px; }
figure.chart svg { display: block; width: 100%; height: auto; }
.chart .series { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .baseline { stroke: var(--ink-3); stroke-width: 1; }
.chart .threshold { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .axis { font-size: 11px; fill: var(--ink-3); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--accent-soft); opacity: .5; }
.chart .nodata { font-size: 13px; fill: var(--ink-3); }
pre.report { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }

/* Uploads (10.7e2): a drop box per folder, and the queue under them */
.zones { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.zone { border: 2px dashed var(--line); border-radius: var(--r); padding: 14px; background: var(--sunk); }
.zone.over { border-color: var(--accent); background: var(--accent-soft); }
.zone h3 { margin: 0 0 4px; font-size: var(--fs-md); }
.zone .muted { font-size: 13px; margin: 0 0 8px; }
.zone .pick { font-size: 13px; color: var(--accent); cursor: pointer; font-weight: 600;
  position: relative; display: inline-block; overflow: hidden; border-radius: 4px; }
/* "or choose files": its input lies see-through over the label, so it stays in the Tab order
   (display: none took it out) and Enter or Space opens it (13.18c). */
.zone .pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0;
  cursor: pointer; }
.zone .pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.zone .set { display: block; font-size: 13px; margin-bottom: 6px; }
.zone .waiting-count { font-size: 13px; font-weight: 600; margin: 8px 0 0; }
#queue { list-style: none; padding: 0; margin: 0; font-size: 14px; }
#queue:empty { display: none; }
#queue li { padding: 3px 0; }
#queue progress { width: 160px; vertical-align: middle; }
#queue li.ok .state { color: var(--ok); }
#queue li.bad .state { color: var(--live); }

/* The Channels page (11.3) */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: flex; background: var(--sunk); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 5px 12px; border-radius: 7px; font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); text-decoration: none; }
.page .seg a { color: var(--ink-2); }
.seg a.on, .page .seg a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.seg .c { color: var(--ink-3); font-weight: 500; margin-left: 2px; }
.filters .search { flex: 1; min-width: 160px; max-width: 320px; padding: 7px 12px; border: 1px solid var(--line);
                   border-radius: 8px; background: var(--surface); color: inherit; font: inherit; }
.filters select { padding: 7px 10px; }
.portfolio { display: grid; gap: 16px; }
.kpi .of { font-size: 16px; color: var(--ink-3); font-weight: 600; }
.kpi .val.need { color: var(--need); }
a.kpi.click, .page a.kpi.click { color: var(--ink); text-decoration: none; }
a.kpi.click:hover { background: var(--need-soft); }
details.needs { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--need); border-radius: var(--r); }
details.needs > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
details.needs > summary::-webkit-details-marker { display: none; }
details.needs > summary .who { color: var(--ink-2); flex: 1; min-width: 200px; }
details.needs > summary .tog { color: var(--accent); font-weight: 600; font-size: var(--fs-sm); }
details.needs[open] > summary .tog::after { content: " ▴"; }
details.needs:not([open]) > summary .tog::after { content: " ▾"; }
details.needs[open] > summary { border-bottom: 1px solid var(--line); }
.need-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(0, 2fr) auto; gap: 14px; align-items: center;
        padding: 10px 16px; border-top: 1px solid var(--line); }
details.needs > summary + .need-row { border-top: 0; }
.need-row .what { color: var(--ink-2); min-width: 0; }
.need-row a.who-link, .page .need-row a.who-link { color: var(--ink); font-weight: 700; text-decoration: none; }
.small.warn { color: var(--warn); } .small.bad { color: var(--need); }
@media (max-width: 720px) { .need-row { grid-template-columns: 1fr; gap: 6px; } }
/* A phone's width: the brand and the account on the first row, the whole menu on the next,
   instead of the bar wrapping so that one link dangles on a row of its own (14.7a). */
@media (max-width: 560px) {
  .bar .who > span { display: none; }
  .bar-in { gap: 6px 10px; }
  .bar a.brand { order: 1; }
  .bar .who { order: 2; margin-left: auto; }
  .bar nav { order: 3; flex-basis: 100%; }
}
/* Header links a finger can hit on a phone or a touch screen (13.18b); the desktop look stays. */
@media (max-width: 720px), (pointer: coarse) {
  .bar nav a, .bar a.brand, .bar .who button.link { min-height: 44px; display: inline-flex; align-items: center; }
  .bar .who button.link { padding: 0 10px; }
}
.calm { color: var(--ink-2); }
table.channels { min-width: 560px; }
table.channels td { vertical-align: middle; }
table.channels tr.grp td { background: var(--sunk); font-weight: 600; font-size: var(--fs-sm); padding: 6px 12px; }
table.channels tr.grp .muted { font-size: 13px; font-weight: 500; }
table.channels tr.row { cursor: pointer; }
table.channels tr.row:hover td { background: var(--sunk); }
.chan { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chan a.name, .page .chan a.name { color: var(--ink); font-weight: 700; }
.chan .nic { font-size: var(--fs-xs); color: var(--ink-3); }
.pill + .small { margin-top: 3px; }

/* The numbers (11.4): deltas, the day's viewers, days of content left */
.delta { font-size: 12px; font-weight: 600; margin-left: 6px; white-space: nowrap; }
.delta.up { color: var(--ok); } .delta.down { color: var(--live); } .delta.flat { color: var(--ink-3); }
svg.spark { width: 64px; height: 20px; vertical-align: middle; margin-left: 8px; }
svg.spark .l { fill: none; stroke: var(--accent); stroke-width: 1.5; }
svg.spark .a { fill: var(--accent-soft); stroke: none; }
svg.meter { display: block; width: 110px; height: 5px; margin-top: 4px; }
svg.meter .track { fill: var(--sunk); }
svg.meter.ok .fill { fill: var(--ok); } svg.meter.warn .fill { fill: var(--warn); } svg.meter.bad .fill { fill: var(--live); }
.meter-t { font-size: 13px; white-space: nowrap; }
.meter-t.warn { color: var(--warn); } .meter-t.bad { color: var(--live); font-weight: 600; }

/* The channel page (11.5) */
.crumbs { font-size: var(--fs-sm); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.chead { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.chead .meta { flex: 1; min-width: 220px; }
/* The code tag (24.3) and the pencil that changes it and the name in the panel. */
.code { display: inline-block; padding: 0 6px; border-radius: 5px; background: var(--sunk); color: var(--ink-2);
  font-size: 12px; font-weight: 700; letter-spacing: .04em; vertical-align: .12em; white-space: nowrap; }
h1 .code { font-size: 15px; vertical-align: .25em; }
.chead .ttl { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
details.rename > summary { list-style: none; cursor: pointer; color: var(--ink-3); font-size: 18px; line-height: 1; user-select: none; }
details.rename > summary::-webkit-details-marker { display: none; }
details.rename > summary:hover { color: var(--accent); }
details.rename[open] { flex-basis: 100%; }
details.rename[open] > summary { color: var(--accent); }
.rename-form { display: grid; gap: 10px; max-width: 560px; margin: 8px 0 4px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.rename-form .field { grid-template-columns: minmax(120px, 160px) minmax(0, 1fr); }
.rename-form .save { display: flex; justify-content: flex-end; }
.chead .meta p { margin-top: 2px; color: var(--ink-2); font-size: var(--fs-sm); }
.chead .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn.danger-quiet, .page a.btn.danger-quiet { border-color: transparent; background: transparent; color: var(--live); }
.btn.on { background: var(--ok-soft); border-color: var(--ok-soft); color: var(--ok); }
section.callout { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--need);
                  border-radius: var(--r); padding: 0 var(--sp-4); display: grid; }
.callout-row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; padding: var(--sp-3) 0; }
.callout-row + .callout-row { border-top: 1px solid var(--line); }
.callout-row p { flex: 1; min-width: 220px; }
.statusline { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--sp-3) var(--sp-4);
              display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
/* The chip list asked for its whole 640 px inside a 358 px column at 390 px and took the
   page sideways with it: scrollWidth 710 against 390 on the Technical tab (the 14.7b walk). */
details.checks { margin-left: auto; min-width: 0; max-width: 100%; }
.statusline > * { min-width: 0; }
details.checks > summary { list-style: none; cursor: pointer; }
details.checks > summary::-webkit-details-marker { display: none; }
details.checks .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; max-width: min(640px, 100%); align-items: center; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-weight: 600; white-space: nowrap; }
.chip.w { background: var(--warn-soft); color: var(--warn); } .chip.f { background: var(--live-soft); color: var(--live); }
details.checks ul.why { flex-basis: 100%; min-width: 0; margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
details.checks ul.why li.f strong { color: var(--live); } details.checks ul.why li.w strong { color: var(--warn); }
nav.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
nav.tabs a, .page nav.tabs a { padding: 10px 12px; font-weight: 600; color: var(--ink-3); text-decoration: none;
              border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
nav.tabs a.on, .page nav.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
article.scard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: grid; align-content: start; }
article.scard .thumb { display: block; width: 100%; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--sunk); }
article.scard .thumb.none { background: linear-gradient(135deg, var(--accent-soft), var(--sunk)); }
article.scard .body { padding: var(--sp-3); display: grid; gap: 6px; justify-items: start; min-width: 0; }
article.scard .ttl { font-weight: 600; line-height: 1.3; }
article.scard .ttl a, .page article.scard .ttl a { color: var(--ink); }
article.scard .row2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
                      font-size: var(--fs-sm); color: var(--ink-2); width: 100%; }
.note { font-size: var(--fs-sm); color: var(--ink-3); }
.tech { display: grid; gap: var(--sp-4); }
.tech > * { min-width: 0; }  /* a wide table scrolls in its box, never the page (390 px) */
.tech .panel h2, .panel.inv h2 { margin: 0 0 var(--sp-3); font-size: var(--fs-md); }
.tech .panel > p + p { margin-top: 8px; }
table.history td { font-size: var(--fs-sm); }

/* The Content tab (11.6) */
.stock { display: grid; gap: 10px; }
.stock-row { display: grid; grid-template-columns: minmax(110px, 180px) minmax(80px, 1fr) auto; gap: 12px; align-items: center; }
svg.stack { width: 100%; height: 8px; border-radius: 4px; overflow: hidden; background: var(--sunk); }
svg.stack .use { fill: var(--accent); } svg.stack .cool { fill: var(--accent-soft); } svg.stack .free { fill: var(--ok); }
.legend { font-size: var(--fs-xs); color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.legend .k { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; }
.legend .k.use { background: var(--accent); } .legend .k.cool { background: var(--accent-soft); } .legend .k.free { background: var(--ok); }
.panel.add { display: grid; gap: 12px; }
.panel.add h2 { margin: 0; font-size: var(--fs-md); }
/* `button.small` and `button.danger` are declared after `button.link` and carry a solid
   background and the colour written for one, which a button with both classes took: the
   Waiting table's Delete was the danger colour on the danger colour, and Accounts' "remove"
   looked like a primary button (14.7b). Taking only the background away then left the white
   `--accent-ink` of a solid button on a white page (the 14.7b walk), so the colour belongs
   in the same rule: a link-styled button stays a link whatever else it carries. */
button.link.small, button.link.danger { background: none; padding: 0; border-radius: 0;
                                        font-weight: inherit; text-decoration: underline;
                                        color: var(--accent); }
button.link.danger { color: var(--live); }  /* after the rule above, so danger keeps its red */
button.link.small { font-size: 13px; }
.note button.link { color: var(--accent); font-weight: 600; }

/* Settings forms (11.7) */
form.settings { display: grid; gap: 18px; }
fieldset.fgroup { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
fieldset.fgroup legend { font-weight: 600; font-size: var(--fs-md); padding: 0 0 6px; border-bottom: 1px solid var(--line); width: 100%; margin-bottom: 8px; }
.field { display: grid; grid-template-columns: minmax(180px, 280px) minmax(0, 1fr); gap: 4px 20px; align-items: start; }
.page form.settings label { font-weight: 600; padding-top: 7px; display: block; }
.field .input { display: grid; gap: 4px; min-width: 0; }
.field input[type="text"], .field input[type="number"], .field select, .field textarea {
  width: 100%; max-width: 440px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: inherit; font: inherit; margin: 0; display: block; }
.field textarea { max-width: 600px; }
.field .hint { font-size: var(--fs-sm); color: var(--ink-3); }
.field .src { font-size: var(--fs-xs); color: var(--ink-3); }
.field .src.changed { color: var(--accent); font-weight: 600; }
.field .src button.link { color: var(--accent); font-size: 12px; text-decoration: underline; }
details.advanced { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 14px; }
details.advanced > summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
form.settings .save { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
@media (max-width: 640px) { .field { grid-template-columns: 1fr; } }
.panel > p.muted:first-child { margin-bottom: 16px; }

/* Adding a channel and its setup steps (11.8) */
.niches { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.page form .niche, label.niche { border: 2px solid var(--line); border-radius: var(--r); padding: 12px; cursor: pointer;
  display: grid; gap: 4px; background: var(--surface); font-weight: 400; }
label.niche:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
label.niche input { width: auto; margin: 0; display: inline; }
label.niche span { font-size: 13px; color: var(--ink-3); }
form.newch { display: grid; gap: 18px; }
section.setup { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r); padding: var(--sp-4) var(--sp-5); }
section.setup h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-md); }
section.setup ol { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
section.setup li.done { color: var(--ink-3); }
section.setup li.done strong::after { content: " ✓"; color: var(--ok); }
section.setup form { margin-left: 8px; }
section.setup ul.todo { margin: 4px 0; padding-left: 18px; display: grid; gap: 4px; }
label.niche input { justify-self: start; }

/* ---- 14.7a: a sideways table says so, and a finger's targets on a phone ---------------- */
/* macOS and iOS draw no scrollbar until something scrolls, so the Servers, Log and Channels
   tables read as if they had no more columns, and the channel page's tab bar as if Settings
   were the last tab. A thin bar is drawn wherever there is more to the side. */
/* `scrollbar-width: thin` won over the height below, so the cue was 1-2 px and barely
   showed (the 14.7b walk); the bar is drawn at its own width now. */
.scroll, nav.tabs { scrollbar-color: var(--ink-3) var(--sunk); }
.scroll::-webkit-scrollbar, nav.tabs::-webkit-scrollbar { height: 14px; -webkit-appearance: none; }
.scroll::-webkit-scrollbar-track, nav.tabs::-webkit-scrollbar-track { background: var(--sunk); }
.scroll::-webkit-scrollbar-thumb, nav.tabs::-webkit-scrollbar-thumb {
  background: var(--ink-3); border-radius: 999px; border: 3px solid var(--sunk); }

/* The Servers table: its 12 columns wanted 1811 px inside a 1166 px box, so RAID, NVMe and
   the prepare count sat outside it. The headings wrap and the two long texts are capped. */
table.servers th { white-space: normal; }
table.servers th, table.servers td { padding: 8px 9px; }
table.servers .chans { display: inline-block; max-width: 160px; overflow-wrap: anywhere; }
table.servers .clip { max-width: 110px; }

/* A finger's target on the lists, the tabs and the filters (83 were under 32 px on the
   Channels page). The desktop look stays: every rule is inside the query. */
@media (max-width: 720px), (pointer: coarse) {
  .seg a, nav.tabs a, .page nav.tabs a, table.grid a, .page table.grid a, .crumbs a,
  .page .chan a.name, .page .need-row a.who-link {
    min-height: 40px; display: inline-flex; align-items: center; }
  .btn.sm, .page a.btn.sm { padding: 9px 13px; }
  details.needs > summary { min-height: 44px; }
  .filters .search, .filters select, .page select, .page input[type="date"] { min-height: 40px; }
  /* Still small at phone width after 14.7a (the 14.7b walk measured 15-23 px): the checks
     summary, the links that stand alone in a note or a panel's paragraph, the drop boxes'
     file pickers, the Log's "Older events", Accounts' "remove" and a creator's to-do links. */
  details.checks > summary, .note button.link, .zone label.pick, p.more a,
  table.accounts form.chan button.link, .page .panel > p > a, ul.todo a {
    min-height: 44px; display: inline-flex; align-items: center; }
  details.checks > summary { flex-wrap: wrap; }
}

/* 39.9, the admin's only (a creator's markup never carries these classes): the Channels
   page's compact top row, smaller tiles, a full channel's green pill, the system's pause,
   the channel page's eight tiles and the footer's version. */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.topbar h1 { font-size: 22px; display: inline-flex; align-items: center; }
.topbar > #status { display: contents; }
.topbar .strip { margin: 0; gap: 6px; }
.topbar .strip .st { padding: 3px 8px; font-size: 13px; gap: 6px; }
.topbar .strip .pill { padding: 1px 8px; font-size: 12px; }
/* The scheduler and each server as a coloured dot, its word on hover; the allowance keeps its number. */
.topbar .strip .st.dot .pill { font-size: 0; width: 10px; height: 10px; padding: 0; gap: 0; background: currentColor; }
.topbar .strip .st.dot .pill.ok { color: var(--ok); } .topbar .strip .st.dot .pill.idle { color: var(--idle); }
.topbar ul.strip-alerts, .topbar #status > p { flex-basis: 100%; order: 9; margin: 0; }
.topbar .pulls { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.topbar .pulls p { margin: 0; }
.topbar .filters { margin-left: auto; gap: 8px; }
.topbar .filters .search { min-width: 120px; max-width: 180px; padding: 5px 10px; }
.topbar .filters select { padding: 5px 8px; }
.topbar .seg a { padding: 4px 10px; font-size: 13px; }
.kpis.kpis-sm .kpi, .ktiles .kpi { padding: 8px 12px; gap: 0; }
.kpis.kpis-sm .kpi .lbl, .ktiles .kpi .lbl { font-size: 11px; }
.kpis.kpis-sm .kpi .val { font-size: 20px; }
.kpis.kpis-sm .kpi .sub, .ktiles .kpi .sub { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpis.ktiles { grid-template-columns: repeat(8, minmax(0, 1fr)); }
@media (max-width: 720px) { .kpis.ktiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ktiles .kpi .val { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ktiles .kpi .of { font-size: 13px; }
.pill.live.full { background: var(--ok-soft); color: var(--ok); }
.pill.live.full::before { background: var(--ok); }
.pill.paused { background: var(--idle-soft); color: var(--idle); letter-spacing: .04em; cursor: help; }
table.channels.admin th { white-space: nowrap; font-size: 12px; }
table.channels.admin td { padding-left: 8px; padding-right: 8px; }
table.channels.admin svg.spark { width: 48px; margin-left: 4px; }
table.channels.admin svg.meter { width: 80px; }
/* The Content tab's "What the channel has", the admin's: a slide set on one line with its
   button, then one line a kind (music, thumbnails, watermarks, titles); a phone puts the
   bar under the name. */
.stock-admin .stock-row { grid-template-columns: minmax(110px, 180px) minmax(80px, 1fr) auto auto; }
.stock-admin .stock-row form { margin: 0; }
ul.holds { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
ul.holds li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
ul.holds .k { font-weight: 600; min-width: 210px; }
ul.holds .n { color: var(--ink-2); flex: 1; min-width: 0; }
@media (max-width: 560px) {
  .stock-admin .stock-row { grid-template-columns: 1fr auto auto; gap: 6px 10px; }
  .stock-admin .stock-row svg.stack { grid-column: 1 / -1; grid-row: 2; }
  ul.holds .k { min-width: 0; flex-basis: 100%; }
}
footer.ver { max-width: 1240px; margin: 0 auto; padding: 0 16px 24px; color: var(--ink-3); font-size: 12px; text-align: right; }
/* ---- 16.5: the stream cards on a phone ------------------------------------------------- */
/* Ten cards, each a full-width empty thumbnail, made the Live streams tab 4,700 px tall at
   390 px. On a phone a card is a row: a small thumbnail beside its words. */
@media (max-width: 560px) {
  article.scard { grid-template-columns: 112px minmax(0, 1fr); }
  article.scard .thumb { margin: var(--sp-3) 0 var(--sp-3) var(--sp-3); border-radius: 6px; align-self: start; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chead .acts { width: 100%; }
}
