/* Text2Air console: a clean broadcast-desk dark theme. No framework. */
:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232c;
  --border: #2a323d;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent-red: #e53935;
  --accent: #4da3ff;
  --badge-bg: #243042;
  --review-bg: #5a1f1f;
  --review-fg: #ff9d9d;
  --radius: 8px;
  /* The extended vocabulary the publisher themes below define per palette.
     Base values here keep every token defined on surfaces that never set
     data-theme (the operator console), matching its existing dark look. */
  --muted-2: #6c7686;
  --border-2: #3a4450;
  --on-accent: #04101f;
  --live: #ff2a2a;
  --live-ink: #ff2a2a;
  --live-soft: rgba(255, 42, 42, 0.5);
  --on-live: #140506;
  --ok: #34e08a;
  --ok-soft: #17361f;
  --ok-line: rgba(52, 224, 138, 0.4);
  --warn: #ffd766;
  --warn-soft: #3d3413;
  --warn-line: rgba(231, 178, 74, 0.4);
  --danger: var(--live-ink);
  --danger-soft: rgba(255, 42, 42, 0.08);
  --danger-line: rgba(255, 42, 42, 0.5);
  --src-import: #5aa9e6;
  --src-import-bg: rgba(90, 169, 230, 0.12);
  --src-citizen: #34e08a;
  --src-citizen-bg: rgba(52, 224, 138, 0.12);
  --src-weather: #e7b24a;
  --src-weather-bg: rgba(231, 178, 74, 0.12);
  --src-ad: #a99bff;
  --src-ad-bg: rgba(169, 155, 255, 0.14);
  --src-portal: #ff6b4d;
  --src-portal-bg: rgba(255, 107, 77, 0.12);
  --font-body: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* --- the publisher theme foundation --------------------------------------------
   One token system, two palettes, applied at the shared publisher shell: the
   shell root carries data-theme, resolved before first paint from the
   t2a_theme_mode cookie (light, dark, or auto by local time of day; see the
   inline script in app_shell.html and theme.js). The palettes are the two
   approved Editorial Review Area mockups, token for token. Only surfaces
   that set data-theme take these; the operator console keeps :root above. */

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1013;
  --panel: #181b21;
  --panel-2: #1e222a;
  --border: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.16);
  --text: #f2f3f5;
  --muted: #99a3b2;
  --muted-2: #6c7686;
  --accent: #4da3ff;
  --on-accent: #04101f;
  --accent-red: var(--live-ink);
  --badge-bg: #243042;
  --review-bg: #5a1f1f;
  --review-fg: #ff9d9d;
  --live: #ff2a2a;
  --live-ink: #ff2a2a;
  --live-soft: rgba(255, 42, 42, 0.5);
  --on-live: #140506;
  --ok: #34e08a;
  --ok-soft: rgba(52, 224, 138, 0.08);
  --ok-line: rgba(52, 224, 138, 0.4);
  --warn: #e7b24a;
  --warn-soft: rgba(231, 178, 74, 0.08);
  --warn-line: rgba(231, 178, 74, 0.4);
  --danger: var(--live-ink);
  --danger-soft: rgba(255, 42, 42, 0.08);
  --danger-line: rgba(255, 42, 42, 0.5);
  --src-import: #5aa9e6;
  --src-import-bg: rgba(90, 169, 230, 0.12);
  --src-citizen: #34e08a;
  --src-citizen-bg: rgba(52, 224, 138, 0.12);
  --src-weather: #e7b24a;
  --src-weather-bg: rgba(231, 178, 74, 0.12);
  --src-ad: #a99bff;
  --src-ad-bg: rgba(169, 155, 255, 0.14);
  --src-portal: #ff6b4d;
  --src-portal-bg: rgba(255, 107, 77, 0.12);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #fbfbfc;
  --border: #e6e8ec;
  --border-2: #d3d7de;
  --text: #14161a;
  --muted: #5b6472;
  --muted-2: #8a93a1;
  --accent: #0c447c;
  --on-accent: #ffffff;
  --accent-red: var(--live-ink);
  --badge-bg: #e9edf3;
  --review-bg: #f9e0e0;
  --review-fg: #a31414;
  --live: #ff2a2a;
  --live-ink: #c21a17;
  --live-soft: rgba(255, 42, 42, 0.18);
  --on-live: #ffffff;
  --ok: #0f8b4c;
  --ok-soft: #eaf6ef;
  --ok-line: rgba(15, 139, 76, 0.35);
  --warn: #633806;
  --warn-soft: #faeeda;
  --warn-line: rgba(231, 178, 74, 0.5);
  --danger: var(--live-ink);
  --danger-soft: #fef0f0;
  --danger-line: rgba(255, 42, 42, 0.4);
  --src-import: #0c447c;
  --src-import-bg: #e6f1fb;
  --src-citizen: #085041;
  --src-citizen-bg: #e1f5ee;
  --src-weather: #633806;
  --src-weather-bg: #faeeda;
  --src-ad: #3c3489;
  --src-ad-bg: #eeedfe;
  --src-portal: #712b13;
  --src-portal-bg: #faece7;
}

/* The themed shell reads in the brand pair the public site already loads:
   Archivo for headings and body, JetBrains Mono for labels, badges and stage
   pills (app_shell.html links the faces; these tokens only change which
   stack wins). Non-themed surfaces keep the system stack above. */
:root[data-theme] {
  --font-body: "Archivo", system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  /* The canonical header bar, shared with the public chrome (site.css
     .site-header): one fixed height and one left inset, so the brand lands
     at the same x and y on every surface. Centring comes from the fixed
     height, never from sibling heights or vertical padding. */
  height: 60px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.wordmark {
  display: flex;
  align-items: center;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.5px;
  /* The Text2Air brand renders as a home link: keep it visually identical
     to the plain div the branded (publisher) branch still uses. Explicit
     colour (the original body white), never the global link accent. */
  color: var(--text);
  text-decoration: none;
}

/* The platform brand anchor, unified with the public chrome (site.css
   .site-wordmark): the same mark, type size and gap on every Text2Air
   header, and line-height 1 so the text box hugs the glyphs and the mark
   centres optically. The branded (publisher) div keeps the base .wordmark
   scale above, untouched. */
a.wordmark {
  font-size: 24px;
  line-height: 1;
}

/* No link state may restyle the brand: no blue, no underline, ever. */
.wordmark:hover,
.wordmark:focus,
.wordmark:visited {
  color: var(--text);
  text-decoration: none;
}

.wordmark .accent {
  color: var(--accent-red);
}

.wordmark .logo-mark {
  display: block;
  flex-shrink: 0;
  height: 30px;
  width: 30px;
  margin-right: 4px;
}

/* A publisher's own uploaded or linked logo in the branded (white-label)
   header: sized to the bar, aspect kept, flex-centred next to the channel
   name. */
.wordmark .brand-logo {
  flex-shrink: 0;
  height: 28px;
  width: auto;
  max-width: 140px;
  margin-right: 8px;
}

/* The current-logo preview shown in the brand-kit forms. */
.brand-current-logo img {
  display: block;
  height: 44px;
  width: auto;
  max-width: 200px;
  margin-top: 6px;
}

.form-note {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.nav {
  display: flex;
  gap: 16px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover {
  color: var(--text);
}

.userbox {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-weight: 600;
}

.user-role {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

.content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}

.panel,
.login,
.story {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* Keep any data table inside its card. A table with more columns than the card
   is wide would otherwise cross the right border; bounding the card as a
   horizontal scroll container holds every column inside the border, with no
   per-table wrapper. Covers the operator console (.panel), the client portal
   (.panel-card) and the reporters section (.reporters); all three load this
   file. Tables keep their width, so a table that already fits is unchanged. */
.panel,
.panel-card,
.reporters {
  overflow-x: auto;
}

h1 {
  margin-top: 0;
}

a {
  color: var(--accent);
}

button {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

.logout-form button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.login {
  max-width: 380px;
  margin: 48px auto;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-form input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 15px;
}

/* The sign-in CTA carries the PLATFORM accent token (the Text2Air red the
   marketing site's primary buttons use), never the generic blue and never a
   tenant colour: login is pre-auth and tenant-less by design. */
.login-form button {
  background: var(--accent-red);
  color: #fff;
}

.error {
  background: var(--review-bg);
  color: var(--review-fg);
  border-radius: 6px;
  padding: 8px 12px;
}

.queue {
  width: 100%;
  border-collapse: collapse;
}

.queue th,
.queue td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.queue th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
}

.badge-review {
  background: var(--review-bg);
  color: var(--review-fg);
}

.cta {
  display: inline-block;
  margin-top: 8px;
}

.story .body {
  margin-top: 16px;
}

.story .byline {
  color: var(--muted);
}

.images figure {
  margin: 12px 0;
}

.images img {
  max-width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.empty {
  color: var(--muted);
}

/* Channel health (3.5): status pills and the key-numbers list. */
.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-healthy {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-degraded {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-down,
.severity-critical {
  background: var(--review-bg);
  color: var(--review-fg);
}

.status-paused {
  background: var(--badge-bg);
  color: var(--muted);
}

.severity-warning {
  background: var(--warn-soft);
  color: var(--warn);
}

.health-overall {
  font-size: 18px;
}

.health-metrics {
  list-style: none;
  padding: 0;
  color: var(--muted);
}

.health-metrics li {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.health-metrics strong {
  color: var(--text);
}

.health .muted {
  color: var(--muted);
}
