/* =========================================================================
   Periscope — operator console design system
   One-accent, minimal, accessible. Tabular-nums everywhere numbers appear.
   Hand-rolled SVG charts only; no framework, no external assets.
   ========================================================================= */

/* ---------- tokens ---------- */
:root,
[data-theme="light"] {
  --page:        #f9f9f7;
  --card:        #fcfcfb;
  --tile:        #ffffff;
  --ink:         #0b0b0b;
  --secondary:   #52514e;
  --muted:       #898781;
  --gridline:    #e1e0d9;
  --accent:      #2a78d6;
  --accent-soft: rgba(42,120,214,0.12);
  --good:        #0ca30c;
  --warning:     #fab219;
  --critical:    #d03b3b;
  --focus:       #2a78d6;

  /* categorical (validated: light adjacent CVD 9.1 / normal 20.8) */
  --cat1: #2a78d6;  /* blue   */
  --cat2: #eb6834;  /* orange */
  --cat3: #1baf7a;  /* aqua   */
  --cat4: #eda100;  /* yellow */
  --other: #898781; /* folded tail */

  /* neutral ramp for in-progress states (never status colors) */
  --gray-1: #d8d7d1;  /* pending        (lightest) */
  --gray-2: #c2c1ba;  /* http_done      */
  --gray-3: #a8a79f;  /* processing     */
  --gray-4: #898781;  /* browser_queued (darkest)  */

  --track:    rgba(0,0,0,0.06);
  --hairline: #e1e0d9;
  --radius-card: 8px;
  --radius-tile: 12px;
  --radius-end:  4px;
  color-scheme: light;
}

[data-theme="dark"] {
  --page:        #0d0d0d;
  --card:        #1a1a19;
  --tile:        #212120;
  --ink:         #ffffff;
  --secondary:   #c3c2b7;
  --muted:       #8c8b85;
  --gridline:    #2c2c2a;
  --accent:      #3987e5;
  --accent-soft: rgba(57,135,229,0.18);
  --good:        #2ecf2e;
  --warning:     #ffc02e;
  --critical:    #ef5050;
  --focus:       #6ea8ff;

  /* categorical (validated: dark all-pairs CVD 8.1 / normal 16.9) */
  --cat1: #3987e5;
  --cat2: #f08144;
  --cat3: #33cc8a;
  --cat4: #f4c534;
  --other: #898781;

  --gray-1: #3a3a37;
  --gray-2: #4a4a46;
  --gray-3: #5c5c57;
  --gray-4: #7d7c77;

  --track:    rgba(255,255,255,0.07);
  --hairline: #2c2c2a;
  color-scheme: dark;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Tabular numbers everywhere a number appears (per design system). */
body, .num, table, th, td, .kpi-val, .axis, .legend, .meter-val, .chip-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
svg { display: block; }

:where(button, a, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-end);
}

/* ---------- shared atoms ---------- */
.muted    { color: var(--muted); }
.sec      { color: var(--secondary); }
.mono-num { font-variant-numeric: tabular-nums; }
[hidden]  { display: none !important; }

.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  padding: 2px 7px; border-radius: 999px;
  border: 1px solid var(--hairline); color: var(--secondary);
  background: var(--tile);
}

/* =========================================================================
   LOGIN
   ========================================================================= */
#login-view {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%),
    var(--page);
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); padding: 32px;
}
.login-card h1 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
.login-card p  { margin: 0 0 24px; color: var(--secondary); font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 11px; font-weight: 500; color: var(--secondary); }
.field input {
  font: inherit; font-size: 14px; padding: 9px 11px;
  background: var(--tile); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: var(--radius-end);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn {
  appearance: none; cursor: pointer; border: 1px solid var(--hairline);
  background: var(--tile); color: var(--ink);
  padding: 8px 14px; border-radius: var(--radius-end); font-weight: 500;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--track); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); color: #fff; border-color: transparent;
  width: 100%; padding: 10px 14px; font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.05); background: var(--accent); }
.login-err {
  color: var(--critical); font-size: 12px; min-height: 16px; margin-top: 4px;
}

/* =========================================================================
   CONSOLE SHELL
   ========================================================================= */
#console-view { padding: 0 24px 48px; max-width: 1680px; margin: 0 auto; }

/* ---------- header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0; margin-bottom: 8px;
  background: linear-gradient(var(--page) 70%, transparent);
  backdrop-filter: blur(2px);
}
.app-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.app-sub   { font-size: 11px; color: var(--muted); margin: 0; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px;
}

/* LIVE pulse dot */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--good); position: relative; flex: none;
}
.live-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: var(--good); opacity: .35;
  animation: pulse 1.8s ease-out infinite;
}
.live-dot.stalled { background: var(--critical); }
.live-dot.stalled::after { background: var(--critical); }
@keyframes pulse {
  0%   { transform: scale(.6); opacity: .45; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* range selector */
.range-group {
  display: inline-flex; border: 1px solid var(--hairline); border-radius: var(--radius-end);
  overflow: hidden; background: var(--tile);
}
.range-group button {
  border: none; background: transparent; padding: 6px 11px; font-size: 12px;
  color: var(--secondary); cursor: pointer; border-radius: 0;
}
.range-group button + button { border-left: 1px solid var(--hairline); }
.range-group button[aria-pressed="true"] {
  background: var(--accent); color: #fff; font-weight: 600;
}

.icon-btn {
  appearance: none; cursor: pointer; width: 32px; height: 32px;
  display: grid; place-items: center; border-radius: var(--radius-end);
  border: 1px solid var(--hairline); background: var(--tile); color: var(--secondary);
}
.icon-btn:hover { background: var(--track); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }

/* auth chip + freshness */
.freshness { font-size: 11px; color: var(--muted); min-width: 92px; text-align: right; }
.freshness.stale { color: var(--warning); }
.freshness.very-stale { color: var(--critical); font-weight: 600; }

/* status pill — overall health (replaces the old live-dot) */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--tile);
}
.status-pill .sp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status-pill.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, var(--hairline)); }
.status-pill.ok .sp-dot { background: var(--good); animation: pulse-dot 2.4s ease-out infinite; }
.status-pill.warning { color: #8a6d00; border-color: color-mix(in srgb, var(--warning) 55%, var(--hairline)); background: color-mix(in srgb, var(--warning) 12%, var(--tile)); }
.status-pill.warning .sp-dot { background: var(--warning); }
[data-theme="dark"] .status-pill.warning { color: var(--warning); }
.status-pill.critical { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, var(--hairline)); background: color-mix(in srgb, var(--critical) 12%, var(--tile)); }
.status-pill.critical .sp-dot { background: var(--critical); animation: blink 1s steps(2, start) infinite; }
@keyframes pulse-dot { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* urgent-attention alerts bar (only renders rows when not healthy) */
.alerts-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.alerts-bar:empty { display: none; }
.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 13px; border-radius: var(--radius-card);
  border: 1px solid var(--hairline); border-left-width: 4px; background: var(--card); font-size: 13px;
}
.alert.critical { border-left-color: var(--critical); background: color-mix(in srgb, var(--critical) 7%, var(--card)); }
.alert.warning { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 7%, var(--card)); }
.alert.info { border-left-color: var(--accent); }
.alert .a-ico { width: 18px; height: 18px; flex: none; font-size: 15px; line-height: 18px; text-align: center; }
.alert.critical .a-ico { color: var(--critical); }
.alert.warning .a-ico { color: var(--warning); }
.alert.info .a-ico { color: var(--accent); }
.alert .a-title { font-weight: 600; }
.alert .a-detail { color: var(--secondary); font-size: 12px; margin-top: 1px; line-height: 1.4; }

/* segmented control (breakdown scope: All / Scraped) + note */
.seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: var(--radius-end); overflow: hidden; background: var(--tile); }
.seg button { border: none; background: transparent; padding: 4px 9px; font-size: 11px; color: var(--secondary); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--hairline); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.bd-note { font-size: 11px; margin-top: -4px; }

/* =========================================================================
   KPI ROW
   ========================================================================= */
.kpi-row {
  display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(6, 1fr);
}
.kpi-tile {
  background: var(--tile); border: 1px solid var(--hairline);
  border-radius: var(--radius-tile); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.kpi-label { font-size: 11px; font-weight: 500; color: var(--secondary); letter-spacing: 0.01em; }
.kpi-val   { font-size: 28px; font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; }
.kpi-val.hero { font-size: 30px; }
.kpi-sub   { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-spark { height: 26px; margin-top: 2px; }
.kpi-tile.accent .kpi-val { color: var(--accent); }
.kpi-tile.good .kpi-val   { color: var(--good); }
.kpi-tile.warn .kpi-val,
.kpi-tile.warn .kpi-sub .flag { color: var(--warning); }
.kpi-tile.crit .kpi-val,
.kpi-tile.crit .kpi-sub .flag { color: var(--critical); }

.stuck-flag {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--critical); font-weight: 600;
}
.stuck-flag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--critical); }
.stuck-flag.active .dot { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.eta-stalled { color: var(--critical); }

/* =========================================================================
   GRID + CARDS
   ========================================================================= */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(6, 1fr);
}
.card {
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); padding: 16px;
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  transition: opacity .15s;
}
.card.paused { box-shadow: inset 0 0 0 1px var(--accent-soft); }
/* spans (6-col base) */
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title { font-size: 13px; font-weight: 500; color: var(--secondary); margin: 0; }
.card-title .sub { color: var(--muted); font-weight: 400; margin-left: 6px; }
.card-tools { display: flex; align-items: center; gap: 6px; }

.toggle-table {
  appearance: none; cursor: pointer; font-size: 11px; color: var(--secondary);
  border: 1px solid var(--hairline); background: var(--tile);
  padding: 3px 8px; border-radius: var(--radius-end);
}
.toggle-table[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* stale data: do NOT dim the whole console (it read as a broken "dark overlay").
   The freshness chip + live-dot already convey staleness; a high tick age turns
   the chip amber/red. Keeping everything at full opacity avoids the confusion. */

/* =========================================================================
   CHART COMMON (SVG)
   ========================================================================= */
.chart { width: 100%; }
.axis  { font-size: 12px; fill: var(--muted); }
.axis-x { font-size: 11px; fill: var(--muted); }
.grid-line { stroke: var(--gridline); stroke-width: 1; shape-rendering: crispEdges; }
.baseline  { stroke: var(--gridline); stroke-width: 1; shape-rendering: crispEdges; }
svg .mark-fill { transition: opacity .12s; }
.slice-hit, .bar-hit { cursor: pointer; }
.slice-hit:focus { outline: none; }
.slice[data-dim="true"] { opacity: .28; }
.bar[data-dim="true"] { opacity: .28; }
.legend-row[data-dim="true"] { opacity: .35; }

/* tooltip */
.tip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--tile); border: 1px solid var(--hairline);
  border-radius: var(--radius-end); padding: 8px 10px; font-size: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 120px; max-width: 260px;
  opacity: 0; transition: opacity .08s;
}
.tip.on { opacity: 1; }
.tip .tip-title { font-weight: 600; margin-bottom: 4px; }
.tip .tip-row { display: flex; justify-content: space-between; gap: 14px; }
.tip .tip-help { color: var(--muted); font-size: 11px; line-height: 1.35; margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--hairline); }
.tip .sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: middle; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 11px; color: var(--secondary); }
.legend-row { display: inline-flex; align-items: center; gap: 6px; cursor: default; }
.legend-row.clickable { cursor: pointer; }
.legend-row .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.legend-row .sw.dashed {
  background: transparent !important; border: 1.5px dashed currentColor;
}
.legend-row .lr-name { color: var(--ink); }
.legend-row .lr-val  { color: var(--muted); }

/* legend-as-grid (queue) */
.legend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 16px; }
.legend-grid .legend-row { cursor: pointer; }

/* =========================================================================
   QUEUE BAR
   ========================================================================= */
.queue-bar { width: 100%; height: 34px; display: block; }
.queue-seg { transition: opacity .12s, transform .12s; transform-origin: center; cursor: pointer; }
.queue-seg[data-dim="true"] { opacity: .25; }

/* =========================================================================
   TABLES (industry / client / recent / fallbacks)
   ========================================================================= */
.tbl-wrap { overflow: auto; max-height: 320px; border: 1px solid var(--hairline); border-radius: var(--radius-end); }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data thead th {
  position: sticky; top: 0; background: var(--card); z-index: 1;
  text-align: left; font-weight: 500; color: var(--secondary);
  padding: 7px 10px; border-bottom: 1px solid var(--hairline); font-size: 11px;
  letter-spacing: 0.02em; text-transform: uppercase;
}
table.data tbody td { padding: 6px 10px; border-bottom: 1px solid var(--hairline); color: var(--ink); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--track); }
table.data tbody tr[data-active="true"] { background: var(--accent-soft); }
table.data td.num, table.data th.num { text-align: right; }
.fill-cell { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.fill-track { flex: 1; height: 5px; background: var(--track); border-radius: 2px; overflow: hidden; }
.fill-bar { height: 100%; background: var(--accent); border-radius: 2px; }
.fill-pct { font-size: 11px; color: var(--muted); min-width: 38px; text-align: right; }

/* recent table specifics */
table.recent { font-size: 12px; }
table.recent tbody td { padding: 5px 10px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--hairline); white-space: nowrap;
}
.status-pill .d { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.status-pill.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--hairline)); }
.status-pill.warn { color: #8a6d00; border-color: color-mix(in srgb, var(--warning) 55%, var(--hairline)); }
[data-theme="dark"] .status-pill.warn { color: var(--warning); }
.status-pill.crit { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 40%, var(--hairline)); }
.status-pill.neutral { color: var(--secondary); }
.status-pill .d.good { background: var(--good); }
.status-pill .d.warn { background: var(--warning); }
.status-pill .d.crit { background: var(--critical); }
.status-pill .d.neutral { background: var(--gray-3); }
.has-email-yes { color: var(--good); font-weight: 600; }
.has-email-no  { color: var(--muted); }
.domain { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =========================================================================
   DONUT
   ========================================================================= */
.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut-center-txt { fill: var(--ink); text-anchor: middle; }
.donut-center-sub { fill: var(--muted); text-anchor: middle; font-size: 11px; }

/* merged "Email breakdown" card (source + type side by side) */
.bd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bd-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bd-label { font-size: 11px; font-weight: 600; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.bd-col .donut-wrap { flex-direction: column; align-items: center; gap: 8px; }
.bd-col .donut-wrap svg { width: 132px; height: 132px; }
.bd-col .legend { justify-content: center; }
@media (max-width: 760px) { .bd-grid { grid-template-columns: 1fr; } }

/* small inline help text under card titles */
.card-title .help { color: var(--muted); font-weight: 400; margin-left: 6px; font-size: 11px; }

/* =========================================================================
   METERS (host)
   ========================================================================= */
.meters { display: flex; flex-direction: column; gap: 14px; }
.meter-block { display: flex; flex-direction: column; gap: 5px; }
.meter-top { display: flex; justify-content: space-between; font-size: 12px; }
.meter-top .ml { color: var(--secondary); }
.meter-top .mv { color: var(--ink); font-weight: 600; }
.meter-track { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; position: relative; }
.meter-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .2s, background .2s; }
.meter-fill.warn { background: var(--warning); }
.meter-fill.crit { background: var(--critical); }
.meter-thresh { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--secondary); opacity: .5; }

.host-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.host-extra { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 6px; }
.host-stat { display: flex; flex-direction: column; gap: 2px; }
.host-stat .hl { font-size: 11px; color: var(--muted); }
.host-stat .hv { font-size: 14px; font-weight: 600; }
.host-stat .hv.crit { color: var(--critical); }

/* small bar lists (http buckets, top errors, p95) */
.barlist { display: flex; flex-direction: column; gap: 7px; }
.barlist-row { display: grid; grid-template-columns: 64px 1fr 56px; align-items: center; gap: 8px; font-size: 12px; }
.barlist-row .bl-label { color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barlist-row .bl-track { height: 10px; background: var(--track); border-radius: 3px; overflow: hidden; }
.barlist-row .bl-fill { height: 100%; background: var(--accent); border-radius: 3px; min-width: 2px; }
.barlist-row .bl-val { text-align: right; color: var(--ink); }

/* procstats stage bars (HTML) */
.stage-bars { display: flex; flex-direction: column; gap: 12px; }
.stage-group { display: flex; flex-direction: column; gap: 5px; }
.stage-group .stage-name { font-size: 12px; font-weight: 600; display: flex; justify-content: space-between; }

/* =========================================================================
   FILTER CHIP BAR
   ========================================================================= */
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-height: 0; margin-bottom: 4px;
}
.filter-bar:not(:empty) { margin-bottom: 12px; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
}
.fchip button { border: none; background: none; color: inherit; cursor: pointer; padding: 0; line-height: 1; }
.note { font-size: 11px; color: var(--muted); font-style: italic; }

.empty-state { font-size: 12px; color: var(--muted); padding: 12px 0; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1180px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .span-6 { grid-column: span 4; }
  .span-4 { grid-column: span 4; }
  .span-3 { grid-column: span 2; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  #console-view { padding: 0 14px 40px; }
  .grid { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4, .span-6 { grid-column: span 1; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .host-grid { grid-template-columns: 1fr; }
  .freshness { display: none; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
}

/* =========================================================================
   REDUCED MOTION
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .live-dot::after { display: none; }
  .stuck-flag.active .dot { animation: none; }
}
