/* Self-hosted fonts (SIL Open Font License 1.1, see src/fonts/README.md). Variable weights. */
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 300 600; font-display: swap; src: url("fonts/inter-tight-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 300 600; font-display: swap; src: url("fonts/inter-tight-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/jetbrains-mono-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* ============================================================
   UI v3 "Control room" (2026-11-29), from the HorizonX DISPATCH
   design system: flat ground, 1px hairlines, neutral ink actions,
   colour reserved for status (green / red / amber / blue / grey),
   one orange brand mark. Loaded after styles.css; token-first so
   every page and dialog picks it up. Performance rules: no blur,
   no per-row shadows or transitions, no :has().
   ============================================================ */
:root {
  --bg: #f3f2f0;
  --panel: #ffffff;
  --panel-soft: #f8f7f6;
  --chrome: #efedeb;
  --header: #f8f7f6;
  --text: #101010;
  --muted: #5f5856;
  --line: #dedad7;
  --line-soft: #ebe8e5;
  --link: #a8410c;
  --accent: #101010;
  --accent-dark: #000000;
  --accent-soft: #efedeb;
  --accent-wash: rgba(16, 16, 16, 0.05);
  --on-accent: #ffffff;
  --brand: #ee6018;
  --row-hover: #f8f7f6;
  --row-selected: #f1efed;
  --radius: 8px;
  --radius-lg: 10px;
  --radius-dialog: 12px;
  --control: 36px;
  --focus-ring: 0 0 0 2px var(--panel), 0 0 0 4px var(--brand);
}

:root[data-theme="dark"] {
  --bg: #101010;
  --panel: #181614;
  --panel-soft: #141211;
  --chrome: #24211f;
  --header: #141211;
  --text: #eeeeee;
  --muted: #a39b97;
  --line: #34312f;
  --line-soft: #262321;
  --link: #f49a6c;
  --accent: #eeeeee;
  --accent-dark: #ffffff;
  --accent-soft: #24211f;
  --accent-wash: rgba(238, 238, 238, 0.06);
  --on-accent: #101010;
  --row-hover: #1d1b19;
  --row-selected: #221f1d;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand);
}

body {
  background: var(--bg);
  font-family: var(--font-text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
h2 { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
h3 { font-size: 13px; font-weight: 600; }
a { color: var(--link); }

/* ---- Shell ---------------------------------------------------- */
.sidebar,
:root[data-theme="dark"] .sidebar {
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
}
.brand { border-bottom: 0; padding: 0 6px 12px; }
.brand-mark {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: #101010;
  font-weight: 600;
  box-shadow: none;
}
.brand strong { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand span { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.nav { gap: 2px; margin-top: 8px; }
.nav a,
.sidebar nav a {
  min-height: 36px;
  border: 0;
  border-radius: var(--radius);
  color: var(--muted);
  padding: 0 10px;
  font-weight: 500;
  transition: background-color 120ms ease, color 120ms ease;
}
.nav a:hover { background: var(--chrome); color: var(--text); box-shadow: none; transform: none; }
.nav a.active,
.nav a.active:hover { background: var(--chrome); color: var(--text); box-shadow: none; }
.nav a.active::before { left: -12px; width: 2px; height: 18px; border-radius: 0 2px 2px 0; background: var(--brand); }
.nav-badge { background: transparent; color: var(--status-fault); border: 1px solid currentColor; font-family: var(--font-mono); font-weight: 600; }
.sidebar-foot { border-top: 1px solid var(--line); }
.sidebar-foot span { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.04em; }

.workspace { padding: 20px 24px 32px; }
.topbar { min-height: 48px; margin-bottom: 16px; }
.topbar p { margin-top: 4px; font-size: 13px; }
.topbar-actions { gap: 8px; }

/* ---- Buttons -------------------------------------------------- */
.button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.button { font-size: 13px; font-weight: 500; letter-spacing: -0.005em; }
.button:hover,
.icon-button:hover { border-color: color-mix(in srgb, var(--text) 28%, var(--line)); background: var(--chrome); transform: none; }
.button:active, .icon-button:active { transform: scale(0.98); }
.button.primary,
.button.primary:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: none;
}
.button.primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--bg)); }
.button.danger,
.button.danger:hover {
  border-color: color-mix(in srgb, var(--status-fault) 55%, var(--line));
  background: transparent;
  color: var(--status-fault);
}
.button.danger:hover { background: color-mix(in srgb, var(--status-fault) 10%, transparent); }
.button.danger-solid, .button.danger-solid:hover { border-color: var(--status-fault); background: var(--status-fault); color: #ffffff; }
:root[data-theme="dark"] .button.danger-solid { color: #ffffff; }

.alert-topbar-badge {
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.alert-topbar-badge.has-alerts {
  border-color: color-mix(in srgb, var(--status-fault) 50%, var(--line));
  background: transparent;
  color: var(--status-fault);
}

/* ---- Metrics: one hairline strip ------------------------------ */
.metrics {
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--line);
  margin-bottom: 16px;
}
.metric,
.metric:hover {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--panel);
  padding: 14px 16px;
  box-shadow: none;
}
.metric span { color: var(--muted); font-weight: 500; }
.metric strong {
  margin-top: 10px;
  font-family: var(--font-text);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.metric p { margin-top: 6px; font-size: 12px; }

/* ---- Panels --------------------------------------------------- */
.panel,
.settings-card,
.table-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: none;
}
.table-panel { padding: 0; }
.panel-head { gap: 12px; }
.table-panel .panel-head { border-bottom: 1px solid var(--line); padding: 12px 16px; }
.panel-head h2, .settings-card .panel-head h2 { font-size: 15px; font-weight: 500; }
.panel-head span, .settings-card .panel-head span { color: var(--muted); font-size: 12px; }

/* ---- Fields --------------------------------------------------- */
.field span, .protocol-field > span { color: var(--muted); font-weight: 500; }
.field input,
.field select,
.field textarea,
.stream-search input,
.modal-body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.modal-body select,
.modal-body textarea {
  min-height: var(--control);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--text);
  box-shadow: none;
}
.field input:hover, .field select:hover, .stream-search input:hover { border-color: color-mix(in srgb, var(--text) 24%, var(--line)); }
.field input:focus,
.field select:focus,
.stream-search input:focus,
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  border-color: var(--text);
  outline: none;
  box-shadow: none;
}
.field-hint.is-ready { color: var(--status-ok); }

/* ---- Segmented filters ---------------------------------------- */
.segments { gap: 2px; border: 1px solid var(--line); background: var(--panel-soft); padding: 2px; }
.segments button { min-height: 28px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.segments button:hover { color: var(--text); }
.segments button.active { background: var(--accent); color: var(--on-accent); box-shadow: none; }

/* ---- Tables --------------------------------------------------- */
th {
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
td { border-bottom-color: var(--line-soft); }
.streams-table tbody tr:hover td,
.streams-table tbody tr:hover td.stream-actions-cell { background: var(--row-hover); }
.streams-table tbody tr.selected td,
.streams-table tbody tr.selected td.stream-actions-cell { background: var(--row-selected); }
.streams-table tbody tr.selected td:first-child { box-shadow: inset 2px 0 0 var(--brand); }
.streams-table td strong { font-weight: 500; }

/* Row actions: quiet until hovered, so 300 rows of icons do not shout. */
.stream-row-actions .icon-button,
.row-actions .icon-button {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.stream-row-actions .icon-button:hover,
.row-actions .icon-button:hover { border-color: var(--line); background: var(--chrome); color: var(--text); }
.stream-row-actions .stream-action-danger:hover,
.row-actions .stream-action-danger:hover { color: var(--status-fault); }

/* DVR and push cells: neutral boxes, status colour only in text. */
.dvr-row-cell,
.push-action,
:root[data-theme="dark"] .push-action {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  box-shadow: none;
}
.push-action:hover, :root[data-theme="dark"] .push-action:hover { background: var(--chrome); }

.stream-pager { border-top: 1px solid var(--line); padding: 10px 16px; }
.stream-pager .button.primary, .stream-pager-pages .button.primary { min-width: 32px; }

/* ---- Tabs ----------------------------------------------------- */
.settings-tabs,
.stream-details-tabs {
  gap: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.settings-tabs button,
.stream-details-tab {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 12px;
  box-shadow: none;
}
.settings-tabs button:hover,
.stream-details-tab:hover,
.stream-details-tab:focus-visible { background: transparent; color: var(--text); }
.settings-tabs button.active,
.stream-details-tab.is-active {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--text);
}

/* ---- Toggles -------------------------------------------------- */
.dvr-toggle { border-color: var(--line); background: var(--panel-soft); border-radius: var(--radius); }
.dvr-toggle-track { background: var(--line); }
.dvr-toggle input[type="checkbox"]:checked + .dvr-toggle-track { background: var(--accent); }
.dvr-toggle input[type="checkbox"]:checked + .dvr-toggle-track span { background: var(--on-accent); }
.dvr-toggle strong { font-weight: 500; }

/* ---- Dialogs -------------------------------------------------- */
.modal-backdrop { background: rgba(8, 8, 8, 0.56); }
.stream-details-modal,
.stream-preview-modal,
.confirm-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-dialog);
  background: var(--panel);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}
.modal-head { border-bottom: 1px solid var(--line); padding: 14px 20px; }
.modal-head h2, .modal-title { font-size: 17px; font-weight: 500; letter-spacing: -0.015em; }
.modal-head span { font-family: var(--font-mono); font-size: 12px; }
.modal-body { padding: 16px 20px 20px; }
.section-title h3 { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

/* ---- Toasts --------------------------------------------------- */
.toast {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.toast.is-danger { border-color: color-mix(in srgb, var(--status-fault) 50%, var(--line)); }
.toast.is-warning { border-color: color-mix(in srgb, var(--status-warn) 50%, var(--line)); }
.toast.is-success { border-color: color-mix(in srgb, var(--status-ok) 50%, var(--line)); }

/* Overlay pills on video: solid, no blur. */
[style*="backdrop-filter"], .live-stage-player button { backdrop-filter: none; }

/* ---- Page pass (2026-11-29) ------------------------------------ */
/* Flat surfaces everywhere: no leftover panel shadows. */
#app :is(section, article, nav, aside, header):not(.stream-details-modal):not(.stream-preview-modal):not(.confirm-dialog) { box-shadow: none; }
#app :is(.metric, .alert-summary-card, .settings-status-item, .dvr-command-panel, .api-docs-hero, .inspector) { background-image: none; }

/* Code / URL boxes: quiet mono wells, not black slabs. */
.url-box code, .create-link-preview code, .publish-link code, .dynamic-template-route code,
.authorization-policy-row code, .pusher-row code, .stream-debug pre, .pusher-debug pre,
:root[data-theme="dark"] .pusher-row code, :root[data-theme="dark"] .pusher-debug pre,
:root[data-theme="dark"] .url-box code, :root[data-theme="dark"] .create-link-preview code,
:root[data-theme="dark"] .publish-link code {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Settings tabs: underline, no purple fill in either theme. */
:root .settings-tabs button.active,
:root[data-theme="dark"] .settings-tabs button.active { background: transparent; color: var(--text); box-shadow: inset 0 -2px 0 var(--text); }

/* Alerts: summary cards read like the metric strip; severity = dot + word. */
.alert-summary-card { border-color: var(--line); border-radius: var(--radius-lg); background: var(--panel); }
.alert-summary-card span { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.04em; }
.alert-summary-card strong { font-size: 26px; font-weight: 400; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.alert-summary-card.alert-summary-active { border-color: var(--text); }
.alert-severity { min-height: 20px; border-radius: 0; background: transparent !important; padding: 0; font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.alert-severity-critical, .alert-severity-major { color: var(--status-fault); }
.alert-severity-warning { color: var(--status-warn); }
.alert-severity-info { color: var(--status-record); }

/* DVR channels: actions column was 75 px and clipped "Stream settings" / "Stop recording". */
.dvr-channel-table th:last-child, .dvr-channel-table td:last-child { width: 150px; }
.dvr-channel-table td:last-child .row-actions { flex-direction: column; align-items: stretch; gap: 4px; }
.dvr-channel-table td:last-child .row-actions .button { min-height: 30px; justify-content: center; font-size: 12px; }

/* Native checkboxes / radios / ranges follow the brand mark. */
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--brand); }

/* ---- UX standards pass ----------------------------------------- */
/* Hit targets >= 24 px (WCAG 2.2 2.5.8). */
.streams-table .row-select, .streams-table input[type="checkbox"], .dvr-channel-table input[type="checkbox"] { width: 18px; height: 18px; margin: 3px; cursor: pointer; }
.th-sort { min-height: 24px; padding: 4px 0; }
/* A dialog that receives focus itself keeps its own frame, not the focus ring. */
[role="dialog"][tabindex="-1"]:focus, [role="dialog"][tabindex="-1"]:focus-visible { outline: none; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28); }

/* ============================================================
   Premium layer (2026-11-29): one signature "Bone" card per view,
   editorial numerals, quiet depth from light (inset highlights,
   halos) instead of blur. All static paint: nothing animates per row.
   ============================================================ */
:root {
  --hero-bg: #101010;
  --hero-text: #f5f3f1;
  --hero-muted: #a39b97;
  --edge-light: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --ambient: radial-gradient(1200px 420px at 85% -120px, rgba(238, 96, 24, 0.07), transparent 70%);
}
:root[data-theme="dark"] {
  --hero-bg: #eeeeee;
  --hero-text: #101010;
  --hero-muted: #5f5856;
  --edge-light: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  --ambient: radial-gradient(1200px 460px at 85% -140px, rgba(238, 96, 24, 0.10), transparent 70%);
}

/* Ambient light on the workspace only (scrolls with content, painted once). */
.workspace { background: var(--ambient) no-repeat; }

/* Page title: mono eyebrow + large tight headline. */
.topbar > div:first-child::before {
  content: "Ares Media  /  Control room";
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: pre;
}
.topbar h1 { font-size: 30px; font-weight: 400; letter-spacing: -0.035em; line-height: 1.05; }

/* Metric strip: editorial numerals; the first tile is the signature card. */
.metrics { background: var(--line); border-radius: 14px; }
.metric { box-shadow: var(--edge-light); }
.metric strong { margin-top: 14px; font-size: 34px; font-weight: 300; letter-spacing: -0.045em; line-height: 0.95; }
.metric span { letter-spacing: 0.08em; }
.metric:first-child,
.metric:first-child:hover { background: var(--hero-bg); color: var(--hero-text); box-shadow: none; }
.metric:first-child span,
.metric:first-child p { color: var(--hero-muted); }
.metric:first-child strong { color: var(--hero-text); }
.metric:first-child span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--brand);
  vertical-align: 1px;
}

/* Surfaces: a hairline of light on the top edge, larger radius on frames. */
.panel, .settings-card, .table-panel { border-radius: 14px; box-shadow: var(--edge-light); }
#app :is(.panel, .settings-card, .table-panel) { box-shadow: var(--edge-light); }
.table-panel .panel-head { padding: 16px 20px; }
.panel-head h2 { font-size: 16px; letter-spacing: -0.015em; }
.stream-details-modal, .stream-preview-modal, .confirm-dialog { border-radius: 16px; box-shadow: var(--edge-light), 0 32px 80px rgba(0, 0, 0, 0.34); }

/* Status dots carry a soft halo, so live state reads at a glance. */
.status > span { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }

/* Primary action: ink pill with a lit top edge. */
.button.primary { border-radius: 999px; padding: 0 18px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16); }
:root[data-theme="dark"] .button.primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7); }
.segments { border-radius: 999px; }
.segments button { border-radius: 999px; padding: 0 14px; }

/* Sidebar: brand lockup and an instrument-style footer. */
.brand-mark { border-radius: 10px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 1px rgba(238, 96, 24, 0.4); font-family: var(--font-mono); }
.brand strong { font-size: 16px; letter-spacing: -0.02em; }
.nav a.active { font-weight: 600; }
.sidebar-foot { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0 2px; box-shadow: var(--edge-light); }
.sidebar-foot strong::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--status-live);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-live) 20%, transparent);
  vertical-align: 1px;
}

/* Row actions: ghost icons; only "watch" keeps a quiet live ring. */
#app .stream-row-actions .icon-button,
#app .row-actions .icon-button { border-color: transparent; background: transparent; color: var(--muted); }
#app .stream-row-actions .icon-button:hover,
#app .row-actions .icon-button:hover { border-color: var(--line); background: var(--chrome); color: var(--text); }
#app .stream-row-actions .stream-action-preview { border-color: color-mix(in srgb, var(--status-live) 35%, transparent); color: var(--status-live); }
#app .stream-row-actions .stream-action-danger:hover { border-color: color-mix(in srgb, var(--status-fault) 45%, transparent); color: var(--status-fault); background: color-mix(in srgb, var(--status-fault) 10%, transparent); }
.sidebar-foot { margin-top: auto; }

/* Alert summary tiles join the metric language (one signature card per view stays in the metric strip). */
.alert-summary-card { box-shadow: var(--edge-light); border-radius: 14px; }
.alert-summary-card strong { font-size: 34px; font-weight: 300; letter-spacing: -0.045em; }

/* ---- Sign-in / setup: the first impression ---------------------- */
.auth-page {
  background:
    radial-gradient(900px 520px at 78% 18%, rgba(238, 96, 24, 0.12), transparent 65%),
    radial-gradient(700px 420px at 10% 100%, color-mix(in srgb, var(--text) 5%, transparent), transparent 70%),
    var(--bg);
  padding: 40px;
}
/* Faint console grid, faded out at the edges (static, painted once). */
.auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
}
.auth-shell-card { position: relative; width: min(1080px, 100%); gap: 40px; }
.auth-identity .brand-mark { width: 36px; height: 36px; }
.auth-identity strong { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.auth-identity span { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.auth-shell-grid { grid-template-columns: minmax(300px, 1fr) minmax(360px, 440px); gap: 64px; }
.auth-copy { max-width: 520px; gap: 18px; }
.auth-kicker { color: var(--muted); font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; }
.auth-kicker::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(238, 96, 24, 0.18);
  vertical-align: 1px;
}
.auth-copy h1 { font-size: clamp(44px, 5.4vw, 72px); font-weight: 300; letter-spacing: -0.05em; line-height: 0.98; }
.auth-copy p { max-width: 420px; font-size: 15px; }
/* Signal meter: one decorative element, pure gradients. */
.auth-copy::after {
  content: "";
  display: block;
  height: 40px;
  margin-top: 12px;
  max-width: 360px;
  background:
    linear-gradient(90deg, var(--brand) 0 3px, transparent 3px) 0 100% / 12px 70% repeat-x,
    linear-gradient(90deg, color-mix(in srgb, var(--text) 22%, transparent) 0 3px, transparent 3px) 0 100% / 12px 100% repeat-x;
  -webkit-mask-image: linear-gradient(90deg, #000, #000 40%, transparent);
  mask-image: linear-gradient(90deg, #000, #000 40%, transparent);
  opacity: 0.85;
}
.auth-page .auth-gate {
  gap: 18px;
  border-color: var(--line);
  border-radius: 20px;
  background: var(--panel);
  padding: 28px;
  box-shadow: var(--edge-light), 0 40px 100px rgba(0, 0, 0, 0.28);
}
.auth-gate .panel-head { border: 0; background: transparent; padding: 0; }
.auth-gate .panel-head h2 { font-size: 22px; font-weight: 400; letter-spacing: -0.03em; }
.auth-gate .field input { min-height: 44px; border-radius: 10px; font-size: 15px; }
.auth-gate .stream-edit-actions { border-top: 0; padding-top: 4px; }
.auth-gate .button.primary { width: 100%; min-height: 46px; justify-content: center; font-size: 14px; }
@media (max-width: 860px) {
  .auth-shell-grid { grid-template-columns: 1fr; gap: 28px; }
  .auth-copy::after { display: none; }
  .auth-copy h1 { font-size: 40px; }
}
.auth-page .auth-gate .panel-head { border: 0; background: transparent; padding: 0 0 6px; }

/* ---- Dialogs: premium entrance (opacity/transform only, once) ---- */
.modal-backdrop { background: rgba(6, 6, 6, 0.62); }
/* Only on open (JS adds .v3-enter once), not on every re-render inside the dialog. */
.modal-backdrop.v3-enter { animation: v3-fade 160ms ease-out both; }
.modal-backdrop.v3-enter > [role="dialog"], .confirm-dialog { animation: v3-rise 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes v3-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes v3-rise { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head { padding: 18px 24px; background: transparent; }
.modal-head h2, .modal-title { font-size: 20px; font-weight: 400; letter-spacing: -0.03em; }
.modal-body { padding: 20px 24px 24px; }
.stream-details-tab-panel > .panel, .stream-details-tab-panel > form, .modal-body .settings-card { border-radius: 12px; }
.confirm-dialog { padding: 28px; }
.confirm-dialog h2 { font-size: 19px; font-weight: 400; letter-spacing: -0.025em; }

/* Empty states: centred, quiet, with a small mark instead of bare text. */
.empty-row, .empty-state { color: var(--muted); font-size: 13px; }
.empty-state::before, td.empty-row::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 10px;
  border: 1px dashed color-mix(in srgb, var(--text) 25%, transparent);
  border-radius: 8px;
}

/* Toasts: dark capsule in both themes, like a console notification. */
.toast { border-radius: 12px; box-shadow: var(--edge-light), 0 18px 48px rgba(0, 0, 0, 0.3); }

/* ---- Settings / API docs dark: replace the old navy block with tokens ---- */
:root[data-theme="dark"] .api-docs-hero { background: var(--panel); border-color: var(--line); box-shadow: var(--edge-light); }
:root[data-theme="dark"] .section-eyebrow,
:root[data-theme="dark"] .api-hero-pills > span,
:root[data-theme="dark"] .api-route-chip,
:root[data-theme="dark"] .api-route-meta > span { background: var(--chrome); border-color: var(--line); }
:root[data-theme="dark"] .api-docs-summary div,
:root[data-theme="dark"] .api-quickstart article,
:root[data-theme="dark"] .api-route-card,
:root[data-theme="dark"] .settings-card { background: var(--panel); border-color: var(--line); box-shadow: var(--edge-light); }
:root[data-theme="dark"] .settings-tabs { background: transparent; border-color: var(--line); box-shadow: none; }
:root[data-theme="dark"] .settings-tabs button { color: var(--muted); }
:root[data-theme="dark"] .settings-tabs button:hover { background: transparent; color: var(--text); }
:root[data-theme="dark"] .settings-control-details div,
:root[data-theme="dark"] .settings-route-details div,
:root[data-theme="dark"] .settings-worker-details div,
:root[data-theme="dark"] .settings-dvr-summary div,
:root[data-theme="dark"] .settings-delivery-intro,
:root[data-theme="dark"] .settings-template-create,
:root[data-theme="dark"] .settings-template-item,
:root[data-theme="dark"] .settings-edge-port-note,
:root[data-theme="dark"] .settings-status-item,
:root[data-theme="dark"] .protocol-badge,
:root[data-theme="dark"] .page-settings .dvr-toggle,
:root[data-theme="dark"] .settings-debug-inline,
:root[data-theme="dark"] .settings-protocol-option span,
:root[data-theme="dark"] .settings-dynamic-controls,
:root[data-theme="dark"] .settings-db-path,
:root[data-theme="dark"] .settings-db-backups,
:root[data-theme="dark"] .settings-db-summary div,
:root[data-theme="dark"] .settings-db-backup-details div,
:root[data-theme="dark"] .settings-alert-config-card .alert-rules-toolbar,
:root[data-theme="dark"] .settings-alert-config-card .alert-rules-note,
:root[data-theme="dark"] .settings-alert-config-card .alert-rule-group > header,
:root[data-theme="dark"] .settings-alert-config-card .alert-rule-editor,
:root[data-theme="dark"] .settings-alert-config-card .alert-rule-fixed { background: var(--panel-soft); border-color: var(--line); }
:root[data-theme="dark"] .settings-protocol-option input:checked + span { background: var(--chrome); border-color: var(--text); }
:root[data-theme="dark"] .page-settings .field input,
:root[data-theme="dark"] .page-settings .field select,
:root[data-theme="dark"] .settings-alert-config-card .alert-rule-controls .field input,
:root[data-theme="dark"] .settings-alert-config-card .alert-rule-controls .field select { background: var(--panel-soft); border-color: var(--line); }

/* Collapsed sidebar (<=1200px): mark only, no squeezed lockup. */
.brand-mark { flex: 0 0 auto; }
@media (max-width: 1200px) {
  .brand div:last-child { display: none; }
  .brand { padding: 0 0 12px; }
  .nav a.active::before { left: -8px; }
  .topbar > div:first-child::before { content: "Control room"; }
}

/* ============================================================
   Motion (2026-11-29). Rules: transform + opacity only, one-shot
   entrances scoped to .v3-page-enter (set by render() only when the
   page changes), no per-row or infinite animations on lists.
   prefers-reduced-motion collapses everything (styles.css rule).
   ============================================================ */
:root { --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1); }
@keyframes v3-rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes v3-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes v3-grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Page entrance: header, metric tiles (staggered), then panels. */
.v3-page-enter .topbar { animation: v3-rise-in 420ms var(--ease-out) backwards; }
.v3-page-enter .metric { animation: v3-rise-in 460ms var(--ease-out) backwards; }
.v3-page-enter .metric:nth-child(1) { animation-delay: 40ms; }
.v3-page-enter .metric:nth-child(2) { animation-delay: 80ms; }
.v3-page-enter .metric:nth-child(3) { animation-delay: 120ms; }
.v3-page-enter .metric:nth-child(4) { animation-delay: 160ms; }
.v3-page-enter .metric:nth-child(5) { animation-delay: 200ms; }
.v3-page-enter .metric:nth-child(n+6) { animation-delay: 240ms; }
.v3-page-enter .workspace > :not(.topbar):not(.metrics) { animation: v3-rise-in 520ms var(--ease-out) 180ms backwards; }
.v3-page-enter .workspace > :not(.topbar):not(.metrics) ~ :not(.topbar):not(.metrics) { animation-delay: 260ms; }
.v3-page-enter .alert-summary-card { animation: v3-rise-in 460ms var(--ease-out) 160ms backwards; }
.v3-page-enter .nav a.active::before { transform-origin: center; animation: v3-grow-y 360ms var(--ease-spring) backwards; }
.v3-page-enter .sidebar { animation: none; }

/* Sign-in: copy rises, card follows, meter sweeps. */
.v3-page-enter .auth-identity { animation: v3-rise-in 500ms var(--ease-out) backwards; }
.v3-page-enter .auth-copy { animation: v3-rise-in 600ms var(--ease-out) 80ms backwards; }
.v3-page-enter .auth-page .auth-gate { animation: v3-rise-in 640ms var(--ease-out) 180ms backwards; }
@keyframes v3-meter { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.95; } }
.auth-copy::after { animation: v3-meter 3.2s ease-in-out infinite; }

/* Micro-interactions: lift on hover, press on click, quick colour easing. */
.button, .icon-button, .segments button, .nav a, .push-action, .alert-topbar-badge {
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 160ms var(--ease-out), box-shadow 160ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:active, .icon-button:active, .segments button:active { transform: translateY(0) scale(0.97); transition-duration: 60ms; }
.button.primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 8px 20px rgba(16, 16, 16, 0.18); }
:root[data-theme="dark"] .button.primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 24px rgba(238, 238, 238, 0.12); }
.nav a:hover > .icon { transform: translateX(1px); }
.nav a > .icon { transition: transform 160ms var(--ease-out); }
.metric { transition: transform 200ms var(--ease-out); }
.metric:hover { transform: translateY(-1px); }
.streams-table tbody td { transition: background-color 120ms ease; }
.segments button.active { animation: v3-fade-in 180ms ease both; }

/* Live signals: only two dots breathe (hero metric + sidebar), never table rows. */
@keyframes v3-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.metric:first-child span::before, .sidebar-foot strong::before, .auth-kicker::before { animation: v3-breathe 2.4s ease-in-out infinite; }

/* Theme switch: circular reveal from the toggle (View Transitions API). */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: v3-reveal 560ms var(--ease-out); }
@keyframes v3-reveal {
  from { clip-path: circle(0 at var(--reveal-x, 90%) var(--reveal-y, 0)); }
  to { clip-path: circle(150vmax at var(--reveal-x, 90%) var(--reveal-y, 0)); }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-new(root) { animation: none; }
  .button:hover, .metric:hover { transform: none; }
}

/* Streams table on 1024–1360px screens: drop Template and Pushes (both are in
   Stream settings) so titles and the source URL stay readable. */
@media (min-width: 721px) and (max-width: 1360px) {
  .streams-table th:nth-child(4), .streams-table td:nth-child(4),
  .streams-table th:nth-child(12), .streams-table td:nth-child(12) { display: none; }
  .streams-table th:nth-child(2), .streams-table td:nth-child(2) { width: auto; min-width: 150px; }
  .streams-table th:nth-child(3), .streams-table td:nth-child(3) { width: 112px; }
  .streams-table th:nth-child(6), .streams-table td:nth-child(6) { width: 170px; min-width: 170px; }
}

/* Stream page -> Play sessions. */
.play-sessions { display: grid; gap: 10px; }
.play-sessions-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.play-sessions-summary strong { color: var(--text); font-size: 16px; font-variant-numeric: tabular-nums; }
.play-sessions .table-wrap { max-height: 520px; overflow: auto; }
.play-sessions-table td { vertical-align: top; }
.play-sessions-table td.tabular { font-variant-numeric: tabular-nums; white-space: nowrap; }
.play-sessions-table td > span:not(.auth-v2-chip):not(.auth-v2-muted) { display: block; color: var(--muted); font-size: 11px; }
.play-sessions-ua { min-width: 220px; max-width: 360px; white-space: normal; overflow-wrap: anywhere; font-size: 12px; color: var(--muted); }
.play-sessions-attribution { margin: 0; font-size: 11px; color: var(--muted); text-align: right; }
.play-sessions-attribution a { color: inherit; }
.play-sessions-kick { color: var(--status-fault); }
.play-sessions-kick:hover { color: var(--status-fault); border-color: currentColor; background: color-mix(in srgb, var(--status-fault) 10%, transparent); }

/* Settings -> Authorization (one page, numbered sections). */
.auth-v2 { display: grid; gap: 14px; }
.auth-v2-card { padding: 0; overflow: hidden; }
.auth-v2-head { padding: 16px 18px; border-bottom: 1px solid var(--line-soft); margin: 0; }
.auth-v2-head h2 { display: flex; align-items: center; gap: 10px; }
.auth-v2-step {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 999px;
  background: var(--panel-soft); border: 1px solid var(--line); color: var(--muted);
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.auth-v2-body { display: grid; gap: 12px; padding: 16px 18px; }
.auth-v2-card > .auth-v2-form { padding: 16px 18px; }
.auth-v2-body > .auth-v2-form { border-top: 1px solid var(--line-soft); padding-top: 14px; }
.auth-v2-muted, .auth-v2-note { color: var(--muted); font-size: 12px; margin: 0; }
.auth-v2-note { padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--radius); }
.auth-v2-loading, .auth-v2-alert { padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); color: var(--muted); }
.auth-v2-alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--status-fault); }

.auth-v2-switch { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel-soft); cursor: pointer; }
.auth-v2-switch input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }
.auth-v2-switch span { display: grid; gap: 2px; }
.auth-v2-switch em { font-style: normal; color: var(--muted); font-size: 12px; }

.auth-v2-modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.auth-v2-mode {
  position: relative; display: grid; gap: 4px; align-content: start; padding: 12px 14px 12px 38px;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.auth-v2-mode:hover { border-color: color-mix(in srgb, var(--text) 28%, var(--line)); }
.auth-v2-mode input { position: absolute; left: 14px; top: 14px; margin: 0; accent-color: var(--brand); }
.auth-v2-mode span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.auth-v2-mode.is-selected { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--panel)); box-shadow: 0 0 0 1px var(--brand) inset; }

.auth-v2-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.auth-v2-check {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: start; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.auth-v2-check:hover { border-color: color-mix(in srgb, var(--text) 28%, var(--line)); }
.auth-v2-check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--brand); }
.auth-v2-check span { display: grid; gap: 2px; }
.auth-v2-check em { font-style: normal; color: var(--muted); font-size: 12px; line-height: 1.4; }
.auth-v2-check small { grid-column: 2; color: var(--muted); font-size: 11px; font-family: var(--mono, ui-monospace, monospace); }
.auth-v2-check.is-on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--panel)); box-shadow: 0 0 0 1px var(--brand) inset; }
.auth-v2-combine { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: var(--radius-lg); font-size: 13px; }
.auth-v2-combine > span { color: var(--muted); }
.auth-v2-combine label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.auth-v2-combine input { accent-color: var(--brand); margin: 0; }
.auth-v2-combine em { font-style: normal; color: var(--muted); font-size: 12px; }
.auth-v2-summary { margin: 0; padding: 12px 14px; border-radius: var(--radius-lg); background: var(--panel-soft); border: 1px solid var(--line); font-weight: 600; }
.auth-v2-summary.is-public { color: var(--status-warn, #b7791f); }
.auth-v2-checks.is-compact { grid-template-columns: repeat(4, max-content); gap: 6px; margin-bottom: 4px; }
.auth-v2-checks.is-compact .auth-v2-check { grid-template-columns: auto auto; padding: 4px 8px; border-radius: 999px; font-size: 12px; }
.auth-v2-checks.is-compact .auth-v2-combine { padding: 4px 10px; font-size: 12px; }
.auth-v2-checks.is-compact .auth-v2-combine em { display: none; }
.auth-v2-row-summary { display: block; color: var(--muted); font-size: 12px; }
.auth-v2-warnings { margin: 0; padding: 10px 14px 10px 30px; border: 1px solid color-mix(in srgb, var(--status-warn, #b7791f) 45%, var(--line)); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--status-warn, #b7791f) 8%, var(--panel)); color: var(--text); font-size: 13px; display: grid; gap: 4px; }
.auth-v2-warnings li::marker { color: var(--status-warn, #b7791f); }
td .auth-v2-warnings { margin-top: 6px; padding: 6px 10px 6px 24px; font-size: 12px; }
.auth-v2-save-row { justify-content: flex-start; }
.auth-v2-row-actions { display: inline-flex; gap: 6px; margin-top: 6px; }
.auth-v2-row-actions .button { min-height: 28px; padding: 0 10px; }
.auth-v2-check-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.auth-v2-chip.is-pass { color: var(--status-live, #1f9d55); border-color: currentColor; background: transparent; }
.auth-v2-chip.is-fail { color: var(--status-fault); border-color: currentColor; background: transparent; }
.auth-v2-chip.is-log { color: var(--muted); border-style: dashed; background: transparent; }

.auth-v2-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; align-items: end; }
.auth-v2-form .field { margin: 0; }
.auth-v2-form textarea { min-height: 96px; resize: vertical; font-family: var(--mono, ui-monospace, monospace); }
.auth-v2-form .check-row { align-self: center; }
.auth-v2-form-title { grid-column: 1 / -1; font-size: 13px; }
.auth-v2-span2 { grid-column: span 2; }
.auth-v2-span-all { grid-column: 1 / -1; }
.auth-v2-form .stream-edit-actions { display: flex; align-items: center; gap: 10px; }
.auth-v2-inline { max-width: 320px; }
.auth-v2-protocols { display: flex; flex-wrap: wrap; gap: 6px 16px; border: 0; padding: 0; margin: 0; }
.auth-v2-protocols legend { font-size: 12px; color: var(--muted); margin-bottom: 6px; padding: 0; }

.auth-v2 .auth-v2-table { width: 100%; min-width: 0; table-layout: auto; }
.auth-v2-table .empty-state { min-height: 0; padding: 14px 0; }
.auth-v2-table .empty-state::before { display: none; }
.auth-v2-table td > span { display: block; color: var(--muted); font-size: 11px; }
.auth-v2-table code { font-size: 12px; word-break: break-all; }
.auth-v2-actions { white-space: nowrap; text-align: right; }
.auth-v2-actions .button { min-height: 30px; padding: 0 10px; margin-left: 4px; }
.auth-v2-chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel-soft); font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap;
}
.auth-v2-chip.is-warn { color: var(--status-warn, #b7791f); border-color: currentColor; background: transparent; }
.auth-v2 [data-as-sessions] .table-wrap, .auth-v2-card .table-wrap { max-height: 460px; overflow: auto; }

.auth-v2-stream-filter { height: var(--control); max-width: 320px; }
.auth-v2-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.auth-v2-filters input, .auth-v2-filters select { height: var(--control); width: 160px; }
.auth-v2-filters .segments { margin-left: auto; }

.auth-v2-result { display: grid; gap: 8px; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--line); border-left-width: 4px; background: var(--panel-soft); }
.auth-v2-result.is-allowed { border-left-color: var(--status-live, #1f9d55); }
.auth-v2-result.is-denied { border-left-color: var(--status-fault); }
.auth-v2-result-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.auth-v2-backend-message { margin: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.auth-v2-backend-message q { font-weight: 500; }
.auth-v2-backend-results { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.auth-v2-result-head > span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.auth-v2-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; margin: 8px 0 0; }
.auth-v2-fields div { display: flex; gap: 8px; min-width: 0; font-size: 12px; }
.auth-v2-fields dt { color: var(--muted); }
.auth-v2-fields dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono, ui-monospace, monospace); }

.auth-v2-issued { display: grid; gap: 8px; margin: 0 18px 4px; padding: 14px; border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--line)); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--brand) 5%, var(--panel)); }
.auth-v2-issued .url-box { display: flex; align-items: center; gap: 8px; }
.auth-v2-issued .url-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.auth-v2-advanced { padding: 0; }
.auth-v2-advanced > summary { display: block; padding: 14px 18px; cursor: pointer; list-style: none; }
.auth-v2-advanced > summary::-webkit-details-marker { display: none; }
.auth-v2-advanced > summary::before { content: "▸"; margin-right: 8px; color: var(--muted); }
.auth-v2-advanced[open] > summary::before { content: "▾"; }
.auth-v2-advanced > summary span { display: block; margin: 2px 0 0 18px; color: var(--muted); font-size: 12px; }
.auth-v2-advanced[open] > summary { border-bottom: 1px solid var(--line-soft); }
@media (max-width: 1100px) {
  .auth-v2-modes, .auth-v2-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Streams list: Source URL column (masked URL + copy, protocol underneath). */
.streams-table th:nth-child(5), .streams-table td:nth-child(5) { width: 16%; min-width: 180px; }
.streams-table td.stream-source-cell { max-width: 0; overflow: hidden; }
.stream-source-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.stream-source-line code { min-width: 0; overflow: hidden; font-family: var(--font-mono); font-size: 12px; color: var(--text); white-space: normal; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.stream-source-line .icon-button { flex: 0 0 auto; }
.stream-source-kind { display: block; margin-top: 2px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------------------------------------------------------------------------
   Icon set v4 (2026-12-03): duotone line icons.
   Stroke = currentColor; .t = soft tone fill; .a = brand accent dot.
   --------------------------------------------------------------------------- */
.icon svg { stroke-width: 1.7; overflow: visible; }
.icon svg .t { fill: currentColor; stroke: none; opacity: 0.16; transition: opacity 180ms ease; }
.icon svg .a { fill: var(--brand, #ee6018); stroke: none; }
:root[data-theme="dark"] .icon svg .t { opacity: 0.22; }
/* Tone deepens on hover / focus / active, accent stays still. */
.button:hover .icon svg .t, .icon-button:hover .icon svg .t, .nav a:hover .icon svg .t,
.button:focus-visible .icon svg .t, .icon-button:focus-visible .icon svg .t { opacity: 0.3; }
.nav a .icon { width: 18px; height: 18px; }
.nav a .icon svg { width: 18px; height: 18px; }
.nav a.active .icon svg .t { opacity: 0.34; }
.nav a.active .icon svg { stroke-width: 1.85; }
/* Destructive and muted contexts: accent follows the text colour. */
.button.danger .icon svg .a, .icon-button.danger .icon svg .a,
.button:disabled .icon svg .a, .icon-button:disabled .icon svg .a { fill: currentColor; }
/* A small, interruptible flourish on hover for nav icons only. */
@media (prefers-reduced-motion: no-preference) {
  .nav a > .icon svg { transition: transform 220ms var(--ease-out, ease); transform-origin: 50% 50%; }
  .nav a:hover > .icon svg { transform: scale(1.08) rotate(-4deg); }
}
/* Streams list: Source URL column (masked URL + copy, protocol underneath). */
.streams-table th:nth-child(5), .streams-table td:nth-child(5) { width: 16%; min-width: 180px; }
.streams-table td.stream-source-cell { max-width: 0; overflow: hidden; }
.stream-source-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.stream-source-line code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 12px; color: var(--text); }
.stream-source-line .icon-button { flex: 0 0 auto; }
.stream-source-kind { display: block; margin-top: 2px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
/* One line: the whole URL when it fits, otherwise cut with "…" and shown in
   full on hover (the cell's title) and by the copy button. */
.stream-source-line code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 1.35; cursor: help; }

/* ---- DVR page v3 (2026-12-03) ---------------------------------
   One headline answers "is DVR recording?"; the streams table comes
   next; storage settings last. Status colour only on state marks. */
.dvr-page-v3 .dvr-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dvr-overview { padding: 16px 18px; border-left: 3px solid var(--line); }
.dvr-overview-ok { border-left-color: var(--success); }
.dvr-overview-warn { border-left-color: var(--warning); }
.dvr-overview-fault { border-left-color: var(--danger); }
.dvr-overview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dvr-overview-head .eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.dvr-overview-head h2 { margin: 4px 0 2px; font-size: 18px; font-weight: 500; letter-spacing: -0.015em; }
.dvr-overview-head p { margin: 0; color: var(--muted); max-width: 72ch; }
.dvr-overview-head .button { flex: none; }
.dvr-overview-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 14px 0 0; border-top: 1px solid var(--line-soft); }
.dvr-overview-stats > div { padding: 10px 12px 0 0; min-width: 0; }
.dvr-overview-stats > div + div { padding-left: 12px; border-left: 1px solid var(--line-soft); }
.dvr-overview-stats dt { font-size: 12px; color: var(--muted); }
.dvr-overview-stats dd { margin: 2px 0 0; font-family: var(--font-mono); font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dvr-overview-stats dd small { margin-left: 6px; font-family: var(--font-text); font-size: 12px; font-weight: 400; color: var(--muted); }
.dvr-disk-warn dd { color: var(--warning); }
.dvr-disk-fault dd { color: var(--danger); }

.dvr-streams-panel .dvr-channel-table td { vertical-align: middle; }
.dvr-stream-cell strong, .dvr-state-cell .dvr-state { display: block; }
.dvr-stream-cell span, .dvr-state-cell > span:last-child, .dvr-depth-line span { display: block; font-size: 12px; color: var(--muted); }
.dvr-state { display: inline-flex !important; align-items: center; gap: 6px; font-weight: 500; }
.dvr-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.dvr-state-on i { background: var(--success); }
.dvr-state-waiting i { background: var(--warning); }
.dvr-state-error i { background: var(--danger); }
.dvr-state-error { color: var(--danger); }
.dvr-state-off { color: var(--muted); }
.dvr-depth-cell { min-width: 160px; }
.dvr-depth-line { display: flex; align-items: baseline; gap: 6px; }
.dvr-depth-line strong { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.dvr-depth-meter { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--line-soft); overflow: hidden; }
.dvr-depth-meter b { display: block; height: 100%; background: var(--text); opacity: 0.55; }
.dvr-page-v3 .dvr-channel-table { table-layout: fixed; width: 100%; }
.dvr-page-v3 .dvr-channel-table :is(th, td):nth-child(1) { width: auto; }
.dvr-page-v3 .dvr-channel-table :is(th, td):nth-child(2) { width: 22%; }
.dvr-page-v3 .dvr-channel-table :is(th, td):nth-child(3) { width: 24%; }
.dvr-page-v3 .dvr-channel-table :is(th, td):nth-child(4) { width: 11%; }
.dvr-page-v3 .dvr-channel-table :is(th, td):nth-child(5) { width: 172px; }
.dvr-page-v3 .dvr-channel-table td:last-child .row-actions .button { width: auto; flex: none; }
.dvr-page-v3 .dvr-channel-table td:last-child .row-actions { flex-direction: row; align-items: center; justify-content: flex-end; }
.button.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.button.ghost:hover { background: var(--chrome); }
.button.danger-text { color: var(--danger); }

.dvr-settings-v3 .panel-head span { color: var(--muted); }
.dvr-settings-v3 .dvr-config-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.dvr-settings-v3 .dvr-config-grid .dvr-path-field { grid-column: 1 / -1; }
.dvr-settings-v3 .field > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dvr-settings-v3 .field small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.dvr-settings-v3 .dvr-master-toggle em { color: var(--muted); font-style: normal; }
.dvr-settings-v3 .dvr-advanced { margin-top: 10px; }
.dvr-settings-v3 .dvr-advanced summary strong { font-weight: 400; color: var(--muted); }
.dvr-recorder-options.is-unused > :not(summary) { opacity: 0.6; }
.dvr-settings-meta { font-size: 12px; color: var(--muted); }
.dvr-settings-v3 .dvr-command-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
@media (max-width: 1200px) { .dvr-overview-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dvr-overview-stats > div:nth-child(3) { border-left: 0; padding-left: 0; } }
.dvr-page.dvr-page-v3 { grid-template-columns: minmax(0, 1fr); }
/* DVR settings v4: three titled columns, underline inputs, actions top right. */
.dvr-settings-v4 { padding: 0; }
.dvr-settings-v4 .dvr-form-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.dvr-settings-v4 .dvr-form-head h2 { margin: 0; font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.dvr-settings-v4 .dvr-form-head > div > span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.dvr-form-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.dvr-settings-v4 .dvr-master-toggle { padding: 6px 10px; }
.dvr-settings-v4 .dvr-master-toggle em { font-style: normal; color: var(--muted); }
.dvr-form-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.dvr-form-columns > section { padding: 16px 18px 20px; min-width: 0; }
.dvr-form-columns > section + section { border-left: 1px solid var(--line-soft); }
.dvr-form-columns h3 { margin: 0 0 12px; font-size: 18px; font-weight: 400; letter-spacing: -0.01em; }
.dvr-form-field { display: block; margin: 0 0 14px; }
.dvr-form-field > span:first-child { display: block; font-size: 12px; color: var(--muted); }
.dvr-form-input { display: flex; align-items: baseline; gap: 6px; border-bottom: 1px solid var(--line); }
.dvr-form-input:focus-within { border-bottom-color: var(--brand); }
.dvr-form-input input, .dvr-form-input select { flex: 1; min-width: 0; height: 32px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; box-shadow: none; outline: none; }
.dvr-form-input em { font-style: normal; font-size: 12px; color: var(--muted); }
.dvr-form-field small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.dvr-settings-v4 .dvr-recorder-options { margin: 0 18px 18px; }
.dvr-settings-v4 .dvr-advanced summary strong { font-weight: 400; color: var(--muted); }
@media (max-width: 1200px) { .dvr-form-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dvr-form-columns > section:nth-child(3) { border-left: 0; border-top: 1px solid var(--line-soft); } }
/* Named DVRs */
.dvr-profiles { display: flex; flex-direction: column; gap: 12px; }
.dvr-profiles-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 6px 2px 0; }
.dvr-profiles-head h2 { margin: 0; font-size: 18px; font-weight: 400; }
.dvr-profiles-head span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.dvr-profile-filter { width: 100%; height: 30px; margin: 0 0 8px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-soft); color: var(--text); font: inherit; font-size: 13px; }
.dvr-profile-streams { max-height: 232px; overflow: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.dvr-profile-streams label { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line-soft); font-size: 13px; cursor: pointer; }
.dvr-profile-streams label:last-child { border-bottom: 0; }
.dvr-profile-streams label[hidden] { display: none; }
.dvr-profile-streams label span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dvr-profile-streams label em { font-style: normal; font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.dvr-profile-streams label.is-taken { cursor: default; opacity: 0.55; }
.dvr-profile-streams p { margin: 0; padding: 10px; color: var(--muted); font-size: 13px; }