* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

:root {
  color-scheme: dark;
  --bg: #0f1017;
  --panel: #171923;
  --panel-2: #202330;
  --border: #303341;
  --text: #edf0f7;
  --muted: #a5acc0;
  --accent: #a78bfa;
  --primary: #7c3aed;
  --selected: #252039;
  --live: #4ade80;
  --danger: #f87171;
  --gift: #f0567a;
  --accent-2: #ffb86b;
  --good: #4ade80;
  --gem: #7dd3fc;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --radius: 6px;
  --radius-lg: 10px;
  --hit: 36px;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-md: 0.9375rem;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  --header-row: 3.5rem;
  --sidebar-w: 0px;
  --nav-bar-h: 0px;
  --live-rail-h: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: calc(var(--header-row) + var(--safe-top));
  /* visualViewport overwrites this in px when the software keyboard is up. */
  --vvh: 100dvh;
  /* Channel hues for the timeline: twelve categorical slots stepped for a
     dark surface, in a fixed order — a channel keeps its hue whatever the
     filters leave beside it. Past twelve, auto reuses a hue with a different
     fill (stripe / dots / ring) rather than inventing a thirteenth colour. */
  --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500;
  --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767;
  --cat-9: #1aa6b8; --cat-10: #e08b2e; --cat-11: #5c7cfa; --cat-12: #c92a2a;
  /* Flags. Three levels, and the colour has to carry the difference at a
     glance in a table full of pink accents — so the top level is the only
     red on the page, and "watch" is deliberately quiet: most flags are
     notes, and if every one of them shouted none of them would. */
  --flag-watch: #a5b4fc;
  --flag-warn: #ffb86b;
  --flag-block: #f87171;
  /* Friendlies. Warm and filled so a marked name reads at a glance, and
     distinct from the green used for "live" and "tracked". */
  --friendly: #e6c15a;
  --friendly-ink: #1a1408;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); font-weight: normal; }
/* Small sign-in footer. */
.attrib { text-align: center; font-size: 0.75rem; color: var(--muted); padding: 1.5rem 0 0.5rem; }
.attrib a { color: var(--muted); }
.attrib a:hover { color: var(--text); }
.error { color: #f87171; margin-top: 0.5rem; }

/* login */
#login-view {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: max(var(--space-4), var(--safe-top)) var(--space-4) max(var(--space-4), var(--safe-bottom));
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  width: min(360px, 100%);
  display: flex; flex-direction: column; gap: var(--space-4);
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.15rem; }
.login-card input { min-height: var(--hit); }
.login-card button { min-height: 40px; }

/* header — one row, never wraps; the tab strip scrolls sideways instead. */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--space-2);
  /* content-box so --safe-top padding is added on top of the 3rem row instead
     of eating it — otherwise a notched phone crushes the tabs. */
  box-sizing: content-box;
  padding: var(--safe-top) var(--space-4) 0;
  height: var(--header-row);
  min-height: var(--header-row);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: nowrap;
  flex: 0 0 auto;
}
.app-header h1 {
  font-size: 0.88rem; margin-right: 0; flex: 0 0 auto;
  font-weight: 600; white-space: nowrap;
}
.app-header h1 .icon-gift { color: var(--muted); }
.app-nav {
  display: flex; gap: 0.15rem;
  flex: 1 1 auto; min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.app-nav::-webkit-scrollbar { display: none; }
.app-nav .tab { white-space: nowrap; }
.header-actions {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
#header-more { display: none; }
.header-overflow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
#logout { flex: 0 0 auto; padding: 0.25rem 0.6rem; font-size: 0.8rem; }

button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  touch-action: manipulation;
  min-height: var(--hit);
  font-weight: 500;
}
button:hover { filter: brightness(1.1); }
button:disabled { cursor: default; opacity: 0.5; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.ghost, button.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
button.tab {
  position: relative;
  padding: 0.22rem 0.5rem;
  font-size: var(--text-sm);
}
button.tab.active {
  color: var(--text);
  background: var(--panel-2);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
button.tab.active::after {
  content: "";
  position: absolute;
  left: 0.35rem;
  right: 0.35rem;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}
button.tiny {
  min-height: var(--hit); min-width: var(--hit);
  padding: 0.3rem 0.65rem; font-size: var(--text-sm);
  display: inline-flex; align-items: center; justify-content: center;
}
button.danger { background: transparent; border: 1px solid #7f1d1d; color: #f87171; }

/* live / quota rail — sticky under the header, no gradient slab */
#live-banner {
  position: sticky; top: var(--header-h); z-index: 19;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.25rem 1rem;
  min-height: var(--hit);
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem;
  background: var(--panel);
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}
#live-banner .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--live); margin-right: 0.35rem; flex: none;
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 50% { opacity: 0.3; } }
#live-banner.quota {
  background: var(--panel);
  border-bottom-color: #f59e0b;
}
#live-banner.quota .dot { background: #f59e0b; animation: none; }

/* toasts
   A popover, so it shares the top layer with the #overlay <dialog> instead of
   rendering behind its backdrop. `inset: auto` undoes the centring a popover
   gets by default. */
#toasts {
  position: fixed;
  inset: auto max(1rem, env(safe-area-inset-right, 0px)) max(1rem, env(safe-area-inset-bottom, 0px)) auto;
  margin: 0; padding: 0; border: 0; background: none; overflow: visible;
  display: flex; flex-direction: column; gap: 0.5rem;
  width: min(24rem, calc(100% - 2rem));
}
#toasts:not(:popover-open) { display: none; }
.toast {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.45rem 0.65rem;
  font-size: var(--text-md);
  box-shadow: var(--shadow);
}
.toast .toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast.error { border-left-color: #f87171; }
.toast.live { border-left-color: var(--good); }
.toast.gift { border-left-color: var(--accent-2); }
.toast.tracked { border-left-color: var(--muted); }
.toast.flag { border-left-color: var(--flag-block); }
.toast.verify { border-left-color: var(--flag-warn); }
.toast-go { color: var(--accent); text-decoration: none; white-space: nowrap; }
.toast-x {
  background: none; border: 0; color: var(--muted);
  cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0;
  min-width: var(--hit); min-height: var(--hit);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.toast-x:hover { color: var(--text); }
.toast-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* per-cell filter affordance.
   Hidden until the cell is hovered so it does not clutter a dense table, but
   :focus-visible is not optional — without it the control is unreachable by
   keyboard — and on touch, where nothing ever hovers, it is always faint. */
.cell-filter {
  opacity: 0; color: var(--muted); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.75rem; min-height: var(--hit); padding: 0 0.2rem; vertical-align: middle;
}
td:hover .cell-filter { opacity: 1; }
.cell-filter:focus-visible { opacity: 1; color: var(--text); outline: 2px solid var(--accent); outline-offset: 1px; }
.cell-filter:hover { color: var(--accent); }
@media (hover: none) { .cell-filter { opacity: 0.55; } }

/* a badge that is also a filter link */
a.badge { text-decoration: none; }
a.badge:hover { border-color: var(--accent); }

/* charts whose points open something */
.chart-group.drillable svg.chart { cursor: pointer; }
.drill-hint { margin: 0 0 0.5rem; }

/* settings page */
.settings-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  max-width: 62rem;
}
.settings-block h3 { margin: 0 0 var(--space-1); font-size: 0.95rem; }
.settings-block > p { margin: 0 0 var(--space-3); }
.settings-block code {
  background: var(--panel-2); border-radius: 4px; padding: 0.05rem 0.3rem; font-size: 0.85em;
}
.settings-block .checkbox { display: block; margin-bottom: 0.5rem; }
.settings-block .field { display: block; margin-top: 0.75rem; font-size: 0.9rem; }
.settings-block .field input { width: 7rem; margin: 0 0.35rem; }

/* Two columns where there is room, one on a phone. Each setting keeps its
   help text with its input rather than in a legend elsewhere. */
.settings-grid {
  display: grid; gap: var(--space-3) var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
}
.setting { display: block; }
.setting-label { display: block; font-size: 0.92rem; margin-bottom: 0.3rem; }
.setting-input { display: flex; align-items: center; gap: 0.45rem; }
.setting-input input {
  width: 7rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
  color: var(--text);
}
.setting-help { display: block; margin-top: 0.35rem; line-height: 1.45; }
/* The env var name, so what the page writes is never a mystery. */
.setting-env {
  display: inline-block; margin-left: 0.35rem;
  font-family: ui-monospace, monospace; font-size: 0.9em; opacity: 0.75;
}
.settings-actions { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }

.settings-status {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.25rem;
  margin: 0; font-size: 0.9rem;
}
.settings-status dt { color: var(--muted); }
.settings-status .warn { color: var(--accent-2); font-weight: 600; }
.settings-status .bad { color: #f87171; font-weight: 600; }
.settings-status dd { margin: 0; }

.host-meters, .host-meter { margin: 0 0 0.9rem; }
.host-meter-top {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: 0.9rem;
}
.host-meter-track {
  height: 0.45rem; margin-top: 0.3rem; border-radius: 99px; overflow: hidden;
  background: color-mix(in srgb, var(--border) 70%, transparent);
}
.host-meter-fill {
  height: 100%; border-radius: 99px; background: var(--accent);
}
.host-meter.warn .host-meter-fill { background: var(--accent-2); }
.host-meter.bad .host-meter-fill { background: #f87171; }
.host-meter .muted { margin: 0.3rem 0 0; }
#settings-host .settings-status { margin-top: 0.25rem; }

.header-alerts {
  position: relative;
  flex: 0 0 auto;
  margin-right: 0.15rem;
}
#alerts-toggle { white-space: nowrap; }
#alerts-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 40;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.9rem;
  width: min(22rem, calc(100dvw - 2rem));
  max-height: min(22rem, 60vh);
  overflow: auto;
  box-shadow: var(--shadow);
}
.alerts-list { list-style: none; margin: 0; padding: 0; }
.alerts-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.35;
}
.alerts-item:last-child { border-bottom: 0; }
.alerts-item a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.video-item { position: relative; }
.video-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  justify-content: flex-end;
  padding: 0.35rem 0.45rem 0.35rem 0.15rem;
  min-width: 0;
}
.backup-list,
.video-file-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}
.backup-row,
.video-file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.65rem;
  align-items: center;
  padding: 0.28rem 0;
  border-bottom: 1px solid var(--border);
}
.backup-row:last-child,
.video-file-row:last-child { border-bottom: 0; }
.backup-name,
.video-file-name {
  flex: 1 1 10rem;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-file-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-left: auto;
}
.video-files-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}
.files-workspace {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  min-height: 0;
}
.files-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: sticky;
  top: 0;
}
.files-main { min-width: 0; }
.archive-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.archive-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: inherit;
  cursor: pointer;
}
.archive-card strong { font-size: 1.15rem; }
.archive-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.archive-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}
.archive-row:last-child { border-bottom: 0; }
.archive-name { font-weight: 600; min-width: 0; }
.archive-slot { flex: 1 1 100%; }
.archive-back { margin: 0 0 0.35rem; }
#files-people-form { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.5rem; }
#files-people-form input { flex: 1 1 auto; min-width: 0; }
@media (max-width: 700px) {
  .files-workspace { grid-template-columns: minmax(0, 1fr); }
  .files-nav { flex-direction: row; flex-wrap: wrap; position: static; }
}

#app-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: var(--sidebar-w);
}
#app-view > footer.attrib { flex: 0 0 auto; }
main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.5rem;
  padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.5rem, env(safe-area-inset-right, 0px));
  max-width: min(100%, 1680px);
  margin: 0 auto;
  width: 100%;
  container-type: inline-size;
}
section h2 { font-size: 26px; line-height: 1.25; margin-bottom: var(--space-3); font-weight: 600; flex: 0 0 auto; letter-spacing: -0.025em; }
section h2 .muted { font-size: var(--text-sm); font-weight: 400; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius-lg); overflow: hidden; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
th, td { padding: 0.65rem 0.8rem; text-align: left; font-size: 0.875rem; white-space: nowrap; }
th { background: var(--panel-2); color: var(--muted); font-weight: 500; font-size: var(--text-sm); letter-spacing: 0.01em; }
tr { border-top: 1px solid var(--border); }
tbody tr:hover { background: var(--panel-2); }
tr.clickable { cursor: pointer; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }

.badge {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.72rem; border: 1px solid var(--border); color: var(--muted);
}
.badge.mine { border-color: var(--good); color: var(--good); }
.badge.live { border-color: color-mix(in srgb, var(--live) 35%, var(--border)); color: var(--live); background: color-mix(in srgb, var(--live) 7%, var(--panel)); }
.badge.elsewhere { border-color: var(--accent-2); color: var(--accent-2); }
.badge.won { border-color: var(--good); color: var(--good); margin-left: 0.3rem; }
.badge.leading { margin-left: 0.3rem; }
/* Verified is a fact about the account, not a status of its own — it reads as
   information rather than competing with the live and tracked badges. */
.badge.verified { border-color: var(--gem); color: var(--gem); }
/* A flag is the one badge that changes what the reader does next, so it is the
   only one that fills rather than outlines. */
.badge.flag { border-color: var(--flag-watch); color: var(--flag-watch); }
.badge.flag-warn { border-color: var(--flag-warn); color: var(--flag-warn); }
.badge.flag-block {
  border-color: var(--flag-block); color: var(--bg); background: var(--flag-block); font-weight: 600;
}
/* Filled, like the top flag, but gold: a friendly should be easy to pick out
   of a table of outline badges without reading as a problem. */
.badge.friendly {
  border-color: var(--friendly); background: var(--friendly); color: var(--friendly-ink);
  font-weight: 600;
}
/* A verification standing against a live: TikTok is waiting for the host to
   answer, and the live ends if nobody does. Filled for the same reason .flag
   is — it is a badge about something the reader has to go and do — and warm
   rather than red, because a challenge is not yet an enforcement. */
.badge.verify {
  border-color: var(--flag-warn); background: var(--flag-warn); color: var(--bg);
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.badge.verify .icon { margin-right: 0.3rem; }
/* Presence, when the person standing in the room is one of them. */
.badge.now.flag { border-color: var(--flag-block); color: var(--flag-block); }
.badge.now.friendly {
  border-color: var(--friendly); background: var(--friendly); color: var(--friendly-ink); font-weight: 600;
}
.badge.now .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; margin-right: 0.35rem;
  animation: pulse 1.4s infinite;
}

/* Shared original outline icon sprite, see index.html. */
.icon {
  width: 1em; height: 1em; fill: currentColor;
  vertical-align: -0.125em; /* sit on the text baseline */
  flex: none; pointer-events: none;
}
/* keep the colour cues the emoji used to carry */
.icon-gem { color: var(--gem); }
.icon-coins { color: var(--accent-2); }
.icon-gift { color: var(--gift); }
/* inside a badge the badge's own colour wins */
.badge .icon { color: inherit; }

/* avatars */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--muted); font-size: 0.75rem; font-weight: 600;
  vertical-align: middle; margin-right: 0.5rem;
  overflow: hidden; position: relative;
}
.avatar::before { content: attr(data-initial); position: absolute; }
.avatar img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.avatar.friendly {
  border-color: var(--friendly);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--friendly) 55%, transparent);
}
.avatar.problem {
  border-color: var(--flag-block);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--flag-block) 55%, transparent);
}
.person-name.friendly { color: var(--friendly); font-weight: 700; }
.person-name.problem { color: var(--flag-block); font-weight: 700; }
.person-name.problem .icon,
.feed-user.problem .icon,
.badge.problem .icon { width: 0.9em; height: 0.9em; margin-right: 0.2rem; }
.badge.problem {
  border-color: var(--flag-block); background: var(--flag-block); color: var(--bg); font-weight: 700;
}
.row-actions { display: inline-flex; gap: 0.35rem; align-items: center; }
button.friendly-mark {
  border-color: var(--friendly); background: var(--friendly); color: var(--friendly-ink); font-weight: 600;
}
tr.is-friendly { background: color-mix(in srgb, var(--friendly) 10%, transparent); }
tr.is-friendly td:first-child { box-shadow: inset 3px 0 0 var(--friendly); }
tbody tr.is-friendly:hover { background: color-mix(in srgb, var(--friendly) 16%, var(--panel-2)); }
tr.is-problem { background: color-mix(in srgb, var(--flag-block) 12%, transparent); }
tr.is-problem td:first-child { box-shadow: inset 3px 0 0 var(--flag-block); }
tbody tr.is-problem:hover { background: color-mix(in srgb, var(--flag-block) 18%, var(--panel-2)); }

/* forms */
input, select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}
input:focus, select:focus { outline: none; border-color: var(--border); }
input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.checkbox { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; color: var(--muted); }
.checkbox input { width: auto; }


/* Airtime bar in the per-day history. Inline width is the value; the minimum
   keeps a day that was on air at all from rendering as nothing. */
.bar {
  display: block; height: 4px; min-width: 2px; margin-bottom: 3px;
  background: var(--accent); border-radius: 2px;
}

/* The same bar under a figure in a numeric cell — the likers tables draw one
   per row for "how big is this against the biggest". A numeric cell is
   right-aligned, and a block element in it would otherwise grow leftward from
   the wrong edge and leave the bar detached from its own number. */
td.num .bar { margin: 2px 0 0 auto; background: var(--series-likes); }

/* --- charts ---
   One measure per chart, so each plot has a single series and needs no legend
   box; the caption's colour key and heading carry the identity. --series-*
   are validated against the panel surface for lightness, chroma, contrast and
   colour-vision separation — they are not the UI accents reused as data ink,
   which is why --gem is not what the diamonds line is drawn in. */
:root {
  --series-likes: #f0567a;
  --series-diamonds: #2b91d8;
  --series-comments: #e8a13c;
  /* A fourth series had to fit a palette already checked all-pairs. This green
     is the best available: its worst pairing under simulated deuteranopia is
     ΔE 10.6, above the 10.3 that likes/comments already binds at, so adding it
     costs the set nothing. It is deliberately not --good (#4ade80), which
     scores the same but is a status accent, and status is not a measure. */
  --series-viewers: #57d68f;

  /* --- diagram palette ---
     Channel identity is NOT carried by hue. Nine categorical hues cannot be
     told apart on this surface — checked all-pairs against the panel colour,
     the worst pair lands at ΔE 1.6 for deuteranopia against a floor of 15 —
     and the flow and network views are all-pairs forms, where any node can end
     up beside any other. So every mark is direct-labelled and hue is spent on
     the two things that really are categorical and small: which way the
     audience drifted, and whether a channel is yours. Both are intrinsic
     properties of the row, so adding or deleting a channel repaints nothing;
     there is no hash and no array index anywhere in the colour choice.
     These three pass all-pairs here: worst CVD ΔE 9.4, worst normal 20.9. */
  --flow-out: #d95926;   /* seen in this channel first */
  --flow-in: #3987e5;    /* seen in the other one first */
  --flow-tied: #199e70;  /* first seen in both at once */

  /* Sequential, one hue monotonic in lightness — the engagement stages are an
     ordered magnitude, not categories. */
  --stage-1: #2e6ba8; --stage-2: #3987e5; --stage-3: #69a6ec; --stage-4: #a8cef7;

  /* How often a gift is sent, against what it is worth — two meanings, two
     slots, reused wherever that pair appears so the reader learns it once. */
  --mix-sends: #d95926;
  --grid: #1c222e;
}

.chart-group { position: relative; display: grid; gap: 1rem; margin-bottom: 1.2rem; }
@media (min-width: 900px) { .chart-group { grid-template-columns: 1fr 1fr; } }
.chart-group > .drill-hint,
.chart-group > .chart-help,
.chart-group > .chart-announcement,
.chart-group-toolbar { grid-column: 1 / -1; }
.chart-group-toolbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem;
}
.chart-group-toolbar .chart-export-group { margin-left: 0; }

.chart-card {
  margin: 0; padding: 0.6rem 0.7rem;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-lg);
}

/* Stream Charts tab: a long stack of groups is hard to sit with. Each
   measure lives in its own panel, notes sit above the plots, and a sticky
   jump bar skips the scroll. Scoped to .charts-page so channel/person
   overlays keep the older denser stacking. The page is a little warmer and
   tighter than the rest of the overlay — same palette, less filing-cabinet. */
.charts-page {
  --charts-warm: color-mix(in srgb, var(--accent-2) 10%, var(--panel-2));
  --charts-well: color-mix(in srgb, var(--bg) 45%, var(--panel));
  --charts-line: color-mix(in srgb, var(--accent-2) 18%, var(--border));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.05rem 0.05rem 0.7rem;
}
.charts-.app-nav {
  position: sticky; top: 0; z-index: 6;
  display: flex; flex-wrap: nowrap; gap: 0.28rem;
  margin: 0;
  padding: 0.3rem 0 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  background: var(--panel);
  border-bottom: 0;
  box-shadow: 0 12px 18px -14px rgba(0, 0, 0, 0.85);
}
.charts-.app-nav::-webkit-scrollbar { display: none; }
.charts-nav .ghost.tiny {
  min-height: var(--hit);
  flex: 0 0 auto;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  background: var(--charts-warm);
  border-color: transparent;
  color: var(--text);
  font-size: 0.75rem;
}
.charts-nav .ghost.tiny:hover,
.charts-nav .ghost.tiny:focus-visible {
  background: color-mix(in srgb, var(--accent-2) 16%, var(--panel-2));
}
.chart-section,
.charts-page > .counters {
  scroll-margin-top: 2.9rem;
}
.chart-section {
  padding: 0.65rem 0.75rem 0.7rem;
  background: var(--charts-warm);
  border: 1px solid var(--charts-line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 5%, transparent);
}
.charts-page .chart-section h4,
.modal-body .charts-page h4,
.modal-body .charts-page .chart-section h4 {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.charts-page .chart-section h4 .muted,
.charts-page .chart-section h4 .small {
  font-weight: 400;
  letter-spacing: 0;
}
.charts-page .chart-note {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.4;
  color: color-mix(in srgb, var(--accent-2) 12%, var(--muted));
  max-width: 42rem;
}
.chart-section .chart-group { margin-bottom: 0; gap: 0.5rem; }
.chart-section .chart-card {
  padding: 0.48rem 0.55rem 0.42rem;
  background: var(--charts-well);
  border-color: transparent;
  border-radius: 10px;
}
.charts-page .chart-card figcaption { margin-bottom: 0.15rem; }
.charts-page .chart-peak,
.charts-page .chart-cursor { stroke: var(--charts-well); }
.chart-section .counters {
  background: transparent;
  border: 0;
  padding: 0.05rem 0 0;
  margin: 0;
  gap: 0.3rem 0.85rem;
}
.charts-page > .counters {
  margin-bottom: 0;
  padding: 0.6rem 0.75rem;
  background: var(--charts-warm);
  border: 1px solid var(--charts-line);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 5%, transparent);
}
.chart-section .empty {
  padding: 0.55rem 0.15rem 0.35rem;
  text-align: left;
  max-width: none;
  margin: 0;
  font-size: 0.8rem;
}
.charts-links {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.2rem 0.35rem 0.15rem;
}
.push-pace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.push-pace-col {
  min-width: 0;
}
.push-pace-col h4 {
  margin: 0;
}
@media (max-width: 700px) {
  .push-pace { grid-template-columns: 1fr; }
}
.charts-links p { margin: 0; }

@media (min-width: 1280px) {
  .charts-page .chart-group { gap: 0.5rem 0.55rem; }
}
.chart-card figcaption {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
  font-size: 0.8rem; margin-bottom: 0.3rem;
}
.chart-export-group {
  margin-left: auto; flex: none;
  display: inline-flex; align-items: center; gap: 0.15rem;
}
.chart-export {
  min-height: var(--hit); min-width: var(--hit);
  padding: 0.2rem 0.45rem; font-size: 0.75rem;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0.7;
}
.chart-export:hover, .chart-export:focus-visible { opacity: 1; }
.chart-export:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Who tapped (and any other plain heading that hosts the same controls) needs
   the flex row the chart figcaption already has, or margin-left:auto does nothing. */
h2:has(> .chart-export-group),
h3:has(> .chart-export-group),
h4:has(> .chart-export-group) {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
/* Lines get a line key, not a filled box — a box is data-weight ink doing a
   label's job at this size. */
.series-key {
  display: inline-block; width: 12px; height: 2px; border-radius: 1px; flex: none;
}

svg.chart { display: block; width: 100%; height: auto; touch-action: pan-y pinch-zoom; }
svg.chart:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Hairline and solid: dashed grid reads as noise and competes with the data. */
.grid line { stroke: var(--grid); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { opacity: 0.1; stroke: none; }
.chart-zero-label { fill: var(--text); font-size: 16px; }
.chart-zero-detail { fill: var(--muted); font-size: 12px; }
/* The 2px ring in the surface colour is what keeps a dot legible where it sits
   on its own line. */
.chart-peak, .chart-cursor { stroke: var(--panel-2); stroke-width: 2; }
.chart-jump { fill: none; stroke: var(--accent); stroke-width: 2; }
.peak-label { fill: var(--text); font-size: 10px; font-variant-numeric: tabular-nums; }
.crosshair { stroke: var(--muted); stroke-width: 1; }

.chart-tip {
  position: absolute; top: -0.4rem; pointer-events: none; z-index: 5;
  padding: 0.45rem 0.6rem; font-size: 0.78rem; line-height: 1.5;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); white-space: nowrap;
}
.chart-tip strong { font-variant-numeric: tabular-nums; }
.chart-tip .series-key { margin-right: 0.35rem; vertical-align: middle; }
.chart-tip-cover {
  display: block; max-width: 120px; max-height: 68px; border-radius: 4px;
  margin-bottom: 0.35rem; object-fit: cover;
}
.chart-tip-spark { margin-top: 0.35rem; }
.chart-tip-spark .spark { width: 100%; max-width: 140px; height: 28px; display: block; }
.empty {
  padding: var(--space-4) var(--space-3);
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

/* --- the broadcast grid ---
   One card per stream, live or finished. This began as the Live tab, which had
   been a table: a table answers the wrong question on a narrow screen, because
   the [data-priority] rules at the foot of this file drop columns tier by tier,
   so the one view whose entire job was "what is happening right now" hid the
   viewer count on a phone. A card reflows instead, and nothing in this block
   hides at any width.

   Live and recorded cards share every rule here — they are the same object at
   two moments — and differ only where .stream-card overrides below. */

.stream-grid {
  display: grid;
  gap: 0.6rem;
  /* The whole responsive strategy, and no media query: auto-fill gives three
     columns at the wide main, two around 900px and one below ~700px, while
     min(...,100%) stops a 320px viewport being pushed into a sideways scroll. */
  grid-template-columns: repeat(auto-fill, minmax(min(310px, 100%), 1fr));
}

/* What is on air, lifted out of the list and pinned above it — in the table
   and the diary as well as the cards, because a row cannot tick. The rule
   under it is the boundary the live group heading used to draw in the cards
   view alone: everything below this line has finished. */
.pinned-live {
  margin-bottom: 0.85rem; padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.pinned-live .group-title { margin-top: 0; }

.live-card,
.stream-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  /* The same left edge a toast uses, so "this one is live" is a cue the reader
     has already been taught elsewhere in the app. */
  border-left: 3px solid var(--live);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.live-card:hover, .stream-card:hover { background: var(--panel-2); }
.live-card:focus-within,
.stream-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.live-card-top { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.live-chan {
  color: var(--text); font-weight: 600; font-size: 1rem;
  text-decoration: none; margin-right: auto; overflow-wrap: anywhere;
}
.live-chan:hover { text-decoration: underline; }
.live-chan:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.live-card-time { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
/* Its own colour and tabular figures: this is the one number on the page that
   moves while nothing happens, and digits of differing width would make it
   twitch sideways every second. */
.live-elapsed { color: var(--accent-2); font-weight: 600; font-variant-numeric: tabular-nums; }

.live-card-viewers { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.live-figures { flex: 0 0 auto; }
.live-now { display: flex; align-items: baseline; gap: 0.35rem; }
/* The card's hero figure. The table it replaced could only show the peak. */
.live-now strong { font-size: 1.5rem; color: var(--text); }
.live-now .icon { color: var(--muted); align-self: center; }
.live-peak { display: block; }

/* --gem, not --accent: the LIVE badge and the card's left edge already carry
   the accent here, and a third mark in the same hue competes with both. */
.spark { display: block; flex: 1 1 8rem; min-width: 6rem; height: 34px; }
.spark-line { fill: none; stroke: var(--gem); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
/* A card with too few points keeps the same overall height, so the grid does
   not jolt when the second sample lands and the curve appears. */
.spark-empty {
  display: block; flex: 1 1 8rem; min-width: 6rem; height: 34px;
  border: 1px dashed var(--border); border-radius: 6px;
}

/* Shared by the cards and the live console, so the two read as one object at
   two sizes. A grid rather than a wrap: numbers that line up into columns can
   be scanned down, and a ragged flex row cannot. */
.counter-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr));
  gap: 0.4rem 0.6rem;
}
.counter-strip.full {
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.35rem 0.75rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.counter {
  display: flex; align-items: baseline; gap: 0.3rem;
  min-width: 0; color: var(--muted); font-size: 0.8rem;
}
.counter strong { color: var(--text); font-variant-numeric: tabular-nums; }
.counter .icon { align-self: center; }
.counter-strip.full .counter { font-size: 0.9rem; }
/* The compact strip on a card is read as a row of figures with their icons;
   the word is the fallback for anyone who does not recognise one. */
.live-card .counter-label,
.stream-card .counter-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* margin-top:auto keeps every Console button on one baseline across a row of
   cards of unequal height. */
.live-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  margin-top: auto; padding-top: 0.5rem; border-top: 1px solid var(--border);
}
/* space-between spreads three items across the foot, and a stitched live card
   has three: the watcher badge, the segment count and Console. Pushing off the
   first item keeps the rest together on the right, and leaves the two-item
   case looking exactly as it did. */
.live-card-foot > :first-child { margin-right: auto; }

/* --- the recorded-stream grid ---
   Same object as a live card and deliberately the same classes inside it, so
   the two read as one thing at two moments. Only the differences live here.
   The accent left edge is what a live card uses to say "this is happening
   now", so a recorded card gives it back and only borrows it again for a row
   that really is still live. */
.stream-card { border-left-color: var(--border); }
.stream-card.is-live { border-left-color: var(--live); }

/* The hero on a recorded card is how long it ran, not how many are watching:
   a stream that has ended has no "now". Tabular figures for the same reason
   the live clock uses them - these sit in a grid and must not jitter. */
.stream-len { font-size: 1.35rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
/* Peak is the secondary figure here, so it steps down from the live card's
   1.5rem rather than competing with the length beside it. */
.stream-card .live-now strong { font-size: 1.25rem; }

/* Top gifter and guest count sit on the foot line. min-width:0 with the
   ellipsis lets a long @name give way to the Delete button rather than
   pushing it out of the card. */
.stream-foot-facts {
  display: flex; align-items: center; gap: 0.75rem; min-width: 0;
  color: var(--muted); font-size: 0.8rem;
}
.stream-foot-facts .fact { display: flex; align-items: center; gap: 0.3rem; min-width: 0; }
.stream-foot-facts .fact strong { color: var(--text); font-variant-numeric: tabular-nums; }
.stream-foot-facts a { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-foot-facts a:hover { text-decoration: underline; }
.live-card-foot > a.tiny { margin-left: auto; }

.live-card.tl-picked, .stream-card.tl-picked,
#streams-list tr.tl-picked {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.live-card.tl-picked-some, .stream-card.tl-picked-some,
#streams-list tr.tl-picked-some {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

/* The recordings behind one stitched broadcast. Folded away because the whole
   point of stitching is that the seam is not what the reader came for - but
   reachable, because a stitch that looks wrong has to be inspectable, and
   because deleting is per-recording and this is the only place a session
   offers it. */
.stream-segments { margin-top: 0.5rem; border-top: 1px solid var(--border); padding-top: 0.5rem; }
.stream-segments[hidden] { display: none; }
.stream-segments ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.stream-segments li {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; color: var(--muted); min-width: 0;
}
.stream-segments a { color: var(--text); text-decoration: none; white-space: nowrap; }
.stream-segments a:hover { text-decoration: underline; }
/* Pushes the per-segment Delete to the right end, the way the card foot did. */
.stream-segments .seg-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: auto; }

/* --- grouped lists ---
   One heading above a run of rows or cards. In a table this is a row spanning
   every column, so the columns stay one set of widths down the whole table -
   splitting a group into its own table would let them drift and the point of
   the table is comparison. */
.group-head th {
  padding: 0.7rem 0.6rem 0.35rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem; text-align: left; position: static;
}
.group-head .group-note { font-weight: 400; margin-left: 0.4rem; }
.group-title {
  margin: 1.1rem 0 0.6rem; font-size: 0.95rem; font-weight: 600;
  padding-bottom: 0.35rem; border-bottom: 1px solid var(--border);
}
.group-title:first-child { margin-top: 0; }
/* The live section's heading borrows the accent and the banner's pulse, so
   the boundary between "now" and "recorded" is visible from across the room. */
.group-title.is-live { color: var(--live); border-bottom-color: var(--border); }
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--live); margin-right: 0.45rem; vertical-align: 1px;
  animation: pulse 1.4s infinite;
}
.group-head .live-dot { animation: none; }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.group-title .group-note { font-weight: 400; margin-left: 0.4rem; }
/* A diary heading is the channel's name and the way into it. It reads as a
   heading first and only shows it is a link under the pointer, so a page of
   them is not a page of blue. */
.group-title a, .group-head a { color: inherit; text-decoration: none; }
.group-title a:hover, .group-title a:focus-visible,
.group-head a:hover, .group-head a:focus-visible { text-decoration: underline; }

/* The two view buttons read as one control, so they lose the gap between them
   and only the outer corners round. */
.view-toggle { display: flex; gap: 0; }
.view-toggle button { border-radius: 0; margin-left: -1px; }
.view-toggle button:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.view-toggle button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
/* The pressed one has to sit above its neighbour or its accent border is
   painted over by the next button's plain one. */
.view-toggle button.active { position: relative; z-index: 1; }

/* Date range: the two inputs are one control and should not wrap apart. */
.range-group { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.range-group input[type="date"] {
  padding: 0.3rem 0.45rem; font-size: 0.82rem;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.range-group .range-sep { color: var(--muted); font-size: 0.85rem; }

/* --- the flag panel, at the top of a person --- */

/* Unflagged it is one quiet line — most people are not flagged and the panel
   must not shout at the reader on every person they open. Flagged, it takes a
   left border in the level's colour and reads as the first thing on the page. */
.flag-panel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-lg);
}
.flag-panel.on { border-left-color: var(--flag-watch); }
.flag-panel.flag-warn { border-left-color: var(--flag-warn); }
.flag-panel.flag-block { border-left-color: var(--flag-block); background: rgba(248, 113, 113, 0.08); }
.flag-panel.editing, .flag-panel.on { display: block; }
.flag-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
.flag-panel p { margin: 0.3rem 0 0; }
.flag-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.flag-panel:not(.on):not(.editing) .flag-actions { margin-top: 0; }
.flag-levels { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.flag-levels .active { border-color: var(--accent); color: var(--text); }
.flag-panel input[type="text"] { width: 100%; }

.friendly-panel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-lg);
}
.friendly-panel.on {
  display: block;
  border-left-color: var(--friendly);
  background: color-mix(in srgb, var(--friendly) 12%, var(--panel));
}
.friendly-panel.editing { display: block; }
.friendly-panel p { margin: 0.3rem 0 0; }
.friendly-panel:not(.on):not(.editing) .flag-actions { margin-top: 0; }
.friendly-panel input[type="text"] { width: 100%; }

/* --- live console --- */

.counters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.counters span { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); }
.counters strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* The live feed is a tab of the stream overlay now, not a separate console
   below the grid. The clock rides in the overlay's title beside the live
   badge, where the reader is already looking to see whose stream this is. */
.title-clock { margin-left: 0.5rem; font-size: 0.85rem; font-weight: normal; }

.guests {
  margin-bottom: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
  padding: 0.4rem 0.65rem; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
/* An empty panel is nobody on it, not a bordered gap where a strip would be. */
.guests:empty { display: none; }

/* The feed is newest-first and capped in JS, so it scrolls within a fixed
   frame rather than pushing the rest of the page down as events arrive. */
.feed {
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.feed-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.28rem 0.65rem;
  border-bottom: 1px solid var(--panel);
  /* Coloured edge by event type — same cue the live console uses, so the
     stream Timeline tab can be scanned by kind without reading every line. */
  border-left: 2px solid transparent;
  font-size: 0.85rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.feed-row:last-child { border-bottom: none; }
.feed-time { color: var(--muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; font-size: 0.8rem; }
.feed-user { color: var(--gem); font-weight: 600; }
.feed-user.friendly { color: var(--friendly); font-weight: 700; }
.feed-user.problem { color: var(--flag-block); font-weight: 700; }
.feed-friendly {
  background: color-mix(in srgb, var(--friendly) 12%, transparent);
  border-left-color: var(--friendly);
}
.feed-problem {
  background: color-mix(in srgb, var(--flag-block) 14%, transparent);
  border-left-color: var(--flag-block);
}
.feed-gift { background: rgba(125, 211, 252, 0.08); border-left-color: var(--gem); }
.feed-mod { background: color-mix(in srgb, var(--danger) 8%, var(--panel)); border-left-color: var(--danger); }
.feed-flagged { background: rgba(248, 113, 113, 0.14); border-left-color: var(--flag-block); }
/* Enforcement against the room, as opposed to a moderator working inside it.
   Same hue as an ordinary mod row rather than a new colour — this is more of
   the same kind of thing, not a different kind — but at a strength that stops
   a reader scrolling past it. The one red on the page stays with the flags. */
.feed-enforcement {
  background: color-mix(in srgb, var(--danger) 18%, var(--panel));
  border-left-color: var(--danger);
  border-left-width: 4px;
}
/* The reason TikTok gave, on a row where the reason is the point. */
.feed-reason { color: var(--danger); font-weight: 600; }
/* Room signals are context, not incident: present but quieter than a mod row. */
.feed-room { background: rgba(148, 163, 184, 0.10); border-left-color: var(--muted); }
.feed-comment { border-left-color: #94a3b8; }
.feed-like { border-left-color: #fb7185; }
.feed-like .icon-heart { color: var(--gift); }
.feed-share, .feed-follow { border-left-color: var(--good); }
.feed-join { border-left-color: #64748b; }
.feed-guest_join, .feed-guest_leave,
.feed-guest_named, .feed-guest_request,
.feed-guest_request_cancel, .feed-guest_request_accepted,
.feed-guest_request_refused {
  background: rgba(255, 184, 107, 0.10);
  border-left-color: var(--accent-2);
}

/* Console keeps denser chrome and drops the row washes — a moving feed is
   easier to read with the coloured edge alone. Type colours come from the
   shared rules above. */
#console-feed { background: var(--bg); border-radius: var(--radius); }
#console-feed .feed-row {
  padding: 0.18rem 0.5rem;
  background: none;
  font-size: 0.72rem;
  line-height: 1.3;
  gap: 0.35rem;
}
#console-feed .feed-row:hover { background: var(--panel); }
#console-feed .feed-row.feed-friendly {
  background: color-mix(in srgb, var(--friendly) 16%, transparent);
  border-left-color: var(--friendly);
  border-left-width: 3px;
}
#console-feed .feed-row.feed-friendly:hover {
  background: color-mix(in srgb, var(--friendly) 24%, var(--panel));
}
#console-feed .feed-row.feed-problem {
  background: color-mix(in srgb, var(--flag-block) 16%, transparent);
  border-left-color: var(--flag-block);
  border-left-width: 3px;
}
#console-feed .feed-row.feed-problem:hover {
  background: color-mix(in srgb, var(--flag-block) 24%, var(--panel));
}
#console-feed .feed-time { font-size: 0.68rem; flex-basis: 3.75rem; }
#console-feed .feed-enforcement {
  background: rgba(240, 86, 122, 0.16);
}
#console-feed .icon { width: 0.85em; height: 0.85em; }

.stream-video {
  margin: 0 0 1rem;
}
.overview-watch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
}
.video-stage {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.stream-video[data-capture-source="audio"] .video-stage,
.stream-video[data-capture-source="audio"] video {
  height: 64px;
  min-height: 64px;
  max-height: 64px;
}
.stream-video[data-capture-source="audio"] .gift-effects { display: none; }
.stream-video video {
  display: block;
  width: 100%;
  max-height: min(70vh, 720px);
  background: #000;
  border-radius: 0;
}
.panel-profiles { position: absolute; pointer-events: none; overflow: hidden; }
.panel-profile-seat { position: absolute; display: grid; place-items: center; container-type: size; }
.panel-profile-seat img { width: 50cqmin; height: 50cqmin; border-radius: 50%; object-fit: cover; }
.panel-profile-name {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 4%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: center;
  font-size: clamp(6px, 12cqmin, 14px);
  font-weight: 600;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 1px 3px #000, 0 0 3px #000;
  pointer-events: auto;
}
.video-hud {
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 3.1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  pointer-events: none;
  z-index: 2;
}
.gift-effects {
  position: absolute;
  left: 1rem;
  bottom: 4.5rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  z-index: 3;
  pointer-events: none;
}
.gift-effect-card {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 15rem;
  padding: .45rem .8rem .45rem .5rem;
  color: #fff;
  background: linear-gradient(100deg, rgba(117, 42, 196, .94), rgba(31, 25, 61, .88));
  border: 1px solid rgba(255, 213, 92, .8);
  border-radius: 999px;
  box-shadow: 0 5px 22px rgba(0,0,0,.48);
  animation: gift-effect-in .32s ease-out both;
}
.gift-effect-card img, .gift-effect-fallback {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #ffd65a;
}
.gift-effect-copy { display: flex; flex-direction: column; gap: .05rem; font-size: .78rem; }
.gift-effect-copy strong { font-size: .86rem; }
@keyframes gift-effect-in { from { opacity: 0; transform: translateX(-1.2rem) scale(.9); } to { opacity: 1; transform: none; } }
.video-chip {
  display: inline-block;
  max-width: min(92%, 28rem);
  padding: 0.28rem 0.55rem;
  border-radius: 0.35rem;
  font-size: 0.82rem;
  line-height: 1.3;
  color: #f4f4f5;
  background: rgba(10, 12, 18, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  overflow-wrap: anywhere;
}
.video-chip-panel { border-left: 3px solid #f4f4f5; }
.video-chip-gift { border-left: 3px solid #ffd166; color: #ffe8a8; }
.video-chip-mod { border-left: 3px solid #7eb6ff; color: #cfe4ff; }
.video-chip-room { border-left: 3px solid #8fd9a8; color: #d7f5e2; }
.video-chip-custom { border-left: 3px solid #ffb086; color: #ffd7c2; }

.video-overlay-editor {
  margin-top: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.video-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.video-editor-title { font-size: 0.92rem; }
.video-editor-body {
  display: grid;
  /* Full-width list until a cue is selected; then a fixed form sidebar. */
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.video-editor-body:has(.video-cue-form:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 17rem);
}
.video-cue-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
.video-cue-head {
  display: grid;
  grid-template-columns: 4.2rem 3.6rem minmax(0, 1fr);
  gap: 0.45rem;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.35rem 0.7rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.video-overlay-editor .video-cue-list-body {
  list-style: none;
  margin: 0;
  padding: 0.15rem 0.35rem 0.35rem;
  min-height: 0;
  max-height: none;
  overflow: visible;
  border-right: 0;
}
.video-editor-body:has(.video-cue-form:not([hidden])) .video-cue-scroll {
  border-right: 1px solid var(--border);
}
.video-cue-form {
  display: grid;
  gap: 0.45rem;
  padding: 0.55rem 0.65rem;
  align-content: start;
  min-width: 0;
  overflow: auto;
}
.video-cue-form label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.video-cue-form input,
.video-cue-form select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.45rem;
}
.video-cue-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.2rem;
}
.video-cue-style {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.video-cue-jump {
  display: grid;
  grid-template-columns: 4.2rem 3.6rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: baseline;
  width: 100%;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0.4rem 0.35rem;
  cursor: pointer;
  font-size: 0.88rem;
  border-radius: var(--radius);
}
.video-cue-jump:hover { background: var(--panel-2); }
.video-cue-jump.is-selected { background: color-mix(in srgb, var(--accent) 18%, var(--panel-2)); }
.video-cue-jump.is-edited .video-cue-text { font-style: italic; }
.video-cue-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.video-cue-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stream-video video::cue {
  background: rgba(0, 0, 0, 0.72);
  color: #f4f4f5;
  font-size: 0.95rem;
  line-height: 1.35;
}
@media (max-width: 900px) {
  .video-editor-body,
  .video-editor-body:has(.video-cue-form:not([hidden])) {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .video-editor-body:has(.video-cue-form:not([hidden])) .video-cue-scroll {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .video-cue-form { max-height: 40%; }
  .videos-player .video-cue-form { max-height: none; }
  .video-hud { bottom: 2.6rem; }
}

.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }

/* --- the detail overlay (person, stream, channel) --- */

/* A native <dialog>: the browser supplies the top layer, focus trap and
   backdrop, so this only has to describe the frame. */
.modal {
  /* The browser centers a native <dialog> with margin:auto in its own
     stylesheet; the * reset above zeroes that and pins it top-left. */
  margin: auto;
  width: min(96%, 1680px);
  height: 96vh;
  height: 96dvh;
  max-height: 96vh;
  max-height: 96dvh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  /* The frame is fixed; .modal-body is what scrolls. */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* A closed dialog must stay hidden — display:flex above would otherwise
   override the browser default and leave it on screen. */
.modal:not([open]) { display: none; }

.modal::backdrop { background: rgba(15, 17, 23, 0.72); }

.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: max(0.45rem, var(--safe-top)) max(0.85rem, env(safe-area-inset-right, 0px)) 0.45rem max(0.85rem, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  min-width: 0;
}
.modal-head h3 { font-size: 0.95rem; min-width: 0; overflow-wrap: anywhere; }
.modal-head h3 a { color: inherit; text-decoration: none; }
.modal-head h3 a:hover { text-decoration: underline; }

/* Where the open subject sits — its list, and its channel if it has one — with
   the same-channel prev/next steppers on the right. */
.crumbs {
  display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
  padding: 0.35rem max(0.85rem, env(safe-area-inset-right, 0px)) 0 max(0.85rem, env(safe-area-inset-left, 0px));
  font-size: 0.75rem; color: var(--muted);
  flex: 0 0 auto; overflow-x: visible;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.crumb-sep { color: var(--muted); opacity: 0.6; }
.crumb-steppers { margin-left: auto; display: flex; gap: 0.4rem; align-items: center; }

.modal-tabs {
  display: flex; gap: 0.25rem; flex-wrap: nowrap;
  padding: 0.4rem max(0.85rem, env(safe-area-inset-right, 0px)) 0.4rem max(0.85rem, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, #000 calc(100% - 1.2rem), transparent);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.2rem), transparent);
}
.modal-tabs .tab { flex: 0 0 auto; }
.modal-tabs button:disabled { opacity: 0.4; cursor: default; }
.modal-tabs button:disabled:hover { filter: none; }
.tab-sep {
  flex: 0 0 auto;
  width: 1px;
  align-self: stretch;
  margin: 0.15rem 0.35rem;
  background: var(--border);
}

.modal-body { container-type: inline-size; padding: 1.25rem; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-body h4 { margin-bottom: 0.6rem; font-size: 0.85rem; color: var(--muted); }
.modal-body h4:not(:first-child) { margin-top: 1.2rem; }
/* Inside the modal the body owns the scrolling, so the feed must not cap
   itself as it does on the page. */
.modal-body .feed { max-height: none; }

/* <dialog> does not consistently stop the page behind it scrolling. */
body.modal-open { overflow: hidden; }

/* Live tab: stats + panel stay put, feed fills the remaining overlay height.
   The wrapper is painted by renderStreamLive. */
.modal-body:has(.console-workspace),
.modal-body:has(.console-layout) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.5rem 0.75rem;
}
.modal-body:has(.console-workspace) > .console-workspace {
  flex: 1 1 auto;
  min-height: 0;
}
.console-layout {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 0.4rem;
}
.console-layout .counter-strip.full,
.console-layout .guests {
  flex: 0 0 auto;
  margin-bottom: 0;
}
.console-layout #console-feed,
.console-layout #console-history {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}
.console-layout #console-feed[hidden],
.console-layout #console-history[hidden] { display: none; }
.span-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  flex: 0 0 auto; margin-bottom: 0.45rem;
}
.span-bar input[type="number"] {
  width: 4.2rem; min-height: 0; padding: 0.15rem 0.35rem;
}
.span-note { margin: 0 0 0.35rem; }
.modal-body:has(.console-layout) #console-feed { max-height: none; }
.console-workspace {
  display: grid;
  grid-template-columns: minmax(14rem, 36%) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: stretch;
  height: 100%;
  min-height: 0;
  flex: 1 1 auto;
}
.console-preview {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 0.55rem;
}
.console-preview > .muted {
  margin: auto;
  text-align: center;
  padding: 0.75rem;
}
.console-preview .stream-video {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.console-preview .detail-head { flex: 0 0 auto; }
.console-preview .detail-head h4 { font-size: 0.9rem; margin: 0; }
.console-preview .video-stage {
  flex: 0 1 38%;
  min-height: 9rem;
  max-height: 42%;
  height: auto;
  display: flex;
  flex-direction: column;
}
.console-preview .stream-video video {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 0;
  max-height: none;
  object-fit: contain;
  background: #0b0b0f;
  border-radius: 0;
}
.console-preview .video-overlay-editor {
  flex: 1 1 auto;
  max-height: none;
  min-height: 16rem;
}
.console-preview .stream-video > .muted { flex: 0 0 auto; margin-top: 0.35rem; }
.console-workspace .console-layout {
  min-width: 0;
  min-height: 0;
}
@media (max-width: 900px) {
  .console-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(11rem, 34%) minmax(0, 1fr);
  }
  .console-preview .stream-video video {
    min-height: 8rem;
  }
}

.videos-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.videos-workspace:has(#videos-player[data-stream-id]) {
  grid-template-columns: minmax(0, 1fr) minmax(34rem, 46%);
}
#videos-player { min-width: 0; }
#videos-player[hidden], #videos-back { display: none; }
.videos-library {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
#tab-videos:not(.hidden) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.videos-player {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: var(--space-2);
}
.videos-preview-head {
  flex: 0 0 auto;
  margin: 0 0 var(--space-2);
  min-width: 0;
}
.videos-workspace:has(#videos-player[data-stream-id]) .videos-preview-head {
  margin-bottom: 0.35rem;
}
.videos-file-name {
  display: block;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#videos-player[data-stream-id] {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}
#videos-player[data-stream-id] .stream-video { display: contents; }
#videos-player[data-stream-id] .video-stage { order: 1; flex-shrink: 1; min-height: 9rem; }
#videos-player[data-stream-id] .recording-timeline { order: 1; flex: 0 0 auto; margin: 0; }
#videos-player[data-stream-id] .videos-preview-head { order: 2; margin: 0; padding: 0.15rem 0 0; border: 0; }
#videos-player[data-stream-id] .video-lifecycle-actions { order: 3; margin: 0; justify-content: flex-start; }
#videos-player[data-stream-id] .video-files {
  order: 4;
  flex: 0 1 auto;
  max-height: 11rem;
  overflow: auto;
  margin: 0;
  padding-top: 0.15rem;
  border-top: 1px solid var(--border);
}
#videos-player[data-stream-id] .detail-head { order: 5; }
#videos-player[data-stream-id] .video-subs-toggle { order: 6; }
#videos-player[data-stream-id] .video-overlay-editor { order: 7; flex: 1 1 auto; min-height: 0; height: auto; margin-top: 0.15rem; }
#videos-player[data-stream-id] .stream-video > .muted { order: 8; }
#videos-player[data-stream-id] .videos-file-name {
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: normal;
}
.videos-player .stream-video {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.videos-player .video-stage {
  flex: 0 0 auto;
  width: 100%;
  height: min(52vh, 34rem);
  min-height: 16rem;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: #000;
}
.videos-player .detail-head { flex: 0 0 auto; }
.videos-player .detail-head h4 { display: none; }
.detail-head-actions { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.video-subs-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  flex: 0 0 auto;
}
.videos-player .stream-video video {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  background: #0b0b0f;
  border-radius: 0;
}
.videos-player .video-overlay-editor {
  flex: unset;
  max-height: none;
  min-height: 0;
  height: 100%;
  margin-top: 0;
}
/* On Videos, the cue list uses the full editor width. The edit fields
   sit in one bar under the list instead of a narrow side column. */
.videos-player .video-editor-body,
.videos-player .video-editor-body:has(.video-cue-form:not([hidden])) {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}
.videos-player .video-editor-body:has(.video-cue-form:not([hidden])) .video-cue-scroll {
  border-right: 0;
  border-bottom: 1px solid var(--border);
}
.videos-player .video-cue-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.45rem 0.65rem;
  max-height: none;
  border-top: 0;
}
.videos-player .video-cue-form label:first-child { flex: 1 1 16rem; }
.videos-player .video-cue-form label:nth-child(2) { flex: 0 1 8rem; }
.videos-player .video-cue-form label:nth-child(3),
.videos-player .video-cue-form label:nth-child(4) { flex: 0 1 6rem; }
.videos-player .video-cue-form-actions { margin-top: 0; flex: 1 1 auto; justify-content: flex-end; }
.videos-player .video-cue-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.videos-player > .empty {
  flex: 1 1 auto;
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  max-width: none;
  margin: 0;
}
.videos-player-meta { margin: 0.15rem 0 0; flex: 0 0 auto; }
.video-lifecycle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0 0 var(--space-2);
  flex: 0 0 auto;
}
.videos-workspace:has(#videos-player[data-stream-id]) .video-lifecycle-actions {
  margin-bottom: 0.35rem;
}
.videos-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  scroll-padding-block-start: 4.5rem;
  -webkit-overflow-scrolling: touch;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}
.videos-list > .empty {
  max-width: none;
  margin: auto;
  padding: var(--space-4);
  border: 0;
}
.video-list-head,
.video-item {
  align-items: center;
  min-width: 0;
  font-size: 1rem;
}
.video-list-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.video-item {
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  flex: 0 0 auto;
  padding: 0.2rem 0.85rem;
  min-height: 4.25rem;
}
.video-item:last-child { border-bottom: 0; }
.video-item:hover { background: var(--panel-2); }
.video-item:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
.video-item.is-selected {
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  box-shadow: inset 2px 0 0 var(--accent);
}
.video-item-main {
  display: contents;
  text-decoration: none;
  color: inherit;
}
.video-item-check {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.4rem 0.15rem 0.4rem 0.45rem;
  cursor: pointer;
}
.video-item-check input { margin: 0; }
.video-group-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
}
.video-col-sort {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}
.video-col-sort:hover { color: var(--text); }
.video-item-name,
.video-item-date,
.video-item-dur,
.video-item-size,
.video-item-status {
  min-width: 0;
}
.video-item-name {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.video-item-title {
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-item .small { font-size: 0.95rem; }
.video-item .badge,
.video-item-status .badge { font-size: 0.95rem; }
.video-item button.tiny { font-size: 0.95rem; min-height: 2.4rem; padding: 0.4rem 0.75rem; }
.video-item-date,
.video-item-dur,
.video-item-size { white-space: nowrap; }
.video-item-status { justify-self: end; }
.video-cue-list {
  flex: 0 1 8rem;
  min-height: 0;
  margin-top: 0.45rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.video-cue-list-head {
  padding: 0.35rem 0.15rem;
  flex: 0 0 auto;
}
.video-cue-list-body {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
}
.video-cue-list-body li { margin: 0; }
.stream-video video::cue {
  background: rgba(0, 0, 0, 0.72);
  color: #f4f4f5;
  font-size: 0.95rem;
  line-height: 1.35;
}
.video-thumb {
  width: 5.2rem;
  height: 2.9rem;
  object-fit: cover;
  border-radius: 4px;
  background: #111;
  flex: 0 0 auto;
}
.video-thumb-spacer {
  visibility: hidden;
  pointer-events: none;
}
.video-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.videos-list .video-list-head,
.videos-list .video-item {
  min-width: 0;
}
.videos-list .video-list-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0 0 0.55rem;
  background: var(--bg);
  border: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: none;
}
.videos-list .video-list-head .video-thumb-spacer { display: none; }
.videos-list .video-thumb-frame {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #111;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 10;
}
.videos-list .video-thumb-frame .video-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  border-radius: 0;
  display: block;
}
.videos-list .video-item-main { min-width: 0; color: inherit; text-decoration: none; }
.videos-list .video-item-copy { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.videos-list .video-item-name { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.videos-list .video-item-title {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.videos-list .video-item-facts { display: flex; flex-wrap: wrap; gap: 0.15rem 0.45rem; align-items: center; }
.videos-list .video-item-facts .video-item-date::after,
.videos-list .video-item-facts .video-item-dur::after { content: "·"; margin-left: 0.45rem; }
.videos-list .video-item.is-selected {
  background: transparent;
  box-shadow: none;
}
.videos-list .video-item.is-selected .video-thumb-frame { outline: 2px solid var(--accent); outline-offset: 1px; }
.videos-list .video-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "check open" ". actions";
  gap: 0.2rem 0.65rem;
  align-items: start;
  padding: 0.55rem 0;
  min-height: 0;
  border: 0;
  background: transparent;
}
.videos-list .video-item-check { grid-area: check; padding-top: 0.35rem; }
.videos-list .video-item-main {
  grid-area: open;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
}
.videos-list .video-item-main:hover .video-item-title,
.videos-list .video-item-main:focus-visible .video-item-title { text-decoration: underline; }
.videos-list .video-item-actions {
  grid-area: actions;
  position: static;
  padding: 0;
  justify-content: flex-start;
}
@media (max-width: 900px), (max-height: 620px) {
  #videos-player[data-stream-id] .video-stage { height: min(42vh, 22rem); min-height: 12rem; }
}
@media (max-width: 900px) {
  .video-cue-list { flex-basis: 5.5rem; }
}

/* --- diagrams ---
   Same frame as .chart-group: positioned, so the shared tooltip can be placed
   against it and clamped to its width. */
.viz { position: relative; margin-bottom: 0.9rem; }
svg.viz-svg { display: block; width: 100%; height: auto; overflow: visible; }

.viz-label { fill: var(--text); font-size: 10px; }
.viz-count { fill: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.viz-rail { stroke: var(--border); stroke-width: 2; }

.viz a { cursor: pointer; }
.viz a .viz-mark { transition: filter 0.1s ease; }
.viz a:hover .viz-mark { filter: brightness(1.3); }
/* SVG anchors are focusable natively, so this is the whole keyboard story. */
.viz a:focus { outline: none; }
.viz a:focus-visible .viz-mark { outline: 2px solid var(--accent); outline-offset: 2px; }

.viz-mark { fill: var(--flow-in); }
.viz-mark.mine { fill: var(--accent); }
/* A ring, the same idiom the chart cursor uses: this mark sits on top of
   something — here, the first time they ever appeared in that channel. */
.viz-mark.first { stroke: var(--accent-2); stroke-width: 2; }
.viz-more { fill: var(--muted); }
.viz-link { fill: var(--muted); text-decoration: underline; }
.viz a:hover .viz-link { fill: var(--text); }

/* Columns and the equality reference line share the chart card's language. */
.chart-bar { opacity: 0.9; }
.chart-equality { stroke: var(--grid); stroke-width: 1.5; stroke-dasharray: 4 4; }

/* --- the broadcast timeline ---
   Days down the side, the clock across the top, one bar per broadcast at the
   hours it ran. Rows are a grid so the label column and the track stay in
   step without a table; bars sit inside the track by percentage, so the track
   itself reflows to any width. The labels do not, which is what the media
   queries at the foot of this block are for.

   Geometry is custom properties rather than fixed pixels in the renderer, so
   a coarse pointer and a narrow screen can grow the lanes without JavaScript
   knowing a thing about it. --tl-i is the lane index and --tl-lanes the count,
   both stamped inline by renderTimeline. */
.tl {
  margin-top: 0.4rem; --tl-lane: 20px; --tl-pad: 6px; --tl-h: 14px;
  /* The lens. --tl-z is how many times the day is magnified and --tl-x where
     the visible window starts, both in fractions of a day; JS writes them and
     everything below works out its own position from them, so a pan is two
     property writes and never a re-render. */
  --tl-z: 1; --tl-x: 0;
}
.tl.tl-comfortable { --tl-lane: 28px; --tl-pad: 8px; --tl-h: 18px; }
/* Keep hover details above the sticky hour axis (6) and selection bar (8). */
.tl > .chart-tip { z-index: 9; }
.tl.tl-embed { margin: 0.35rem 0 0.75rem; }
.tl.tl-embed .tl-more { margin-left: 6rem; }
/* Anything placed on the clock: at fraction f of the day it lands at
   (f - x) * z of the width. One formula, used by the bars, the now marker and
   the hour ticks alike, so the axis and the data can never drift apart. */
.tl-bar, .tl-now, .tl-hours span {
  left: calc((var(--tl-x0) - var(--tl-x)) * var(--tl-z) * 100%);
}
.tl-legend {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1rem;
  margin-bottom: 0.5rem; font-size: 0.8rem;
}
.tl-legend-item { display: inline-flex; align-items: center; gap: 0.25rem; position: relative; }
.tl-legend-item.active .tl-legend-filter { color: var(--text); background: var(--border); }
.tl-legend-filter { padding: 0 0.25rem; line-height: 1.2; opacity: 0.65; }
.tl-legend-filter:hover, .tl-legend-filter:focus-visible { opacity: 1; }
.tl-legend a { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 0.4rem; }
.tl-legend a:hover, .tl-legend a:focus-visible { text-decoration: underline; }
.tl-swatch { position: relative; display: inline-flex; align-items: center; }
.tl-key {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none;
  background: var(--hue); border: none; padding: 0; cursor: pointer; vertical-align: middle;
  /* Match the bars immediately when a saved color or pattern changes. */
  transition: none;
  /* Beat the global button fill so a swatch is its hue, not the accent. */
  color: transparent; line-height: 0;
}
button.tl-key:hover, button.tl-key:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.tl-style-pop {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 12;
  display: flex; flex-direction: column; gap: 0.45rem;
  padding: 0.55rem 0.6rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  min-width: 14rem;
}
.tl-style-pop.hidden { display: none; }
.tl-style-grid { display: flex; flex-direction: column; gap: 0.35rem; }
.tl-style-row { display: grid; grid-template-columns: 3.2rem 1fr; gap: 0.35rem; align-items: center; }
.tl-style-row-label { line-height: 1; }
.tl-style-hues { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tl-style-hues .tl-key { width: 16px; height: 16px; border-radius: 4px; }
.tl-style-hues .tl-key.is-on { outline: 2px solid var(--text); outline-offset: 1px; }
.tl-style-hues .tl-key.is-taken,
.tl-style-hues .tl-key:disabled {
  opacity: 0.28; cursor: not-allowed; outline: none;
}
.tl-key.tl-dot {
  border: 1px solid color-mix(in srgb, var(--hue) 55%, transparent);
}
/* What height means. Neutral on purpose: drawn in a channel's hue it would
   read as being about that channel. */
.tl-scale { display: flex; align-items: flex-end; gap: 2px; margin-bottom: 0.6rem; }
.tl-scale i { width: 7px; background: var(--muted); border-radius: 1px; height: var(--tl-h); }
.tl-scale .small { margin: 0 0.4rem; }
.tl-caption { margin-top: 0.5rem; }

/* Days are bands, not a stacked tape: padding, a hairline, and a two-line
   label (weekday over date) so the eye can drop down the column. The hour
   axis sticks under the header and live rail so a long list still has a clock. */
.tl-row { display: grid; grid-template-columns: minmax(5.25rem, auto) 1fr; gap: 0 0.75rem; align-items: center; }
.tl-row:not(.tl-head):not(.tl-quiet) { padding: 0.28rem 0; }
.tl-row:not(.tl-head):not(.tl-quiet) + .tl-row:not(.tl-quiet) {
  border-top: 1px solid var(--border);
  margin-top: 0.2rem;
  padding-top: 0.45rem;
}
.tl.tl-comfortable .tl-row:not(.tl-head):not(.tl-quiet) { padding: 0.4rem 0; }
.tl.tl-comfortable .tl-row:not(.tl-head):not(.tl-quiet) + .tl-row:not(.tl-quiet) { padding-top: 0.55rem; }
.tl-head {
  position: sticky;
  top: calc(var(--header-h) + var(--live-rail-h) + 1px);
  z-index: 6;
  background: var(--bg);
  padding: 0.15rem 0 0.35rem;
  margin-bottom: 0.1rem;
  border-bottom: 1px solid var(--border);
}
.tl:has(.tl-pickbar) .tl-head,
#streams-list:has(> .tl-pickbar) .tl-head { top: calc(var(--header-h) + var(--live-rail-h) + 3.25rem); }
.tl-month {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.85rem 0 0.3rem;
  margin: 0.45rem 0 0.1rem;
  border-bottom: 1px solid var(--border);
}
.tl-head + .tl-month { margin-top: 0.2rem; padding-top: 0.45rem; }
/* A day label is the way into that day, like every day mark on every chart
   here. It reads as a label and only shows it is a link under the pointer. */
.tl-label {
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.05rem;
  padding: 0.15rem 0; line-height: 1.15;
  white-space: nowrap; font-variant-numeric: tabular-nums;
  text-decoration: none; color: var(--muted);
}
.tl-dow {
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
.tl-date {
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums;
}
a.tl-label:hover .tl-date, a.tl-label:focus-visible .tl-date { text-decoration: underline; }
.tl-row.is-today .tl-dow { color: var(--accent); }
.tl-row.is-today .tl-date { color: var(--text); }
.tl-track {
  position: relative; margin: 0;
  height: calc(var(--tl-lanes, 1) * var(--tl-lane) + var(--tl-pad));
  background-color: color-mix(in srgb, var(--panel) 70%, transparent);
  /* Noon and midnight read harder than the three-hour grid, then the grid
     itself, all shifted with the lens so they cannot drift from the bars. */
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--text) 22%, transparent) 1px, transparent 1px),
    linear-gradient(to right, var(--border) 1px, transparent 1px);
  background-size:
    calc(50% * var(--tl-z)) 100%,
    calc(12.5% * var(--tl-z)) 100%;
  background-position-x:
    calc(var(--tl-x) * var(--tl-z) * -100%),
    calc(var(--tl-x) * var(--tl-z) * -100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Zoomed in, most of the day is outside the track and must be clipped. */
  overflow: hidden;
  /* Vertical scrolling still belongs to the page; sideways is the lens's. */
  touch-action: pan-y;
}
.tl-row.is-weekend .tl-track {
  background-color: color-mix(in srgb, var(--panel-2) 88%, transparent);
}
.tl-row.is-today .tl-track {
  background-color: color-mix(in srgb, var(--accent) 8%, var(--panel));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, var(--border));
}
/* Only once there is somewhere to pan to. At full width the cursor would be
   promising a gesture that does nothing. */
.tl.is-zoomed .tl-track { cursor: grab; }
.tl.is-zoomed .tl-track:active { cursor: grabbing; }
.tl-head .tl-track {
  background: none; background-color: transparent; border: none; height: 1.25rem; cursor: default;
  box-shadow: none; border-radius: 0;
}
/* Ticks are placed on the clock like the bars are, rather than shared out
   across a grid, because the count and the spacing change with the zoom. */
.tl-hours span {
  position: absolute; top: 0; padding-left: 3px;
  font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tl-hours span.is-major { color: var(--text); font-weight: 600; }
.tl-head .tl-label, .tl-quiet .tl-label { padding: 0; min-height: 0; }
.tl-quiet { margin: 0.15rem 0 0.25rem; padding: 0; }
.tl-gap {
  display: flex; align-items: center; justify-content: center;
  min-height: 1.55rem; color: var(--muted); font-size: 0.7rem;
  background-image: linear-gradient(to right, var(--border), var(--border));
  background-size: 100% 1px; background-repeat: no-repeat; background-position: center;
}
.tl-gap span { padding: 0 0.55rem; background: var(--bg); }
.tl-more { margin: 0.65rem 0 0 6rem; font-size: 0.8rem; }
.tl-more a { color: var(--muted); }
.tl-more a:hover, .tl-more a:focus-visible { color: var(--text); }

/* One line per channel: a middle column of names, each parked at its lane's
   own offset so it lines up with the bars it belongs to. */
.tl.tl-by-channel .tl-row { grid-template-columns: minmax(5.25rem, auto) minmax(3.5rem, 5.5rem) 1fr; }
.tl-lane-labels { position: relative; align-self: stretch; }
.tl-lane-labels span {
  position: absolute; left: 0; right: 0;
  top: calc(var(--tl-i) * var(--tl-lane) + var(--tl-pad) / 2);
  height: var(--tl-lane); line-height: var(--tl-lane);
  font-size: 0.7rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Separate recording blocks — see renderTimeline.
   Bars sit on their lane's baseline rather than its top edge, so the four
   heights are comparable across lanes and days at a glance. */
.tl-bar {
  position: absolute; min-width: 4px; border-radius: 4px;
  width: calc(var(--tl-w) * var(--tl-z) * 100%);
  overflow: hidden; display: block;
  height: var(--tl-h);
  top: calc(var(--tl-i) * var(--tl-lane) + var(--tl-pad) / 2 + var(--tl-lane) - var(--tl-pad) - var(--tl-h));
  box-shadow: none;
}
/* Breaks keep the track visible, with a light connector in the channel hue. */
.tl-bar::before { content: none; }
.tl-segment-gap {
  position: absolute; top: 0; bottom: 0;
  container: recording-gap / size;
  overflow: visible; z-index: 2;
  color: color-mix(in srgb, var(--hue) 75%, var(--text));
}
.tl-segment-gap::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  border-top: 1px dashed color-mix(in srgb, var(--hue) 40%, transparent);
}
.tl-segment-gap-label { display: none; }
/* A fixed-size break glyph stays visible even for subpixel interruptions.
   It overlays the boundary without shifting either recording on the clock. */
.tl-segment-gap::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 5px; height: min(10px, calc(var(--tl-h) - 2px));
  border-inline: 1px solid currentColor;
  background: var(--panel); box-shadow: 0 0 0 2px var(--panel);
  transform: translate(-50%, -50%) skewX(-20deg);
}
@container recording-gap (min-width: 76px) and (min-height: 16px) {
  .tl-segment-gap::after { display: none; }
  .tl-segment-gap-label {
    display: block; position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%); padding: 1px 6px;
    border: 1px solid color-mix(in srgb, var(--hue) 25%, transparent);
    border-radius: 999px; background: var(--panel);
    font-size: 9px; line-height: 12px; font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
}
.tl-seg {
  position: absolute; top: 0; bottom: 0; min-width: 1px;
  left: var(--tl-seg-x);
  width: var(--tl-seg-width);
  /* Live and ended recordings keep the channel's selected color and opacity. */
  background: var(--hue);
  border-radius: min(6px, calc(var(--tl-h) / 2));
  z-index: 1;
  /* Recording boundaries follow the clock without adding visual downtime. */
  box-shadow: inset 0 1px 0 #ffffff26, inset 0 -1px 0 #00000026;
}
/* Touching recordings share a straight edge, including custom pill shapes. */
.tl .tl-bar .tl-seg.tl-seg-joined-start { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
.tl .tl-bar .tl-seg.tl-seg-joined-end { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.tl-seg.tl-picked { box-shadow: 0 0 0 2px var(--accent); filter: brightness(1.3); z-index: 4; }
/* A bar that ran in from yesterday or out into tomorrow is squared on that
   side, so the midnight cut is not mistaken for a start or an end. */
.tl-bar.tl-from { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-bar.tl-to { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-bar:hover .tl-seg, .tl-bar:focus-visible .tl-seg { filter: brightness(1.3); }
.tl-bar.tl-dim { opacity: 0.25; }
.tl-bar.tl-dim .tl-seg { filter: none; }
.tl-bar.tl-peer { z-index: 2; }
.tl-bar.tl-peer .tl-seg { filter: brightness(1.35); box-shadow: 0 0 0 1px var(--text); }
.tl-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tl-bar.tl-picked {
  z-index: 3;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tl-bar.tl-picked.tl-dim { opacity: 1; }
.tl-bar.tl-picked .tl-seg { filter: brightness(1.25); box-shadow: 0 0 0 1px var(--accent); }
.tl-pickbar {
  position: sticky; top: calc(var(--header-h) + var(--live-rail-h) + 1px); z-index: 8;
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem 0.7rem;
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.7rem;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
/* Event ticks on a bar — same hues the console feed uses for those kinds, so
   a gift, a guest, a mute and a poll are the same colours here as there. */
.tl-evs { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.tl-ev {
  position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px;
  border-radius: 1px; pointer-events: auto; z-index: 5;
  box-shadow: 0 0 0 1px var(--bg);
}
.tl-ev-gift { background: var(--gem); }
.tl-ev-guest { background: var(--accent-2); }
.tl-ev-mod { background: var(--danger); }
.tl-ev-room { background: var(--muted); }
.tl-ev:hover, .tl-ev:focus-visible {
  outline: 1px solid var(--text); outline-offset: 1px; z-index: 6;
}
.tl-ev-filter { border-left: 3px solid transparent; }
.tl-ev-filter-gift { border-left-color: var(--gem); }
.tl-ev-filter-guest { border-left-color: var(--accent-2); }
.tl-ev-filter-mod { border-left-color: var(--danger); }
.tl-ev-filter-room { border-left-color: var(--muted); }

/* How big the night was, in quarters — the ranked scale magnitudeBands cuts.
   Height and not fill or opacity: those pixels already carry the stitched
   rendering above, and height is a size channel, so the whole magnitude read
   survives for a reader who sees no hue at all. */
.tl-w1 { --tl-h: 7px; } .tl-w2 { --tl-h: 10px; } .tl-w3 { --tl-h: 13px; } .tl-w4 { --tl-h: 16px; }
/* Nothing was recorded — not a quiet night. Different in kind, not degree. */
.tl-w0 { --tl-h: 8px; background: none; border: 1px dashed var(--hue); box-shadow: none; }
.tl-w0::before, .tl-w0 .tl-seg { display: none; }

.tl-hue-1 { --hue: var(--cat-1); } .tl-hue-2 { --hue: var(--cat-2); }
.tl-hue-3 { --hue: var(--cat-3); } .tl-hue-4 { --hue: var(--cat-4); }
.tl-hue-5 { --hue: var(--cat-5); } .tl-hue-6 { --hue: var(--cat-6); }
.tl-hue-7 { --hue: var(--cat-7); } .tl-hue-8 { --hue: var(--cat-8); }
.tl-hue-9 { --hue: var(--cat-9); } .tl-hue-10 { --hue: var(--cat-10); }
.tl-hue-11 { --hue: var(--cat-11); } .tl-hue-12 { --hue: var(--cat-12); }
.tl-other { --hue: var(--muted); }
/* Shared fills keep the legend and picker faithful to the channel's bars. */
.tl-key.tl-alt, .tl-bar.tl-alt .tl-seg { background: repeating-linear-gradient(135deg,
  var(--hue) 0 3px, color-mix(in srgb, var(--hue) 38%, var(--panel)) 3px 6px); }
.tl-key.tl-dot, .tl-bar.tl-dot .tl-seg {
  background-color: transparent;
  background-image: radial-gradient(circle, var(--hue) 1.15px, transparent 1.35px);
  background-size: 5px 5px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hue) 45%, var(--bg));
}
.tl-key.tl-ring, .tl-bar.tl-ring .tl-seg {
  background: transparent;
  border: 2px solid var(--hue);
  box-sizing: border-box;
  box-shadow: none;
}
/* The ring's stroke spans the full recording height. */
.tl-bar.tl-ring .tl-seg { top: 0; bottom: 0; }
.tl-now { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--live); pointer-events: none; }

/* Narrow screens. The day label moves above its own track rather than being
   truncated beside it, which hands the whole 5.25rem gutter back to the clock:
   at 360px that is ~336px of track instead of ~220. */
@media (max-width: 700px) {
  .tl-row, .tl.tl-by-channel .tl-row { grid-template-columns: 1fr; }
  .tl-label {
    flex-direction: row; align-items: baseline; gap: 0.4rem;
    padding-top: 0.55rem;
  }
  .tl-dow { font-size: 0.72rem; letter-spacing: 0.03em; }
  .tl-month { padding-top: 0.7rem; }
  .tl-more { margin-left: 0; }
  /* The lane names become one line above the day, in lane order. */
  .tl.tl-by-channel .tl-lane-labels {
    position: static; display: flex; flex-wrap: wrap; gap: 0 0.6rem; height: auto;
  }
  .tl.tl-by-channel .tl-lane-labels span { position: static; height: auto; line-height: 1.5; }
  /* Ticks are absolutely placed now, so hiding one cannot shift the others —
     and timelineTicks already thins them by zoom. Every other one keeps a
     narrow axis from running its labels together. */
  .tl-hours span:nth-child(even) { visibility: hidden; }
}
@media (max-width: 420px) {
  .tl-hours span:nth-child(4n + 2), .tl-hours span:nth-child(4n + 3),
  .tl-hours span:nth-child(4n + 4) { visibility: hidden; }
}
/* The rest of the app gives a touch target 40px; these bars were exempt from
   that rule, and a 4x14px anchor is not a thumb target. Because the geometry
   is custom properties, growing them is three declarations. */
@media (pointer: coarse) {
  .tl { --tl-lane: 28px; --tl-pad: 8px; }
  .tl-w1 { --tl-h: 12px; } .tl-w2 { --tl-h: 16px; } .tl-w3 { --tl-h: 20px; } .tl-w4 { --tl-h: 24px; }
  .tl-w0 { --tl-h: 14px; }
  .tl-bar { min-width: 10px; }
}

/* --- viewer trajectories ---
   Small multiples: one card per stream, all in the same ink because ten hues
   would be indistinguishable here. The caption on each card carries identity. */
.traj-grid {
  display: grid; gap: 0.6rem; margin-bottom: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.traj-card {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0.45rem 0.5rem;
  background: var(--panel-2);
}
.traj-card:hover, .traj-card:focus-visible { border-color: var(--accent); outline: none; }
.traj-head { display: block; font-size: 0.75rem; color: var(--text); }
.traj-foot { display: block; font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.traj-svg { display: block; width: 100%; height: auto; }
.traj-line { fill: none; stroke: var(--series-diamonds); stroke-width: 2; stroke-linejoin: round; }
.traj-card:hover .traj-line, .traj-card:focus-visible .traj-line { stroke: var(--accent); }
/* A watched channel with no audience yet still takes its seat: one missing
   from the picture of watched channels is a hole the reader cannot see. */
.viz-mark.idle { fill: var(--panel-2); stroke: var(--border); stroke-dasharray: 2 2; }

/* A filter strip above a figure, and the caption under one. Named for what
   they are rather than where they were first used: three unrelated features
   put a row of chips over a chart, and only one of them is a timeline.
   The stream timeline's filter strip and its caption both need air the plain
   .filter-row (used inline in a toolbar) deliberately does not have. */
.viz-filters { margin-bottom: 0.6rem; }
.viz-caption { margin-bottom: 0.7rem; }
.feed-stream_start, .feed-stream_end { opacity: 0.85; }

/* --- a person's era rail ---
   One rail of eras, newest at the top. The dot marks the era's channel; an
   accent ring on it is the person's first appearance in that channel — the
   migration moments the tab exists to show. */
.era-rail { display: flex; flex-direction: column; margin-left: 0.4rem; }
.era {
  position: relative;
  display: flex; gap: 0.8rem; align-items: baseline; flex-wrap: wrap;
  padding: 0.4rem 0 0.4rem 1rem;
  border-left: 2px solid var(--border);
}
.era::before {
  content: '';
  position: absolute; left: -6px; top: 0.75em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); border: 2px solid var(--panel-2);
}
.era.first::before { background: var(--accent-2); }
.era-when { flex: 0 0 auto; min-width: 8.5rem; }
.era-what { display: flex; gap: 0.45rem; align-items: baseline; flex-wrap: wrap; }
.era-what a { color: var(--text); }

/* --- toolbars --- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3);
}
.toolbar-group { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.toolbar input[type="search"] { min-width: 15rem; }
.filter-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0; }
.filter-row .active { border-color: var(--accent); color: var(--text); background: var(--panel-2); }

/* A toolbar that stacks: controls on the first row, chips on the second. Each
   row wraps on its own so a long run of channel chips never drags the search
   box down the page with it. */
.toolbar.stacked { flex-direction: column; align-items: stretch; gap: 0.6rem; }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }

/* Search / view / sort stay one line where there is room, so Filters and the
   summary chip do not drop under the search box on a tablet. */
@media (min-width: 701px) {
  #stream-toolbar > .toolbar-row:first-child { flex-wrap: wrap; }
  #stream-filter-form {
    flex: 1 1 auto; min-width: 12rem; max-width: 22rem;
  }
  #stream-filter-form input[type="search"] { min-width: 0; width: 100%; }
  #stream-view, #stream-sort, #stream-shape, #stream-more { flex: 0 0 auto; }
}

.people-track {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 1rem; width: 100%;
}
#people-track-toggle { display: none; }
.people-track-panel {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 1rem; width: 100%;
}
/* Desktop always shows the form — `hidden` is only for the phone disclosure. */
@media (min-width: 701px) {
  .people-track-panel[hidden] { display: flex; }
}

.settings-jump {
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  margin-bottom: var(--space-3);
  max-width: 62rem;
}
.settings-block { scroll-margin-top: calc(var(--header-h) + var(--live-rail-h) + 0.75rem); }

/* The folded half of the toolbar. `hidden` is an attribute, not a class, and a
   display rule beats it - so the [hidden] line below is not belt and braces,
   it is the only thing keeping the panel shut. */
.toolbar-panel { display: flex; flex-direction: column; gap: 0.6rem; }
.toolbar-panel[hidden] { display: none; }
/* The count rides in the label rather than in a floating pip: a pip has to be
   positioned against a button that changes width with its own text, and this
   button already says the word the number belongs to. */
#stream-more[aria-expanded="true"] { border-color: var(--accent); color: var(--text); background: var(--panel-2); }
#stream-more .count { color: var(--accent); }
/* One word in front of a chip row, so "Live · Ended · Had gifts" and a run of
   channel names read as two different questions rather than one long one. */
.chip-label { color: var(--muted); font-size: 0.78rem; margin-right: 0.1rem; }
/* What the list is narrowed to, and the one control that undoes all of it.
   Pushed to the right end of the row so it reads as a status, not a filter. */
.filter-summary { margin-left: auto; gap: 0.4rem; color: var(--muted); font-size: 0.8rem; }
.filter-summary .chip-label { margin: 0; }
/* The heading's totals for whatever is on screen. */
#streams-count .sep { margin: 0 0.3rem; opacity: 0.6; }
.empty-actions { margin-top: 0.75rem; }

/* An <a> that has to sit in a row of buttons. */
.button-like {
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--hit); padding: 0.2rem 0.55rem;
}
.button-like:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.overview-watch a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.detail-actions { display: flex; gap: 0.4rem; align-items: center; }

.broadcast-summary-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  gap: 0.4rem;
  margin: 0.45rem 0 0.75rem;
}
.broadcast-summary-metrics > div {
  min-width: 0;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.broadcast-summary-metrics dt { color: var(--muted); font-size: var(--text-sm); }
.broadcast-summary-metrics dd { margin: 0.1rem 0 0; font-weight: 600; }
.broadcast-summary > p { margin: 0.45rem 0; }
.broadcast-summary-label { margin-bottom: 0.2rem !important; }
.broadcast-summary-events { margin: 0 0 0.5rem; padding-left: 1.2rem; }
.broadcast-summary-coverage { margin-top: 0.7rem !important; }

/* Everyone the monitor can see right now. Not a table filter: presence is
   runtime state the paged query knows nothing about. */
.live-strip {
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
  margin-bottom: 0.8rem;
}
.live-strip .badge { text-decoration: none; }
.live-strip.panel-now-strip { display: block; margin-bottom: 1rem; }
.panel-now-heading { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; font-size: var(--text-sm); font-weight: 600; }
.panel-now-heading > svg { color: var(--muted); }
.panel-now-count { padding: 0.05rem 0.45rem; border-radius: 5px; background: var(--panel-2); color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.panel-now-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 0.5rem; }
.panel-now-card { display: flex; align-items: center; gap: 0.65rem; min-width: 0; padding: 0.65rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); text-decoration: none; }
.panel-now-card:hover { background: var(--panel-2); border-color: var(--live); text-decoration: none; }
.panel-now-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.panel-now-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--live); }
.panel-now-person { display: flex; flex: 1; flex-direction: column; min-width: 0; gap: 0.1rem; overflow-wrap: anywhere; }
.panel-now-guest { font-size: var(--text-sm); font-weight: 600; }
.panel-now-host { color: var(--muted); font-size: var(--text-xs); }
.panel-now-markers { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.2rem; }
.panel-now-duration { flex-shrink: 0; padding-left: 0.6rem; border-left: 1px solid var(--border); color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.panel-now-grid + .small { display: block; margin-top: 0.5rem; }

/* --- sortable headers --- */
.th-sort {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: none; border: none; padding: 0; margin: 0;
  color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit;
  cursor: pointer;
}
.th-sort:hover { color: var(--text); filter: none; }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
th.num .th-sort { flex-direction: row-reverse; }
.sort-arrow { font-size: 0.6em; color: var(--accent); }
th[aria-sort] { color: var(--text); }

/* --- pager --- */
.pager {
  display: flex; align-items: center; justify-content: center; gap: 0.8rem;
  padding: 0.9rem 0;
}
.pager-note { padding: 0.7rem 0; text-align: center; }

/* Non-numeric cells wrap by default, which is right for a comment and wrong
   for an error string long enough to double a table's row height. Truncate it
   and leave the whole text in the cell's title. */
/* The gift's own artwork, sized to sit on a line of text rather than to be
   looked at — it is there to be recognised at a glance beside the name. */
.gift-img {
  width: 20px; height: 20px; vertical-align: -0.35em;
  margin-right: 0.35rem; border-radius: 3px;
}

/* The raw protocol payload, folded away. It exists for the action codes the
   protocol does not name, so it has to be readable when opened and invisible
   when not. */
.raw summary { cursor: pointer; color: var(--muted); font-size: 0.8rem; }
.raw pre {
  margin-top: 0.4rem; padding: 0.5rem; max-width: 40ch; max-height: 16rem;
  overflow: auto; background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; font-size: 0.75rem; white-space: pre;
}

.trunc {
  display: inline-block; max-width: 22ch;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}

/* --- responsive columns ---
   Every cell carries the priority its column declared. A narrow screen drops
   the secondary columns rather than side-scrolling a table whose first column
   is the one being looked for. */
@container (max-width: 1200px) {
  [data-priority="4"] { display: none; }
}

@container (max-width: 900px) {
  [data-priority="3"] { display: none; }
}
@media (max-width: 1100px) {
  .app-header h1 span { display: none; }
}

@container (max-width: 700px) {
  [data-priority="2"] { display: none; }
}

@media (max-width: 700px) {
  main {
    padding: var(--space-3) var(--space-2);
    padding-left: max(var(--space-2), env(safe-area-inset-left, 0px));
    padding-right: max(var(--space-2), env(safe-area-inset-right, 0px));
  }
  /* Keep the notch padding the desktop header already applied. */
  .app-header { padding: var(--safe-top) var(--space-2) 0; gap: var(--space-2); }
  .app-header h1 { font-size: 0.9rem; }
  .app-header h1 span { display: none; }
  #header-more { display: inline-flex; }
  .header-overflow {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.5rem;
    min-width: 11rem;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    z-index: 50;
  }
  .header-overflow.is-open { display: flex; }
  .header-overflow #logout,
  .header-overflow #alerts-toggle { width: 100%; justify-content: flex-start; }
  .header-overflow .header-alerts { position: static; }
  .header-overflow #alerts-panel {
    position: static;
    width: 100%;
    max-height: min(16rem, 50vh);
    margin-top: 0.35rem;
  }
  #live-banner { padding: 0.2rem 0.6rem; }
  .toolbar input[type="search"] { min-width: 0; width: 100%; }
  .toolbar-group { width: 100%; }
  .toolbar-row { width: 100%; }
  .filter-summary { margin-left: 0; }
  /* iOS zooms any focused field under 16px. */
  input, select, textarea { font-size: 16px; }
  #channel-form, #videos-filter-form, #people-form, #track-form {
    flex-direction: column; align-items: stretch;
  }
  #channel-form input, #videos-filter-form input,
  #people-form input, #track-form input {
    width: 100%; min-width: 0;
  }
  .people-track #people-track-toggle { display: inline-flex; }
  .people-track-panel[hidden] { display: none; }
  section h2 .muted { display: block; margin-top: 0.15rem; }
  section h2 .page-blurb { display: none; }
  .modal-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    mask-image: none;
    -webkit-mask-image: none;
    row-gap: 0.35rem;
  }
  .modal-tabs .tab.active::after { display: none; }
  th, td { padding: 0.45rem 0.5rem; }
  .settings-actions { flex-wrap: wrap; }
  /* Full-bleed without 100vw — that unit includes the scrollbar and shoves
     the page sideways on a 375px phone. --vvh tracks the visual viewport. */
  .modal {
    width: 100%; max-width: 100%;
    height: var(--vvh); max-height: var(--vvh);
    margin: 0; border-radius: 0; border: none;
  }
  .counters { gap: 0.35rem 0.75rem; font-size: 0.82rem; }
  .counter-strip.full { gap: 0.35rem 0.75rem; padding: 0.45rem 0.6rem; }
  .counter-strip.full .counter { font-size: 0.82rem; }
  .live-card, .stream-card { padding: 0.6rem; }
  .live-now strong { font-size: 1.25rem; }
}

/* A 24px-tall button is a fine mouse target and a poor thumb one. */
@media (pointer: coarse) {
  button.tiny, .button-like { min-height: 40px; padding: 0.5rem 0.8rem; }
  button.tab, #logout, #header-more { min-height: 40px; }
  .th-sort { min-height: 0; padding: 0; }
  .setting-input input, .settings-block .field input, #people-track-toggle {
    min-height: 40px;
  }
}

/* Long usernames and comment text must be allowed to wrap; the numeric
   columns are what benefit from nowrap. */
td:not(.num) { white-space: normal; }

/* A refetch that keeps its frame: the current render dims rather than
   blanking to a skeleton and jumping the panel under the reader. */
.modal-body.loading { opacity: 0.55; transition: opacity 0.15s ease; }

/* This tab went from a single pulsing dot in the banner to one on every card,
   which is the point at which the animation needs an opt-out. */
@media (prefers-reduced-motion: reduce) {
  .badge.now .dot, #live-banner .dot { animation: none; }
}

/* A comment TikTok deleted. Kept past the rolling window on purpose, so it can
   sit among far newer ones — the strike is what says why it is still here. */
.feed-row.removed { opacity: 0.72; }
.feed-row.removed s { text-decoration-color: #f87171; }

/* The comments a moderation row removed, listed under its detail cell. */
.moderation-account { display: grid; justify-items: start; gap: 0.4rem; }
.removed-comments { margin: 0.4rem 0 0; padding-left: 1rem; list-style: none; }
.removed-comments li { margin-bottom: 0.25rem; border-left: 2px solid #f87171; padding-left: 0.5rem; }

/* --- gift gallery ---
   TikTok's own board, laid out the way TikTok lays it out: a grid of gift
   tiles, the sponsored ones lit and carrying their sponsor, the rest greyed
   with the number of sends they still need. A reader holding their phone next
   to this should not have to translate between the two. */
.gg-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.gg-head h4 { margin: 0; }
.gg-prev { margin-top: 1.4rem; }
.gg-prev h4 { margin-bottom: 0.4rem; }
.badge.gg-league { border-color: var(--gem); color: var(--gem); }
.gg-count { font-variant-numeric: tabular-nums; font-weight: 600; }
.gg-grid {
  display: grid; gap: 0.4rem; margin-bottom: 0.75rem;
  /* A fixed ceiling so one lit gift does not stretch across the overlay.
     The floor shrinks on a narrow panel so the row never overflows. */
  grid-template-columns: repeat(auto-fill, minmax(min(108px, 100%), 132px));
}
.gg-card {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--panel-2); display: flex; flex-direction: column; min-width: 0;
}
/* Unsponsored is the resting state and reads as such — the art is dimmed and
   desaturated the way TikTok greys it, rather than hidden. */
.gg-card .gg-art { filter: grayscale(1); opacity: 0.45; }
.gg-card.gg-lit { border-color: var(--gem); background: var(--panel); }
.gg-card.gg-lit .gg-art { filter: none; opacity: 1; }
.gg-art { height: 52px; display: flex; align-items: center; justify-content: center; padding: 0.25rem 0.25rem 0; }
.gg-art img { max-height: 100%; max-width: 100%; object-fit: contain; }
.gg-name {
  text-align: center; font-size: 0.72rem; padding: 0.05rem 0.3rem 0.2rem;
  color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gg-card.gg-lit .gg-name { color: var(--text); font-weight: 600; }
.gg-foot {
  border-top: 1px solid var(--border); padding: 0.15rem 0.3rem;
  font-size: 0.68rem; display: flex; align-items: center; justify-content: center;
  min-width: 0;
}
.gg-by {
  display: flex; align-items: center; justify-content: center; gap: 0.25rem;
  max-width: 100%; min-width: 0; line-height: 1.2;
}
.gg-by a, .gg-by .muted {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.gg-by img { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.gg-who { display: inline-flex; align-items: center; gap: 0.4rem; }
.gg-who img { width: 22px; height: 22px; border-radius: 50%; flex: none; }
.gg-goal { font-variant-numeric: tabular-nums; }
/* How much of the board is lit — the one figure the API really returns. */
.gg-bar { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-bottom: 0.4rem; }
.gg-bar span { display: block; height: 100%; background: var(--gem); }

/* --- settings, grouped ---
   .env is long enough now that one flat grid was a wall. The groups are the
   ones the file itself is organised into. */
.settings-group {
  margin: 1.2rem 0 0.6rem; font-size: 0.85rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
  border-bottom: 1px solid var(--border); padding-bottom: 0.3rem;
}
.settings-group:first-of-type { margin-top: 0.4rem; }
/* A switch reads as a line, not as a labelled box with an empty column. */
.setting-bool .setting-input { justify-content: flex-start; }
.setting-bool input[type="checkbox"] { width: auto; }
.setting-label .badge { margin-left: 0.4rem; vertical-align: 1px; }

/* --- one gift --- */
.gift-hero { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.8rem; }
.gift-hero h4 { margin: 0 0 0.2rem; }
.gift-hero-art { width: 72px; height: 72px; object-fit: contain; flex: none; }
/* A gift's name is a link, but a table of them should not read as a page of
   blue — the same rule the diary headings follow. */
.gift-link { color: inherit; text-decoration: none; }
.gift-link:hover, .gift-link:focus-visible { text-decoration: underline; color: var(--text); }

/* Workspace shell and shared page hierarchy. Component colors above carry
   event meaning; purple here marks navigation, selection and actions. */
.app-header { padding-left: 1.5rem; padding-right: 1.5rem; gap: 1rem; }
.app-brand { display: flex; align-items: center; gap: 0.7rem; line-height: 1.3; }
.app-brand > .icon { color: var(--accent); width: 1.35rem; height: 1.35rem; }
.app-brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 3px; }
.workspace-label { display: none; color: var(--muted); font-size: var(--text-sm); }
.nav-caption { display: none; }
.app-nav .tab { display: flex; align-items: center; gap: 0.65rem; }
.app-nav .tab > .icon { width: 16px; height: 16px; opacity: 0.8; flex: none; }
.app-nav .tab.active { background: var(--selected); border-color: transparent; color: var(--accent); }
.app-nav .tab.active::after { display: none; }
.app-nav .tab:hover { background: var(--panel-2); color: var(--text); filter: none; }
.header-actions { margin-left: auto; }

@media (min-width: 1100px) {
  :root { --sidebar-w: 208px; --header-row: 3.75rem; }
  .app-header .app-brand {
    position: fixed; top: 0; left: 0; z-index: 22;
    width: var(--sidebar-w); height: var(--header-h);
    padding: var(--safe-top) 1.25rem 0; background: var(--panel);
    border-right: 1px solid var(--border); font-size: 14px;
  }
  .app-header .app-brand span { display: block; }
  .app-nav {
    position: fixed; top: var(--header-h); bottom: 0; left: 0;
    width: var(--sidebar-w); padding: 1.75rem 0.75rem 1rem;
    display: flex; flex-direction: column; gap: 0.35rem;
    background: var(--panel); border-right: 1px solid var(--border);
    overflow-y: auto; overflow-x: hidden;
  }
  .nav-caption { display: block; padding: 0 0.75rem 0.7rem; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
  .app-nav .tab { min-height: 44px; padding: 0.65rem 0.75rem; border: 1px solid transparent; font-size: 14px; text-align: left; }
  .app-nav .tab.active { border-color: color-mix(in srgb, var(--accent) 18%, transparent); }
  .app-nav .tab[data-tab="settings"] { margin-top: auto; }
  .workspace-label { display: inline; }
}
@media (max-width: 1099px) {
  .app-brand span, .app-nav .tab > .icon { display: none; }
  .app-nav { gap: 0.25rem; }
  .app-nav .tab { flex: none; padding: 0.4rem 0.65rem; }
  .app-header { gap: 0.65rem; padding-left: 1rem; padding-right: 1rem; }
}

.page-heading { margin-bottom: 1.5rem; flex: 0 0 auto; }
.page-heading h2 { margin: 0.3rem 0 0.5rem; }
.eyebrow { display: block; color: var(--accent); font-size: 10px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; }
.page-description { color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 52rem; }
.my-channel-controls { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.my-channel-controls select { min-width: min(18rem, 100%); }
.my-channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 0.75rem; margin: 1rem 0 1.5rem; }
.my-channel-stat { min-width: 0; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.my-channel-stat strong { display: block; font-size: clamp(1.25rem, 3vw, 1.75rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.my-channel-stat span { display: block; margin-top: 0.2rem; color: var(--muted); font-size: var(--text-sm); }
.my-channel-section { margin: 1.5rem 0; }
.my-channel-section h3 { margin-bottom: 0.5rem; }
.my-channel-chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 0.75rem; }
.my-channel-chart { min-width: 0; }
.my-channel-chart .chart-group { grid-template-columns: 1fr; gap: 0.5rem; margin-bottom: 0; }
.my-channel-chart .chart-card { min-width: 0; }
.my-channel-change-list { display: grid; gap: 0.4rem; padding: 0; list-style: none; }
.my-channel-change-list li { display: flex; gap: 0.5rem; flex-wrap: wrap; padding: 0.65rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.my-channel-note { padding: 0.75rem 1rem; border-left: 3px solid var(--accent); background: var(--panel); }
.page-heading-action { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.page-heading-action > button { flex: none; }
section h2 .small { letter-spacing: normal; vertical-align: middle; }
#streams-count, #videos-count { margin-left: 0.5rem; }

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select {
  min-height: var(--hit); font-size: 14px; padding: 0.4rem 0.65rem;
  border-radius: var(--radius); background: var(--bg);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
input::placeholder { color: var(--muted); opacity: 0.75; }
:where(a, summary, select, input, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button.ghost:hover { background: var(--panel-2); filter: none; }
.view-toggle { padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.view-toggle button { border: 0; background: transparent; }
.view-toggle button.active { color: var(--accent); background: var(--selected); box-shadow: none; }
.toolbar { padding: 0.85rem; border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius-lg); margin-bottom: 1.25rem; }
.toolbar .toolbar { padding: 0; border: 0; margin-bottom: 0; }
.toolbar-panel:not([hidden]) { padding-top: 0.8rem; border-top: 1px solid var(--border); }
.toolbar-row { gap: 0.6rem 0.8rem; }
#stream-filter-form { min-width: 10rem; }
#stream-shape { min-width: 0; flex: 1 1 auto; }
#stream-shape:empty { display: none; }
#stream-toolbar:has(.timeline-primary-controls) > .toolbar-row:first-child { align-items: flex-start; }
.timeline-primary-controls, .timeline-display-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
.timeline-display { width: 100%; }
.timeline-display-controls { padding-top: 0.75rem; gap: 0.6rem; }
#timeline-display-panel[hidden] { display: none; }
.timeline-display-controls .chip-label { flex-basis: 100%; margin-top: 0.25rem; }
.toolbar [aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.filter-summary { font-size: var(--text-sm); }
.channel-add-panel { padding: 1rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); }
.channel-add-panel .toolbar { margin: 0; padding: 0; border: 0; }
.people-track { border-top: 1px solid var(--border); padding-top: 0.65rem; }
#people-track-toggle { display: inline-flex; }
.people-track-panel[hidden] { display: none; }
.live-strip { padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); gap: 0.5rem; }
.live-strip:empty { display: none; }

.group-head th { padding: 1.1rem 0.85rem; background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }
.group-head th > a { font-size: 15px; }
.group-head .group-note { display: inline-block; font-size: var(--text-sm); font-weight: 400; color: var(--muted); }
.group-title { font-size: 15px; padding-bottom: 0.65rem; margin-top: 1.5rem; }
.pinned-live { margin-bottom: 1.5rem; padding-bottom: 1.25rem; }
.pinned-live .live-card { border-left-width: 2px; }
.stream-grid { gap: 1rem; }
.stream-card, .live-card { padding: 1rem; }
.stream-card { border-left-color: var(--border); }
.stream-card.is-live { border-left-color: var(--live); }
.stream-card.is-friendly {
  border-left-color: var(--friendly);
  background: color-mix(in srgb, var(--friendly) 8%, var(--panel));
}
.stream-card.is-problem {
  border-left-color: var(--flag-block);
  background: color-mix(in srgb, var(--flag-block) 8%, var(--panel));
}
.th-sort { min-height: 0; }
.empty { background: var(--panel); border-radius: var(--radius-lg); padding: 2rem 1.5rem; color: var(--muted); }
.loading { color: var(--muted); }
.settings-block { padding: 1.5rem; margin-bottom: 1.25rem; }
.settings-block h3 { font-size: 18px; margin-bottom: 0.6rem; }
.settings-grid { gap: 1.5rem; }
.settings-group { margin-top: 1.75rem; padding-bottom: 0.6rem; }
.settings-actions { padding-top: 1rem; border-top: 1px solid var(--border); }
.settings-status dd { min-width: 0; overflow-wrap: anywhere; }
.settings-jump .tab { min-height: 36px; }
.diagram, .chart-group { border-radius: var(--radius-lg); }

/* Videos alone uses the remaining viewport at full content width. */
#app-view:has(#tab-videos:not(.hidden)) { height: 100dvh; overflow: hidden; }
#app-view:has(#tab-videos:not(.hidden)) > main {
  flex: 1;
  overflow: hidden;
  max-width: none;
  width: 100%;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
}
#app-view:has(#tab-videos:not(.hidden)) > footer { padding: 0.35rem 1rem; font-size: 10px; }
.videos-player { padding: 0; border: 0; background: transparent; }
.videos-preview-head { padding-bottom: 0; border-bottom: 0; }
.videos-file-name { font-size: 1.15rem; }

.modal { border-radius: 12px; }
.modal-head { padding: 1rem 1.25rem; }
.modal-head h3 { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.crumbs { padding: 0.75rem 1.25rem 0; font-size: var(--text-sm); }
.modal-tabs { padding: 0.5rem 1.25rem; gap: 0.35rem; }
.modal-tabs button.tab { border-color: transparent; padding: 0.4rem 0.7rem; font-size: var(--text-sm); }
.modal-tabs button.tab.active { background: var(--selected); color: var(--accent); }
.modal-body h4 { font-size: 15px; color: var(--text); }
.counters { gap: 0.75rem 1.25rem; line-height: 1.6; }
.person-primary-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.person-primary-metrics > span { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.person-primary-metrics strong { font-size: 24px; letter-spacing: -0.025em; }
.person-secondary-metrics { padding: 1rem 0; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.person-bio {
  margin: 0 0 0.75rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 42rem;
  line-height: 1.45;
}
.person-profile-flags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.75rem; }
#overlay-title .person-tiktok {
  font-size: 12px;
  font-weight: 500;
  margin-left: 0.15rem;
  vertical-align: middle;
}

.login-card { width: min(400px, 100%); padding: 2rem; gap: 1rem; }
.login-card h1 { font-size: 26px; letter-spacing: -0.03em; }
.login-card > p.muted { font-size: 14px; margin-top: -0.5rem; }
.login-mark { width: 44px; height: 44px; display: grid; place-items: center; background: var(--selected); border-radius: 12px; color: var(--accent); margin-bottom: 0.5rem; }
.login-mark .icon-gift { color: inherit; width: 22px; height: 22px; }
.field-label { font-size: var(--text-sm); color: var(--muted); margin-bottom: -0.65rem; }
.login-card button { min-height: 42px; }
.login-card .attrib { font-size: 10px; padding-top: 0.75rem; }

@media (max-width: 700px) {
  .app-header { padding-left: var(--space-2); padding-right: var(--space-2); gap: 0.4rem; }
  .app-nav .tab { padding: 0.4rem 0.55rem; }
  .page-heading { margin-bottom: 1rem; }
  .page-heading h2 { font-size: 24px; }
  .page-description { display: none; }
  .page-heading-action { align-items: center; gap: 0.5rem; }
  .eyebrow { font-size: 9px; }
  .toolbar { padding: 0.65rem; }
  .toolbar input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select { font-size: 16px; }
  .toolbar .view-toggle { width: auto; }
  .toolbar .toolbar-group { min-width: 0; }
  #stream-shape { flex-basis: 100%; }
  .timeline-primary-controls { gap: 0.35rem; }
  .person-primary-metrics { grid-template-columns: 1fr; }
  .person-primary-metrics > span { padding: 0.75rem; }
  .settings-block { padding: 1rem; }
  .settings-status { grid-template-columns: minmax(0, 1fr); }
  .settings-status dd { margin-bottom: 0.5rem; }
  .modal { border-radius: 0; }
  .modal-head { padding: 0.75rem; }
  .modal-head h3 { font-size: 18px; }
  .modal-tabs { flex-wrap: nowrap; overflow-x: auto; padding: 0.4rem 0.75rem; }
  .modal-tabs .tab { min-height: 40px; }
  .modal-body { padding: 0.75rem; }
  .crumbs { padding: max(0.5rem, var(--safe-top)) 0.75rem 0; }
  .videos-player { padding: 0.65rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* --- phone chrome ---
   Below 700px the six workspace tabs leave the header and sit on a bottom
   bar, thumb-reachable, with their icons restored. The header keeps the
   brand and the More overflow. --nav-bar-h is reserved on #app-view so
   the Videos split and the toasts sit above the home indicator. */
@media (max-width: 700px) {
  :root { --nav-bar-h: 3.6rem; --hit: 40px; }
  a { touch-action: manipulation; }
  #app-view {
    padding-bottom: calc(var(--nav-bar-h) + var(--safe-bottom));
  }
  .app-header {
    justify-content: space-between;
  }
  .app-header .app-brand span,
  .app-header h1 span {
    display: block;
  }
  .app-header .app-brand small { display: none; }
  .app-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    width: auto;
    height: calc(var(--nav-bar-h) + var(--safe-bottom));
    padding: 0.15rem 0.2rem var(--safe-bottom);
    padding-left: max(0.2rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.2rem, env(safe-area-inset-right, 0px));
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--panel);
    border-top: 1px solid var(--border);
    border-right: 0;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: stretch;
    gap: 0;
  }
  .nav-caption { display: none; }
  .app-nav .tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: var(--nav-bar-h);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.12rem;
    padding: 0.3rem 0.1rem;
    font-size: 10px;
    line-height: 1.15;
    border: 0;
    border-radius: 8px;
  }
  .app-nav .tab > .icon {
    display: block;
    width: 18px;
    height: 18px;
    opacity: 0.9;
  }
  .app-nav .tab > span {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    white-space: nowrap;
    letter-spacing: -0.03em;
  }
  .app-nav .tab.active {
    background: var(--selected);
    color: var(--accent);
  }
  .workspace-label { display: none; }
  #toasts {
    inset: auto max(0.75rem, env(safe-area-inset-right, 0px)) auto auto;
    bottom: calc(var(--nav-bar-h) + var(--safe-bottom) + 0.6rem);
  }
  svg.chart { touch-action: pan-y pinch-zoom; }
  .chart-tip {
    white-space: normal;
    max-width: min(18rem, calc(100% - 1rem));
  }
  .modal {
    padding-bottom: var(--safe-bottom);
  }
  .login-card { width: min(400px, 100%); }
  #app-view:has(#tab-videos:not(.hidden)) > footer { display: none; }
  #tab-videos .page-heading { margin-bottom: 0.5rem; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select, textarea { font-size: 16px; }
  .live-card .counter-strip,
  .stream-card .counter-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .live-card .counter-label,
  .stream-card .counter-label { white-space: normal; text-overflow: unset; }
}
@media (max-width: 700px) and (max-height: 500px) {
  :root { --nav-bar-h: 2.75rem; }
  .app-nav .tab {
    flex-direction: row;
    gap: 0.3rem;
    font-size: 11px;
    min-height: 2.75rem;
    padding: 0.2rem 0.35rem;
  }
}


/* Keep the growing recording seekable even with native live-only controls. */
.recording-timeline { margin: 12px 0; flex: 0 0 auto; }
.recording-timeline input[type="range"] { width: 100%; min-width: 0; cursor: pointer; }
.recording-timeline-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.recording-timeline-actions [data-recording-position] { flex: 1; font-variant-numeric: tabular-nums; }

/* Likes: readable highlights and an exact-count ranking on every screen. */
.like-chart-highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.like-chart-highlights > div { display: flex; flex-direction: column; gap: 4px; padding: 14px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.like-chart-highlights strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; color: var(--series-likes); }
.like-leaderboard { margin: 24px 0; }
.like-leaders { list-style: none; display: grid; gap: 6px; margin: 12px 0; padding: 0; }
.like-leader { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--panel); }
.like-leader.podium { background: color-mix(in srgb, var(--series-likes) 6%, var(--panel)); }
.like-rank { flex: 0 0 28px; text-align: center; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.podium .like-rank { color: var(--series-likes); }
.like-leader-person { flex: 1; min-width: 0; }
.like-leader-person > a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.like-leader-track { display: block; height: 4px; background: var(--panel-2); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.like-leader-track > span { display: block; height: 100%; background: var(--series-likes); border-radius: inherit; }
.like-leader-score { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .like-leader { gap: 8px; padding: 10px 8px; }
  .like-leader-score .small { font-size: 0.65rem; }
}

/* Manual links between independently recorded accounts. */
.account-links { border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin: 1rem 0; }
.account-links-heading h4 { display: flex; align-items: center; gap: .5rem; margin: 0; }
.account-links-count { border: 1px solid var(--border); border-radius: 999px; padding: .1rem .45rem; font-size: .75rem; color: var(--muted); }
.account-links-description { margin: .5rem 0 1rem; }
.account-link-list { display: grid; gap: .5rem; margin-bottom: .75rem; }
.account-link-row { display: flex; align-items: center; gap: .75rem; padding: .75rem; border: 1px solid var(--border); border-radius: 8px; }
.account-link-symbol { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; background: var(--bg); color: var(--accent); font-size: 1.25rem; }
.account-link-row .avatar { flex-shrink: 0; margin-right: 0; }
.account-link-identity { display: grid; gap: .2rem; min-width: 0; }
.account-link-identity a, .account-link-identity span { overflow-wrap: anywhere; }
.account-link-direction { margin-left: auto; }
.account-link-actions { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.account-link-group { margin: .5rem 0 0; }
.account-links-empty { display: grid; gap: .35rem; padding: .75rem; margin-bottom: .75rem; border: 1px dashed var(--border); border-radius: 8px; }
@media (max-width: 600px) {
  .account-link-row { flex-wrap: wrap; }
  .account-link-identity { flex: 1; }
  .account-link-direction { margin-left: 84px; flex-basis: calc(100% - 84px); }
  .account-link-actions { margin-left: 84px; }
}
.account-link-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-top: .75rem; }
.account-link-form label { display: flex; flex-direction: column; gap: .3rem; }
.account-link-form [data-account-results], .account-link-form [data-account-selection] { flex-basis: 100%; }
.account-link-form [data-account-results] { display: flex; flex-wrap: wrap; gap: .4rem; }
.account-links [role="alert"]:empty { display: none; }

/* Audio recordings share timeline controls without reserving a video-sized stage. */
#videos-player[data-stream-id] .stream-video[data-capture-source="audio"] .video-stage {
  height: 64px;
  min-height: 64px;
  max-height: 64px;
  flex-shrink: 0;
}

.like-leaderboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.like-leaderboard-heading h4 { margin: 0; }

/* Recorded person-to-broadcast connections; links remain usable without SVG. */
.people-connections { padding: 16px; border: 1px solid var(--border); border-radius: 12px; }
.people-connections label { display: flex; align-items: center; gap: 8px; }
.connection-canvas { position: relative; min-height: var(--connection-height); display: grid; grid-template-columns: 40% 60%; align-items: center; }
.connection-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.connection-lines path { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: .4; vector-effect: non-scaling-stroke; }
.connection-person, .connection-broadcast { position: relative; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; text-decoration: none; overflow-wrap: anywhere; }
.connection-person { justify-self: start; max-width: 90%; }
.connection-broadcasts { display: grid; gap: 8px; }
.connection-broadcast { display: flex; flex-direction: column; justify-content: center; min-height: 56px; box-sizing: border-box; }
.connection-person:focus-visible, .connection-broadcast:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 600px) { .connection-canvas { grid-template-columns: 32% 68%; } .connection-person { padding: 6px; font-size: 12px; } }

.person-profile-photos { display: flex; flex-wrap: wrap; gap: 1rem; margin: .75rem 0; }
.person-profile-photos figure { margin: 0; min-width: 100px; }
.person-profile-photos figcaption { font-size: .8rem; color: var(--muted); margin-bottom: .3rem; }
.person-profile-photos img { border-radius: .5rem; object-fit: cover; }

.profile-polling-panel { border: 1px solid var(--border); border-radius: .75rem; padding: 1rem; margin-bottom: 1rem; }
.profile-polling-panel p { margin: .6rem 0; }
.profile-polling-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.profile-polling-heading button { margin-left: auto; }

.chart-help { margin: 0; font-size: 0.72rem; }
.chart-announcement {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
@media (max-width: 540px) {
  .chart-x-intermediate { display: none; }
  .chart-tip { max-width: 100%; box-sizing: border-box; white-space: normal; }
}

.badge.priority-guest { color: #785500; background: #fff1bc; border-color: #d2aa39; }


.account-label-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.account-label-actions [role="alert"]:empty { display: none; }
.account-label-actions [role="alert"] { flex-basis: 100%; }
.account-label-actions button[aria-pressed="true"] { color: var(--bg); border-color: var(--flag-block); background: var(--flag-block); font-weight: 700; }
.account-label-panel { padding: 0.8rem; margin: 0.75rem 0; border: 1px solid var(--border); border-radius: 8px; }
.account-label.is_bot { color: var(--bg); border-color: var(--flag-block); background: var(--flag-block); font-weight: 700; }

/* Account labels use the same name, ring and row emphasis as manual flags. */
.malicious, .is-malicious, .feed-malicious { --account-tone: var(--flag-block); }
.person-name.malicious, .feed-user.malicious {
  color: var(--account-tone); font-weight: 700;
}
.avatar.malicious {
  border-color: var(--account-tone);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--account-tone) 55%, transparent);
}
tr.is-malicious { background: color-mix(in srgb, var(--account-tone) 12%, transparent); }
tr.is-malicious td:first-child { box-shadow: inset 3px 0 0 var(--account-tone); }
tbody tr.is-malicious:hover { background: color-mix(in srgb, var(--account-tone) 18%, var(--panel-2)); }
:is(.stream-card, .guest-live-card, .panel-now-card, .account-label-panel).is-malicious {
  border-left: 3px solid var(--account-tone);
  background: color-mix(in srgb, var(--account-tone) 10%, var(--panel));
}
.feed-row.feed-malicious, .console-layout :is(#console-feed, #console-history) .feed-row.feed-malicious {
  border-left: 3px solid var(--account-tone);
  background: color-mix(in srgb, var(--account-tone) 16%, transparent);
}
.feed-row.feed-malicious:hover, .console-layout :is(#console-feed, #console-history) .feed-row.feed-malicious:hover {
  background: color-mix(in srgb, var(--account-tone) 24%, var(--panel));
}

/* Personal channel role, separate from moderator-logging controls. */
.badge.channel-moderator { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--good); border-color: var(--good); }
.badge.channel-moderator .icon { width: 14px; height: 14px; }

.watched-word-panel,
#watched-word-recent,
#watched-word-settings {
  margin-block: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.watched-word-panel > summary,
#watched-word-recent > summary,
#watched-word-settings > summary {
  cursor: pointer;
}

[data-recording-transcript] button[hidden] {
  display: none;
}

#watched-word-recent {
  flex: 0 0 auto;
  margin-top: 0;
}

#watched-word-recent [data-watched-word-results] {
  max-height: 30vh;
  overflow-y: auto;
}

#watched-word-settings textarea,
#transcript-watch-settings textarea {
  display: block;
  width: min(100%, 34rem);
  margin-block: 0.4rem;
}

#tab-transcripts h3 {
  margin-top: 1.25rem;
}

.watched-word-matches {
  padding-inline-start: 1.2rem;
}

.watched-word-matches li {
  margin-block: 0.45rem;
  overflow-wrap: anywhere;
}

.watched-word-matches li p {
  margin: 0.2rem 0;
}
