/* Media Monitor -- Westra.
   Ink on white, monochrome chrome; signal colour only for severity and health.
   Tokens ported from westra-doc-processing/frontend/src/index.css (@theme). */

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(fonts/plex-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(fonts/plex-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2113, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/plex-mono-400-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/plex-mono-500-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Noto Sans Tamil';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(fonts/noto-sans-tamil.woff2) format('woff2');
  unicode-range: U+0964-0965, U+0B82-0BFA, U+200C-200D, U+20B9, U+25CC;
}

:root {
  --font-sans: 'IBM Plex Sans', 'Noto Sans Tamil', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-tamil: 'Noto Sans Tamil', 'IBM Plex Sans', sans-serif;

  --brand: #121314;
  --frame: #f1f1f2;
  --canvas: #fbfbfb;
  --surface: #ffffff;

  --slate-50: #fafafa;
  --slate-100: #f4f4f5;
  --slate-200: #e6e6e7;
  --slate-300: #d4d4d6;
  --slate-400: #a1a1a5;
  --slate-500: #737377;
  --slate-600: #525256;
  --slate-700: #3f3f42;
  --slate-800: #27272a;
  --slate-900: #18181b;
  --slate-950: #0b0b0c;

  /* signal colours: severity + health only */
  --sev-low: #a1a1a5;
  --sev-medium: #c98a0e;
  --sev-high: #e0601a;
  --sev-critical: #d6312f;
  --ok: #2f9e5b;
  --warn: #c98a0e;
  --down: #d6312f;

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-card: 0 1px 2px 0 rgb(0 0 0 / 0.04), 0 0 0 1px rgb(0 0 0 / 0.02);
  --shadow-pop: 0 0 0 1px rgb(0 0 0 / 0.06), 0 4px 8px -2px rgb(0 0 0 / 0.06), 0 16px 32px -8px rgb(0 0 0 / 0.16);
  --shadow-panel: 0 0 0 1px rgb(0 0 0 / 0.07), 0 1px 3px 0 rgb(0 0 0 / 0.04);

  --radius: 8px;
  --radius-sm: 6px;
  --focus: 0 0 0 3px color-mix(in oklab, var(--brand) 16%, transparent);
  --topbar-h: 52px;
}

* { box-sizing: border-box; }
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in oklab, var(--slate-400) 45%, transparent) transparent;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--frame);
  color: var(--slate-800);
  font: 400 13px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: color-mix(in oklab, var(--slate-500) 22%, transparent); }
h1, h2, h3 { letter-spacing: -0.011em; margin: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ta { font-family: var(--font-tamil); }
.muted { color: var(--slate-500); }
.faint { color: var(--slate-400); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- motion (quick and restrained) ---------- */
@keyframes pop-in { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes status-ring {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, currentColor 45%, transparent); }
  70% { box-shadow: 0 0 0 5px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* ---------- top bar (sits on the frame) ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px 0 20px;
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand img { height: 19px; width: auto; display: block; }
.brand .product { font-size: 13px; font-weight: 500; color: var(--slate-600); padding-left: 12px; border-left: 1px solid var(--slate-300); line-height: 18px; }
/* vitals give way (clip with an ellipsis) before anything can overlap the spend group */
.vitals { display: flex; align-items: center; gap: 18px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.vital { display: flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--slate-600); font-size: 12.5px; flex-shrink: 0; }
.vital.optional { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: block; }
/* 'Last segment' gives way with an ellipsis, never a mid-word cut */
.vital.seg { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: block; }
.vital strong { font-weight: 500; color: var(--slate-900); }
.budget-flag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface); box-shadow: inset 3px 0 0 var(--warn), var(--shadow-panel); color: var(--slate-800); }
.budget-flag.stopped { box-shadow: inset 3px 0 0 var(--down), var(--shadow-panel); }
.budget-flag .short { display: none; }
.vital .sep { width: 1px; height: 14px; background: var(--slate-300); }
.spend { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 12.5px; color: var(--slate-600); flex-shrink: 0; }
.spend .amount { display: inline-flex; align-items: baseline; gap: 6px; }
.meter { width: 64px; height: 4px; border-radius: 2px; background: var(--slate-200); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 2px; transition: width 300ms ease; }
.meter.warn > i { background: var(--warn); }
.meter.full > i { background: var(--down); }
.operator { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.operator label { font-size: 12.5px; color: var(--slate-500); }
.operator input { width: 150px; }
.operator.missing input { border-color: var(--sev-high); box-shadow: 0 0 0 3px color-mix(in oklab, var(--sev-high) 16%, transparent); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--slate-400); color: var(--slate-400); }
.dot.live { background: var(--ok); color: var(--ok); animation: status-ring 2.4s ease-out infinite; }
.dot.warn { background: var(--warn); color: var(--warn); }
.dot.down { background: var(--down); color: var(--down); }
.dot.sev-low { background: var(--sev-low); }
.dot.sev-medium { background: var(--sev-medium); }
.dot.sev-high { background: var(--sev-high); }
.dot.sev-critical { background: var(--sev-critical); }

.banner {
  margin: 0 8px 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--down) 8%, var(--surface));
  box-shadow: inset 3px 0 0 var(--down), var(--shadow-panel);
  color: var(--slate-800);
  font-size: 12.5px;
  animation: fade-in 160ms ease-out;
}

/* ---------- the inset panel ---------- */
.panel {
  position: absolute;
  inset: var(--topbar-h) 8px 8px 8px;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  border-radius: 10px;
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
body.has-banner .panel { top: calc(var(--topbar-h) + 44px); }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  height: 46px;
  border-bottom: 1px solid var(--slate-200);
  background: var(--surface);
  flex-shrink: 0;
}
.tabs { display: flex; align-items: stretch; gap: 20px; height: 100%; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; background: none; padding: 0; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--slate-500);
  box-shadow: inset 0 -2px 0 transparent;
  transition: color 120ms ease, box-shadow 120ms ease;
}
.tab:hover { color: var(--slate-800); }
.tab[aria-selected="true"] { color: var(--slate-950); box-shadow: inset 0 -2px 0 var(--brand); }
.tab:focus-visible { outline: none; box-shadow: inset 0 -2px 0 var(--brand), var(--focus); border-radius: 4px; }
.count { min-width: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; line-height: 18px; text-align: center; background: var(--slate-100); color: var(--slate-500); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .count { background: var(--brand); color: #fff; }

.manual { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--slate-500); }
.segmented { display: inline-flex; padding: 2px; border-radius: var(--radius); background: var(--slate-100); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.04); }
.segmented button {
  height: 26px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer;
  font-size: 12.5px; font-weight: 500; color: var(--slate-600);
}
.segmented button:hover:not(:disabled) { color: var(--slate-900); background: rgb(255 255 255 / 0.6); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--slate-900); box-shadow: var(--shadow-card); }
.segmented button:disabled { opacity: 0.5; cursor: progress; }
.segmented button:focus-visible { outline: none; box-shadow: var(--focus); }

.view { flex: 1; min-height: 0; display: flex; }
.view[hidden] { display: none; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--slate-200); background: var(--surface); color: var(--slate-800);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover:not(:disabled) { border-color: var(--slate-300); background: var(--slate-50); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--slate-800); border-color: var(--slate-800); }
.btn.danger { color: var(--sev-critical); }
.btn.danger.solid { background: var(--sev-critical); border-color: var(--sev-critical); color: #fff; }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; border-radius: var(--radius-sm); }
.btn.ready { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.kbd { font-family: var(--font-mono); font-size: 10.5px; line-height: 16px; min-width: 16px; padding: 0 4px; border-radius: 4px; text-align: center; background: rgb(0 0 0 / 0.06); color: var(--slate-500); }
.btn.primary .kbd { background: rgb(255 255 255 / 0.16); color: rgb(255 255 255 / 0.8); }

.input, .select, .textarea {
  height: 32px; width: 100%; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--slate-200); background: var(--surface); color: var(--slate-800);
  font-size: 13px; box-shadow: var(--shadow-xs); transition: border-color 120ms ease, box-shadow 120ms ease;
}
.input::placeholder, .textarea::placeholder { color: var(--slate-400); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--slate-300); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--slate-500); box-shadow: var(--focus); }
.select {
  appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
  background-position: right 8px center; background-repeat: no-repeat; background-size: 14px;
}
.textarea { height: auto; min-height: 64px; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--slate-700); cursor: pointer; }
.check input { width: 14px; height: 14px; margin: 0; accent-color: var(--brand); }

/* ---------- queue: rundown list ---------- */
.list {
  width: 372px; flex-shrink: 0;
  border-right: 1px solid var(--slate-200);
  overflow-y: auto; background: var(--canvas);
}
.list-head { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px 8px; }
.list-head h2 { font-size: 13px; font-weight: 600; color: var(--slate-900); }
.list-head span { font-size: 12px; color: var(--slate-500); }
.rows { list-style: none; margin: 0; padding: 0 8px 12px; }
.row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  padding: 10px 12px 10px 15px;
  border-radius: var(--radius);
  cursor: pointer;
  outline: none;
  transition: background 100ms ease;
}
.row::before { content: ""; position: absolute; left: 4px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--slate-200); }
.row.sev-low::before { background: var(--sev-low); }
.row.sev-medium::before { background: var(--sev-medium); }
.row.sev-high::before { background: var(--sev-high); }
.row.sev-critical::before { background: var(--sev-critical); }
.row + .row { margin-top: 2px; }
.row:hover { background: rgb(0 0 0 / 0.03); }
.row[aria-selected="true"] { background: var(--surface); box-shadow: var(--shadow-panel); }
.row:focus-visible { box-shadow: var(--focus); }
.row .time { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 500; color: var(--slate-900); }
.row .dur { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--slate-500); text-align: right; }
.row .what { grid-column: 1 / -1; font-size: 13px; font-weight: 500; color: var(--slate-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .what .place { font-weight: 400; color: var(--slate-600); }
.row .gist { grid-column: 1 / -1; font-size: 12px; color: var(--slate-500); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .flags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.flag { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 500; color: var(--slate-600); background: var(--slate-100); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.04); }
.flag.ink { background: var(--brand); color: #fff; box-shadow: none; }
.row.new { animation: rise-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }

/* priority filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 10px 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px;
  border-radius: 13px; border: 1px solid var(--slate-200); background: var(--surface);
  font-size: 11.5px; font-weight: 500; color: var(--slate-600); cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--slate-400); color: var(--slate-900); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 11px; opacity: 0.7; }
.chip:focus-visible { outline: none; box-shadow: var(--focus); }

/* stories being followed right now */
#tracking { padding: 12px 8px 0; display: grid; gap: 6px; }
#tracking:empty { display: none; }
.track-card {
  padding: 10px 12px; border-radius: var(--radius); background: var(--surface);
  box-shadow: inset 3px 0 0 var(--brand), var(--shadow-panel); animation: rise-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.track-card.confirming { box-shadow: inset 3px 0 0 var(--slate-300), var(--shadow-panel); }
.tc-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--slate-600); }
.tc-head strong { font-weight: 600; color: var(--slate-900); }
.tc-head .elapsed { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--slate-900); }
.tc-what { margin-top: 4px; font-size: 13px; font-weight: 500; color: var(--slate-800); }
.tc-what .place { font-weight: 400; color: var(--slate-600); }
.tc-reason { margin-top: 2px; font-size: 12px; color: var(--slate-500); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--slate-500); }
.spinner { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--slate-300); border-top-color: var(--slate-700); animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* district chips in the tag editor */
.dchips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 32px; }
.dchip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 9px; border-radius: 6px; background: var(--slate-100); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.05); font-size: 12.5px; color: var(--slate-800); }
.dchip button { border: 0; background: none; width: 18px; height: 18px; border-radius: 4px; cursor: pointer; color: var(--slate-500); font-size: 14px; line-height: 1; }
.dchip button:hover { background: rgb(0 0 0 / 0.07); color: var(--slate-900); }
.dchips .select { width: 170px; height: 28px; font-size: 12.5px; }

/* ---------- detail pane ---------- */
.detail { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.detail-scroll { flex: 1; overflow-y: auto; }
.detail-inner { max-width: 940px; padding: 18px 24px 28px; }
.detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.detail-title h1 { font-size: 18px; line-height: 1.35; font-weight: 600; color: var(--slate-950); }
.detail-title h1 .ta { font-weight: 500; font-size: 15px; color: var(--slate-500); margin-left: 6px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 12.5px; color: var(--slate-600); }
.fact { display: inline-flex; align-items: center; gap: 6px; }
.fact .k { color: var(--slate-400); }

.player { margin-top: 14px; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 16 / 9; max-height: 46vh; width: 100%; display: flex; align-items: center; justify-content: center; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player .gone { color: var(--slate-400); font-size: 13px; }

/* trim timeline */
.trim { margin-top: 10px; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
.track { position: relative; height: 26px; border-radius: var(--radius-sm); background: var(--slate-100); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.05); cursor: pointer; }
.track .keep { position: absolute; top: 0; bottom: 0; background: color-mix(in oklab, var(--brand) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--brand) 35%, transparent); border-radius: 4px; }
.track .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--brand); border-radius: 1px; }
.track .head { position: absolute; top: 3px; bottom: 3px; width: 1px; background: var(--sev-high); pointer-events: none; }
.track .ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 1px 3px; pointer-events: none; }
.track .ticks i { width: 1px; height: 5px; background: var(--slate-300); }
.trim-controls { display: flex; align-items: center; gap: 6px; }
.trim-readout { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--slate-500); }
.trim-readout .mono { color: var(--slate-800); }
.trim-readout .changed { color: var(--slate-900); font-weight: 500; }

/* the ticker as a miniature lower-third */
.lower-third { margin-top: 16px; display: flex; align-items: stretch; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-card); }
.lower-third .tag { flex-shrink: 0; display: flex; align-items: center; padding: 0 10px; background: var(--slate-800); color: rgb(255 255 255 / 0.72); font-size: 11.5px; font-weight: 500; }
.lower-third .text { flex: 1; padding: 9px 14px; background: var(--brand); color: #fff; font-family: var(--font-tamil); font-size: 15px; font-weight: 500; line-height: 1.6; }

.section { margin-top: 22px; }
.section > h2 { font-size: 12.5px; font-weight: 600; color: var(--slate-900); margin-bottom: 8px; display: flex; align-items: baseline; gap: 8px; }
.section > h2 .muted { font-weight: 400; font-size: 12px; }
.summaries { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.summary-en { font-size: 14px; line-height: 1.6; color: var(--slate-800); max-width: 68ch; }
.summary-ta { font-family: var(--font-tamil); font-size: 15px; line-height: 1.75; color: var(--slate-800); }
.quotes { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.quotes li { padding-left: 12px; border-left: 2px solid var(--slate-200); color: var(--slate-600); font-size: 13.5px; }
.note { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--slate-50); box-shadow: inset 0 0 0 1px var(--slate-200); font-size: 12.5px; color: var(--slate-600); }
.note.warn { box-shadow: inset 3px 0 0 var(--warn), inset 0 0 0 1px var(--slate-200); }

.tags { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.field > span { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 500; color: var(--slate-600); }
.field.wide { grid-column: span 2; }
.depts { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 2px; }
.depts .check { align-items: flex-start; line-height: 1.35; }
.depts .check input { flex: none; margin-top: 2px; }
.tags-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--slate-500); }

.coverage { list-style: none; margin: 0; padding: 0; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--slate-200); }
.coverage li { display: grid; grid-template-columns: 90px 64px 1fr auto; gap: 12px; align-items: center; padding: 8px 12px; font-size: 12.5px; }
.coverage li + li { border-top: 1px solid var(--slate-100); }
.coverage button { border: 0; background: none; padding: 0; cursor: pointer; text-align: left; font: inherit; }
.coverage li.current { background: var(--slate-50); }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12px; color: var(--slate-500); }
.history .mono { color: var(--slate-600); margin-right: 8px; }

/* decision bar */
.decide { flex-shrink: 0; border-top: 1px solid var(--slate-200); background: var(--surface); padding: 10px 24px; }
.decide-row { display: flex; align-items: center; gap: 8px; }
.decide-row .spacer { flex: 1; }
.decided { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--slate-700); }
.unsent-reason { margin-top: 10px; display: grid; gap: 6px; color: var(--slate-700); }
.unsent-reason strong { font-weight: 600; color: var(--slate-900); }
.unsent-text { white-space: pre-wrap; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--slate-200); user-select: text; }
.unsent-actions { display: flex; gap: 8px; }
.share-note { margin-top: 10px; }
.share-extra:empty { display: none; }
#btn-copy-full .short { display: none; }
/* measured: the full label needs 1138 px, the short one with key hints 1051 px */
@media (max-width: 1180px) {
  #btn-copy-full .full { display: none; }
  #btn-copy-full .short { display: inline; }
}
@media (max-width: 1080px) {
  .decide-row.with-extra .kbd { display: none; }
}
.share-error { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--slate-50); box-shadow: inset 3px 0 0 var(--down), inset 0 0 0 1px var(--slate-200); font-size: 12.5px; color: var(--slate-700); }
.share-error strong { font-weight: 600; color: var(--slate-900); }
.share-error-actions { display: flex; gap: 8px; flex-shrink: 0; }
.linkline { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--slate-600); }
.linkline .k { color: var(--slate-400); }
.linkline .btn { margin-left: auto; }
.reason-form { margin-top: 10px; display: grid; gap: 8px; animation: pop-in 140ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--slate-200); background: var(--surface); font-size: 12px; color: var(--slate-700); cursor: pointer; }
.quick button:hover { border-color: var(--slate-400); }
.quick button[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.reason-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--slate-500); }

.keys { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 11.5px; color: var(--slate-400); }
.keys span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- empty / loading states ---------- */
.empty { margin: auto; max-width: 380px; padding: 40px 24px; text-align: center; }
.empty .mark { width: 32px; height: 32px; margin: 0 auto 14px; display: block; opacity: 0.9; }
.empty h3 { font-size: 14px; font-weight: 600; color: var(--slate-900); }
.empty p { margin-top: 6px; font-size: 13px; color: var(--slate-500); line-height: 1.55; }
.empty .listening { display: inline-flex; align-items: center; gap: 7px; margin-top: 14px; font-size: 12px; color: var(--slate-600); white-space: nowrap; }
.list .empty { padding: 32px 16px; }
.skeleton { height: 64px; margin: 2px 8px; border-radius: var(--radius); background: linear-gradient(90deg, var(--slate-100), var(--slate-50), var(--slate-100)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- tables (reviewed, activity) ---------- */
.page { flex: 1; overflow-y: auto; padding: 16px 20px 28px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.filters .select { width: 190px; }
.filters .input { width: 240px; }
.table-wrap { border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-panel); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; font-weight: 500; color: var(--slate-500); padding: 9px 12px; border-bottom: 1px solid var(--slate-200); background: var(--slate-50); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--slate-100); vertical-align: top; color: var(--slate-700); }
tr:last-child td { border-bottom: 0; }
td .strong { color: var(--slate-900); font-weight: 500; }
td.num, th.num { text-align: right; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 60ch; }
.decision { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.decision .dot.yes { background: var(--slate-900); }
.decision .dot.no { background: transparent; box-shadow: inset 0 0 0 1.5px var(--slate-400); }
.thumb { width: 72px; height: 40px; border-radius: 4px; object-fit: cover; background: var(--slate-200); display: block; }

.activity { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.activity h2, .page h2 { font-size: 13px; font-weight: 600; color: var(--slate-900); margin: 0 0 8px; }
.activity .full { grid-column: 1 / -1; }

/* ---------- live ---------- */
.live { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.embed { aspect-ratio: 16 / 9; width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow-panel); }
.embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.embed .gone { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--slate-400); font-size: 13px; padding: 24px; text-align: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 12.5px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-panel); }
.kv dt { color: var(--slate-500); }
.kv dd { margin: 0; color: var(--slate-800); text-align: right; }
.kv .head { grid-column: 1 / -1; font-weight: 600; color: var(--slate-900); display: flex; align-items: center; gap: 8px; }
.kv .rule { grid-column: 1 / -1; height: 1px; background: var(--slate-100); margin: 4px 0; }

/* ---------- toasts ---------- */
/* top centre: clear of the decision bar, the reason form and the manual-clip control */
.toasts { position: fixed; top: calc(var(--topbar-h) + 6px); left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 8px; z-index: 50; pointer-events: none; }
.toast { pointer-events: auto; }
.toast {
  min-width: 240px; max-width: 420px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--brand); color: #fff; font-size: 13px; box-shadow: var(--shadow-pop);
  animation: pop-in 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.error { box-shadow: inset 3px 0 0 var(--sev-critical), var(--shadow-pop); }

/* ---------- narrower windows ---------- */
/* Over the cap the flag takes room the vitals need. Measured in every budget
   and recorder state (longest labels: 'Reconnecting', '50m ago', 'Paused:
   twice the daily cap reached'): nothing is cut at any width 1024-1920. */
@media (max-width: 1440px) {
  /* the flag says it all: the meter and 'today' give way first */
  #spend.flagged .meter, #spend.flagged .today { display: none; }
}
@media (max-width: 1360px) {
  .budget-flag .full { display: none; }
  .budget-flag .short { display: inline; }
}
@media (max-width: 1300px) {
  .vital.optional { display: none; }
}
@media (max-width: 1240px) {
  .list { width: 316px; }
  .vital.optional { display: none; }
  .summaries { grid-template-columns: 1fr; }
  .detail-inner { padding: 16px 20px 24px; }
}
@media (max-width: 1100px) {
  .brand .product { display: none; }
  .tags { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field.wide { grid-column: span 2; }
  .live { grid-template-columns: 1fr; }
  .activity { grid-template-columns: 1fr; }
  .operator input { width: 120px; }
  .operator label { display: none; }
  .spend .today, .spend .meter { display: none; }
  .manual > span { display: none; }
}

/* ---------- Message tab ---------- */
.msg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; max-width: 1500px; }
.msg-col { min-width: 0; }
.msg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.msg-head h2 { margin: 0; }
.msg-head .select { flex: 1 1 100%; width: 100%; min-width: 0; }
.msg-help { margin: 0 0 10px; font-size: 12.5px; color: var(--slate-600); max-width: 75ch; }
.ph-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.ph-chips .chip { font-family: var(--font-mono); font-size: 11.5px; border-radius: 6px; }
.tpl-wrap { position: relative; border-radius: var(--radius-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--slate-300); }
.tpl-wrap:focus-within { box-shadow: inset 0 0 0 1px var(--slate-500), var(--focus); }
.tpl, .tpl-backdrop {
  font: 400 13px/1.6 var(--font-mono); padding: 10px 12px; margin: 0; border: 0; letter-spacing: 0;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; tab-size: 4;
}
.tpl { position: relative; z-index: 1; display: block; width: 100%; min-height: 300px; resize: none; background: transparent; color: var(--slate-900); border-radius: var(--radius-sm); outline: none; overflow: hidden; }
.tpl-backdrop { position: absolute; inset: 0; z-index: 0; color: transparent; overflow: hidden; pointer-events: none; }
.tpl-backdrop mark { background: color-mix(in oklab, var(--warn) 30%, transparent); color: transparent; border-radius: 3px; box-shadow: 0 0 0 1px var(--warn); }
.tpl-backdrop .ph-ok { background: var(--slate-100); border-radius: 3px; }
.msg-warn { display: grid; gap: 6px; margin-top: 8px; }
.msg-warn:empty { display: none; }
.msg-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.msg-actions .spacer { flex: 1; }
.ph-doc { margin-top: 14px; font-size: 12.5px; color: var(--slate-600); }
.ph-doc summary { cursor: pointer; color: var(--slate-700); font-weight: 500; }
.ph-doc table { margin-top: 8px; font-size: 12px; }
.ph-doc td { padding: 4px 10px 4px 0; border: 0; }
.pv { margin-bottom: 12px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-panel); overflow: hidden; }
.pv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--slate-200); background: var(--slate-50); font-size: 12.5px; color: var(--slate-800); }
.pv-head .mono { font-family: var(--font-mono); font-size: 12px; color: var(--slate-600); white-space: nowrap; }
.pv-head .mono.over { color: var(--down); font-weight: 600; }
.pv-trim strong { font-weight: 600; color: var(--slate-900); }
.pv-trim { padding: 7px 12px; font-size: 12px; color: var(--slate-700); box-shadow: inset 3px 0 0 var(--warn); background: color-mix(in oklab, var(--warn) 8%, var(--surface)); }
.pv-text { margin: 0; padding: 10px 12px; font: 400 13px/1.55 var(--font-sans); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--slate-800); max-height: 360px; overflow-y: auto; }
@media (max-width: 1240px) { .msg-grid { grid-template-columns: 1fr; } }

/* Reviewed list: rows open the clip in the detail pane (share from there). */
#reviewed tr.clickable { cursor: pointer; }
#reviewed tr.clickable:hover td { background: var(--frame); }
#reviewed .row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; align-items: center; white-space: nowrap; }
