/* SKWAD Wall: the SKWAD design system (skwad-tokens.css), in Live mode throughout.
   Ink by default, one ember decision per view, telemetry in mono, motion that settles. */
@import url("skwad-tokens.css");

:root {
  /* Info bar under each video: name row + stats row, or the name row alone. The wall's
     layout maths reads these, so the bar is always exactly one of the two heights. */
  --bar-full: 51px;
  --bar-slim: 33px;
  /* Gutter between feeds: wide enough to tell one feed from the next. The layout maths reads it. */
  --grid-gap: 6px;
  --audio-meter-w: 44px;
  /* Live on the timelines: red, as YouTube's own bar; a shade off the alarm red. */
  --tl-live: #f2353b;
  --topbar-h: 44px; /* side sheets open below it, so their headers and Close stay visible */
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--background);
  color: var(--foreground);
  font: 500 13.5px/1.5 var(--font-sans);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--primary); color: var(--primary-foreground); }
h1, h2, h3, p { margin: 0; }
code { font-family: var(--font-mono); }

/* Voices — display for names, Manrope for UI, mono for telemetry. Never mixed. */
.telemetry {
  font: 600 10px/1.4 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.muted { color: var(--muted-foreground); }

/* Tag — 1px-radius mono micro-label for provenance and identifiers */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--secondary);
  color: var(--muted-foreground);
  font: 600 10px/1.4 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag-accent { background: var(--accent); color: var(--accent-foreground); }

/* Live badge — the only looping animation in the system */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--ember-bright);
  color: var(--live-bg);
  font: 800 10px/1.3 var(--font-display);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-live var(--pulse-duration) var(--ease-swift) infinite;
}

/* Buttons (SKWAD Button): ink is the routine action, ember (.btn-accent) the decisive one,
   roughly one per view. Press darkens; the geometry holds. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--foreground);
  color: var(--background);
  font: 700 12.5px/1 var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms var(--ease-swift), border-color 120ms var(--ease-swift), color 120ms var(--ease-swift);
}
.btn:hover { background: color-mix(in oklab, var(--primary) 92%, transparent); }
.btn:active { background: color-mix(in oklab, var(--primary) 84%, var(--background)); }
.btn-accent { background: var(--ember-bright); color: var(--live-bg); }
.btn-accent:hover, .btn-accent:active { background: var(--ember); color: var(--live-bg); }
.btn-outline { background: transparent; color: var(--foreground); box-shadow: inset 0 0 0 1px var(--input); }
.btn-outline:hover { background: var(--secondary); }
.btn-outline:active { background: var(--border); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--secondary); }
.btn-ghost:active { background: var(--border); }
.btn-destructive { background: var(--destructive); color: var(--destructive-foreground); }
.btn-destructive:hover, .btn-destructive:active { background: var(--danger-deep); }
.btn-sm { height: 28px; padding: 0 12px; font-size: 12px; gap: 6px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 11px; gap: 4px; }
.btn-icon { width: 24px; padding: 0; }
.btn svg { width: 14px; height: 14px; display: block; }

:is(.btn, .input, .switch):focus-visible {
  outline: 2px solid color-mix(in oklab, var(--ring) 70%, transparent);
  outline-offset: 1px;
}

/* Inputs */
.input {
  height: 34px;
  min-width: 0;
  padding: 4px 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--input) 30%, transparent);
  color: var(--foreground);
  font: 500 13.5px/1 var(--font-sans);
  transition: border-color 120ms var(--ease-swift);
}
.input::placeholder { color: var(--ink-4); }
.input:focus-visible { border-color: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-num { width: 76px; text-align: right; font-family: var(--font-mono); font-size: 12.5px; }
.select { border-radius: var(--radius-md); padding-right: 8px; cursor: pointer; }
.select option { background: var(--card); }

/* Switch: immediate effect with a square module track. */
.switch {
  appearance: none;
  flex: none;
  position: relative;
  width: 32px;
  height: 18px;
  margin: 0;
  border-radius: 999px;
  background: var(--input);
  cursor: pointer;
  transition: background-color 180ms var(--ease-swift);
}
.switch::after {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--foreground);
  transition: transform 180ms var(--ease-swift), background-color 180ms var(--ease-swift);
}
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(14px); background: var(--primary-foreground); }

/* Top bar — one 48px row: brand, live state, telemetry strip, actions. Adding feeds lives
   in a popover so the bar never wraps and the wall keeps its height. */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 12;
}
.brand { flex: none; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand-name {
  font: 700 18px/1 var(--font-display);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.brand-mark {
  align-self: center;
  width: 9px;
  height: 9px;
  margin-left: -4px;
  background: var(--ember-bright);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.topbar > .live-badge { flex: none; }
/* The show clock: mono figures, IST, beside the actions */
.topbar-clock { flex: none; display: inline-flex; align-items: baseline; gap: 6px; padding: 0 12px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.topbar-clock-time { font: 600 13px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--foreground); }
@media (max-width: 1499px) { .topbar-clock { display: none; } .topbar { gap: 12px; } }

.wall-tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 16px;
}
.wall-tab { display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted-foreground); font: 700 12px/1 var(--font-sans); white-space: nowrap; cursor: pointer; }
.wall-tab:hover { color: var(--foreground); }
.wall-tab[aria-selected="true"] { color: var(--foreground); border-bottom-color: var(--ember-bright); }
.wall-tab:focus-visible { outline: 2px solid var(--ring); outline-offset: -4px; }
/* One baseline for the tab's words, counts and labels, whatever their sizes */
.tab-line { display: inline-flex; align-items: baseline; gap: 8px; }
.tab-count { font: 500 11px/1 var(--font-mono); }
.tab-ccv { display: inline-flex; align-items: baseline; gap: 6px; padding-left: 8px; border-left: 1px solid var(--border); font: 500 11px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
/* Total views (ended broadcasts, or beside a live CCV): bright green, apart from the CCV */
.tab-ccv .telemetry { line-height: 1; }
.tab-ccv[data-kind="views"] #r-ccv, #r-views { color: var(--ok-on-dark); }
.tab-count[data-tone="bad"] { color: var(--danger-on-dark); }
.tab-count[data-tone="warn"] { color: var(--warn-on-dark); }
.metric {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 14px;
  border-left: 1px solid var(--border);
}
.metric:first-child { border-left: 0; padding-left: 0; }
.metric-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 600 9.5px/1.2 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.metric-label .tag { padding: 0 3px; font-size: 8.5px; line-height: 1.35; }
.metric-value {
  font: 600 14px/1.1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.metric-value small { font-size: 11px; color: var(--muted-foreground); font-weight: 500; }
.metric-value[data-tone="warn"] { color: var(--warn-on-dark); }
.metric-value[data-tone="bad"] { color: var(--danger-on-dark); }
.global-actions { flex: none; display: flex; align-items: center; gap: 12px; }
/* The actions in three groups (adding feeds · the players · settings and the menu), a hairline between */
.action-group { display: flex; align-items: center; gap: 6px; }
.action-group + .action-group { padding-left: 12px; border-left: 1px solid var(--border); }
.menu-toggle { gap: 6px; padding-right: 10px; }
.menu-toggle .btn-chevron { width: 12px; height: 12px; flex: none; }
/* Settings and Menu: a name on a wide screen, an icon (with the name as its tooltip) under 1440 px,
   where the Feeds tab also leaves Views to Wall stats so a live wall's bar stays one row. */
.btn-icon { display: none; width: 15px; height: 15px; flex: none; }
@media (max-width: 1439px) {
  .global-actions .btn-collapsible { width: 32px; padding: 0; gap: 0; }
  .global-actions .btn-collapsible .btn-label, .global-actions .btn-collapsible .btn-chevron { display: none; }
  .global-actions .btn-collapsible .btn-icon { display: block; }
  #r-views-wrap { display: none !important; }
}
/* The Menu: the other pages, and Clear wall apart from them, under its button at the right edge */
.popover.wall-menu { right: 16px; width: min(300px, calc(100vw - 32px)); padding: 6px; display: grid; gap: 2px; }
.wall-menu-item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-md); background: none; color: var(--foreground); text-align: left; text-decoration: none; font: inherit; cursor: pointer; }
.wall-menu-item:hover, .wall-menu-item:focus-visible { background: var(--secondary); outline: none; }
.wall-menu-item:focus-visible { box-shadow: inset 0 0 0 1px var(--ring); }
.wall-menu-item:disabled { opacity: .45; cursor: default; background: none; }
.wall-menu-label { font: 600 13px/1.3 var(--font-sans); }
.wall-menu-hint { color: var(--muted-foreground); font: 500 11.5px/1.35 var(--font-sans); }
.wall-menu-item.is-danger .wall-menu-label { color: var(--danger-on-dark); }
.wall-menu-sep { height: 1px; margin: 4px 2px; background: var(--border); }
.btn-square { width: 28px; padding: 0; }

/* Add-stream popover, anchored under the actions */
.popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 12px;
  width: min(520px, calc(100vw - 24px));
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: none;
  animation: none;
}
.popover form { display: grid; gap: 12px; }
.popover .field-stack > span { font-size: 12.5px; }
.textarea {
  height: auto;
  min-height: 92px;
  padding: 8px 10px;
  resize: vertical;
  font: 500 12.5px/1.5 var(--font-mono);
}
.form-error {
  margin: 0;
  padding: 8px 10px;
  border-left: 2px solid var(--danger);
  background: color-mix(in oklab, var(--danger) 14%, var(--background));
  font-size: 12.5px;
  white-space: pre-line;
}
.popover-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Session: which event's feeds the wall is showing; earlier sessions wait in the panel */
.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  max-width: 360px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--foreground);
  box-shadow: inset 0 0 0 1px var(--input);
  font: 600 12.5px/1 var(--font-sans);
  cursor: pointer;
}
.session-chip:hover, .session-chip[aria-expanded="true"] { background: var(--secondary); }
.session-chip:focus-visible { outline: 2px solid color-mix(in oklab, var(--ring) 70%, transparent); outline-offset: 1px; }
.session-chip svg { width: 12px; height: 12px; flex: none; }
.session-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The date a wall was made: its tag, before its name; it stays when the chip narrows. */
.session-made { flex: none; white-space: nowrap; }
.session-row-name .session-made { margin-right: 2px; }
.session-when { flex: none; font: 500 11px/1 var(--font-mono); color: var(--muted-foreground); white-space: nowrap; }
@media (max-width: 1100px) { .session-chip .telemetry, .session-when { display: none; } }
/* The tabs never give way: with an admin's full set of actions it's the session chip that
   yields, its date first, then its name truncating. */
.wall-tabs { flex: none; margin-right: auto; } /* the spare width goes after the tabs: clock and actions sit at the right edge */
.session-chip { flex: 0 1 auto; min-width: 128px; max-width: 320px; overflow: hidden; } /* room for the date tag and some of the name */
@media (max-width: 1399px) { .session-when { display: none; } }
.session-panel { left: 12px; right: auto; display: grid; gap: 16px; max-height: calc(100vh - 80px); overflow-y: auto; }
.session-block { display: grid; gap: 6px; }
.session-block .hint { margin: 0; }
.session-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.session-info { display: grid; gap: 2px; min-width: 0; }
/* A session's actions (Open, New window, Archive / Reopen, Delete): one cell, wrapping as a group */
.session-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; grid-column: 2 / span 2; }
.session-row[data-current="1"] .session-row-name { color: var(--foreground); font-weight: 700; }
.session-row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-row-meta { font: 600 10px/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); }
.session-row-feeds { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-row-meta[data-tone="ok"] { color: var(--ok-on-dark); }
.session-row-meta[data-tone="warn"] { color: var(--warn-on-dark); }
.session-row-meta[data-tone="bad"] { color: var(--danger-on-dark); }
#ingest-channels { margin: 8px 0 4px; }
#ingest-channels .session-row-meta { white-space: normal; overflow-wrap: anywhere; }
/* Dashboard (dashboard.html): sessions live and past, what each was, and what's scheduled next */
body.dashboard { display: block; height: auto; min-height: 100dvh; overflow: auto; background: var(--background); }
.dash-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 32px; background: var(--card); border-bottom: 1px solid var(--border); }
.dash-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--foreground); text-decoration: none; font: 700 15px/1 var(--font-sans); }
.dash-brand img { display: block; height: 24px; width: auto; }
/* The brand at full size: the wordmark leads, the product line beside it in telemetry, never underlined */
.dash-brand, .dash-brand:hover { gap: 14px; text-decoration: none; }
.dash-brand .telemetry { padding-left: 14px; border-left: 1px solid var(--border); font-size: 12px; line-height: 24px; color: var(--muted-foreground); }
.dash-top { padding-top: 14px; padding-bottom: 14px; }
.dash-nav { display: flex; align-items: center; gap: 8px; }
.dash-nav a.btn { text-decoration: none; }
/* The Dashboard hero: SKWAD's crowd plate (public/art, cream on ink, the brand's LIVE treatment)
   drawn as a luminance mask in live ink, so its ink ground drops out onto the card exactly,
   dissolving to clear toward the copy; one display line on top in Anybody; one data moment. */
.dash-hero { position: relative; overflow: hidden; display: flex; align-items: stretch; min-height: 320px; margin-bottom: 32px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.dash-hero-art { position: absolute; inset: 0 0 -10px auto; /* the plate's last rows are a cream rule: clipped */ width: min(58%, 760px); background: var(--live-ink); opacity: .92; pointer-events: none;
  mask: url('/art/halftone-crowd.jpg') center bottom / cover no-repeat luminance, linear-gradient(to right, transparent 0%, #000 42%) alpha;
  mask-composite: intersect; }
.dash-hero-copy { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; max-width: min(560px, 60%); padding: 36px 40px; }
.dash-hero-copy h1 { font: 800 clamp(30px, 3.6vw, 48px)/.95 var(--font-display); letter-spacing: .03em; text-transform: uppercase; color: var(--foreground); }
.dash-hero-sub { max-width: 44ch; color: var(--muted-foreground); font-size: 13.5px; }
.dash-hero-stats { display: flex; flex-wrap: wrap; gap: 12px 36px; margin: 10px 0 0; padding-top: 18px; border-top: 1px solid var(--border); }
.dash-hero-stats > div { display: flex; flex-direction: column; gap: 6px; }
.dash-hero-stats dt, .dash-hero-stats dd { margin: 0; }
.dash-hero-figure { font: 600 28px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--foreground); }
/* Under a banner figure: what it's made of (live now · ended; when and which wall). */
.dash-hero-note { font: 500 12px/1.3 var(--font-sans); color: var(--muted-foreground); white-space: nowrap; }
/* One session: the assembly plate behind its header, from the right edge */
.dash-sec-head.dash-session-head { position: relative; overflow: hidden; min-height: 170px; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 14px; margin-bottom: 16px; padding: 24px 28px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.dash-session-head::before { content: ""; position: absolute; inset: 0 0 0 auto; width: min(60%, 640px); background: var(--live-ink); opacity: .85; pointer-events: none;
  mask: url('/art/halftone-assembly-live.jpg') center 38% / cover no-repeat luminance, linear-gradient(to right, transparent 0%, #000 38%) alpha;
  mask-composite: intersect; }
.dash-session-head > * { position: relative; z-index: 1; }
@media (max-width: 760px) {
  .dash-hero { min-height: 0; }
  .dash-hero-art { width: 100%; opacity: .28; }
  .dash-hero-copy { max-width: none; padding: 24px 20px; }
  .dash-session-head::before { width: 100%; opacity: .22; }
}
/* The profile beside Admin center and Wall: initials, name, and the role in telemetry */
.dash-profile { display: inline-flex; align-items: center; gap: 8px; margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--border); }
.dash-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--secondary); color: var(--foreground); font: 700 11px/1 var(--font-sans); }
.dash-profile-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.1; }
.dash-profile-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 12.5px/1.2 var(--font-sans); }
.dash { max-width: 1280px; margin: 0 auto; padding: 24px 32px 48px; }
.dash-sec { margin: 0 0 28px; }
.dash-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.dash-sec-head h2 { margin: 0; font: 600 17px/1.3 var(--font-sans); }
.dash-session-head h1 { margin: 4px 0 0; font: 800 clamp(22px, 2.4vw, 32px)/1 var(--font-display); letter-spacing: .03em; text-transform: uppercase; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
/* Live walls with nothing on them: a line each under Live now, not a card. */
.dash-empty-walls { display: grid; gap: 4px; margin-top: 10px; }
.dash-empty-wall { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; font: 500 12.5px/1.4 var(--font-sans); color: var(--muted-foreground); }
/* Past sessions, a heading per date. */
.dash-past { display: grid; gap: 20px; }
.dash-past-day { display: grid; gap: 10px; }
.dash-past-date { display: flex; align-items: baseline; gap: 10px; margin: 0; padding-bottom: 6px; border-bottom: 1px solid var(--border); font: 600 14px/1.3 var(--font-sans); }
.dash-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px 16px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.dash-card.is-live { border-color: color-mix(in oklab, var(--ember-bright) 45%, var(--border)); }
/* A live session whose streams have all ended: greyed out, still there to open or archive. */
.dash-card.is-finished { filter: grayscale(1); opacity: .55; transition: opacity var(--duration-fast, .15s) var(--ease-swift, ease); }
.dash-card.is-finished:hover, .dash-card.is-finished:focus-within { opacity: .85; }
/* A live session with nothing on air yet (empty, or only scheduled streams): quieter than live. */
.dash-card.is-idle { opacity: .8; }
.finished-badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: var(--radius-xs); background: var(--muted); color: var(--muted-foreground); font: 800 10px/1.3 var(--font-display); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* A wall's date leads its name: the date it was made, as a tag. */
.dash-card-title { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.dash-made { flex: none; }
.dash-card-name { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 14px/1.3 var(--font-sans); }
.dash-card-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px 10px; }
.dash-card-grid dd { font-size: 15px; }
.dash-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.dash-card-actions a.btn { text-decoration: none; }
.dash-upcoming .dash-countdown { display: flex; flex-direction: column; gap: 2px; margin: 2px 0; }
.dash-countdown-figure { font: 500 clamp(20px, 2vw, 26px)/1.2 var(--font-figure); font-variant-numeric: tabular-nums; color: var(--foreground); }
.dash-countdown-figure[data-tone="warn"] { color: var(--warn-on-dark); }
.dash-countdown-figure[data-tone="ok"] { color: var(--ok-on-dark); }
.dash-new { display: flex; gap: 8px; max-width: 520px; }
.dash-new .input { flex: 1; min-width: 0; height: 32px; }
#dash-live-sec .dash-new { margin-bottom: 12px; }
/* The jumps under the banner: one row of quiet links to each section. */
.dash-jump { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: -16px 0 24px; }
.dash-jump a { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted-foreground); font: 600 12px/1.4 var(--font-sans); text-decoration: none; }
.dash-jump a:hover, .dash-jump a:focus-visible { color: var(--foreground); border-color: var(--ring); }
.dash-sec { scroll-margin-top: 16px; }
.dash-plus { display: inline-block; margin-right: 4px; font: 700 15px/1 var(--font-sans); }
.dash-back { margin: 0 0 12px; }
.dash-back a { text-decoration: none; }
.dash-metrics { margin-bottom: 20px; }
.dash-feed { margin: 0 0 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.dash-feed-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.dash-feed-head h3 { margin: 0; font: 600 14px/1.3 var(--font-sans); }
.dash-feed-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
@media (min-width: 900px) { .dash-feed-charts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.dashboard .spark .mark { fill: var(--chart-1, var(--foreground)); stroke: var(--card); stroke-width: 1.5; }
.dashboard .spark.spark-band .axis-y { visibility: hidden; }
/* A session's days (one chip each), the expected go-live and flags on a countdown card, and
   the scheduling table: one row per channel, figures in the mono figure font. */
.dash-days { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.dash-days .dash-day { text-decoration: none; }
.dash-days .dash-day.is-current { color: var(--foreground); border-color: var(--foreground); }
.dash-expected .tag { margin: 0 2px; }
.dash-flag[data-tone="warn"] { color: var(--warn-on-dark); }
.dash-flag[data-tone="bad"] { color: var(--danger-on-dark); }
.dash-sched { overflow-x: auto; }
.dash-sched-table { border-collapse: collapse; width: 100%; font: 500 13px/1.4 var(--font-sans); }
.dash-sched-table th { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dash-sched-table td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--border); font-family: var(--font-figure); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-sched-table td:first-child { font-family: var(--font-sans); font-weight: 600; white-space: normal; min-width: 140px; }
.dash-sched-table td[data-tone="ok"] { color: var(--ok-on-dark); }
.dash-sched-table td[data-tone="warn"] { color: var(--warn-on-dark); }
.dash-sched-table td[data-tone="bad"] { color: var(--danger-on-dark); }
/* Scheduled next: Remove sits at the card's far end; what was removed, to put back */
.dash-upcoming-remove { margin-left: auto; }
.dash-upcoming-removed { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; font: 500 12px/1.4 var(--font-sans); color: var(--muted-foreground); }
.dash-upcoming-removed-item { display: inline-flex; align-items: center; gap: 6px; }
/* By date: a row per day that opens to the day's streams */
.bydate-row { cursor: pointer; transition: background var(--dur-fast) var(--ease-swift); }
.bydate-row:hover, .bydate-row.is-open { background: var(--card); }
.bydate-row:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.bydate-row td:first-child { padding-left: 8px; }
.bydate-table td.bydate-text { font-family: var(--font-sans); white-space: normal; min-width: 160px; max-width: 360px; }
.bydate-kind { margin-left: 4px; color: var(--ink-4); font: 600 9px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.bydate-detail > td { padding: 4px 0 14px 22px; background: var(--card); }
.bydate-streams { border-collapse: collapse; width: 100%; font-size: 12px; }
.bydate-streams th { padding: 4px 10px 4px 0; }
.bydate-streams td { padding: 5px 10px 5px 0; }
.bydate-streams td:first-child { font-weight: 500; }
.bydate-walls td { color: var(--muted-foreground); }
.bydate-foot { max-width: 820px; }
@media (max-width: 600px) { .dash, .dash-top { padding-left: 16px; padding-right: 16px; } }

/* Access → People in SKWAD OS (IAM): the organisation's people, each with a wall role */
.iam-block { margin: 14px 0 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.iam-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#iam-list .session-row-meta { white-space: normal; overflow-wrap: anywhere; }

/* Add stream preview: what was read out of the pasted text, one row per feed */
#add-panel { max-height: calc(100dvh - 100px); overflow-y: auto; }
.channel-lookup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.channel-lookup-head .hint { flex: 1 1 200px; margin: 0; }
.channel-results { display: grid; gap: 8px; max-height: 220px; overflow-y: auto; }
.channel-result { padding: 8px; border: 1px solid var(--border); border-radius: 3px; }
.channel-result p { margin: 0 0 6px; overflow-wrap: anywhere; }
.channel-candidate { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; }
.channel-candidate a { min-width: 0; overflow-wrap: anywhere; }
.channel-candidate button { flex: none; }
.add-preview { display: grid; gap: 6px; }
.add-preview .hint { margin: 0; }
.add-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(300px, 40vh);
  overflow-y: auto;
  border-top: 1px solid var(--border);
}
.add-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 10px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--border);
}
.add-row input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--foreground); cursor: pointer; }
.add-row input[type="checkbox"]:disabled { cursor: default; }
.add-label { height: 28px; font-size: 12.5px; }
.add-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); font-size: 12.5px; }
.add-id { font: 500 11px/1.3 var(--font-mono); color: var(--muted-foreground); white-space: nowrap; }
.add-why {
  grid-column: 2 / -1;
  font: 600 10px/1.4 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.add-row[data-state="bad"] .add-why { color: var(--danger-on-dark); }

/* Upcoming: live and scheduled streams from watched channels. Purple while one waits for an answer. */
.upcoming-toggle { gap: 6px; }
.upcoming-dot { display: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ember-bright); flex: none; }
.upcoming-toggle[data-attention="1"] { box-shadow: inset 0 0 0 1px var(--ember-bright); }
.upcoming-toggle[data-attention="1"] .upcoming-dot { display: inline-block; }
.upcoming-panel { display: grid; gap: 12px; max-height: calc(100vh - 80px); overflow-y: auto; }
.offer-row .session-row-name, #channel-list .session-row-name { color: var(--foreground); text-decoration: none; }
.offer-row .session-row-name:hover, #channel-list .session-row-name:hover { text-decoration: underline; text-underline-offset: 2px; }
/* A watched channel gone live: cards in the wall's bottom-left corner, above the transport and
   clear of the side sheets, each until it's answered */
.ask-live { position: fixed; left: 16px; bottom: 56px; z-index: 13; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.ask-card { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid var(--border-strong); border-left: 2px solid var(--ember-bright); border-radius: var(--radius-lg); background: var(--card); }
.ask-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ask-channel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); }
.ask-title { font: 700 13.5px/1.35 var(--font-sans); color: var(--foreground); text-decoration: none; overflow-wrap: anywhere; }
.ask-title:hover { text-decoration: underline; text-underline-offset: 2px; }
.ask-meta { margin: 0; color: var(--muted-foreground); font-size: 12px; line-height: 1.45; }
.ask-meta strong { color: var(--foreground); font-weight: 600; }
.ask-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.ask-more { justify-self: start; }
.ask-slot { display: grid; gap: 8px; }
.ask-slot:empty { display: none; }
/* A feed's screenshot folder to name: one row per feed, the title then its folder name */
.ask-rows { display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; }
.ask-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.ask-row > .input { min-width: 0; }
.ask-row:has(> .input) { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.ask-row-feed { grid-column: 1 / -1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); font-size: 12px; }
.ask-row .input[aria-invalid="true"] { box-shadow: inset 0 0 0 1px var(--danger); }
#channel-list .session-row-meta { white-space: normal; overflow-wrap: anywhere; }
#channel-form { width: 100%; justify-items: stretch; }
.perf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }

/* Keep the wall navigation reachable when the action bar needs a second row. */
@media (max-width: 1500px) { .brand-sub { display: none; } }
@media (max-width: 1100px) {
  .topbar { height: auto; min-height: var(--topbar-h); flex: none; flex-wrap: wrap; gap: 10px 14px; padding: 8px 12px; }
  .wall-tabs { min-width: max-content; min-height: 32px; }
  .global-actions { flex: 1 0 100%; flex-wrap: wrap; }
  .session-chip { max-width: 180px; }
}

/* Alerts */
.notice {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid;
  font-size: 12.5px;
}
.notice-danger { border-left-color: var(--danger); background: color-mix(in oklab, var(--danger) 14%, var(--background)); }
.notice-warn { border-left-color: var(--warn); background: color-mix(in oklab, var(--warn) 12%, var(--background)); }
.session-notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.session-notice[hidden] { display: none; }
.account-info { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.account-info[hidden] { display: none; }
.audit-list .session-row { padding: 6px 0; }
.audit-list .session-row-name { font-size: 12px; }

/* Wall */
.wall { position: relative; flex: 1; min-height: 0; }
/* Scrolling layouts grow with the feed rows; Fit all keeps its viewport canvas. */
html { scrollbar-gutter: stable; }
body.document-wall { height: auto; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
.document-wall .topbar { position: sticky; top: 0; }
.document-wall .wall { flex: none; height: max(var(--wall-viewport-h, 0px), var(--wall-content-h, 0px)); }
.document-wall .transport { position: sticky; bottom: 0; z-index: 12; }
.document-wall .grid { overflow: visible; scrollbar-gutter: auto; }
body.document-wall.wall-stats-view { height: 100dvh; overflow: hidden; }
.document-wall.wall-stats-view .wall-stats-panel, .document-wall.wall-stats-view .feed-health-panel { position: fixed; top: var(--sheet-top, var(--topbar-h)); bottom: 0; z-index: 8; }
.feeds-panel { position: absolute; inset: 0; }
/* Keep player dimensions stable while viewing stats: returning to Feeds must not
   resize, remount, or reload the players. */
.feeds-panel.is-inactive { visibility: hidden; pointer-events: none; }
.wall-stats-panel { position: absolute; inset: 0; overflow-y: auto; padding: 32px; }
.wall-stats-heading { margin-bottom: 24px; }
.wall-stats-heading h1 { font: 600 22px/1.3 var(--font-sans); margin-bottom: 6px; }
.wall-stats-heading p { color: var(--muted-foreground); }
.wall-alerts { max-width: 1280px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.wall-alerts h2 { font: 600 18px/1.3 var(--font-sans); }
.alert-subtitle { margin: 16px 0 8px; }
.wall-alerts .active-alerts { margin-bottom: 20px; }
.active-alerts:empty { display: none; }
.wall-message-log { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.wall-alerts .log li { display: grid; grid-template-columns: 100px minmax(100px, 180px) minmax(0, 1fr); gap: 8px; padding: 10px 0; }
.wall-alerts .log .who, .wall-alerts .log .what { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .wall-alerts { padding: 16px; }
  .wall-alerts .log li { grid-template-columns: 100px minmax(0, 1fr); }
  .wall-alerts .log .what { grid-column: 1 / -1; }
}
.wall-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 16px; max-width: 1280px; margin-bottom: 24px; }
.wall-stats-grid .metric { min-width: 0; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); gap: 14px; }
.wall-stats-grid .metric-label { flex-wrap: wrap; white-space: normal; font-size: 10px; }
.wall-stats-grid .metric-label .tag { padding: 0; background: transparent; color: var(--ink-4); font-size: 9px; }
.wall-stats-grid .metric-value { font: 500 clamp(21px, 2vw, 28px)/1.2 var(--font-mono); white-space: normal; overflow-wrap: anywhere; }
.metric-description { max-width: 36ch; color: var(--muted-foreground); font-size: 12.5px; line-height: 1.5; }
/* The combined Peak CCV: its main figure first; the Sum of Stream Peaks smaller, reference only */
.wall-stats-grid.peak-grid { margin-bottom: 8px; }
.wall-stats-grid .metric-minor .metric-value { font-size: clamp(16px, 1.4vw, 20px); color: var(--muted-foreground); }
.wall-stats-grid .metric-value[data-tone="warn"] { color: var(--warn-on-dark); }
.peak-note { max-width: 1280px; margin: 0 0 24px; }
@media (max-width: 600px) { .wall-stats-panel { padding: 20px 16px; } }

/* Feed health tab: one card per feed, in a grid. Frame timing, the health grid and the
   telemetry graphs as in the feed's Stats sheet, smaller, so every feed is seen at once. */
.feed-health-panel { position: absolute; inset: 0; overflow-y: auto; padding: 24px 32px 32px; }
.fh-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.fh-heading p { max-width: 70ch; }
.fh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 16px; }
.fh-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px 14px 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.fh-card[data-tone="bad"] { border-color: var(--danger); }
.fh-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fh-top .status { flex: none; }
.fh-label { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 13.5px/1.3 var(--font-sans); }
.fh-push { margin: -4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fh-push:empty { display: none; }
/* Verdicts: the state words in the display voice */
.fh-verdicts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.fh-verdict { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fh-verdict .m-k { color: var(--muted-foreground); font: 600 9.5px/1.5 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fh-verdict b { color: var(--foreground); font: 700 15px/1.2 var(--font-display); letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fh-verdict b[data-tone="ok"] { color: var(--ok-on-dark); }
.fh-verdict b[data-tone="warn"] { color: var(--warn-on-dark); }
.fh-verdict b[data-tone="bad"] { color: var(--danger-on-dark); }
.fh-card .pipe { gap: 3px; margin: 0; }
.fh-card .pipe-bar { height: 14px; }
.fh-card .pipe-seg { font-size: 9px; line-height: 14px; }
.fh-card .pipe-stamps { font-size: 9.5px; }
.fh-card .hx td { font-size: 13px; }
.fh-card .hx td[data-kind="word"] { font-size: 11.5px; }
.fh-sparks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin: 12px 0 0; }
.fh-sparks .spark { min-width: 0; }
.fh-sparks .spark figcaption { gap: 6px; margin-bottom: 2px; font-size: 9.5px; }
.fh-sparks .spark figcaption > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fh-sparks .spark figcaption > span:last-child { flex: none; white-space: nowrap; }
.fh-sparks .spark svg { height: var(--chart-plot-h); }
/* Feed health uses the same chart scale, line weight and time axes as the Stats sheet. */
.fh-sparks .spark .line { stroke-width: 2; }
.fh-sparks .spark figcaption > span:last-child { font-size: 14px; }
.fh-sparks .spark.spark-band { grid-column: 1 / -1; }
.fh-sparks .spark.spark-band svg { height: 10px; }
.fh-note { margin: 0; }
.fh-hint { max-width: 90ch; margin-top: 16px; }
@media (max-width: 600px) { .feed-health-panel { padding: 20px 16px; } }
.grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr));
  gap: var(--grid-gap);
  background: var(--background);
}

/* Scroll layout: fixed columns, every tile one legible size (height set from the layout
   maths), and the wall scrolls for the feeds below. */
.grid.scroll {
  grid-template-rows: none;
  grid-auto-rows: var(--tile-h);
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--input) transparent;
  scrollbar-gutter: stable;
}
/* Preset layout: its boxes fill the screen on a 12 × 12 grid (app.js places each feed), and it
   repeats a screen-high page at a time for every feed; scrolling settles on a page. */
.grid.preset {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(var(--units-total, 12), var(--unit-h));
  align-content: start;
  scroll-snap-type: y proximity;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--input) transparent;
  scrollbar-gutter: stable;
}
.grid.preset > .tile.page-start { scroll-snap-align: start; }
.document-wall .grid.scroll, .document-wall .grid.preset { overflow: visible; }
.grid.scroll .label, .grid.preset .label { font-size: 15px; }
/* Dragging a feed: the lifted box rides above the others with a shadow and a ring, while the
   others slide out of its way (app.js). The players mustn't swallow the pointer meanwhile. */
.tile .info { cursor: grab; user-select: none; }
.tile.lifted { z-index: 6; box-shadow: 0 18px 44px rgb(0 0 0 / .6); }
.tile.lifted::after { box-shadow: inset 0 0 0 2px var(--ring); }
.dragging-feed, .dragging-feed * { cursor: grabbing !important; user-select: none; }
.dragging-feed iframe { pointer-events: none; }
/* Page snapping would undo each step of scrolling at the wall's edge mid-drag. */
.dragging-feed .grid { scroll-snap-type: none; }
.grid.scroll .info-head .tag { font-size: 10px; }

/* Settings → Layout preview: the wall in miniature, to scale */
.layout-preview {
  position: relative;
  width: 100%;
  margin: 6px 0 4px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.layout-preview.scrolls::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--fold);
  border-top: 1px dashed var(--muted-foreground);
}
.lp-tile { position: absolute; display: flex; align-items: flex-start; background: var(--card); box-shadow: inset 0 0 0 1px var(--border); }
.lp-tile.below { opacity: .35; }
.lp-video { flex: none; background: var(--secondary); }
.lp-card { flex: none; border-left: 1px solid var(--border); background: color-mix(in oklab, var(--ok) 22%, var(--card)); }
.layout-summary { color: var(--foreground); }
.range { width: 120px; accent-color: var(--foreground); }
#card-pct-out { min-width: 4ch; text-align: right; }

/* Empty — the calm state, halftone ground on one edge */
.empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  background: var(--background);
}
.empty-body { position: relative; z-index: 1; max-width: 460px; display: grid; gap: 10px; text-align: center; }
.empty h1 { font: 600 18px/1.3 var(--font-sans); }
.empty-body > p:not(.telemetry) { color: var(--muted-foreground); }
.empty-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 45%; }

.halftone-fade-b { display: none; }

/* Feed tiles — the video stays clean; identity and telemetry live in a solid bar beneath it */
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--card);
  overflow: hidden;
  /* A telemetry update in one tile never re-lays-out or repaints its 29 neighbours. */
  contain: layout paint style;
}
.screen {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  background: #000;
  container: screen / size;
}
/* The video sits in an exact 16:9 box (or the full screen when the tile is taller than 16:9).
   Centred normally; pushed left when the side panel takes the spare width. */
.stage {
  position: relative;
  flex: none;
  width: min(100cqw, calc(100cqh * 16 / 9 + var(--audio-meter-w)));
  height: 100%;
  margin: 0 auto;
}
.tile.side-on .stage { margin: 0; }
.frame, .shield {
  position: absolute;
  inset: 0;
  left: var(--audio-meter-w);
  overflow: hidden;
}
.audio-meter { position: absolute; inset: 0 auto 0 0; width: var(--audio-meter-w); display: flex; flex-direction: column; gap: 4px; padding: 8px 4px; border-right: 1px solid var(--border); background: var(--card); color: var(--muted-foreground); overflow: hidden; }
.audio-meter-heading { font: 600 9px/1.2 var(--font-sans); text-align: center; }
.audio-meter-bars { display: flex; flex: 1; min-height: 16px; gap: 3px; }
.audio-meter-scale { display: flex; flex-direction: column; justify-content: space-between; width: 16px; flex: none; font: 500 8px/1 var(--font-figure); font-variant-numeric: tabular-nums; }
.audio-channel { position: relative; flex: 1; overflow: hidden; background: var(--secondary); border-radius: 1px; }
/* Levels move ten times a second on every feed, so the bars move by transform alone: no
   layout and no repaint, only the compositor. The gradient stays put and an unlit cover
   shrinks off it from the top; the peak line is a full-height layer whose top edge slides. */
.audio-fill { position: absolute; inset: 0; background: linear-gradient(to top, var(--ok-on-dark) 0% 70%, var(--warn-on-dark) 70% 90%, var(--danger-on-dark) 90% 100%); }
.audio-fill::after { content: ''; position: absolute; inset: 0; background: var(--secondary); transform-origin: top; transform: scaleY(calc(1 - var(--audio-level, 0))); will-change: transform; }
.audio-peak { position: absolute; inset: 0; border-top: 2px solid var(--foreground); transform: translateY(calc((1 - var(--audio-peak, 0)) * (100% - 2px))); will-change: transform; }
.audio-meter:not([data-state="ok"]) .audio-peak { display: none; }
.audio-meter-channels { padding-left: 16px; font: 500 8px/1 var(--font-figure); text-align: center; }
.audio-meter-state { font: 500 8px/1.2 var(--font-figure); font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.lp-audio { flex: none; background: var(--border); }
.frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  transform-origin: 0 0;
}
.shield { cursor: pointer; }
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--border); /* each feed's edge; the audio and alarm frames replace it */
  transition: box-shadow 180ms var(--ease-swift);
}
/* The audible feed carries a neutral frame. */
.tile.solo::after { box-shadow: inset 0 0 0 2px var(--foreground); }
/* Buffering or failed: a red frame, readable from across the room. Outranks the audio frame. */
.tile.alarm::after { box-shadow: inset 0 0 0 2px var(--danger); }

.tile-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 180ms var(--ease-swift);
}
.tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; }
.btn-overlay {
  background: rgba(19, 18, 16, .9);
  color: var(--foreground);
  box-shadow: inset 0 0 0 1px var(--border);
}
.btn-overlay:hover { background: var(--secondary); }
.btn-overlay:active { background: var(--border); }
/* On: the action purple. */
.btn-overlay[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); box-shadow: none; }

/* Side card: fills the spare width beside the video. Built from IXG metric roles: figure
   label, mono value (weight 500, at the system's lg / md / sm sizes), provenance. The state word
   is the card's hero moment, in the display voice. Sizes scale with the card; a card too short
   for every block hides whole blocks, lowest data-drop first. */
.side {
  --u: min(1cqi, .6cqh);
  display: none;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: var(--card);
  border-left: 1px solid var(--border);
  overflow: hidden;
  container: side / size;
}
.tile.side-on .side { display: flex; }
.tile.side-on .info-head .status { display: none; }

/* Status tab: state and how long it has held, then live health */
.side-status {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px 9px 8px;
  border-left: 3px solid var(--ink-4);
  border-radius: var(--radius-sm);
  background: var(--secondary);
  color: var(--muted-foreground);
}
.side-status-row { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.side-state {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font: 700 clamp(14px, calc(var(--u) * 10), 26px)/1.1 var(--font-display);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.side-status .status-dot { flex: none; width: clamp(7px, calc(var(--u) * 3.5), 11px); height: clamp(7px, calc(var(--u) * 3.5), 11px); }
.side-for {
  margin-left: auto;
  padding-left: 4px;
  font: 600 clamp(10px, calc(var(--u) * 5), 13px)/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}
@container side (max-width: 150px) { .side-for { display: none; } }
.side-status[data-tone="ok"] { border-left-color: var(--ok-on-dark); background: color-mix(in oklab, var(--ok) 22%, var(--card)); color: var(--foreground); }
.side-status[data-tone="ok"] .status-dot { background: var(--ok-on-dark); }
.side-status[data-tone="warn"] { border-left-color: var(--warn-on-dark); background: color-mix(in oklab, var(--warn) 28%, var(--card)); color: var(--foreground); }
.side-status[data-tone="warn"] .status-dot { background: var(--warn-on-dark); }
/* Buffering and errors on a live broadcast are red flags, never amber */
.side-status[data-tone="bad"] { border-left-color: var(--danger); background: color-mix(in oklab, var(--danger) 34%, var(--card)); color: #fff; }
.side-status[data-tone="bad"] .status-dot { background: var(--danger-on-dark); }
/* What the state means (the sheet's Status row), in the tab's ink. Always two lines tall, so the
   card's height never changes with the message. */
.side-detail {
  flex: none;
  display: -webkit-box;
  height: 2.8em;
  margin: 0;
  color: inherit;
  font: 500 clamp(11px, calc(var(--u) * 5.5), 13px)/1.4 var(--font-sans);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* Sections: a Manrope title, provenance on the right */
.side-sec { flex: none; display: flex; flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px solid var(--border); }
.side-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.side-title { color: var(--foreground); font: 600 clamp(11.5px, calc(var(--u) * 5.5), 13px)/1.3 var(--font-sans); }
/* Provenance tag: the number's origin travels with it */
.prov { color: var(--ink-4); font: 600 9px/1.5 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.prov:empty { display: none; }

/* Metric blocks: label over value */
.m-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; margin: 0; }
@container side (min-width: 200px) { .m-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Feed health: the Stats sheet's rows, one line each: the term on the left (with where it's
   measured, when the card is wide enough), the figure on the right. */
.m-grid.m-rows { grid-template-columns: minmax(0, 1fr); gap: 0; }
.m-rows .m { flex-direction: row; align-items: baseline; gap: 8px; padding: 2px 0; border-bottom: 1px solid var(--border); }
.m-rows .m:last-child { border-bottom: 0; }
.m-rows dt { flex: 1; min-width: 0; }
.m-rows dd { flex: none; max-width: 75%; text-align: right; font-size: clamp(12px, min(calc(var(--u) * 7.5), 7cqi), 18px); }
.m-q { color: var(--ink-4); font-weight: 500; }
.m-q::before { content: " · "; white-space: pre; }
@container side (max-width: 239px) { .m-q:not(.m-q-keep) { display: none; } }
/* Feed health grid: delay and buffer (rows) at each step a frame passes (columns: encoder box,
   YouTube, this PC). Figures right-aligned under their step, each one line. */
.hx { width: 100%; table-layout: fixed; border-collapse: collapse; }
.hx .hx-kcol { width: 50px; }
.hx th, .hx td { padding: 2px 0 2px 6px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx th[scope="row"], .hx thead th:first-child { padding-left: 0; text-align: left; }
.hx thead th { color: var(--muted-foreground); font: 600 10.5px/1.4 var(--font-sans); }
.hx tbody th { color: var(--muted-foreground); font: 600 10px/1.5 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; }
.hx td { color: var(--foreground); font: 500 clamp(11px, min(calc(var(--u) * 6.5), 5.6cqi), 17px)/1.25 var(--font-figure); font-variant-numeric: tabular-nums; }
/* A reason or a mode in place of a figure: smaller and in the UI voice */
.hx td[data-kind="word"] { color: var(--muted-foreground); font: 600 clamp(10.5px, calc(var(--u) * 5.5), 13px)/1.25 var(--font-sans); }
.hx td[data-tone="ok"] { color: var(--ok-on-dark); }
.hx td[data-tone="warn"] { color: var(--warn-on-dark); }
.hx td[data-tone="bad"] { color: var(--danger-on-dark); }
/* Too narrow for three columns: one labelled line per figure instead */
@container side (max-width: 189px) {
  .hx, .hx tbody, .hx tr { display: block; }
  .hx thead, .hx tbody th { display: none; }
  .hx td { display: flex; align-items: baseline; gap: 6px; padding-left: 0; }
  .hx td::before {
    content: attr(data-label);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted-foreground);
    font: 600 10px/1.5 var(--font-sans);
    letter-spacing: .1em;
    text-align: left;
    text-transform: uppercase;
  }
}
.m { display: flex; flex-direction: column; min-width: 0; }
.m-wide { grid-column: span 2; }
.m-hero, .m-full { grid-column: 1 / -1; }
.m dt {
  color: var(--muted-foreground);
  font: 600 10px/1.5 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m dd {
  min-width: 0;
  margin: 0;
  color: var(--foreground);
  font: 500 clamp(11px, min(calc(var(--u) * 6.5), 6.2cqi), 16px)/1.25 var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m dd.m-md { font-size: clamp(12px, min(calc(var(--u) * 9), 6.3cqi), 21px); } /* fits h:mm:ss inside the status tab */
.m dd.m-lg { display: flex; align-items: baseline; gap: 8px; font-size: clamp(20px, calc(var(--u) * 14), 28px); line-height: 1.2; }
.m dd.m-lg > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Reason in place of a number (Ended, Hidden): smaller and muted, never mistaken for a count */
.m dd [data-kind="word"], .m dd[data-kind="word"] { color: var(--muted-foreground); font-size: clamp(12px, calc(var(--u) * 6.5), 16px); }
/* Delta: the sign colours itself, up is ok and down is danger */
.m-delta { flex: none; font: 600 11px/1 var(--font-mono); }
.m-delta[data-tone="ok"] { color: var(--ok-on-dark); }
.m-delta[data-tone="bad"] { color: var(--danger-on-dark); }
.m dd[data-tone="ok"] { color: var(--ok-on-dark); }
.m dd[data-tone="warn"] { color: var(--warn-on-dark); }
.m dd[data-tone="bad"] { color: var(--danger-on-dark); }
.m-hero .prov { margin-top: 1px; }
/* The side card's YouTube block: CCV and Stream Peak side by side on one line, their figures 30 %
   under the metric's lg size (28 → 19.6 px), so a short card keeps Feed health's rows too. CCV
   takes the wider column, so its trend fits beside a six-figure count; a trend that still
   doesn't fit goes under it. The provenance stays on one line. */
.side-yt .m-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.side-yt .m-hero { grid-column: auto; }
.side-yt .m dd.m-lg, .side-yt .m dd[data-yt="peak"] { font-size: clamp(14px, calc(var(--u) * 9.8), 19.6px); line-height: 1.2; }
.side-yt .m dd.m-lg { flex-wrap: wrap; column-gap: 6px; }
.side-yt .m-hero .prov { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A live figure (setFigure): YouTube's own motion, each digit a column rolling to its new
   value in ~500 ms, never overshooting (the system's Metric rule). The provenance of a count
   read live off the feed's page carries the live dot. */
[data-odo] { --odo-h: 1.2em; display: inline-flex; align-items: flex-end; line-height: var(--odo-h); white-space: nowrap; }
/* A whole number of pixels per digit cell: the strip settles on the pixel grid, level with
   the commas and the K beside it, rather than a fraction off at the card's fluid sizes. */
@supports (height: round(1em, 1px)) { [data-odo] { --odo-h: round(nearest, 1.2em, 1px); } }
.odo-d, .odo-c { display: inline-block; height: var(--odo-h); line-height: var(--odo-h); }
.odo-d { position: relative; overflow: hidden; }
.odo-strip { display: flex; flex-direction: column; transform: translateY(calc(var(--d, 0) * var(--odo-h) * -1)); transition: transform 500ms cubic-bezier(.2, .7, .2, 1); will-change: transform; }
.odo-strip > span { display: block; height: var(--odo-h); line-height: var(--odo-h); }
@media (prefers-reduced-motion: reduce) { .odo-strip { transition: none; } }
.prov.prov-live::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; vertical-align: 1px; background: var(--ember-bright); animation: pulse-live var(--pulse-duration) var(--ease-swift) infinite; animation: pulse-live 2.4s ease-in-out infinite; }
/* A metric with nothing behind it yet (Peak before any viewer count) gives up its space */
.m[data-empty] { display: none; }

/* Always two lines tall, so the card's height never changes with the message */
.side-note {
  flex: none;
  height: 2.8em;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted-foreground);
  font: 500 11.5px/1.4 var(--font-sans);
  text-align: left;
  overflow: hidden;
}
.side-note[data-link] { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.side-note[data-link]:hover { color: var(--foreground); }
.side-note[data-tone="warn"] { color: var(--warn-on-dark); }
.side-note[data-tone="bad"] { color: var(--danger-on-dark); }

/* YouTube API key: its state, right under the input */
.yt-status { margin: 6px 0 0; color: var(--muted-foreground); font: 500 11.5px/1.45 var(--font-mono); overflow-wrap: anywhere; }
.yt-status:empty { display: none; }
.yt-status[data-tone="ok"] { color: var(--ok-on-dark); }
.yt-status[data-tone="warn"] { color: var(--warn-on-dark); }
.yt-status[data-tone="bad"] { color: var(--danger-on-dark); }
.hint a { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
.key-form { display: grid; justify-items: start; gap: 8px; margin: 8px 0 4px; }
.key-form .field { width: 100%; }
.key-label { font-size: 13px; }
.key-row { display: flex; gap: 6px; width: 100%; }
.key-row .input { flex: 1; min-width: 0; height: 28px; font-family: var(--font-mono); font-size: 12px; }
.key-form > .input { width: 100%; height: 28px; font-family: var(--font-mono); font-size: 12px; }
.ingest-settings { margin-top: 14px; padding-top: 6px; border-top: 1px solid var(--border); }
.ingest-settings code { overflow-wrap: anywhere; color: var(--foreground); }
.key-row .btn { flex: none; }
.info {
  flex: none;
  display: grid;
  align-content: center;
  gap: 3px;
  height: var(--bar-full);
  padding: 0 8px;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.hide-stats .info, .tile.side-on .info { height: var(--bar-slim); }

/* Timelines — a feed's seek bar sits on the top edge of its bar, where YouTube's own sits under
   the picture, and never over the video. The wall's runs under the whole wall. */
.tl { position: relative; cursor: pointer; touch-action: none; --at: 1; --drag: 1; --reach: 0; }
.tl-track { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; background: var(--input); }
.tl-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--at) * 100%); background: var(--foreground); }
.tl-gone { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--reach) * 100%); background: var(--card); background-image: repeating-linear-gradient(-45deg, var(--input) 0 1px, transparent 1px 4px); }
.tl-knob { position: absolute; top: 50%; left: calc(var(--at) * 100%); width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--foreground); box-shadow: 0 0 0 2px var(--card); }
.tl.dragging .tl-fill { width: calc(var(--drag) * 100%); }
.tl.dragging .tl-knob { left: calc(var(--drag) * 100%); }
.tl-tip {
  position: absolute;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--foreground);
  color: var(--background);
  font: 600 10px/1.4 var(--font-mono);
  letter-spacing: .04em;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}
.info { position: relative; }
.tile-tl { position: absolute; left: 0; right: 0; top: -1px; height: 7px; z-index: 1; }
.tile-tl .tl-track { top: 0; margin: 0; height: 3px; transition: height 120ms var(--ease-swift); }
.tile-tl:hover .tl-track, .tile-tl.dragging .tl-track { height: 6px; }
.tile-tl .tl-knob { display: none; top: 3px; width: 10px; height: 10px; margin: -5px 0 0 -5px; }
.tile-tl:hover .tl-knob, .tile-tl.dragging .tl-knob { display: block; }
.tile-tl .tl-tip { bottom: calc(100% + 6px); }
/* Live is red, as on YouTube's own bar; an ended broadcast or a recording is grey. Its own
   red, a shade off the alarm red, which stays reserved for buffering and faults. */
.tl[data-state="live"] .tl-fill, .tl[data-state="live"] .tl-knob { background: var(--tl-live); }
.tl[data-state="ended"] .tl-fill, .tl[data-state="ended"] .tl-knob { background: var(--muted-foreground); }
/* Viewer counts over a hovered bar, on the bar's own span: peak and low marked, a cursor at
   the pointer. The label moves up to sit above it. */
.tl-graph { position: absolute; left: 0; right: 0; bottom: 100%; width: 100%; height: 44px; pointer-events: none; z-index: 1; background: color-mix(in oklab, var(--background) 78%, transparent); }
.tile-tl .tl-graph { bottom: calc(100% + 1px); }
.tl.has-graph .tl-tip { bottom: calc(100% + 50px); }
.tl-graph .area { fill: color-mix(in oklab, var(--tl-live) 24%, transparent); }
.tl-graph .line { fill: none; stroke: var(--tl-live); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.tl[data-state="ended"] .tl-graph .area, .tl-master .tl-graph .area { fill: color-mix(in oklab, var(--foreground) 14%, transparent); }
.tl[data-state="ended"] .tl-graph .line, .tl-master .tl-graph .line { stroke: var(--foreground); }
.tl-graph .pt { fill: var(--tl-live); }
.tl-graph .untracked { fill: color-mix(in oklab, var(--foreground) 7%, transparent); }
.tl-graph .untracked-edge { stroke: var(--muted-foreground); stroke-width: 1; stroke-dasharray: 3 3; }
.tl-graph .untracked-text { fill: var(--muted-foreground); font: 600 9px/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; }
.tl[data-state="ended"] .tl-graph .pt, .tl-master .tl-graph .pt { fill: var(--foreground); }
.tl-graph .mark { fill: var(--foreground); stroke: var(--background); stroke-width: 1; }
.tl-graph .mark-pcv { fill: var(--accent); } /* the backend's recorded PCV, the figure on the tile and beside Feeds */
/* The encoder box's push (side card): out of the layout, not merely hidden, when no push matches
   the feed, so the side card's trimming (trimSide) can't bring it back. */
.side-enc[data-off] { display: none; }
.side-enc .m-hero .m-md[data-kind="word"] { font-family: var(--font-display, var(--font-mono)); text-transform: uppercase; letter-spacing: .02em; }
.tile-stats [data-stat="encoder"][hidden] { display: none; }

/* Frame timing: encoder → YouTube → this PC. One colour per stretch, kept apart from the
   state colours (ok / warn / danger) so a long stretch isn't read as a fault by itself. */
:root {
  /* The system's data-series tokens (skwad-tokens.css), never hex: series 1 for the encoder box,
     series 3 for YouTube, the foreground for this PC, the grey series for the buffer cushion. */
  --pipe-enc: var(--chart-1);    /* the encoder box */
  --pipe-yt: var(--chart-3);     /* YouTube */
  --pipe-pc: var(--foreground);  /* this PC */
  --pipe-buf: var(--chart-2);    /* buffer ahead, a cushion */
}
.pipe { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 10px; }
.pipe-bar { display: flex; width: 100%; height: 18px; border-radius: var(--radius-md); overflow: hidden; background: color-mix(in oklab, var(--foreground) 6%, transparent); }
.pipe-bar.pipe-mini { height: 6px; margin-top: 3px; border-radius: 3px; }
.pipe-seg { display: block; flex: none; height: 100%; min-width: 0; font: 600 10px/18px var(--font-mono); color: #fff; text-align: center; white-space: nowrap; overflow: hidden; transition: width .4s ease; }
.pipe-seg.pipe-enc { background: var(--pipe-enc); }
.pipe-seg.pipe-yt { background: var(--pipe-yt); }
.pipe-seg.pipe-pc { background: var(--pipe-pc); color: var(--background); }
.pipe-stamps { display: flex; justify-content: space-between; gap: 8px; font: 600 10px/1.2 var(--font-mono); letter-spacing: .03em; }
.pipe-stamp { white-space: nowrap; }
.pipe-enc-ink { color: var(--pipe-enc); }
.pipe-yt-ink { color: var(--pipe-yt); }
.pipe-pc-ink { color: var(--pipe-pc); }
.pipe-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pipe-dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; vertical-align: 0; }
.pipe-dot.pipe-enc { background: var(--pipe-enc); }
.pipe-dot.pipe-yt { background: var(--pipe-yt); }
.pipe-dot.pipe-pc { background: var(--pipe-pc); }
.pipe-dot.pipe-buf { background: var(--pipe-buf); }
/* The frame-timing sparks sit side by side: encoder beside YouTube, encoder beside this PC. */
@media (min-width: 560px) { .sparks.sparks-2 { grid-template-columns: 1fr 1fr; } }
/* Encoding health graphs (backend/feed-telemetry.js): taller, a span picker, the second push
   dashed, and YouTube's rating of the stream as a strip of colour over time. */
#fs-tele-section .sparks.sparks-2 { grid-template-columns: 1fr; } /* over time, so full width */
#fs-tele-section .spark svg { height: var(--chart-plot-h); }
#fs-tele-section .spark.spark-band svg { height: 14px; }
.tele-range { display: inline-flex; gap: 2px; }
.tele-range .btn[aria-pressed="true"] { background: var(--secondary); color: var(--foreground); box-shadow: inset 0 0 0 1px var(--input); }
.tele-group { display: flex; align-items: center; margin: 12px 0 0; }
.spark .line.alt { stroke-dasharray: 4 3; opacity: .85; }
.spark .band-good { fill: color-mix(in oklab, var(--ok-on-dark) 70%, transparent); }
.spark .band-ok { fill: color-mix(in oklab, var(--warn-on-dark) 75%, transparent); }
.spark .band-bad { fill: var(--danger-on-dark); }
.spark .band-none { fill: color-mix(in oklab, var(--muted-foreground) 30%, transparent); }
.tl-graph .mark-text { fill: var(--foreground); font: 600 9px/1 var(--font-mono); letter-spacing: .03em; paint-order: stroke; stroke: var(--background); stroke-width: 2.5px; stroke-linejoin: round; }
.tl-graph .cursor { stroke: var(--foreground); stroke-width: 1; stroke-dasharray: 2 2; }
.tl-graph .cursor-dot { fill: var(--foreground); stroke: var(--background); stroke-width: 1; }

.transport {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  background: var(--card);
  border-top: 1px solid var(--border);
}
.transport.is-inactive { visibility: hidden; }
.transport { position: relative; }

/* Layout bar: icon buttons drawn from each layout's boxes; the chosen one is filled ink. */
.layout-bar { flex: none; display: flex; align-items: center; gap: 4px; padding-left: 8px; border-left: 1px solid var(--border); }
.layout-quick { display: flex; gap: 4px; }
.layout-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--secondary);
  color: var(--muted-foreground);
  cursor: pointer;
}
.layout-btn svg { width: 22px; height: 15px; fill: currentColor; }
.layout-btn:hover { color: var(--foreground); }
.layout-btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); }
.layout-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.layout-more[aria-expanded="true"] { box-shadow: inset 0 0 0 1px var(--foreground); }
.layout-panel { top: auto; bottom: calc(100% + 6px); right: 12px; width: auto; display: grid; gap: 10px; z-index: 13; }
.layout-grid { display: grid; grid-template-columns: repeat(7, 32px); gap: 6px; }
.layout-panel-row { display: flex; align-items: center; gap: 6px; }
.layout-custom { flex: 1; }

/* Custom layout builder: squares to drag across, boxes numbered in the order feeds fill them. */
.layout-builder { width: min(560px, calc(100vw - 32px)); }
.lb-sizes { display: flex; align-items: flex-end; gap: 12px; }
.lb-sizes .field { display: grid; gap: 4px; }
.lb-sizes .select { width: 76px; }
.lb-canvas {
  display: grid;
  grid-template-columns: repeat(var(--lb-cols), 1fr);
  grid-template-rows: repeat(var(--lb-rows), 1fr);
  gap: 4px;
  aspect-ratio: 16 / 9;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--background);
  touch-action: none;
  user-select: none;
}
.lb-cell { border-radius: var(--radius-sm); background: var(--secondary); cursor: crosshair; }
.lb-box {
  z-index: 1;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--foreground);
  color: var(--background);
  font: 600 16px/1 var(--font-mono);
  cursor: pointer;
}
.lb-box:hover { background: var(--danger); color: #fff; }
.lb-ghost { z-index: 2; border-radius: var(--radius-sm); background: color-mix(in oklab, var(--ring) 45%, transparent); box-shadow: inset 0 0 0 2px var(--ring); pointer-events: none; }
.lb-ghost.blocked { background: color-mix(in oklab, var(--danger) 35%, transparent); box-shadow: inset 0 0 0 2px var(--danger); }
.tl-step { font: 600 11px/1 var(--font-mono); padding: 0 8px; }
.tl-pos { flex: none; display: flex; align-items: baseline; gap: 8px; min-width: 190px; padding: 0 4px; }
.tl-behind { font: 500 16px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.tl-behind[data-state="live"] { color: var(--tl-live); }
.tl-behind[data-state="paused"] { color: var(--warn-on-dark); }
.tl-clock { font: 500 11px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
.tl-master { flex: 1; min-width: 120px; height: 28px; }
.tl-master:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.tl-master.is-off { cursor: default; }
.tl-master.is-off .tl-knob, .tl-master.is-off .tl-fill { display: none; }
.tl-span { flex: none; width: auto; height: 28px; font: 500 11.5px/1 var(--font-mono); }
.tl-follow { flex: none; min-width: 11ch; text-align: right; }
@media (max-width: 900px) {
  .tl-follow, .tl-clock { display: none; }
  .tl-pos { min-width: 0; }
}
.tile.side-on .tile-stats { display: none; }
.info-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* Fixed width so every feed name starts at the same x across the wall */
.status {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 98px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--secondary);
  font: 600 10px/1.4 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-text { overflow: hidden; text-overflow: ellipsis; }
.status-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); }
.status[data-tone="ok"] .status-dot { background: var(--ok-on-dark); }
.status[data-tone="warn"] .status-dot { background: var(--warn-on-dark); }
.status[data-tone="bad"] { background: color-mix(in oklab, var(--danger) 34%, var(--card)); color: #fff; }
.status[data-tone="bad"] .status-dot { background: var(--danger-on-dark); }
.label {
  flex: 1;
  min-width: 0;
  font: 600 13px/1.3 var(--font-sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.info-head .tag { flex: none; padding: 0 5px; font-size: 9px; }
.feed-folder-name {
  flex: 0 1 160px;
  width: 160px;
  min-width: 76px;
  height: 27px;
  padding: 3px 7px;
  font: 500 12px/1.3 var(--font-sans);
}
.prio-tag, .audio-tag { display: none !important; }
.tile.priority .prio-tag, .tile.solo .audio-tag { display: inline-flex !important; }
.tile.priority.held .prio-tag { color: var(--warn-on-dark); }

/* One line of telemetry: items that do not fit wrap onto a hidden second line, so a
   narrow tile shows fewer whole readings rather than clipped ones. The tag always stays. */
.tile-stats { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stats-list {
  flex: 1;
  min-width: 0;
  height: 15px;
  display: flex;
  flex-wrap: wrap;
  column-gap: 12px;
  overflow: hidden;
  font: 500 11px/15px var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  color: var(--muted-foreground);
}
.stats-list > span { white-space: nowrap; }
/* Fixed columns for the core readings so they line up tile to tile */
.stats-list [data-stat="latency"] { min-width: 10ch; }
.stats-list [data-stat="buffer"] { min-width: 10ch; }
.stats-list [data-stat="drift"] { min-width: 12ch; }
.stats-list [data-stat="quality"] { min-width: 7ch; }
.stats-list [data-stat="stalls"] { min-width: 16ch; }
.tile-stats [data-tone="warn"] { color: var(--warn-on-dark); }
.tile-stats [data-tone="bad"] { color: var(--danger-on-dark); font-weight: 600; }
.tile-stats > .tag { flex: none; padding: 0 5px; font-size: 9px; }
.hide-stats .tile-stats { display: none; }
.section-title { margin: 8px 0 2px; }
.stats-btn { flex: none; height: 20px; padding: 0 6px; color: var(--muted-foreground); box-shadow: inset 0 0 0 1px var(--border); }
.stats-btn:hover { color: var(--foreground); }
.tile.inspected .stats-btn { background: var(--primary); color: var(--primary-foreground); box-shadow: none; }

/* Inspecting with YouTube's own stats: the player is lifted beside the feed sheet and scaled
   up from its normal render size, so it keeps streaming at the same quality. */
.tile.focused .screen {
  position: fixed;
  top: var(--wall-top, 56px);
  left: 0;
  right: min(420px, 100vw);
  bottom: 0;
  z-index: 9;
  box-shadow: 0 0 0 1px var(--border);
}
.tile.focused .info { margin-top: auto; }
.tile.focused { contain: none; } /* containment would trap the fixed-position player */

.feed-sheet { width: min(420px, 100vw); z-index: 11; }
.feed-title { min-width: 0; }
.feed-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-sub { margin-top: 2px; color: var(--muted-foreground); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-actions { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.feed-actions a.btn { text-decoration: none; }
.fs-quality { display: inline-flex; align-items: center; gap: 6px; }
.feed-actions { flex-wrap: wrap; }
.fs-shot-status { margin: 0; padding: 6px 16px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted-foreground); overflow-wrap: anywhere; }
.fs-shot-status[data-tone="ok"] { color: var(--ok-on-dark); }
.fs-shot-status[data-tone="bad"] { color: var(--danger-on-dark); }
#fs-nerds[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); box-shadow: none; }
.feed-body { flex: 1; min-height: 0; overflow-y: auto; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 6px; }
.section-head .tag { padding: 0 5px; font-size: 9px; }
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 12px;
  margin: 0;
  font-size: 12.5px;
}
.kv dt, .kv dd { padding: 5px 0; border-bottom: 1px solid var(--border); }
.kv dt { color: var(--muted-foreground); }
.kv dd {
  margin: 0;
  text-align: right;
  font: 500 12px/1.45 var(--font-mono);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.kv dd[data-tone="ok"] { color: var(--ok-on-dark); }
.kv dd[data-tone="warn"] { color: var(--warn-on-dark); }
.kv dd[data-tone="bad"] { color: var(--danger-on-dark); }
.kv dd .tag { margin-left: 6px; padding: 0 4px; font-size: 9px; }
.sparks { display: grid; gap: 24px; margin: 12px 0 4px; }
/* SKWAD Chart: an ember headline series, contextual secondary series, 220 px container. */
.spark { margin: 0; min-width: 0; --chart-1: #f58138; --chart-2: #95908a; --chart-3: #6fa89e; --chart-4: #a98fb2; --chart-5: #c9b268; --chart-font: 'JetBrains Mono', Consolas, monospace; --chart-plot-h: 196px; }
.spark figcaption.telemetry { font: 600 10px/1.4 var(--chart-font); letter-spacing: .1em; }
.spark figcaption { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
/* The chart's figure: the latest reading, in the figure voice, at the title's right */
.spark figcaption > span:last-child { flex: none; color: var(--foreground); font: 500 14px/1.5 var(--chart-font); font-variant-numeric: tabular-nums; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.spark svg { display: block; width: 100%; height: var(--chart-plot-h); background: transparent; border-radius: 0; overflow: hidden; }
.spark svg:focus-visible { outline: 2px solid var(--ring); outline-offset: 4px; }
.spark .line { fill: none; stroke: var(--chart-1); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark .line.alt { stroke: var(--chart-2); }
.spark .area { fill: var(--chart-1); fill-opacity: .2; }
/* Axis labels beside and under the SVG (setAxes): y ticks top, middle, bottom; time along the bottom */
.chart-body { position: relative; display: grid; grid-template-columns: minmax(36px, max-content) minmax(0, 1fr); grid-template-rows: var(--chart-plot-h) 24px; column-gap: 8px; }
.chart-body > svg { grid-column: 2; grid-row: 1; }
.axis-y, .axis-x { color: var(--muted-foreground); font: 500 11px/1 var(--chart-font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.axis-y { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding: 1px 0; }
.axis-x { grid-column: 2; grid-row: 2; display: flex; justify-content: space-between; padding-top: 8px; }
.chart-provenance { margin: 8px 0 0; color: var(--muted-foreground); font: 600 10px/1.4 var(--chart-font); letter-spacing: .1em; text-transform: uppercase; }
.chart-tooltip { position: absolute; z-index: 2; max-width: calc(100% - 8px); min-width: min(128px, 100%); padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--foreground); font: 500 11px/1.4 var(--chart-font); box-shadow: 0 4px 16px #0003; pointer-events: none; }
.chart-tooltip > b { display: block; margin-bottom: 6px; }
.chart-tooltip-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-left: 3px solid var(--chart-1); padding-left: 8px; margin-top: 6px; }
.chart-tooltip-row.alt { border-color: var(--chart-2); }
.chart-tooltip-row > span { color: var(--muted-foreground); }
.chart-tooltip-row strong { flex: none; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-cursor { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.chart-dot { fill: var(--chart-1); stroke: var(--card); stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.chart-dot.alt { fill: var(--chart-2); }
/* The low-buffer line on the buffer chart: below it a live feed is about to stall */
.spark .threshold { stroke: var(--danger-on-dark); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
/* Faint horizontal gridlines at quarter heights, as the system's charts draw them */
.spark .grid { stroke: var(--border); stroke-opacity: .5; stroke-width: 1; vector-effect: non-scaling-stroke; }
/* Provenance beside a graph group: the readings' origin travels with them */
.tele-group .prov, .fh-prov .prov { margin-left: 6px; }
.fh-prov { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin: 2px 0 -2px; }
.fh-prov > span { display: inline-flex; align-items: center; }
.field-stack { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
/* .field (declared later) would centre a stacked field's label and shrink its input */
.field.field-stack { align-items: stretch; justify-content: flex-start; }

/* One-shot settle flashes when the wall acts on a feed — not loops */
.tile.pulse-resync::after { animation: none; }
.tile.pulse-reload::after { animation: none; }
.tile.pulse-alarm::after { animation: none; }
@keyframes flash-resync { from { box-shadow: inset 0 0 0 2px var(--foreground); } }
@keyframes flash-reload { from { box-shadow: inset 0 0 0 2px var(--warn-on-dark); } }
/* Refreshed because it was stuck buffering: a red flash, then the alarm frame if it persists */
@keyframes flash-alarm { from { box-shadow: inset 0 0 0 3px var(--danger-on-dark); } }

/* Sheet — right-side context panel */
.sheet {
  position: fixed;
  top: var(--sheet-top, var(--topbar-h)); /* the top bar's measured height when it wraps */
  right: 0;
  bottom: 0;
  width: min(380px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-left: 1px solid var(--border);
  z-index: 10;
  animation: none;
}
@keyframes sheet-in { from { transform: translateX(24px); opacity: 0; } }
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.sheet-head h2 { margin-top: 4px; font: 600 15px/1.2 var(--font-sans); }
.sheet-head-actions { display: flex; gap: 8px; flex: none; }

/* Hosted (a website, not the laptop app): the server isn't the machine showing the wall,
   so laptop readouts and the managed wall window go away. app.js sets body.hosted. */
.hosted [data-laptop-only] { display: none !important; }
body:not(.hosted) [data-hosted-only] { display: none !important; }
/* Signed in from a user link: the integrations and the wall computer's own settings go away.
   Hiding is only for tidiness; the server strips and blocks them for users. */
.role-user [data-admin-only] { display: none !important; }
/* An operator runs the wall but sees nothing of the integrations: only the admin-only parts marked for operators */
.role-operator [data-admin-only]:not([data-operator]) { display: none !important; }
/* The Admin center (/admin): the integrations and links, and no wall; the wall never shows them */
body:not(.admin-center) [data-admin-center] { display: none !important; }
.admin-center .wall-tabs, .admin-center .global-actions > :not(#admin-center-link), .admin-center .session-chip,
.admin-center #feeds-panel, .admin-center #wall-stats-panel, .admin-center #add-panel, .admin-center #session-panel, .admin-center #upcoming-panel, .admin-center #ask-live { display: none !important; }
.admin-center #drawer .sheet-section:not([data-admin-center]) { display: none !important; }
.admin-center #drawer { left: 0; right: 0; width: min(760px, 100vw); margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
body:not(.role-user) [data-user-only] { display: none !important; }
.role-chip { margin-right: 8px; }
.key-row .link-days { font-family: var(--font-sans); }
.link-list:empty { display: none; }
.link-list .session-row-meta { overflow-wrap: anywhere; }
.link-list .session-info .input { width: 100%; height: 26px; margin-top: 4px; font: 500 11px/1 var(--font-mono); }
.sheet-section { padding: 6px 16px 12px; border-bottom: 1px solid var(--border); }
/* Settings scroll as one column under the fixed header, above the sheet edge. */
.sheet-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sheet-body, .feed-body {
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--input) transparent;
  scrollbar-gutter: stable;
}
.sheet-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 120px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; }
.field-unit { display: flex; align-items: center; gap: 6px; color: var(--muted-foreground); font: 500 12px var(--font-mono); }
.switch-row { display: flex; align-items: center; gap: 10px; margin: 12px 0; cursor: pointer; }
.hint { color: var(--muted-foreground); font-size: 12px; line-height: 1.5; margin: 2px 0 10px; }
.log-head { display: flex; align-items: center; justify-content: space-between; }
.log {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font: 500 11px/1.45 var(--font-mono);
}
.log li { padding: 6px 0; border-bottom: 1px solid var(--border); color: var(--muted-foreground); }
.log time { color: var(--muted-foreground); margin-right: 8px; }
.log .who { color: var(--foreground); font-weight: 600; margin-right: 8px; }
.log li[data-level="warn"] .what { color: var(--warn-on-dark); }
.log li[data-level="bad"] .what { color: var(--danger-on-dark); }
.log:empty::before {
  content: "No events yet. Jumps, refreshes and errors land here as they happen.";
  color: var(--muted-foreground);
  font-family: var(--font-sans);
  font-size: 12px;
}

/* Dialog — confirmations; destructive asks before it acts */
.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  color: var(--foreground);
}
.dialog[open] { animation: none; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px); } }
.dialog::backdrop { background: rgba(10, 9, 8, .72); }
.dialog-form { display: grid; gap: 12px; padding: 20px; }
.dialog h2 { font: 600 15px/1.3 var(--font-sans); }
.dialog-body { color: var(--muted-foreground); font-size: 13px; }
.dialog-body:empty { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Settings → What the numbers mean: each reading and where in the chain it happens */
.terms { display: grid; gap: 4px; margin: 6px 0 4px; }
.terms dt { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 600; font-size: 13px; }
.terms dt .tag { padding: 0 5px; font-size: 9px; }
.terms dd { margin: 0; color: var(--muted-foreground); font-size: 12px; line-height: 1.5; }

/* Feed Meter install prompt */
.meter-dialog { width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; }
.meter-install { margin-top: 8px; }
.meter-steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.meter-steps li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 4px 10px;
  counter-increment: step;
  font-size: 13px;
}
.meter-steps li::before {
  content: counter(step);
  grid-row: span 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--secondary);
  font: 600 11px/1 var(--font-mono);
}
.meter-steps .btn { justify-self: start; }
.meter-steps code { padding: 1px 4px; border-radius: var(--radius-xs); background: var(--secondary); }
.meter-status { margin: 0; font: 500 11.5px/1.45 var(--font-mono); color: var(--muted-foreground); }
.meter-status:empty { display: none; }
.meter-snooze { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted-foreground); }
.meter-snooze input { accent-color: var(--foreground); }

@media (max-width: 720px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px 12px; }
  .metrics { order: 3; flex-basis: 100%; overflow-x: auto; }
  .global-actions { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* SKWAD component roles (Button, Input, Tabs, Badge, Metric, Dialog), on the wall's dense
   desk: controls sit on the 28 px line, xs (24) for telemetry rows only. Labels and
   provenance are mono microcaps; figures are mono with tabular digits; names are display. */
body { font-variant-numeric: tabular-nums; }
strong, b { font-weight: 700; }
.brand { align-items: center; gap: 10px; }
.brand-logo { width: auto; height: 19px; display: block; flex: none; }
.signin-card .brand-logo { height: 26px; }
.signin-card .brand-sub { font-size: 12px; }
.brand-sub { display: inline !important; color: var(--muted-foreground); font: 600 10px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.topbar { --topbar-h: 44px; gap: 16px; padding-inline: 16px; flex-shrink: 0; background: var(--background); }
.btn { height: var(--control-sm); border: 1px solid transparent; font-size: 12px; }
.btn-outline { background: transparent; color: var(--foreground); border-color: var(--input); box-shadow: none; }
.btn-outline:hover, .btn-outline:active { background: var(--secondary); }
.btn-ghost { background: transparent; color: var(--muted-foreground); }
.btn-ghost:hover, .btn-ghost:active { background: var(--secondary); color: var(--foreground); }
/* An ON control fills ink, and stays ink under the pointer. */
.btn[aria-pressed="true"], .btn[aria-pressed="true"]:hover, .btn[aria-pressed="true"]:active { background: var(--primary); color: var(--primary-foreground); }
#layout-scroll[aria-pressed="true"], #layout-fit[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-xs { height: var(--control-xs); font-size: 11px; }
.btn-icon { padding: 0; }
.input { height: var(--control-sm); padding-inline: 10px; font-size: 13px; font-weight: 500; }
.input:focus-visible { outline: 0; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 30%, transparent); }
.textarea { height: auto; font-family: var(--font-sans); }
.metric-value, .m dd, .tab-count, .tab-ccv, .side-for, .tile-stats, .log time, .session-when, .input-num, .tl-clock, .tl-behind { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
/* A sheet value is often a sentence: Manrope, with tabular digits for the figures in it. */
.kv dd { font-family: var(--font-sans); font-weight: 600; font-variant-numeric: tabular-nums; }
.wall-tab { align-self: stretch; }
.empty-body { max-width: 520px; gap: 16px; }
.empty h1, .wall-stats-heading h1 { font: 800 24px/1.1 var(--font-display); letter-spacing: .03em; text-transform: uppercase; }
.wall-alerts h2, .sheet-head h2, .dialog h2 { font: 700 15px/1.3 var(--font-sans); }
/* Status pills: the state carried by a tint and its hue, never a loud fill. */
.status { font-size: 11px; font-weight: 600; }
.status[data-tone='ok'], .side-status[data-tone='ok'] { background: var(--ok-bg); color: var(--ok-on-dark); }
.status[data-tone='warn'], .side-status[data-tone='warn'] { background: var(--warn-bg); color: var(--warn-on-dark); }
.status[data-tone='bad'], .side-status[data-tone='bad'] { background: var(--danger-bg); color: var(--danger-on-dark); }
.switch, .switch::after { transition: background-color var(--dur-base) var(--ease-swift), transform var(--dur-base) var(--ease-swift); }
.dialog::backdrop { background: rgb(19 18 16 / .78); }
@media (max-width: 1100px) { .topbar { gap: 8px 12px; padding: 8px 16px; } }

/* Settings: setup steps folded under a one-line hint */
details.setup { margin-top: 2px; }
details.setup summary { cursor: pointer; color: var(--muted-foreground); font-weight: 600; }
details.setup summary:hover { color: var(--foreground); }
details.setup[open] summary { margin-bottom: 4px; }

/* Match detection (OCR): the Stats sheet block and Settings section */
.fs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ocr-preview { margin: 8px 0 0; }
.ocr-preview img { display: block; width: 100%; max-height: 160px; object-fit: contain; border: 1px solid var(--border); border-radius: 3px; background: #000; }
.ocr-preview figcaption { margin-top: 4px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
.ocr-region { display: grid; gap: 6px; }
.ocr-region[hidden] { display: none; }
.ocr-region-inputs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ocr-region-inputs .input { min-width: 0; }
#fs-match-tag[data-tone="ok"] { color: var(--ok, #7ddc8a); border-color: currentColor; }
#fs-match-tag[data-tone="warn"] { color: var(--warn, #f0c060); border-color: currentColor; }
#fs-match-tag[data-tone="bad"] { color: var(--bad, #ff7a7a); border-color: currentColor; }
/* A new all-time record (celebrateRecord): a card under the top bar. The ember star is the
   single hot moment and turns into place; cream micro-stars burst once from it and fade. It
   arrives, holds, leaves: no loop, no bounce, never in the way of the pointer. */
.celebrate { position: fixed; z-index: 60; top: calc(var(--topbar-h) + 14px); left: 50%; display: flex; align-items: center; gap: 18px; padding: 16px 24px 16px 18px; border: 1px solid var(--border-strong); border-left: 2px solid var(--ember-bright); border-radius: var(--radius-lg); background: var(--card); pointer-events: none; transform: translateX(-50%); opacity: 0; }
.celebrate.is-on { animation: celebrate-in var(--dur-slow) var(--ease-swift) forwards; }
.celebrate.is-off { animation: celebrate-out var(--dur-slow) var(--ease-swift) forwards; }
@keyframes celebrate-in { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes celebrate-out { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -6px); } }
.celebrate-mark { position: relative; flex: none; width: 56px; height: 56px; display: grid; place-items: center; }
.celebrate-star { width: 44px; height: 44px; display: block; }
.celebrate.is-on .celebrate-star { animation: celebrate-star 700ms var(--ease-swift) both; }
@keyframes celebrate-star { from { opacity: 0; transform: scale(.4) rotate(-45deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
.celebrate-burst { position: absolute; inset: 0; }
.celebrate-burst i { position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; background: var(--live-ink);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); opacity: 0; }
.celebrate.is-on .celebrate-burst i { animation: celebrate-burst 1400ms var(--ease-swift) 120ms forwards; }
@keyframes celebrate-burst {
  0% { opacity: 0; transform: rotate(var(--a)) translateX(10px) scale(calc(var(--s) * .5)); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scale(var(--s)); }
}
.celebrate-copy { display: flex; flex-direction: column; gap: 4px; }
.celebrate-copy .telemetry { color: var(--ember-bright); }
.celebrate-figure { font: 600 30px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--foreground); }
.celebrate-sub { color: var(--muted-foreground); font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) {
  .celebrate.is-on { animation: none; opacity: 1; transform: translateX(-50%); }
  .celebrate.is-off { animation: none; opacity: 0; }
  .celebrate-burst { display: none; }
}

/* Dashboard · Channels to watch */
.watch-add { display: grid; gap: 8px; max-width: 760px; margin-bottom: 10px; }
.watch-add > .textarea { width: 100%; resize: vertical; }
.watch-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.watch-wall { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 0; }
.watch-wall .select { flex: 1; min-width: 0; max-width: 340px; height: 32px; }
.watch-row .watch-row-wall, .watch-table .watch-row-wall { width: min(220px, 40vw); height: 28px; font-size: 12.5px; }
.watch-table td.watch-text { font-family: var(--font-sans); white-space: normal; min-width: 160px; max-width: 380px; }
.watch-table td.muted { color: var(--muted-foreground); }
.watch-name { color: var(--foreground); text-decoration: none; }
.watch-name:hover { text-decoration: underline; }
.watch-handle { display: block; color: var(--ink-4); font: 500 11px/1.4 var(--font-mono); }
.watch-table td:last-child { text-align: right; padding-right: 0; }

/* Screenshots page (/screenshots): the backend's folder, session / date / feed. Folders as cards,
   files as a grid of thumbnails, each with its time, size and a Download. */
.shots-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.shots-head h1 { margin: 2px 0 6px; font: 800 28px/1.15 var(--font-display, var(--font-sans)); letter-spacing: -.01em; }
.shots-about { max-width: 640px; margin: 0; }
.shots-save { flex: none; display: flex; align-items: flex-start; gap: 10px; max-width: 380px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); cursor: pointer; }
.shots-save .switch { flex: none; margin-top: 2px; }
.shots-save-title { display: block; color: var(--foreground); font: 600 13px/1.4 var(--font-sans); }
.shots-save .hint { display: block; margin: 2px 0 0; }
.shots-bar { position: sticky; top: 60px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding: 10px 0; border-bottom: 1px solid var(--border); background: var(--background); }
.shots-crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; min-width: 0; font: 600 14px/1.4 var(--font-sans); }
.shots-crumb { color: var(--muted-foreground); text-decoration: none; overflow-wrap: anywhere; }
.shots-crumb:hover { color: var(--foreground); text-decoration: underline; }
.shots-crumb.is-current { color: var(--foreground); }
.shots-crumb-sep { color: var(--ink-4); }
.shots-actions { flex: none; display: flex; align-items: center; gap: 12px; }
.shots-dirs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.shots-dir { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: inherit; text-decoration: none; transition: border-color var(--dur-fast) var(--ease-swift); }
.shots-dir:hover, .shots-dir:focus-visible { border-color: var(--border-strong); }
.shots-dir:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.shots-dir-name { color: var(--foreground); font: 600 14px/1.35 var(--font-sans); overflow-wrap: anywhere; }
.shots-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.shots-file { display: flex; flex-direction: column; min-width: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); overflow: hidden; }
.shots-thumb { display: grid; place-items: center; aspect-ratio: 16 / 10; background: var(--surface-3, var(--muted)); overflow: hidden; }
.shots-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.shots-thumb-kind { color: var(--muted-foreground); font: 600 12px/1 var(--font-mono); letter-spacing: .1em; }
.shots-file figcaption { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 8px 10px 10px; }
.shots-file-name { grid-column: 1 / -1; color: var(--foreground); font: 500 12px/1.35 var(--font-sans); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
/* By date or by wall: a quiet switch (the page's one ember action stays the folder's zip) */
.shots-view { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-md, 8px); }
.shots-view .btn { border-color: transparent; box-shadow: none; }
.shots-view .btn[aria-pressed="true"], .shots-view .btn[aria-pressed="true"]:hover { background: var(--secondary); color: var(--foreground); box-shadow: inset 0 0 0 1px var(--input); }
/* Each day, newest first: its heading (date, Today/Yesterday, counts, the day's zip), then its walls */
.shots-day-head { justify-content: flex-start; flex-wrap: wrap; }
.shots-day-head h2 { display: flex; align-items: center; gap: 8px; }
.shots-day-head .btn { margin-left: auto; }
/* In a folder whose files span several days: a heading per day across the grid */
.shots-files-day { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; margin: 12px 0 0; color: var(--foreground); font: 600 13px/1.4 var(--font-sans); }
.shots-files-day:first-child { margin-top: 0; }
@media (max-width: 700px) {
  .shots-head { flex-direction: column; }
  .shots-save { max-width: none; }
  .shots-bar { flex-direction: column; align-items: flex-start; }
  .shots-actions { flex-wrap: wrap; }
}
