/* === Theme Variables === */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #010203;
  --hud-bg: rgba(2, 4, 8, 0.95);
  --cyan: #00f3ff;
  --cyan-glow: rgba(0, 243, 255, 0.6);
  --amber: #ffaa00;
  --red: #ff003c;
  --green: #00ffaa;
  --ink: #f0f4f8;
  --soft: #91a1b1;
  --line: rgba(0, 243, 255, 0.2);
  --line-strong: rgba(0, 243, 255, 0.5);
  --font-mono: "JetBrains Mono", "Courier New", monospace;
  --font-sans: "Manrope", "Inter", sans-serif;
  --glow: 0 0 8px var(--cyan-glow);
  --glow-soft: 0 0 4px var(--cyan-glow);
  --card-bg: rgba(0, 243, 255, 0.02);
  --card-hover: rgba(0, 243, 255, 0.06);
  --grid-opacity: 0.25;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --hud-bg: rgba(255, 255, 255, 0.95);
  --cyan: #0077b6;
  --cyan-glow: rgba(0, 119, 182, 0.3);
  --amber: #e67700;
  --red: #d00036;
  --green: #00875a;
  --ink: #1a1a2e;
  --soft: #5a6a7a;
  --line: rgba(0, 119, 182, 0.15);
  --line-strong: rgba(0, 119, 182, 0.35);
  --card-bg: rgba(0, 119, 182, 0.03);
  --card-hover: rgba(0, 119, 182, 0.08);
  --grid-opacity: 0.12;
}

* { box-sizing: border-box; }

html, body {
  height: 100%; margin: 0;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-mono); font-size: 11px;
  overflow-x: hidden; overflow-y: auto;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: ""; position: fixed; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none; z-index: 10; opacity: var(--grid-opacity);
}

/* === Shell === */
.dashboard-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

/* === Masthead === */
.masthead {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 16px; border-bottom: 2px solid var(--line-strong);
  background: var(--hud-bg); backdrop-filter: blur(12px); z-index: 100;
  gap: 16px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.title-block { flex: 1; min-width: 0; }
.title-block h1 {
  font-family: var(--font-sans); font-weight: 800; font-size: 15px;
  text-transform: uppercase; letter-spacing: 0.22em; margin: 0;
  color: var(--cyan); text-shadow: var(--glow);
  line-height: 1.1;
}
.eyebrow { font-size: 9px; letter-spacing: 0.2em; color: var(--cyan); opacity: 0.8; margin-bottom: 2px; }
.summary-lead { font-size: 9px; color: var(--soft); margin-top: 2px; line-height: 1.4; }

.status-block { display: flex; align-items: center; gap: 4px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.controls-row { display: flex; gap: 4px; }
.ctrl-btn, .lang-btn {
  background: transparent; border: 1px solid var(--line); color: var(--soft);
  font-family: var(--font-mono); font-size: 8px; padding: 2px 8px;
  cursor: pointer; letter-spacing: 0.1em; transition: all 0.2s;
}
.ctrl-btn:hover, .lang-btn:hover, .lang-btn.active { border-color: var(--cyan); color: var(--cyan); background: var(--card-bg); }
.micro-badge { font-size: 9px; color: var(--cyan); padding: 2px 8px; border: 1px solid var(--line); }
.runtime-meta {
  min-width: 260px;
  max-width: 380px;
  display: grid;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  background: var(--card-bg);
}
.runtime-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.runtime-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: 8px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.runtime-badge[data-mode="live"] {
  color: var(--green);
  border-color: var(--green);
  background: rgba(0, 255, 170, 0.08);
}
.runtime-badge[data-mode="snapshot"] {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(0, 243, 255, 0.06);
}
.runtime-badge[data-mode="fallback"] {
  color: var(--amber);
  border-color: var(--amber);
  background: rgba(255, 170, 0, 0.08);
}
.runtime-badge[data-mode="pages-static"] {
  color: var(--cyan);
  border-color: var(--cyan);
}
.runtime-badge[data-mode="live-service"] {
  color: var(--green);
  border-color: var(--green);
}
.runtime-detail {
  color: var(--soft);
  font-size: 8px;
  line-height: 1.45;
}
.runtime-detail strong {
  color: var(--ink);
  font-weight: 700;
}
.runtime-detail a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.runtime-detail a:hover { border-bottom-color: currentColor; }
.status-pill {
  padding: 3px 10px; border: 1px solid var(--green); color: var(--green);
  font-size: 9px; background: rgba(0, 255, 170, 0.08);
  box-shadow: 0 0 8px rgba(0, 255, 170, 0.2); text-transform: uppercase; letter-spacing: 0.1em;
}
[data-theme="light"] .status-pill { box-shadow: none; background: rgba(0, 135, 90, 0.08); }

.partner-row { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.partner-row img {
  height: 22px; width: auto; object-fit: contain;
  background: rgba(255, 255, 255, 0.92); padding: 2px 4px; border-radius: 2px;
  opacity: 0.95;
  transition: opacity 0.25s, transform 0.25s;
}
.partner-row img:hover { opacity: 1; transform: translateY(-1px); }
[data-theme="light"] .partner-row img { background: rgba(255, 255, 255, 1); opacity: 0.95; border: 1px solid rgba(0, 60, 110, 0.08); }

/* === Ticker === */
.ticker-bar {
  display: flex; align-items: center; background: var(--hud-bg);
  border-bottom: 1px solid var(--line); overflow: hidden; height: 26px;
  flex: 0 0 26px;
}
.section-stamp {
  flex-shrink: 0; padding: 0 10px; font-size: 8px; font-weight: 700;
  color: var(--cyan); letter-spacing: 0.15em; border-right: 1px solid var(--line); line-height: 26px;
}
.ticker-summary {
  flex-shrink: 0; padding: 0 10px; font-size: 9px; color: var(--soft);
  max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-right: 1px solid var(--line);
}
.ticker-window { flex: 1; overflow: hidden; }
.ticker-track { display: flex; gap: 32px; white-space: nowrap; animation: ticker 50s linear infinite; }
.ticker-item { flex-shrink: 0; font-size: 10px; color: var(--soft); }
.ticker-source { color: var(--cyan); font-weight: 700; margin-right: 6px; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* === Metrics === */
.metric-band {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 2px; background: var(--line); border-bottom: 1px solid var(--line-strong);
  flex: 0 0 auto;
}
.metric-card {
  background: var(--hud-bg);
  padding: 6px 8px;
  border: 1px solid transparent;
  position: relative;
  cursor: default;
  transition: border-color 160ms ease, background 160ms ease;
}
.metric-card:hover {
  border-color: var(--cyan);
  background: var(--card-hover);
  box-shadow: inset 0 0 24px rgba(0,243,255,0.05);
}
.metric-card .metric-source {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed transparent;
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  color: var(--soft);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 200ms ease, max-height 200ms ease, border-color 200ms ease;
}
.metric-card:hover .metric-source {
  opacity: 0.85;
  max-height: 30px;
  border-top-color: var(--line);
}
.metric-card .metric-source .src-name { color: var(--cyan); text-shadow: 0 0 2px var(--cyan-glow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-card .metric-source .src-fresh { color: var(--soft); white-space: nowrap; }
.metric-label { font-size: 7px; color: var(--soft); text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 15px; font-weight: 700; color: var(--cyan); margin: 1px 0; text-shadow: var(--glow-soft); }
.metric-unit { font-size: 8px; opacity: 0.7; }
.metric-context { font-size: 7px; color: var(--soft); opacity: 0.9; }
.metric-card[data-tone="warn"] .metric-value { color: var(--amber); text-shadow: 0 0 5px rgba(255,170,0,0.3); }
.metric-card[data-tone="critical"] .metric-value { color: var(--red); }
.metric-card[data-tone="focus"] .metric-value { color: var(--green); text-shadow: 0 0 5px rgba(0,255,170,0.3); }
.sparkline-shell { margin-top: 2px; }
.sparkline { width: 100%; height: 14px; display: block; }

/* === Brief Strip === */
.brief-strip {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 2px;
  background: var(--line);
  border-bottom: 1px solid var(--line-strong);
  flex: 0 0 auto;
}
.brief-card {
  min-height: 72px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.02), transparent 45%),
    linear-gradient(90deg, rgba(0, 243, 255, 0.03), transparent 75%),
    var(--hud-bg);
  position: relative;
}
.brief-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}
.brief-card[data-tone="alert"]::before { background: var(--red); }
.brief-card[data-tone="watch"]::before { background: var(--amber); }
.brief-card[data-tone="blind"]::before { background: var(--cyan); }
.brief-kicker {
  color: var(--ink);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
}
.brief-list {
  display: grid;
  gap: 4px;
}
.brief-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  color: var(--soft);
  font-size: 8px;
  line-height: 1.35;
}
.brief-item span:last-child { color: var(--ink); }
.brief-index {
  color: var(--cyan);
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* === Board Grid (2-column: map-dominant + situation rail) === */
.board-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(300px, 1fr);
  grid-template-areas: "center situation";
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg);
}

/* === Panels === */
.panel { display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--hud-bg); overflow: hidden; }
.panel-head { padding: 6px 10px; border-bottom: 1px solid var(--line-strong); background: var(--card-bg); flex-shrink: 0; }
.kicker { font-size: 8px; color: var(--cyan); font-weight: 700; letter-spacing: 0.1em; }
.panel-head h2 { font-size: 11px; margin: 2px 0 0; color: var(--ink); text-transform: uppercase; letter-spacing: 0.05em; }
.panel-inner { flex: 1; overflow-y: auto; min-height: 0; }
.section-group { border-bottom: 1px solid var(--line); }
.situation-rail { grid-area: situation; }

/* Compact section labels (replaces kicker+h2 in sidebar) */
.section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.15em;
  padding: 8px 10px 4px;
  border-bottom: 1px solid var(--line);
}

/* Posture block: the single most prominent element in the sidebar */
.posture-block {
  padding: 12px 10px;
  border-bottom: 2px solid var(--line-strong);
  background: var(--card-bg);
}
.posture-title {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}
.posture-detail {
  font-size: 9px;
  color: var(--soft);
  margin-top: 4px;
  line-height: 1.35;
}
.posture-block[data-posture="stable"] { border-left: 3px solid var(--green); }
.posture-block[data-posture="stable"] .posture-title { color: var(--green); }
.posture-block[data-posture="steady-watch"] { border-left: 3px solid var(--cyan); }
.posture-block[data-posture="steady-watch"] .posture-title { color: var(--cyan); }
.posture-block[data-posture="watch"] { border-left: 3px solid var(--amber); }
.posture-block[data-posture="watch"] .posture-title { color: var(--amber); }
.posture-block[data-posture="stretched"] { border-left: 3px solid var(--red); }
.posture-block[data-posture="stretched"] .posture-title { color: var(--red); }

/* === Map === */
.map-panel { min-width: 0; grid-area: center; }
.map-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 6px; }
.title-wrap { flex: 1; }
.map-summary { font-size: 9px; color: var(--soft); margin-top: 2px; line-height: 1.3; }
.map-controls { display: flex; gap: 6px; }
.map-frame { position: relative; flex: 1; min-height: 0; background: #000; overflow: hidden; }
.map-canvas { width: 100%; height: 100%; }

/* === Cinematic map atmospherics ===
   Layered on top of the Leaflet pane via pointer-events: none so they never
   block interaction. Each element is a separate concern: vignette draws the
   eye to centre, scan-grid gives a "satellite ops console" texture, corner
   brackets read as a HUD reticle, scanline simulates a passive sensor sweep. */
.map-vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 45;
  background:
    radial-gradient(ellipse at 50% 50%,
      transparent 35%,
      rgba(0,0,0,0.18) 78%,
      rgba(0,0,0,0.55) 100%);
  mix-blend-mode: multiply;
}
[data-theme="light"] .map-vignette { display: none; }

.map-scan-grid {
  position: absolute; inset: 0; pointer-events: none; z-index: 46;
  background-image:
    linear-gradient(rgba(0,243,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,243,255,0.04) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.35;
  mix-blend-mode: screen;
}
[data-theme="light"] .map-scan-grid {
  background-image:
    linear-gradient(rgba(0,119,182,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,119,182,0.06) 1px, transparent 1px);
  mix-blend-mode: multiply;
  opacity: 0.5;
}

/* Reticle corner brackets — small L-shaped marks at each corner. Read as a
   targeting frame; reinforce the "this is a scope, not a slideshow" feel. */
.map-reticle {
  position: absolute; inset: 12px; pointer-events: none; z-index: 47;
  /* Single element, four corner marks via box-shadow inset clip pattern. */
}
.map-reticle::before, .map-reticle::after,
.map-frame .map-reticle-tl, .map-frame .map-reticle-br {
  content: ""; position: absolute; width: 18px; height: 18px;
  border: 1px solid var(--cyan);
  opacity: 0.55;
  box-shadow: 0 0 4px rgba(0,243,255,0.25);
}
.map-reticle::before {
  top: 0; left: 0;
  border-right: none; border-bottom: none;
}
.map-reticle::after {
  top: 0; right: 0;
  border-left: none; border-bottom: none;
}
.map-frame .map-reticle-tl {
  bottom: 12px; left: 12px;
  border-right: none; border-top: none;
}
.map-frame .map-reticle-br {
  bottom: 12px; right: 12px;
  border-left: none; border-top: none;
}
[data-theme="light"] .map-reticle::before,
[data-theme="light"] .map-reticle::after,
[data-theme="light"] .map-reticle-tl,
[data-theme="light"] .map-reticle-br {
  border-color: var(--soft); opacity: 0.4; box-shadow: none;
}

/* Compass rose — a small N indicator + bearing hashes in the upper-right
   quadrant inside the map frame. Pure visual, pointer-events: none. */
.map-compass {
  position: absolute; top: 16px; right: 16px;
  width: 38px; height: 38px;
  pointer-events: none; z-index: 48;
  font-family: var(--font-mono);
  color: var(--soft);
  opacity: 0.55;
}
.map-compass::before {
  content: ""; position: absolute; inset: 4px;
  border: 1px solid currentColor; border-radius: 50%;
  opacity: 0.5;
}
.map-compass::after {
  /* North marker — small upward triangle */
  content: ""; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 7px solid var(--cyan);
  filter: drop-shadow(0 0 2px var(--cyan-glow));
}
.map-compass-label {
  position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%);
  font-size: 7px; letter-spacing: 0.18em; color: var(--cyan);
  text-shadow: 0 0 2px var(--cyan-glow);
}
[data-theme="light"] .map-compass { color: var(--soft-strong, #687a8c); opacity: 0.7; }
[data-theme="light"] .map-compass::after { border-bottom-color: var(--blue, #0077b6); filter: none; }
[data-theme="light"] .map-compass-label { color: var(--blue, #0077b6); text-shadow: none; }

/* === Map coordinate HUD === */
.map-coord-hud {
  position: absolute;
  bottom: 12px;
  left: 10px;
  z-index: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(1, 2, 3, 0.88);
  border: 1px solid var(--cyan);
  padding: 4px 8px;
  font-family: var(--font-mono);
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease, border-color 120ms ease;
}
.map-coord-hud.is-active { opacity: 1; pointer-events: all; }
.map-coord-hud.is-snapped { border-color: var(--amber); }
.map-coord-hud.is-copied { border-color: var(--green); }
.coord-label {
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--soft);
  white-space: nowrap;
}
.coord-value {
  font-size: 10px;
  color: var(--cyan);
  text-shadow: 0 0 4px var(--cyan-glow);
  letter-spacing: 0.04em;
  min-width: 168px;
  white-space: nowrap;
}
.map-coord-hud.is-snapped .coord-value { color: var(--amber); text-shadow: none; }
.map-coord-hud.is-copied .coord-value { color: var(--green); text-shadow: none; }
.coord-copy {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  background: transparent;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 2px 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 80ms ease, color 80ms ease;
}
.coord-copy:hover { background: var(--cyan); color: #010203; }
.map-coord-hud.is-snapped .coord-copy { border-color: var(--amber); color: var(--amber); }
.map-coord-hud.is-snapped .coord-copy:hover { background: var(--amber); color: #010203; }
.map-coord-hud.is-copied .coord-copy { border-color: var(--green); color: var(--green); }

.leaflet-container { background: #000 !important; }
[data-theme="light"] .leaflet-container { background: #e0e5ec !important; }
.leaflet-tile-pane { filter: brightness(0.78) contrast(1.28) saturate(0.55) hue-rotate(-4deg); }
[data-theme="light"] .leaflet-tile-pane { filter: contrast(1.05) saturate(0.85); }

.municipal-label span {
  background: rgba(1,2,3,0.85) !important; border: 1px solid var(--cyan) !important;
  color: var(--cyan) !important; font-family: var(--font-mono); font-weight: 700;
  padding: 3px 6px; font-size: 10px;
  text-shadow: 0 0 5px var(--cyan-glow); box-shadow: 0 0 12px rgba(0,243,255,0.2);
}
[data-theme="light"] .municipal-label span { background: rgba(255,255,255,0.9) !important; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }

.marker-tooltip {
  background: rgba(1,2,3,0.9) !important; border: 1px solid var(--line-strong) !important;
  color: var(--ink) !important; font-family: var(--font-mono) !important;
  font-size: 9px !important; padding: 3px 6px !important;
}
[data-theme="light"] .marker-tooltip { background: rgba(255,255,255,0.95) !important; }

.map-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 10px; border-top: 1px solid var(--line); font-size: 8px; background: var(--hud-bg); flex-shrink: 0;
}
.map-legend { display: flex; gap: 10px; align-items: center; }
.legend-item { display: flex; align-items: center; gap: 3px; color: var(--soft); }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.watchpoint-list { display: flex; gap: 4px; flex-wrap: wrap; }
.watchpoint-list span { padding: 1px 5px; border: 1px solid var(--line); font-size: 7px; text-transform: uppercase; color: var(--soft); }

.segmented-control { display: flex; gap: 2px; }
.segmented-control button {
  background: transparent; border: 1px solid var(--line); color: var(--soft);
  font-family: var(--font-mono); font-size: 8px; padding: 2px 8px; cursor: pointer; transition: all 0.2s;
}
.segmented-control button:hover, .segmented-control button.active {
  border-color: var(--cyan); color: var(--cyan); background: var(--card-bg);
}

.urban-toggle {
  border-left: 2px solid var(--line-strong);
  padding-left: 6px;
  margin-left: 2px;
}

.urban-layer-tag {
  display: inline-block;
  font-size: 7px;
  padding: 1px 4px;
  border: 1px solid;
  border-radius: 2px;
  margin-right: 4px;
  text-transform: uppercase;
  font-weight: 700;
}

/* === Official Pulse === */
.official-pulse-block {
  padding: 10px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.05) 0%, transparent 100%);
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}

.official-pulse-block::before {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 2px; height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.pulse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.pulse-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--cyan);
  text-transform: uppercase;
}

.pulse-indicator {
  width: 6px;
  height: 6px;
  background: var(--cyan);
  border-radius: 50%;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(0, 243, 255, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(0, 243, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 243, 255, 0); }
}

.pulse-metagrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.pulse-stat {
  display: flex;
  flex-direction: column;
}

.pulse-stat strong {
  font-size: 14px;
  color: var(--ink);
  line-height: 1;
}

.pulse-stat span {
  font-size: 8px;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.radar-scan {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0,243,255,0.04), transparent);
  animation: radar-sweep 6s linear infinite; pointer-events: none; z-index: 50;
}
[data-theme="light"] .radar-scan { background: linear-gradient(90deg, transparent, rgba(0,119,182,0.04), transparent); }
@keyframes radar-sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* === Sidebar Components === */
.signal-card { padding: 8px; border: 1px solid var(--line); margin-bottom: 3px; background: var(--card-bg); }
.signal-card strong { font-size: 9px; color: var(--cyan); text-shadow: var(--glow-soft); }
.signal-card .val { font-size: 18px; font-weight: 800; color: var(--ink); margin: 4px 0; }
.signal-card .meta { font-size: 8px; color: var(--soft); }
.signal-cards, .trend-list, .operation-list { padding: 6px; display: flex; flex-direction: column; gap: 3px; }

.trend-item { padding: 6px 8px; border-bottom: 1px dotted var(--line); }
.trend-item strong { color: var(--ink); font-size: 10px; }
.trend-item .meta { color: var(--cyan); font-size: 8px; opacity: 0.8; margin-top: 1px; }
.trend-item.is-external { opacity: 0.68; }
.trend-empty {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--card-bg);
}
.trend-empty strong { color: var(--ink); font-size: 10px; }
.trend-empty .meta { color: var(--soft); font-size: 8px; line-height: 1.4; }

.operation-card { padding: 8px; border-left: 3px solid var(--cyan); background: var(--card-bg); margin-bottom: 3px; }
.operation-card[data-severity="high"] {
  border-left-color: var(--red);
  background: linear-gradient(90deg, rgba(255, 0, 60, 0.1) 0%, transparent 100%);
  animation: high-alert-pulse 2s infinite;
}

@keyframes high-alert-pulse {
  0% { box-shadow: inset 5px 0 10px -5px rgba(255, 0, 60, 0.4); }
  50% { box-shadow: inset 8px 0 15px -5px rgba(255, 0, 60, 0.6); }
  100% { box-shadow: inset 5px 0 10px -5px rgba(255, 0, 60, 0.4); }
}
.operation-card[data-severity="medium"] { border-left-color: var(--amber); }
.operation-card strong { font-size: 10px; color: var(--ink); }
.operation-card .kicker { margin-bottom: 1px; }
.operation-detail { font-size: 8px; color: var(--soft); margin-top: 3px; line-height: 1.4; }
.directive-context {
  font-size: 8px;
  font-style: italic;
  color: var(--cyan);
  opacity: 0.72;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  line-height: 1.4;
}

/* === Clocks === */
.clock-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); }
.clock-card { padding: 6px 8px; background: var(--hud-bg); }
.clock-card .country { font-size: 8px; color: var(--soft); text-transform: uppercase; }
.clock-card .time { font-size: 13px; font-weight: 700; color: var(--cyan); text-shadow: var(--glow-soft); }

/* === Exchange Rates === */
.exchange-list { padding: 6px 8px; }
.fx-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dotted var(--line); font-size: 10px; }
.fx-code { color: var(--cyan); font-weight: 700; }
.fx-rate { color: var(--ink); }

/* === Airport Panel === */
.airport-panel { padding: 8px; }
.airport-feed-status {
  margin-bottom: 6px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--card-bg);
}
.airport-feed-status[data-status="live"] {
  color: var(--green);
  border-color: var(--green);
  background: rgba(0, 255, 170, 0.06);
}
.airport-feed-status[data-status="fallback"] {
  color: var(--amber);
  border-color: var(--amber);
  background: rgba(255, 170, 0, 0.08);
}
.airport-feed-status[data-status="offline"] {
  color: var(--red);
  border-color: var(--red);
  background: rgba(255, 0, 60, 0.08);
}
.airport-summary { display: flex; gap: 6px; margin-bottom: 8px; }
.airport-stat {
  flex: 1; text-align: center; padding: 6px 4px; border: 1px solid var(--line); background: var(--card-bg);
}
.airport-stat .stat-val { font-size: 18px; font-weight: 800; color: var(--ink); }
.airport-stat .stat-label { font-size: 7px; color: var(--soft); text-transform: uppercase; letter-spacing: 0.05em; }
.airport-stat.arrival .stat-val { color: var(--green); }
.airport-stat.departure .stat-val { color: var(--amber); }

.flight-list { display: flex; flex-direction: column; gap: 3px; }
.flight-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 6px; border: 1px solid var(--line); font-size: 9px; background: var(--card-bg);
}
.flight-row.arrival { border-left: 2px solid var(--green); }
.flight-row.departure { border-left: 2px solid var(--amber); }
.flight-callsign { color: var(--ink); font-weight: 700; }
.flight-type { color: var(--cyan); font-size: 8px; }
.flight-dist { color: var(--soft); }
.flight-eta { color: var(--amber); font-weight: 700; }
.flight-feed-tag {
  padding: 1px 4px;
  border: 1px solid var(--amber);
  color: var(--amber);
  font-size: 7px;
  letter-spacing: 0.06em;
}

/* === Sentiment Panel === */
.sentiment-panel { padding: 8px; }
.sentiment-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.sent-pos { background: var(--green); }
.sent-neu { background: var(--soft); opacity: 0.5; }
.sent-neg { background: var(--red); }
.sentiment-labels { display: flex; justify-content: space-between; font-size: 8px; }
.sent-label { color: var(--soft); }
.sent-label.pos { color: var(--green); }
.sent-label.neg { color: var(--red); }
.news-intake-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
.news-intake-card {
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  background: var(--card-bg);
}
.news-intake-card strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
}
.news-intake-card span {
  color: var(--soft);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.news-intake-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  color: var(--cyan);
  font-size: 7px;
  letter-spacing: 0.08em;
}
.news-intake-note {
  margin-top: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: 8px;
  line-height: 1.4;
}
.news-intake-list {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}
.news-intake-item {
  padding: 6px;
  border: 1px solid var(--line);
  background: var(--card-bg);
}
.news-intake-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 7px;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.news-intake-item-head strong {
  color: var(--cyan);
  font-size: 8px;
  font-weight: 700;
}
.news-intake-item-head span:last-child {
  margin-left: auto;
}
.news-intake-title {
  margin-top: 4px;
  color: var(--ink);
  font-size: 9px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Jurisdiction Tags === */
.jurisdiction-cards { padding: 6px; display: flex; flex-wrap: wrap; gap: 3px; }
.municipality-tag {
  display: inline-block; padding: 4px 8px; font-size: 8px;
  font-weight: 700; letter-spacing: 0.05em; border: 1px solid; text-transform: uppercase; background: rgba(0,0,0,0.3);
}
[data-theme="light"] .municipality-tag { background: rgba(255,255,255,0.5); }

/* === Lower Grid === */
.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(300px, 0.98fr) minmax(260px, 0.84fr);
  gap: 2px;
  border-top: 1px solid var(--line-strong);
  flex: 0 0 340px;
  height: 340px;
  max-height: 340px;
  overflow: hidden;
}
.lower-grid > .panel,
.qualitative-panel,
.satellite-panel,
.source-panel {
  min-height: 0;
}
.intel-panel,
.qualitative-panel,
.source-panel {
  min-width: 0;
}
/* === Intel Panel: Economy + News Digest + Trends === */
.intel-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
/* Economy band — MYR rates + macro indicators */
.econ-band {
  display: flex;
  gap: 2px;
  padding: 6px 8px 4px;
  flex-shrink: 0;
  overflow: hidden;
}
.econ-pill {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  background: var(--panel-bg);
}
.econ-pill-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: 0 0 5px var(--cyan-glow);
}
.econ-pill-label {
  font-size: 7px;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.econ-pill.econ-macro .econ-pill-value {
  color: var(--amber);
}
/* News digest — EN/BM/ZH tabs + headlines */
.news-digest {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--line);
}
.news-digest-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 8px 0;
  flex-shrink: 0;
}
.news-digest-tab {
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
  border: 1px solid var(--line);
  border-bottom: none;
  background: transparent;
  cursor: pointer;
  appearance: none;
  transition: color 120ms ease, border-color 120ms ease;
}
.news-digest-tab.active,
.news-digest-tab:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}
.news-digest-list {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 4px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.news-digest-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 5px;
  min-height: 0;
}
.news-digest-badge {
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.06em;
  padding: 1px 4px;
  border: 1px solid var(--line-strong);
  color: var(--soft);
  white-space: nowrap;
  flex-shrink: 0;
}
.news-digest-title {
  font-size: 9px;
  color: var(--ink);
  line-height: 1.3;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.news-digest-time {
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--soft);
  white-space: nowrap;
  flex-shrink: 0;
}
/* Trends band */
.trends-band {
  border-top: 1px solid var(--line);
  padding: 4px 8px 5px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.trends-band-head {
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--soft);
  margin-bottom: 2px;
}
.trend-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 6px;
}
.trend-rank {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--soft);
  text-align: right;
}
.trend-term {
  font-size: 9px;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.trend-row.local .trend-term {
  color: var(--cyan);
  text-shadow: 0 0 4px var(--cyan-glow);
}
.trend-traffic {
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--amber);
  white-space: nowrap;
}
[data-theme="light"] .econ-pill { background: rgba(255,255,255,0.7); }

/* === Ground Pulse (per-city mention rollup) === */
.ground-pulse {
  border-top: 1px solid var(--line);
  padding: 6px 8px 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.gp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.gp-kicker {
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--soft);
}
.gp-totals {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--ink);
  text-shadow: 0 0 4px var(--cyan-glow);
  white-space: nowrap;
}
.gp-lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.gp-lane {
  background: rgba(0, 243, 255, 0.05);
  border-left: 2px solid var(--cyan);
  padding: 4px 6px 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.gp-lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.gp-lane-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}
.gp-lane-trend:empty { display: none; }
.gp-lane-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
}
.gp-lane-count {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink);
  white-space: nowrap;
}
.gp-unit {
  font-size: 7px;
  color: var(--soft);
  margin-left: 1px;
  margin-right: 3px;
}
.gp-spark {
  color: var(--cyan);
  opacity: 0.85;
  flex-shrink: 0;
}
.gp-spark.is-peak {
  color: var(--amber);
  opacity: 1;
}
.gp-delta {
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.05em;
  padding: 1px 4px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.gp-delta.is-up { color: var(--amber); }
.gp-delta.is-down { color: var(--green); }
.gp-delta.is-flat { color: var(--soft); }
.gp-narrative {
  font-size: 9px;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gp-trends {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.gp-trend {
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--amber);
  border: 1px solid var(--amber);
  padding: 1px 4px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gp-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 5px;
  row-gap: 1px;
  align-items: baseline;
  min-width: 0;
}
.gp-badge {
  grid-row: 1 / 3;
  align-self: start;
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.05em;
  padding: 1px 4px;
  border: 1px solid var(--line-strong);
  color: var(--soft);
  white-space: nowrap;
}
.gp-item .gp-badge[data-official="true"],
.gp-badge.official {
  color: var(--cyan);
  border-color: var(--cyan);
}
.gp-title {
  font-size: 9px;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.25;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}
.gp-title:hover {
  color: var(--cyan);
  text-shadow: 0 0 4px var(--cyan-glow);
}
.gp-meta {
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--soft);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}
/* On TV, Ground Pulse replaces the older news-digest panel (same data, per-city view).
   The headline list inside each lane is hidden on TV (would break the 3-column fit) and
   news-digest itself is hidden — both reappear at mobile breakpoints. */
.gp-list { display: none; }
.intel-panel .news-digest { display: none; }

/* === Flood Forecast (River Discharge) === */
.flood-forecast {
  padding: 4px 0 2px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.flood-station {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--soft);
}
.flood-today {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.flood-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 6px var(--cyan-glow);
}
.flood-unit {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--soft);
}
.flood-peak-warn { color: var(--amber); }
.flood-days {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.flood-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.flood-day-label {
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--soft);
}
.flood-day-val {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink);
}
.flood-day-val.warn { color: var(--amber); }
.flood-model {
  font-size: 7px;
  color: var(--soft);
  margin-top: 2px;
}

/* === Bypass Tracker (Sarawak River Bypass Project) === */
.bypass-tracker {
  border-top: 1px solid var(--line);
  padding: 6px 8px 5px;
  flex-shrink: 0;
}
.bypass-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.bypass-title {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.bypass-budget {
  font-family: var(--font-mono);
  font-size: 7px;
  background: rgba(251, 191, 36, 0.15);
  color: var(--amber);
  padding: 1px 5px;
  border: 1px solid rgba(251,191,36,0.3);
}
.bypass-phases {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}
.bypass-phase {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 6px;
}
.bypass-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--soft);
  flex-shrink: 0;
}
.bypass-dot.active { background: var(--green); box-shadow: 0 0 4px var(--green); }
.bypass-phase-label {
  font-size: 8px;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.bypass-period {
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--soft);
  white-space: nowrap;
}
.bypass-benefit {
  font-size: 7px;
  color: var(--soft);
  line-height: 1.4;
}

/* === Qualitative Panel === */
.qualitative-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  overflow: hidden;
}
.qual-hero {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--amber);
  background:
    linear-gradient(135deg, rgba(255, 170, 0, 0.08), transparent 55%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent 80%),
    var(--card-bg);
}
.qual-hero-kicker {
  color: var(--amber);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
}
.qual-hero strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  font-family: var(--font-sans);
}
.qual-hero-line {
  color: var(--soft);
  font-size: 8px;
  line-height: 1.35;
}
.qual-hero-note {
  color: var(--ink);
  font-size: 8px;
  line-height: 1.4;
  opacity: 0.88;
}
.qualitative-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.qualitative-section {
  display: grid;
  gap: 6px;
  min-height: 0;
}
.qualitative-label {
  color: var(--cyan);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}
.qualitative-list {
  display: grid;
  gap: 4px;
}
.qualitative-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  padding: 5px 6px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--soft);
  font-size: 8px;
  line-height: 1.4;
}
.qualitative-item span:last-child { color: var(--ink); }
.qualitative-index {
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.08em;
}
.qualitative-sources {
  min-height: 0;
}
.qualitative-source-list {
  display: grid;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
}
.qualitative-source-item {
  display: grid;
  gap: 3px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  text-decoration: none;
  color: inherit;
  transition: border-color 120ms ease, background 120ms ease;
}
.qualitative-source-item:hover {
  border-color: var(--amber);
  background: rgba(255, 170, 0, 0.06);
}
.qualitative-source-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  color: var(--soft);
  font-size: 7px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.qualitative-source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border: 1px solid var(--amber);
  color: var(--amber);
  font-size: 7px;
  letter-spacing: 0.08em;
}
.qualitative-source-item strong {
  color: var(--ink);
  font-size: 9px;
}
.qualitative-source-title {
  color: var(--ink);
  font-size: 8px;
  line-height: 1.35;
}
.qualitative-source-note {
  color: var(--soft);
  font-size: 7px;
  line-height: 1.35;
}
.qualitative-source-empty {
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--soft);
  font-size: 8px;
  line-height: 1.4;
}

/* === Sources === */
.source-matrix {
  padding: 6px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 6px;
}
.source-matrix-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
.source-matrix-card {
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  background: var(--card-bg);
}
.source-matrix-card strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
}
.source-matrix-card span {
  color: var(--soft);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.source-matrix-card[data-tone="live"] strong { color: var(--green); }
.source-matrix-card[data-tone="official"] strong { color: var(--cyan); }
.source-matrix-card[data-tone="degraded"] strong { color: var(--amber); }
.source-matrix-card[data-tone="offline"] strong { color: var(--red); }
.source-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.source-chip {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: 7px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.source-chip[data-status="fallback"],
.source-chip[data-status="curated"] {
  color: var(--amber);
  border-color: var(--amber);
}
.source-chip[data-status="offline"] {
  color: var(--red);
  border-color: var(--red);
}
.source-chip[data-status="reference"] {
  color: var(--soft);
  border-color: var(--soft);
}
.source-chip[data-status="live"] {
  color: var(--green);
  border-color: var(--green);
}
.source-list {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.source-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  font-size: 9px;
  background: var(--card-bg);
}
.source-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.source-name { color: var(--ink); }
.source-detail {
  color: var(--soft);
  font-size: 8px;
  line-height: 1.35;
}
.source-meta {
  flex-shrink: 0;
  display: grid;
  gap: 4px;
  justify-items: end;
}
.source-updated {
  color: var(--soft);
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.source-status { padding: 1px 5px; border: 1px solid; font-size: 7px; text-transform: uppercase; letter-spacing: 0.05em; }
.source-status[data-status="live"] { color: var(--green); border-color: var(--green); }
.source-status[data-status="official"] { color: var(--cyan); border-color: var(--cyan); }
.source-status[data-status="fallback"], .source-status[data-status="curated"] { color: var(--amber); border-color: var(--amber); }
.source-status[data-status="offline"] { color: var(--red); border-color: var(--red); }
.source-status[data-status="stable"], .source-status[data-status="reference"] { color: var(--soft); border-color: var(--soft); }

/* === Footer === */
.bottom-bar { flex-shrink: 0; display: flex; justify-content: space-between; padding: 3px 12px; font-size: 9px; border-top: 1px solid var(--line); background: var(--hud-bg); align-items: center; }
.action-btn {
  background: transparent; border: 1px solid var(--cyan); color: var(--cyan);
  font-family: var(--font-mono); font-size: 8px; padding: 3px 10px;
  cursor: pointer; letter-spacing: 0.1em; text-transform: uppercase; transition: all 0.2s;
}
.action-btn:hover { background: var(--cyan); color: var(--bg); }

/* === Scrollbars === */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); }

@media (max-width: 1240px) {
  .metric-band { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .brief-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .board-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
  .lower-grid { grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.96fr) minmax(250px, 0.84fr); }
  .qualitative-columns { grid-template-columns: 1fr; }
}

@media (max-width: 1040px) {
  html, body { overflow-x: hidden; overflow-y: auto; }
  .dashboard-shell { height: auto; min-height: 100svh; overflow: visible; }
  .masthead {
    align-items: flex-start;
    flex-direction: column;
    padding: 8px 12px;
    flex: 0 0 auto;
    flex-wrap: wrap;
  }
  .status-block {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .runtime-meta {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
  .partner-row { flex-wrap: wrap; gap: 6px; }
  .ticker-bar { flex: 0 0 auto; }
  .metric-band { grid-template-columns: repeat(4, minmax(0, 1fr)); flex: 0 0 auto; }
  .brief-strip { grid-template-columns: 1fr; flex: 0 0 auto; }
  .board-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "center"
      "situation";
    flex: 0 0 auto;
  }
  .panel-inner { overflow: visible; }
  .map-panel { min-height: 540px; }
  .map-frame { min-height: 440px; }
  .lower-grid {
    grid-template-columns: 1fr;
    flex: 0 0 auto;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }
  .intel-panel, .qualitative-panel, .source-panel {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .qualitative-body { overflow: visible; }
  .qualitative-source-list { overflow: visible; }
  .source-list { overflow: visible; }
  .gp-lanes { grid-template-columns: 1fr; }
  .gp-narrative { -webkit-line-clamp: 3; }
  .gp-list { display: flex; }
  .intel-panel .news-digest { display: flex; }
}

@media (max-width: 720px) {
  html, body { font-size: 12px; }
  body::before { background-size: 24px 24px; opacity: 0.14; }
  .masthead { padding: 6px 10px; gap: 6px; }
  .title-block h1 {
    font-size: 13px;
    letter-spacing: 0.12em;
    white-space: normal;
  }
  .eyebrow { font-size: 8px; letter-spacing: 0.16em; }
  .summary-lead { font-size: 8px; display: none; }
  .partner-row img { height: 18px; padding: 2px 3px; }
  .partner-row { gap: 5px; }
  .runtime-detail { font-size: 8px; }
  .micro-badge { font-size: 8px; padding: 1px 6px; }
  .status-pill { font-size: 9px; padding: 2px 8px; }
  .econ-band { flex-wrap: wrap; gap: 4px; overflow: visible; }
  .econ-pill { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .controls-row { flex-wrap: wrap; }
  .runtime-badges { width: 100%; }
  .ctrl-btn, .lang-btn, .segmented-control button, .action-btn {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 9px;
  }
  .ticker-bar { height: auto; flex-wrap: wrap; }
  .section-stamp { line-height: 24px; }
  .ticker-summary {
    max-width: none;
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--line);
    line-height: 24px;
  }
  .ticker-window {
    width: 100%;
    border-top: 1px solid var(--line);
  }
  .metric-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-matrix-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-controls {
    width: 100%;
    flex-direction: column;
  }
  .segmented-control { flex-wrap: wrap; }
  .map-panel { min-height: 480px; }
  .map-frame { min-height: 360px; }
  .map-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .airport-summary { flex-wrap: wrap; }
  .flight-row { flex-wrap: wrap; gap: 6px; }
  .satellite-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .news-intake-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qualitative-columns { grid-template-columns: 1fr; }
  .source-item {
    flex-direction: column;
    align-items: stretch;
  }
  .source-meta {
    justify-items: start;
    grid-auto-flow: column;
    justify-content: space-between;
  }
  .bottom-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .ground-pulse { padding: 6px 10px 8px; }
  .gp-lane { padding: 5px 8px 6px; }
  .gp-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
  .gp-meta { white-space: normal; }
  .gp-item { row-gap: 2px; }
}

/* === MPP governance: Councillor roster === */
.councillor-panel { padding: 6px; display: flex; flex-direction: column; gap: 8px; }
.councillor-leaders { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.councillor-card {
  padding: 8px 10px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.councillor-role {
  font-size: 8px;
  color: var(--cyan);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: var(--glow-soft);
}
.councillor-name { font-size: 11px; color: var(--ink); font-weight: 700; line-height: 1.25; }
.councillor-scope { font-size: 8px; color: var(--soft); letter-spacing: 0.3px; }
.councillor-phone {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--cyan);
  text-decoration: none;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.councillor-phone:hover { text-shadow: var(--glow-soft); }

.ward-chip-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}
.ward-chip {
  padding: 6px 4px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-top: 2px solid var(--ward-color, var(--line-strong));
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
  font-family: inherit;
  color: var(--ink);
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.ward-chip:hover { background: var(--card-hover); border-color: var(--line-strong); }
.ward-chip[data-active="true"] {
  background: rgba(0,243,255,0.08);
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(0,243,255,0.25);
}
.ward-chip-code {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.ward-chip-area { font-size: 7px; color: var(--soft); line-height: 1.15; min-height: 16px; }
.ward-chip-stats { font-size: 7px; color: var(--cyan); letter-spacing: 0.3px; display: flex; gap: 2px; justify-content: center; flex-wrap: wrap; }

.ward-detail {
  padding: 8px 10px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ward-detail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ward-detail-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.ward-detail-area { font-size: 8px; color: var(--soft); }
.ward-detail-roster { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ward-detail-roster .councillor-card {
  padding: 6px 8px;
  border-left-width: 2px;
  background: rgba(255,255,255,0.02);
}
.ward-detail-roster .councillor-name { font-size: 10px; }
.ward-detail-roster .councillor-phone { font-size: 9px; }

.ward-hint {
  padding: 8px 10px;
  font-size: 9px;
  color: var(--soft);
  border: 1px dashed var(--line);
  background: rgba(255,255,255,0.02);
  letter-spacing: 0.5px;
}
.councillor-term {
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  color: var(--soft);
  letter-spacing: 0.5px;
  padding-top: 3px;
  border-top: 1px dotted var(--line);
}

/* === MPP governance: Locality Explorer (compact, panel-fit) === */
.locality-panel {
  padding: 6px 10px 4px;
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(0, 2.4fr);
  grid-template-areas:
    "head head"
    "kpis filters"
    "kpis list";
  gap: 4px 12px;
  flex: 0 0 150px;
  max-height: 150px;
  overflow: hidden;
}
.locality-panel .panel-head { grid-area: head; padding: 0 0 2px; border: 0; background: transparent; }
.locality-panel .panel-head .kicker { display: inline; margin-right: 8px; }
.locality-panel .panel-head h2 { display: inline; font-size: 10px; letter-spacing: 0.06em; }

.locality-kpis {
  grid-area: kpis;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.locality-kpis .metric-card {
  background: var(--hud-bg);
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-top: 1px solid var(--cyan);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.locality-kpis .metric-label {
  font-size: 7px;
  color: var(--cyan);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.locality-kpis .metric-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-shadow: var(--glow-soft);
  line-height: 1.05;
}
.locality-kpis .metric-unit { font-size: 8px; color: var(--soft); margin-left: 3px; }

.locality-filters {
  grid-area: filters;
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  align-items: center;
  overflow: hidden;
}
.locality-filter,
.locality-search {
  background: var(--card-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  padding: 2px 4px;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 140px;
}
.locality-filter:focus,
.locality-search:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(0,243,255,0.3);
}
.locality-search { flex: 2 1 auto; max-width: none; }
.locality-reset {
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  padding: 3px 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--soft);
  cursor: pointer;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.locality-reset:hover { color: var(--cyan); border-color: var(--cyan); }

.locality-status {
  grid-area: list;
  font-size: 8px;
  color: var(--soft);
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.4px;
  align-self: start;
  display: none;
}

.locality-list {
  grid-area: list;
  height: 84px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--line);
  padding: 2px;
  background: var(--hud-bg);
}
.locality-list::-webkit-scrollbar { width: 5px; }
.locality-list::-webkit-scrollbar-track { background: transparent; }
.locality-list::-webkit-scrollbar-thumb { background: var(--line-strong); }

.locality-row {
  padding: 2px 6px;
  background: var(--card-bg);
  border-left: 2px solid var(--line-strong);
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 70px 90px;
  gap: 6px;
  align-items: center;
  cursor: pointer;
  transition: background 100ms ease;
  font-family: "JetBrains Mono", monospace;
  line-height: 1.2;
}
.locality-row:hover { background: var(--card-hover); }
.locality-code { font-size: 9px; color: var(--cyan); font-weight: 700; letter-spacing: 0.3px; }
.locality-name {
  font-size: 9px; color: var(--ink); letter-spacing: 0.1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.locality-const { font-size: 8px; color: var(--cyan); letter-spacing: 0.3px; }
.locality-counts { display: flex; gap: 6px; justify-content: flex-end; font-size: 8px; color: var(--soft); }
.locality-counts .c-res { color: var(--green); }
.locality-counts .c-com { color: var(--amber); }
.locality-counts .c-ind { color: var(--red); }

.panel-empty {
  padding: 24px;
  text-align: center;
  color: var(--soft);
  font-size: 10px;
  letter-spacing: 0.5px;
}

@media (max-width: 1040px) {
  .locality-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "kpis"
      "filters"
      "list";
    flex: 0 0 auto;
    max-height: none;
    overflow: visible;
  }
  .locality-list { max-height: none; overflow: visible; }
  .locality-kpis { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 960px) {
  .ward-chip-grid { grid-template-columns: repeat(3, 1fr); }
  .councillor-leaders { grid-template-columns: 1fr; }
  .locality-kpis { grid-template-columns: repeat(3, 1fr); }
  .ward-detail-roster { grid-template-columns: 1fr; }
}

/* === Secretary Goh view: trimmed for a non-tech municipal user ===
   Set data-view="full" on <html> to restore everything. Nothing deleted. */
[data-view="secretary"] .qualitative-panel,
[data-view="secretary"] .source-panel,
[data-view="secretary"] #trendsBand,
[data-view="secretary"] #bypassTracker,
[data-view="secretary"] #jurisdictionCards,
[data-view="secretary"] .locality-kpis {
  display: none !important;
}

/* When 2 panels are removed from lower-grid, intel panel claims the row.
   Free the row from a fixed 340px so the freed vertical real estate goes to
   the map (.board-grid has flex: 1). max-height is a safety cap. */
[data-view="secretary"] .lower-grid {
  grid-template-columns: minmax(0, 1fr);
  height: auto;
  min-height: 180px;
  max-height: 260px;
}

/* Locality panel: cap the height so a long ward list doesn't push the map up.
   Internal scroll preserves access to all 525 localities. */
[data-view="secretary"] .locality-panel {
  max-height: 220px;
}
[data-view="secretary"] .locality-list {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

/* One-line locality summary that replaces the 6-tile KPI grid */
.locality-summary {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--soft);
  letter-spacing: 0.04em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.locality-summary span { white-space: nowrap; }
.locality-summary .locality-count,
.locality-summary .locality-num {
  color: var(--cyan);
  font-weight: 700;
  text-shadow: 0 0 4px var(--cyan-glow);
}

/* Ward-grouped list: ward header + nested locality rows */
.locality-ward-group { margin-bottom: 6px; }
.locality-ward-header {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  padding: 6px 12px 3px;
  border-top: 1px solid var(--line);
  background: rgba(251,191,36,0.04);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.locality-ward-header .ward-locality-count {
  color: var(--soft);
  font-weight: 400;
}

/* === Pass 1: Control-room upgrades === */

/* Delta strip — "what changed since you last looked" thin row */
.delta-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--hud-bg);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  min-height: 24px;
}
.delta-stamp {
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.18em;
  white-space: nowrap;
}
.delta-since {
  color: var(--soft);
  white-space: nowrap;
}
.delta-list {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.delta-line {
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.delta-line .delta-glyph {
  font-weight: 700;
  font-size: 11px;
}
.delta-line[data-tone="alert"] .delta-glyph { color: var(--red); }
.delta-line[data-tone="warn"]  .delta-glyph { color: var(--amber); }
.delta-line[data-tone="cool"]  .delta-glyph { color: var(--cyan); }
.delta-line[data-tone="info"]  .delta-glyph { color: var(--soft); }
.delta-line .delta-text { color: var(--ink); }
.delta-line[data-tone="info"] .delta-text { color: var(--soft); }
.delta-strip[data-empty="true"] .delta-list { color: var(--soft); }
.delta-strip[data-empty="true"] .delta-since { color: var(--soft); opacity: 0.7; }
.delta-strip[data-empty="false"] {
  /* Subtle pulse when there are deltas — eye-catching but quiet */
  animation: delta-pulse 4s ease-in-out 1;
}
@keyframes delta-pulse {
  0%   { background: var(--hud-bg); }
  10%  { background: rgba(0,243,255,0.04); box-shadow: inset 0 0 12px rgba(0,243,255,0.08); }
  100% { background: var(--hud-bg); }
}

/* Universal interactive polish — applies to anything that's tabbable.
   Subtle cyan focus ring; never a 2px-blue browser default. */
:where(button, [tabindex], a, .operation-card, .locality-row, .locality-ward-header):focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 8px rgba(0,243,255,0.35);
}

/* Smoother default transitions on all interactive surfaces */
button, .operation-card, .metric-card, .locality-row, .locality-ward-header, .signal-card, .ward-project, .event-row {
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, opacity 200ms ease;
}

/* Subtle ascending entrance for the situation-rail panels — soft cinematic
   stagger that runs once on first load. Anti-templated: 6px slide, no bounce. */
.situation-rail .section-group, .situation-rail .ward-brief, .situation-rail .posture-block {
  animation: rail-enter 360ms ease-out both;
}
.situation-rail .section-group:nth-child(2) { animation-delay: 50ms; }
.situation-rail .section-group:nth-child(3) { animation-delay: 100ms; }
.situation-rail .section-group:nth-child(4) { animation-delay: 150ms; }
.situation-rail .section-group:nth-child(5) { animation-delay: 200ms; }
.situation-rail .section-group:nth-child(6) { animation-delay: 250ms; }
@keyframes rail-enter {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Brief-strip cards: a hairline cyan glow on hover so they feel inspectable */
.brief-card { transition: border-color 220ms ease, box-shadow 220ms ease; }
.brief-card:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(0,243,255,0.08), inset 0 0 24px rgba(0,243,255,0.03);
}

/* Today-brief: compact the spacing slightly when the line is long */
.today-brief { line-height: 1.45; }
.today-brief .brief-flag { padding: 0 2px; }

/* Locality summary: when the page is on the wider breakpoint, make the
   monospaced row more rhythmic — tabular numbers, even spacing */
.locality-summary { font-variant-numeric: tabular-nums; }
.metric-value      { font-variant-numeric: tabular-nums; }
.wp-rm, .wp-pct, .ward-brief-stat strong { font-variant-numeric: tabular-nums; }
.event-time        { font-variant-numeric: tabular-nums; }

/* Directive aging + interactive status */
.operation-card {
  position: relative;
  cursor: pointer;
  transition: opacity 200ms ease, border-color 200ms ease;
  user-select: none;
}
.operation-card:hover { background: rgba(0,243,255,0.03); }
.operation-card[data-age="aging"]  { opacity: 0.85; border-left-color: var(--amber) !important; }
.operation-card[data-age="stale"]  { opacity: 0.7;  border-left-color: var(--red) !important; }
.operation-card[data-status="done"] { opacity: 0.4; }
.operation-card[data-status="done"] strong { text-decoration: line-through; text-decoration-color: var(--soft); }
.directive-status {
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--soft);
  letter-spacing: 0;
  line-height: 1;
}
.operation-card[data-status="active"] .directive-status {
  color: var(--amber);
  animation: directive-pulse 1.6s ease-in-out infinite;
}
.operation-card[data-status="done"] .directive-status {
  color: var(--green);
}
@keyframes directive-pulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}
.directive-stale-mark {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--red);
  letter-spacing: 0.1em;
}

/* Glyph-based status indicators */
.glyph {
  font-family: var(--font-mono);
  font-weight: 700;
  margin-right: 4px;
  display: inline-block;
}
.glyph[data-tone="ok"]    { color: var(--cyan); }
.glyph[data-tone="warn"]  { color: var(--amber); }
.glyph[data-tone="alert"] { color: var(--red); }
.glyph[data-tone="muted"] { color: var(--soft); opacity: 0.7; }

/* === Pass 2: Per-ward briefing + pulse rings + functional radar sweep === */

/* Ward brief — slim mission-report panel inside the situation rail */
.ward-brief {
  border-bottom: 1px solid var(--line-strong);
  padding: 8px 10px 10px;
  background:
    linear-gradient(0deg, rgba(0,243,255,0.02), rgba(0,243,255,0.02)),
    var(--card-bg);
  position: relative;
}
.ward-brief[data-active="false"], .ward-brief[hidden] { display: none !important; }
.ward-brief-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.ward-brief-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--cyan);
  text-shadow: 0 0 4px var(--cyan-glow);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ward-brief-title .ward-brief-code {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.ward-brief-title .ward-brief-area {
  color: var(--ink);
  font-size: 9px;
  letter-spacing: 0.12em;
}
.ward-brief-close {
  font-family: var(--font-mono);
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--soft);
  padding: 1px 6px;
  cursor: pointer;
  letter-spacing: 0;
  line-height: 1;
}
.ward-brief-close:hover { color: var(--red); border-color: var(--red); }
.ward-brief-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.ward-brief-stat {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--soft);
  text-transform: uppercase;
  border-left: 2px solid var(--cyan);
  padding-left: 6px;
}
.ward-brief-stat strong {
  display: block;
  font-size: 13px;
  color: var(--cyan);
  font-weight: 700;
  text-shadow: 0 0 4px var(--cyan-glow);
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}
.ward-brief-row {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink);
  line-height: 1.55;
  letter-spacing: 0.04em;
  padding: 1px 0;
}
.ward-brief-row .ward-brief-label {
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 7.5px;
  margin-right: 6px;
}
.ward-brief-row .ward-brief-phone {
  color: var(--cyan);
  text-decoration: none;
}
.ward-brief-row .ward-brief-phone:hover { text-decoration: underline; }
.ward-brief-section {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}

/* Make the ward groups in the locality list clickable */
.locality-ward-header { cursor: pointer; user-select: none; }
.locality-ward-header:hover { background: rgba(0,243,255,0.05); }

/* Per-ward project ledger — line-item operational substance.
   Hand-encoded entries from data.js MPP_WARD_PROJECTS, rendered in HUD-monospace. */
.ward-projects { margin-top: 4px; padding-top: 6px; }
.ward-projects-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.ward-projects-totals {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--soft);
}
.ward-projects-totals [data-tone="ok"]    { color: var(--green); }
.ward-projects-totals [data-tone="warn"]  { color: var(--amber); }
.ward-projects-totals [data-tone="muted"] { color: var(--soft); opacity: 0.8; }
.ward-projects-empty {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--soft);
  font-style: italic;
}
.ward-projects-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ward-project {
  border-left: 2px solid var(--line);
  padding: 4px 8px;
  background: rgba(0,243,255,0.02);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.03em;
  line-height: 1.4;
}
.ward-project[data-status="complete"]    { border-left-color: var(--green); opacity: 0.78; }
.ward-project[data-status="in-progress"] { border-left-color: var(--amber); }
.ward-project[data-status="queued"]      { border-left-color: var(--soft); }
.ward-project .wp-row1 {
  display: grid;
  grid-template-columns: 14px 50px 1fr auto;
  gap: 6px;
  align-items: baseline;
}
.ward-project .wp-status {
  font-size: 11px;
  color: var(--soft);
  text-align: center;
}
.ward-project[data-status="in-progress"] .wp-status { color: var(--amber); }
.ward-project[data-status="complete"]    .wp-status { color: var(--green); }
.ward-project .wp-cat {
  color: var(--cyan);
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 8px;
}
.ward-project .wp-title {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ward-project .wp-rm {
  color: var(--cyan);
  font-weight: 700;
  text-shadow: 0 0 3px var(--cyan-glow);
  letter-spacing: 0.05em;
  font-size: 9.5px;
  white-space: nowrap;
}
.ward-project .wp-row2 {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 3px;
  padding-left: 20px;
}
.ward-project .wp-bar {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  overflow: visible;
}
.ward-project .wp-bar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--cyan);
  box-shadow: 0 0 4px var(--cyan-glow);
  transition: width 600ms ease-out;
}
.ward-project[data-status="complete"]    .wp-bar-fill { background: var(--green); box-shadow: 0 0 4px rgba(34,197,94,0.5); }
.ward-project[data-status="in-progress"] .wp-bar-fill { background: var(--amber); box-shadow: 0 0 4px rgba(251,191,36,0.5); }
.ward-project[data-status="queued"]      .wp-bar-fill { background: var(--soft); box-shadow: none; }
.ward-project .wp-pct {
  position: absolute;
  right: -28px; top: -3px;
  font-size: 8px;
  color: var(--soft);
  letter-spacing: 0.04em;
}
.ward-project .wp-contractor {
  color: var(--soft);
  font-size: 8px;
  font-style: italic;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  margin-right: 32px;
}
.ward-project .wp-note {
  margin-top: 3px;
  padding-left: 20px;
  color: var(--soft);
  font-size: 8.5px;
  font-style: italic;
}

/* Pulse rings on map markers — period coded to data freshness */
.pulse-marker {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.pulse-marker::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0;
  animation: pulse-ring var(--pulse-period, 4s) ease-out infinite;
}
@keyframes pulse-ring {
  0%   { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(1.9); opacity: 0; }
}
.pulse-marker[data-swept="true"]::after {
  animation: pulse-ring-flash 600ms ease-out 1;
}
@keyframes pulse-ring-flash {
  0%   { transform: scale(0.6); opacity: 1; border-width: 2px; }
  100% { transform: scale(2.4); opacity: 0; border-width: 1px; }
}

/* === Today's Brief === a single teleprompter line under the title.
   Reads as the dashboard's "stand-up announcement" — first thing the eye sees. */
.today-brief {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  line-height: 1.5;
}
.today-brief .brief-sep {
  color: var(--soft);
  opacity: 0.45;
  font-weight: 700;
}
.today-brief .brief-posture {
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--cyan);
  text-shadow: 0 0 4px var(--cyan-glow);
}
.today-brief .brief-posture[data-posture="watch"]      { color: var(--amber); text-shadow: 0 0 5px rgba(251,191,36,0.45); }
.today-brief .brief-posture[data-posture="steady-watch"]{ color: var(--amber); text-shadow: 0 0 5px rgba(251,191,36,0.45); }
.today-brief .brief-posture[data-posture="stretched"]  { color: var(--red);   text-shadow: 0 0 5px rgba(239,68,68,0.5); }
.today-brief .brief-flag {
  letter-spacing: 0.1em;
}
.today-brief .brief-flag[data-tone="ok"]    { color: var(--cyan); }
.today-brief .brief-flag[data-tone="warn"]  { color: var(--amber); }
.today-brief .brief-flag[data-tone="alert"] { color: var(--red); text-shadow: 0 0 4px rgba(239,68,68,0.4); }
.today-brief .brief-flag[data-tone="muted"] { color: var(--soft); }

/* === Pass 3: Events stack, telemetry, connectors, sitrep toast === */

/* Events stack — vertical timeline, ATC-style */
.events-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}
.event-row {
  display: grid;
  grid-template-columns: 8px 38px 32px 1fr;
  align-items: baseline;
  gap: 6px;
  padding: 3px 8px;
  border-left: 1px solid var(--line);
  position: relative;
}
.event-row::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--soft);
  display: inline-block;
  align-self: center;
}
.event-row[data-fresh="now"]::before    { background: var(--green); box-shadow: 0 0 4px var(--green); }
.event-row[data-fresh="recent"]::before { background: var(--cyan);  box-shadow: 0 0 4px var(--cyan-glow); }
.event-row[data-fresh="older"]::before  { background: var(--soft);  opacity: 0.6; }
.event-time {
  color: var(--soft);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.event-type {
  color: var(--cyan);
  font-weight: 700;
  letter-spacing: 0.12em;
}
.event-row[data-type="MET"]   .event-type { color: var(--red); }
.event-row[data-type="HYDRO"] .event-type { color: var(--amber); }
.event-row[data-type="QUAKE"] .event-type { color: var(--red); }
.event-row[data-type="AIR"]   .event-type { color: var(--cyan); }
.event-row[data-type="FLOOD"] .event-type { color: var(--amber); }
.event-row[data-type="NEWS"]  .event-type { color: var(--soft); }
.event-text {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-row[data-fresh="older"] .event-text { color: var(--soft); opacity: 0.85; }
.events-empty {
  padding: 6px 12px;
  font-size: 9px;
  color: var(--soft);
  font-style: italic;
}

/* Telemetry strip — kernel-boot-log feel above the bottom bar */
.telemetry-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 18px;
  padding: 0 12px;
  border-top: 1px solid var(--line);
  background: var(--hud-bg);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  color: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.telemetry-strip .tlm-time   { color: var(--cyan); font-weight: 700; }
.telemetry-strip .tlm-entry  { display: inline-flex; align-items: baseline; gap: 4px; }
.telemetry-strip .tlm-sep    { color: var(--soft); opacity: 0.4; }

/* Cross-reference connector canvas — full-screen overlay, pointer-events:none */
.connector-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  width: 100vw;
  height: 100vh;
}

/* Keyboard help overlay — power-user key-map. Hit ? to summon. */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(1, 2, 3, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: help-fade-in 220ms ease-out;
}
.help-overlay[hidden] { display: none !important; }
@keyframes help-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.help-overlay-card {
  width: min(720px, 90vw);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--hud-bg);
  border: 1px solid var(--cyan);
  box-shadow: 0 0 24px rgba(0, 243, 255, 0.18), inset 0 0 80px rgba(0,243,255,0.04);
  padding: 18px 24px 20px;
  position: relative;
}
.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.help-title {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 6px var(--cyan-glow);
}
.help-close {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--soft);
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}
.help-close:hover { color: var(--red); border-color: var(--red); }
.help-section {
  margin-top: 12px;
}
.help-section h3 {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--cyan);
  margin: 0 0 8px;
  font-weight: 700;
}
.help-keys, .help-glyphs {
  display: grid;
  grid-template-columns: 175px 1fr;
  gap: 4px 16px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.help-keys dt, .help-glyphs dt {
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: baseline;
}
.help-keys dd, .help-glyphs dd {
  color: var(--soft);
  margin: 0;
}
.help-keys kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(0,243,255,0.06);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  padding: 1px 6px;
  color: var(--cyan);
  letter-spacing: 0.04em;
  text-shadow: 0 0 3px var(--cyan-glow);
  line-height: 1.5;
  min-width: 18px;
  text-align: center;
}
.help-foot {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--soft);
  font-style: italic;
  line-height: 1.6;
}

/* Help-hint pill in the bottom bar — "?" for key map */
.bottom-bar .help-hint {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--soft);
  border: 1px solid var(--line);
  padding: 1px 6px 2px;
  cursor: pointer;
  user-select: none;
  margin-left: 8px;
  background: transparent;
}
.bottom-bar .help-hint:hover { color: var(--cyan); border-color: var(--cyan); }
.bottom-bar .help-hint kbd {
  font-family: inherit;
  font-size: inherit;
  color: var(--cyan);
}

/* Sitrep toast — appears after COMMAND EXPORT click */
.export-toast {
  position: fixed;
  bottom: 60px;
  right: 20px;
  z-index: 200;
  padding: 8px 14px;
  background: var(--hud-bg);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-shadow: 0 0 4px var(--cyan-glow);
  animation: toast-in 220ms ease-out;
}
.export-toast[hidden] { display: none; }
.export-toast[data-tone="error"] {
  border-color: var(--red);
  color: var(--red);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Print stylesheet — single-page A4 sitrep, white background, signature typography preserved */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  html, body { background: #fff !important; color: #000 !important; }
  .dashboard-shell { height: auto !important; overflow: visible !important; }
  /* Hide everything that's noise in print */
  .ticker-bar, .delta-strip, .partner-row, .controls-row, .runtime-meta,
  .map-panel, .situation-rail, .lower-grid, .telemetry-strip,
  .bottom-bar, .connector-canvas, .export-toast, #generatedAt,
  .micro-badge, #sysStatus, .radar-scan, .map-controls,
  .locality-filters, .locality-status, .locality-list { display: none !important; }
  /* Keep the title block, metric band, brief strip, locality summary */
  .masthead { border: none !important; padding: 0 !important; background: #fff !important; }
  .masthead h1 { color: #000 !important; text-shadow: none !important; }
  .eyebrow, .summary-lead { color: #444 !important; }
  .metric-band { background: #fff !important; border: 1px solid #000 !important; }
  .metric-card { color: #000 !important; background: #fff !important; border: 1px solid #999 !important; }
  .metric-value, .metric-label { color: #000 !important; text-shadow: none !important; }
  .brief-strip, .brief-card { background: #fff !important; color: #000 !important; border-color: #999 !important; }
  .brief-kicker { color: #000 !important; }
  .locality-panel { background: #fff !important; }
  .locality-summary { color: #333 !important; }
  .locality-summary .locality-num { color: #000 !important; text-shadow: none !important; }
  .panel-head h2, .panel-head .kicker { color: #000 !important; }
}
