/* jafo — "command center" skin.
   Turns the main page into a SIGINT monitoring console: phosphor palette,
   grid + scanline overlays, glowing panels with corner brackets, live
   spectrum + telemetry. Loaded LAST so it re-skins everything cohesively. */

:root {
  /* Re-point the shared theme tokens toward cyan/green phosphor on near-black.
     Every existing component (feed, sidebar, cards) inherits this. */
  --bg:        #04070b;
  --bg-alt:    #080e15;
  --bg-hover:  #0e1824;
  --border:    #16323d;
  --text:      #d3ebf3;
  --text-dim:  #6f93a3;
  --text-faint:#486271;
  --accent:    #35e3ff;
  --accent-bg: #0a2029;
  --good:      #37f5a6;
  --warn:      #ffb000;
  --bad:       #ff4d5e;
  --crit:      #ff6b6b;

  /* Command-center specifics */
  --cc-cyan:   #35e3ff;
  --cc-green:  #37f5a6;
  --cc-amber:  #ffb000;
  --cc-red:    #ff4d5e;
  --cc-panel:  #070d14;
  --cc-line:   rgba(53,227,255,0.14);
  --cc-glow:   rgba(53,227,255,0.45);
}

/* Global grid + vignette behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(var(--cc-line) 1px, transparent 1px) 0 0 / 100% 42px,
    linear-gradient(90deg, var(--cc-line) 1px, transparent 1px) 0 0 / 42px 100%,
    radial-gradient(130% 90% at 50% 0%, rgba(53,227,255,0.05), transparent 60%),
    radial-gradient(120% 120% at 50% 120%, rgba(0,0,0,0.6), transparent 55%);
  opacity: 0.55;
}
/* Faint CRT scanlines over the whole UI (non-interactive, very subtle). */
.cc-scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 9998;
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,0.11) 3px);
  mix-blend-mode: multiply;
  opacity: 0.5;
}
/* Keep real in-flow content above the grid overlay. NB: do NOT include
   .sidebar or .channel-picker here — they are position:fixed overlays and
   must stay that way (relative would drop them into the grid flow). */
.topbar, .cc-console, .cc-ticker, .rail, .timeline,
.view-toggle { position: relative; z-index: 1; }

/* Add ticker + analyst + bottom classification rows to the grid. */
body {
  grid-template-rows: 56px auto auto auto 1fr 20px;
  grid-template-areas:
    "topbar  topbar"
    "scanner scanner"
    "ticker  ticker"
    "sitrep  sitrep"
    "rail    timeline"
    "classbot classbot";
}
.cc-ticker { grid-area: ticker; }
.cc-sitrep { grid-area: sitrep; }
.cc-classbar-bot { grid-area: classbot; z-index: 2; }
/* bottom bar sits below the drawer */
.sidebar { bottom: 20px; }

/* ---------- Cold-boot overlay ---------- */
.cc-boot {
  position: fixed; inset: 0; z-index: 10000;
  background: radial-gradient(circle at 50% 45%, #061018, #02060a 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 0.6s ease;
}
.cc-boot.done { opacity: 0; pointer-events: none; }
.cc-boot-text {
  color: var(--cc-green); font-family: var(--font-mono);
  font-size: 13px; line-height: 1.65; margin: 0; white-space: pre;
  text-shadow: 0 0 8px rgba(55,245,166,0.5); min-width: min(440px, 90vw);
}
.cc-boot-text .ok { color: var(--cc-cyan); }
.cc-boot-text .hdr { color: #eafff6; }
.cc-boot-hint { margin-top: 26px; color: var(--text-faint); font-family: var(--font-mono); font-size: 11px; }

/* ---------- Topbar theater chips ---------- */
.cc-class-chip {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  color: var(--cc-amber); border: 1px solid rgba(255,176,0,0.4);
  background: rgba(255,176,0,0.08); border-radius: 3px; padding: 2px 7px; white-space: nowrap;
}
.cc-hud-cluster { display: flex; align-items: center; gap: 16px; margin-left: 18px; font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.cc-posture-chip { color: var(--text-dim); letter-spacing: 0.06em; }
.cc-posture-chip b { color: var(--cc-green); text-shadow: 0 0 8px rgba(55,245,166,0.5); }
.cc-posture-chip.elevated b { color: var(--cc-amber); text-shadow: 0 0 8px rgba(255,176,0,0.5); }
.cc-posture-chip.high b     { color: #ff8c3c; text-shadow: 0 0 8px rgba(255,140,60,0.5); }
.cc-posture-chip.critical b { color: var(--cc-red); text-shadow: 0 0 10px rgba(255,77,94,0.6); animation: cc-blink 1s steps(2) infinite; }
.cc-clocks { color: var(--text-dim); }
.cc-clocks b { color: var(--cc-cyan); text-shadow: 0 0 6px var(--cc-glow); }
.cc-clocks .z { color: var(--text-faint); }

/* ---------- Bottom classification bar ---------- */
.cc-classbar-bot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; height: 20px; overflow: hidden;
  background: linear-gradient(90deg, rgba(255,176,0,0.10), transparent 28%, transparent 72%, rgba(255,176,0,0.10));
  border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em;
  color: var(--text-faint); white-space: nowrap;
}
.cc-cb-mid { color: var(--cc-amber); opacity: 0.85; overflow: hidden; text-overflow: ellipsis; }
.cc-cb-right { color: var(--cc-green); }

@media (max-width: 900px) { .cc-hud-cluster, .cc-class-chip { display: none; } }
@media (prefers-reduced-motion: reduce) { .cc-boot { display: none; } }

/* ---------- Boot wireframe globe ---------- */
.cc-boot-globe { display: block; width: 190px; height: 190px; margin-bottom: 26px; }

/* ---------- Link-analysis graph (toggleable panel) ---------- */
.cc-link-pane {
  flex: 0 0 auto; height: 46vh; max-height: 460px;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(circle at 50% 45%, #04101a, #02060a 75%);
  position: relative; display: flex; align-items: center; justify-content: center; padding: 10px;
}
.cc-link-pane.collapsed { display: none !important; }
#cc-link { display: block; width: 100%; height: 100%; }
.cc-link-title {
  position: absolute; top: 10px; left: 16px; z-index: 2;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--cc-cyan); text-shadow: 0 0 8px var(--cc-glow); text-transform: uppercase;
}

/* ---------- ACARS split panel (grouped list + detail) ---------- */
.cc-acars-pane {
  flex: 0 0 auto; height: 50vh; max-height: 520px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(8,16,24,0.95), rgba(5,10,16,0.95));
}
.cc-acars-pane.collapsed { display: none !important; }
.cc-acars-split { display: flex; height: 100%; }
.cc-acars-left { flex: 1 1 52%; min-width: 0; display: flex; flex-direction: column; padding: 10px 12px; overflow: hidden; }
.cc-acars-right { flex: 1 1 48%; min-width: 0; border-left: 1px solid var(--border); overflow: hidden; padding: 10px 14px; display: flex; flex-direction: column; }
/* Only the decode + aircraft text scrolls; the route map stays pinned & visible. */
.acd-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.cc-acars-hdr {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--cc-cyan); text-shadow: 0 0 8px var(--cc-glow); text-transform: uppercase;
  padding-bottom: 8px; border-bottom: 1px dashed var(--cc-line); margin-bottom: 8px;
}
.cc-acars-list { overflow-y: auto; flex: 1 1 auto; font-family: var(--font-mono); font-size: 12px; }
.acg { margin-bottom: 8px; }
.acg-hdr {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-dim);
  padding: 4px 4px; border-bottom: 1px solid var(--cc-line);
  background: linear-gradient(180deg, #0a131c, #0a131c);
  cursor: pointer; overflow: hidden; white-space: nowrap;
}
.acg-hdr:hover { background: #0d1824; }
.acg-hdr b { color: var(--cc-cyan); text-shadow: 0 0 6px var(--cc-glow); }
/* Category highlight: colored left bar + flight-name tint (commercial/cargo/private/military). */
.acg > .acg-hdr { border-left: 3px solid transparent; }
.acg.cat-comm  > .acg-hdr { border-left-color: #35a7ff; }
.acg.cat-cargo > .acg-hdr { border-left-color: #ff9d2e; }
.acg.cat-priv  > .acg-hdr { border-left-color: #ffe14d; }
.acg.cat-mil   > .acg-hdr { border-left-color: #ff4d5e; }
.acg.cat-comm  > .acg-hdr b { color: #6bbcff; text-shadow: 0 0 6px rgba(53,167,255,0.55); }
.acg.cat-cargo > .acg-hdr b { color: #ffb259; text-shadow: 0 0 6px rgba(255,157,46,0.55); }
.acg.cat-priv  > .acg-hdr b { color: #ffe766; text-shadow: 0 0 6px rgba(255,225,77,0.55); }
.acg.cat-mil   > .acg-hdr b { color: #ff6b78; text-shadow: 0 0 6px rgba(255,77,94,0.55); }
/* Category legend above the by-flight list. */
.cc-acars-legend { display: flex; flex-wrap: wrap; gap: 3px 10px; padding: 0 2px 6px; margin-bottom: 6px; border-bottom: 1px dashed var(--cc-line); font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); flex: 0 0 auto; }
.cc-acars-legend .lg { display: inline-flex; align-items: center; gap: 4px; }
.cc-acars-legend .lg::before { content: ""; width: 8px; height: 8px; border-radius: 2px; }
.cc-acars-legend .lg-comm::before { background: #35a7ff; }
.cc-acars-legend .lg-cargo::before { background: #ff9d2e; }
.cc-acars-legend .lg-priv::before { background: #ffe14d; }
.cc-acars-legend .lg-mil::before { background: #ff4d5e; }
.acg-caret { flex: 0 0 auto; color: var(--text-faint); font-size: 10px; transition: transform 0.15s; }
.acg.collapsed .acg-caret { transform: rotate(-90deg); }
.acg.collapsed .cc-acars-row { display: none; }
.acg-title { flex: 0 0 auto; }
.acg-meta { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.acg-n { flex: 0 0 auto; margin-left: auto; color: var(--text-faint); background: rgba(53,227,255,0.08); border-radius: 8px; padding: 0 7px; font-size: 10px; }
.acg-route { color: var(--cc-green); font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.acg-type { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acg-dot { color: var(--text-faint); }
.cc-acars-row { display: grid; grid-template-columns: 62px 38px 1fr; gap: 8px; padding: 3px 6px; border-radius: 4px; cursor: pointer; border-left: 2px solid transparent; }
.cc-acars-row:hover { background: rgba(53,227,255,0.06); }
.cc-acars-row.sel { background: rgba(55,245,166,0.1); border-left-color: var(--cc-green); }
.cc-acars-time { color: var(--text-dim); }
.cc-acars-lbl { color: var(--cc-amber); }
.cc-acars-txt { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-acars-empty { color: var(--text-faint); font-size: 12px; padding: 12px; font-family: var(--font-mono); line-height: 1.6; }
.cc-acars-empty code { color: var(--cc-cyan); background: rgba(53,227,255,0.08); padding: 2px 6px; border-radius: 3px; }
.cc-acars-detail-empty { color: var(--text-faint); font-size: 12px; padding: 16px 6px; font-family: var(--font-mono); line-height: 1.6; }

/* decode block (reused from the old popup) — compact so the whole card fits one pane */
/* compact header: identity line + label + meta chips, ~3 lines instead of six rows */
.acd-decode .ap-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.acd-decode .ap-ident { font-family: var(--font-mono); font-size: 12px; color: var(--text); line-height: 1.45; }
.acd-decode .ap-ident b { color: var(--cc-green); }
.acd-decode .ap-label { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); line-height: 1.4; margin: 1px 0 3px; }
.acd-decode .ap-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-bottom: 4px; }
.acd-decode .ap-chip { font-family: var(--font-mono); font-size: 10px; color: var(--text); white-space: nowrap; }
.acd-decode .ap-chip i { color: var(--cc-cyan); font-style: normal; text-transform: uppercase; font-size: 8px; letter-spacing: 0.04em; margin-right: 4px; }
.acd-decode .ap-row { display: flex; gap: 8px; font-size: 11px; padding: 1px 0; }
.acd-decode .ap-k { flex: 0 0 62px; color: var(--cc-cyan); font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.03em; text-transform: uppercase; line-height: 1.5; }
.acd-decode .ap-v { flex: 1 1 auto; color: var(--text); font-family: var(--font-mono); font-size: 11px; word-break: break-word; line-height: 1.5; }
.acd-decode .ap-v b, .acd-decode .ap-decoded b { color: var(--cc-green); }
.acd-decode .ap-decoded {
  margin: 6px 0; padding: 6px 8px; font-size: 11px; line-height: 1.45; color: #d8f5e8;
  font-family: var(--font-mono); background: rgba(55,245,166,0.07);
  border: 1px solid rgba(55,245,166,0.3); border-radius: 5px;
}
/* plain-language field breakdown */
.acd-decode .ap-fields { margin: 8px 0; border: 1px solid var(--cc-line); border-radius: 5px; overflow: hidden; }
.acd-decode .ap-fields-h {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; color: var(--cc-cyan);
  background: rgba(53,227,255,0.08); padding: 3px 8px; text-transform: uppercase;
}
.acd-decode .ap-frow { display: flex; gap: 8px; padding: 2px 8px; font-size: 11px; line-height: 1.5; }
.acd-decode .ap-frow:nth-child(even) { background: rgba(255,255,255,0.02); }
.acd-decode .ap-fk { flex: 1 1 auto; color: var(--text-dim); font-family: var(--font-mono); }
.acd-decode .ap-fv { flex: 0 0 auto; color: var(--cc-green); font-family: var(--font-mono); font-weight: 600; text-align: right; }
.acd-decode .ap-text { margin-top: 6px; }
.acd-decode .ap-text pre {
  margin: 3px 0 0; white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.4; color: #cfe8f0;
  background: rgba(0,0,0,0.3); border: 1px solid var(--cc-line); border-radius: 4px; padding: 6px 8px;
  max-height: 86px; overflow-y: auto;
}

/* aircraft card */
.acd-ac { margin-top: 8px; border-top: 1px dashed var(--cc-line); padding-top: 8px; }
.acd-ac-hdr { display: flex; align-items: center; gap: 9px; }
.acd-logo { width: 38px; height: 38px; object-fit: contain; background: rgba(255,255,255,0.06); border-radius: 5px; padding: 3px; flex: 0 0 auto; }
.acd-ac-id { min-width: 0; }
.acd-ac-reg { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--cc-green); text-shadow: 0 0 6px rgba(55,245,166,0.4); line-height: 1.15; }
.acd-ac-op { font-size: 11px; color: var(--text-dim); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acd-ac-type { font-family: var(--font-mono); font-size: 11px; color: var(--text); margin-top: 1px; }
.acd-loading, .acd-none { color: var(--text-faint); font-size: 11px; padding: 6px 0; font-family: var(--font-mono); }

/* media row: drawn silhouette + optional spotter photo side by side */
.acd-media { display: flex; align-items: stretch; gap: 8px; margin-top: 8px; }
.acd-draw {
  flex: 0 0 auto; width: 128px; min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: radial-gradient(circle at 50% 50%, rgba(53,227,255,0.10), rgba(0,0,0,0.25) 70%);
  border: 1px solid var(--cc-line); border-radius: 6px; padding: 8px 6px;
}
.acd-media.has-photo .acd-draw { width: 108px; }
/* Fill the box height; the SVG's default xMidYMid centers the plane vertically
   so it never floats high/low next to a tall photo. */
.acd-plane { flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; fill: var(--cc-cyan); filter: drop-shadow(0 0 6px var(--cc-glow)); }
.acd-cat { flex: 0 0 auto; font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.08em; color: var(--text-dim); text-transform: uppercase; }
.acd-photo-wrap { flex: 1 1 auto; min-width: 0; display: block; }
.acd-photo { width: 100%; height: 100%; max-height: 104px; object-fit: cover; border-radius: 6px; border: 1px solid var(--cc-line); display: block; }

/* route map (flat Leaflet map) */
.acd-globe-wrap { flex: 0 0 auto; margin-top: 8px; border-top: 1px dashed var(--cc-line); padding-top: 6px; }
.acd-route { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); text-align: center; margin-bottom: 4px; }
.acd-route b { color: var(--cc-cyan); text-shadow: 0 0 6px var(--cc-glow); }
.acd-map { display: block; width: 100%; height: 190px; border: 1px solid var(--cc-line); border-radius: 6px; background: #0a131c; overflow: hidden; }
/* dark-skin the OSM tiles to match the command-center theme */
.acd-map .acd-map-tiles { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.9) saturate(0.85); }
.acd-map .acd-map-lbl span {
  display: inline-block; transform: translate(-50%, -150%); white-space: nowrap;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: #eafaff;
  background: rgba(4,10,16,0.85); border: 1px solid var(--cc-cyan); border-radius: 3px; padding: 1px 5px;
}
.acd-map .leaflet-container { background: #0a131c; touch-action: pan-y !important; cursor: default; }

@media (max-width: 760px) {
  .cc-acars-split { flex-direction: column; }
  .cc-acars-right { border-left: 0; border-top: 1px solid var(--border); }
}

/* ---------- THE WALL — fullscreen rotating ops display ---------- */
.cc-wall-btn { cursor: pointer; background: transparent; }
body.wall-mode { grid-template-columns: 0 1fr; }
body.wall-mode .rail,
body.wall-mode .sidebar,
body.wall-mode .sidebar-backdrop,
body.wall-mode .menu-btn,
body.wall-mode .view-toggle,
body.wall-mode .actions .nav-link:not(.cc-wall-btn),
body.wall-mode .auto-refresh,
body.wall-mode .timeline > .active-filters,
body.wall-mode .timeline > .results,
body.wall-mode .timeline > .loading,
body.wall-mode .timeline > .load-more { display: none !important; }
/* whichever view panel is open fills the stage */
body.wall-mode .map-pane,
body.wall-mode #cc-radar-pane,
body.wall-mode #cc-link-pane,
body.wall-mode #air-strip,
body.wall-mode #stories-strip {
  height: auto !important; max-height: none !important; flex: 1 1 auto !important; min-height: 0;
}
body.wall-mode .cc-wall-btn { color: var(--cc-green); border: 1px solid rgba(55,245,166,0.5); box-shadow: 0 0 10px rgba(55,245,166,0.4); }
.cc-wall-stage {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; color: var(--text-dim);
  z-index: 9000; pointer-events: none; display: none;
  background: rgba(4,8,12,0.7); padding: 5px 14px; border: 1px solid var(--border); border-radius: 4px;
}
body.wall-mode .cc-wall-stage { display: block; }
body.wall-mode .cc-wall-stage b { color: var(--cc-cyan); }

/* ---------- Spectrum + waterfall split ---------- */
.cc-spectrum-top { flex: 0 0 40%; min-height: 60px; }
.cc-waterfall { flex: 1 1 auto; min-height: 60px; margin-top: 4px; }

/* ---------- AI Analyst SITREP strip ---------- */
.cc-sitrep {
  display: flex; align-items: stretch;
  background: linear-gradient(90deg, rgba(55,245,166,0.05), transparent 40%);
  border-bottom: 1px solid var(--border);
  min-height: 84px;
}
.cc-sitrep-tag {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  min-width: 108px; padding: 0 14px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; font-weight: 700;
  color: #04120c; background: var(--cc-green); box-shadow: 0 0 16px rgba(55,245,166,0.5);
}
.cc-sitrep-body { flex: 1 1 auto; display: flex; align-items: center; gap: 14px; padding: 10px 18px; min-width: 0; }
.cc-sitrep-text {
  flex: 1 1 auto; color: #d8f5e8; font-size: 14px; line-height: 1.5;
  font-family: var(--font-mono); white-space: normal; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4;
}
.cc-sitrep-text .cursor { color: var(--cc-green); animation: cc-blink 1s steps(2) infinite; }
.cc-sitrep-meta { flex: 0 0 auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); white-space: nowrap; }

/* ---------- Target-lock reticle over the map ---------- */
.map-reticle {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 180px; height: 180px; pointer-events: none; z-index: 650;
}
.map-reticle.hidden { display: none; }
.reticle-ring {
  position: absolute; inset: 20px; border: 2px solid var(--cc-red);
  border-radius: 50%; box-shadow: 0 0 20px rgba(255,77,94,0.7), inset 0 0 20px rgba(255,77,94,0.4);
  animation: reticle-spin 3s linear infinite;
}
.reticle-ring::before, .reticle-ring::after {
  content: ""; position: absolute; background: var(--cc-red); box-shadow: 0 0 8px var(--cc-red);
}
.reticle-ring::before { left: -8px; right: -8px; top: 50%; height: 2px; }
.reticle-ring::after { top: -8px; bottom: -8px; left: 50%; width: 2px; }
.reticle-cross-h, .reticle-cross-v { position: absolute; background: rgba(255,77,94,0.5); }
.reticle-cross-h { left: 0; right: 0; top: 50%; height: 1px; }
.reticle-cross-v { top: 0; bottom: 0; left: 50%; width: 1px; }
.reticle-readout {
  position: absolute; left: 50%; bottom: -34px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-family: var(--font-mono); font-size: 10px; white-space: nowrap;
  color: var(--cc-red); text-shadow: 0 0 8px rgba(255,77,94,0.8);
}
.reticle-readout #reticle-label { color: #ffd0d4; font-size: 11px; }
@keyframes reticle-spin { to { transform: rotate(360deg); } }
.map-reticle.locked .reticle-ring { border-color: var(--cc-green); box-shadow: 0 0 20px rgba(55,245,166,0.7); animation-duration: 8s; }
.map-reticle.locked .reticle-ring::before, .map-reticle.locked .reticle-ring::after { background: var(--cc-green); box-shadow: 0 0 8px var(--cc-green); }
.map-reticle.locked .reticle-readout { color: var(--cc-green); text-shadow: 0 0 8px rgba(55,245,166,0.8); }

/* ---------- Topbar ---------- */
.topbar {
  background: linear-gradient(180deg, #06111a, #04090f);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--cc-line), 0 8px 24px rgba(0,0,0,0.5);
}
.brand .sub {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cc-cyan);
  text-shadow: 0 0 8px var(--cc-glow);
}
.stats-bar { color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.live-indicator {
  color: var(--cc-green);
  border-color: rgba(55,245,166,0.45);
  background: rgba(55,245,166,0.08);
  text-shadow: 0 0 8px rgba(55,245,166,0.6);
}

/* ---------- Console shell ---------- */
.cc-console {
  grid-area: scanner;
  display: grid;
  /* scanner | spectrum (halved) | active units | telemetry */
  grid-template-columns: minmax(260px, 1.1fr) minmax(210px, 1.1fr) minmax(220px, 1.3fr) minmax(260px, 1.1fr);
  gap: 12px;
  padding: 12px 16px;
  height: 262px;
  background:
    linear-gradient(180deg, rgba(10,22,32,0.6), rgba(4,8,12,0.4));
  border-bottom: 1px solid var(--border);
}
.cc-panel { overflow: hidden; }

/* ---------- Active Units board ---------- */
.cc-units-panel { display: flex; flex-direction: column; }
.cc-units-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; }
.cc-units-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 2px; border-bottom: 1px solid rgba(53,227,255,0.06);
  font-family: var(--font-mono); font-size: 12px;
}
.cc-unit-id {
  flex: 0 0 auto; min-width: 54px;
  color: var(--cc-green); font-weight: 700; text-shadow: 0 0 6px rgba(55,245,166,0.4);
}
.cc-unit-id.sev-hi { color: var(--cc-red); text-shadow: 0 0 6px rgba(255,77,94,0.5); }
.cc-unit-id.sev-med { color: var(--cc-amber); text-shadow: 0 0 6px rgba(255,176,0,0.5); }
.cc-unit-type { flex: 1 1 auto; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-unit-city { flex: 0 0 auto; color: var(--text-dim); font-size: 10px; white-space: nowrap; }
.cc-units-empty { color: var(--text-faint); font-size: 12px; padding: 8px 2px; font-family: var(--font-mono); }

/* Panels — glass box with glowing corner brackets. */
.cc-panel {
  position: relative;
  background: linear-gradient(180deg, rgba(8,16,24,0.92), rgba(5,10,16,0.92));
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px 10px;
  box-shadow: inset 0 0 24px rgba(53,227,255,0.04), 0 4px 18px rgba(0,0,0,0.4);
  min-width: 0;
}
.cc-panel::before, .cc-panel::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
}
.cc-panel::before { top: -1px; left: -1px; border-top: 2px solid var(--cc-cyan); border-left: 2px solid var(--cc-cyan); }
.cc-panel::after  { bottom: -1px; right: -1px; border-bottom: 2px solid var(--cc-cyan); border-right: 2px solid var(--cc-cyan); }

.cc-panel-hdr {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cc-cyan);
  text-shadow: 0 0 8px var(--cc-glow);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--cc-line);
}
.cc-hdr-right { margin-left: auto; color: var(--text-dim); text-shadow: none; letter-spacing: 0.1em; }
.cc-led {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--cc-cyan);
  box-shadow: 0 0 8px var(--cc-cyan);
  animation: cc-blink 1.6s ease-in-out infinite;
}
.cc-led-green { background: var(--cc-green); box-shadow: 0 0 8px var(--cc-green); }
.cc-led-cyan  { background: var(--cc-cyan);  box-shadow: 0 0 8px var(--cc-cyan); }
@keyframes cc-blink { 0%,100%{opacity:1} 50%{opacity:0.35} }

/* The scanner lives inside the left panel — strip its own chrome and lay it
   out as two rows: controls on top, a big "now receiving" readout filling the
   rest so the panel height matches its neighbours. */
.cc-scanner-panel { display: flex; flex-direction: column; }
.cc-scanner-panel .scanner-bar {
  background: none; border: 0; min-height: 0; padding: 0; z-index: auto;
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
}
.cc-scanner-panel .scanner-bar::before { display: none; }

.scanner-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scanner-top .scanner-channels { flex: 1 1 auto; min-width: 0; }
.scanner-top .scanner-controls { margin-left: auto; flex: 0 0 auto; gap: 6px; }
.cc-scanner-panel .scanner-add { white-space: nowrap; }
.cc-scanner-panel .scanner-vol { width: 58px; }
.cc-scanner-panel .scanner-ctl-btn { width: 30px; height: 30px; font-size: 13px; }

.cc-scanner-panel .scanner-now {
  flex: 1 1 auto;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--cc-line);
  border-radius: 4px;
  padding: 12px 14px;
  min-height: 72px;
}
.cc-scanner-panel .scanner-now-label {
  color: var(--cc-cyan); text-shadow: 0 0 6px var(--cc-glow);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
}
.cc-scanner-panel .scanner-now-text {
  white-space: normal; overflow: hidden; color: var(--text);
  font-size: 14px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}

/* ---------- Spectrum / oscilloscope canvas ---------- */
.cc-canvas { display: block; width: 100%; height: 100%; }
.cc-spectrum-panel { display: flex; flex-direction: column; }
.cc-spectrum-panel #cc-spectrum { flex: 1 1 auto; min-height: 92px; }

/* ---------- Telemetry ---------- */
.cc-telemetry-panel { display: flex; flex-direction: column; }
.cc-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.cc-metric {
  background: rgba(53,227,255,0.03);
  border: 1px solid var(--cc-line);
  border-radius: 3px;
  padding: 5px 7px;
  position: relative;
  overflow: hidden;
}
.cc-metric-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}
.cc-metric-val {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--cc-green);
  text-shadow: 0 0 10px rgba(55,245,166,0.5);
  font-variant-numeric: tabular-nums;
}
.cc-metric-val.cyan  { color: var(--cc-cyan);  text-shadow: 0 0 10px var(--cc-glow); }
.cc-metric-val.amber { color: var(--cc-amber); text-shadow: 0 0 10px rgba(255,176,0,0.5); }
.cc-metric-spark { display: block; width: 100%; height: 12px; margin-top: 2px; opacity: 0.8; }

.cc-traffic-wrap { margin-top: 8px; flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.cc-traffic-label {
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 3px;
}
.cc-traffic-label span { color: var(--text-faint); }
.cc-traffic { flex: 1 1 auto; min-height: 40px; }

/* ---------- Intel ticker ---------- */
.cc-ticker {
  display: flex; align-items: stretch;
  background: #05090e;
  border-bottom: 1px solid var(--border);
  height: 38px;
  overflow: hidden;
}
.cc-ticker-tag {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  min-width: 108px; padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.16em;
  color: #04090f; font-weight: 700;
  background: var(--cc-cyan);
  box-shadow: 0 0 16px var(--cc-glow);
}
.cc-ticker-viewport { flex: 1 1 auto; overflow: hidden; position: relative; }
.cc-ticker-track {
  position: absolute; top: 0; left: 0; height: 100%;
  display: flex; align-items: center; gap: 36px;
  white-space: nowrap;
  font-family: var(--font-mono); font-size: 12px; color: var(--text);
  will-change: transform;
  animation: cc-ticker-scroll 60s linear infinite;
}
.cc-ticker:hover .cc-ticker-track { animation-play-state: paused; }
.cc-ticker-item { display: inline-flex; align-items: center; gap: 8px; }
.cc-ticker-item b { color: var(--cc-cyan); text-shadow: 0 0 6px var(--cc-glow); }
.cc-ticker-item .sub { color: var(--text-dim); }
.cc-ticker-sep { color: var(--cc-amber); }
@keyframes cc-ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- View toggle + rail restyle ---------- */
.view-toggle { background: #05090e; border-bottom: 1px solid var(--border); }
.view-chip { font-family: var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; font-size: 11px; }
.view-chip.active { box-shadow: 0 0 12px var(--cc-glow); }
.rail { background: #05090e; }
.rail-btn:hover { box-shadow: inset 0 0 12px rgba(53,227,255,0.1); }

/* ---------- Sidebar SDR radio selector ---------- */
.sdr-divider { border: 0; border-top: 1px solid var(--border); margin: 12px 0 8px; }
.sdr-block .sdr-current {
  font-family: var(--font-mono); font-size: 11px; color: var(--cc-green);
  text-shadow: 0 0 6px rgba(55,245,166,0.4); letter-spacing: 0.06em;
}
.sdr-power-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--cc-cyan); background: var(--accent-bg); color: var(--cc-cyan);
  font-size: 19px; line-height: 1; cursor: pointer; display: block; margin: 8px auto 2px;
  transition: box-shadow .2s, transform .1s;
}
.sdr-power-btn:hover { transform: scale(1.06); box-shadow: 0 0 14px var(--cc-glow); }
.sdr-mode-list { list-style: none; margin: 8px 0 0; padding: 0; }
.sdr-mode-list.hidden { display: none; }
.sdr-mode-list li {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 5px;
  cursor: pointer; font-size: 12px; border: 1px solid transparent;
}
.sdr-mode-list li:hover { background: var(--bg-hover); }
.sdr-mode-list li.active { border-color: var(--cc-green); background: rgba(55,245,166,0.08); color: var(--cc-green); }
.sdr-mode-list li.busy { opacity: 0.55; cursor: wait; }
.sdr-mode-list .ico { width: 16px; text-align: center; flex: 0 0 auto; }
.sdr-mode-list .lbl { flex: 1 1 auto; }
.sdr-mode-list .hz { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }
.sdr-note { font-size: 10px; color: var(--text-faint); margin-top: 6px; line-height: 1.4; }

/* ---------- Feed as "intercept log" ---------- */
.call {
  background: linear-gradient(180deg, rgba(8,16,24,0.85), rgba(5,10,16,0.85));
  box-shadow: inset 0 0 0 1px rgba(53,227,255,0.02);
}
.call .when > div:first-child {
  font-family: var(--font-mono);
  color: var(--cc-cyan);
  text-shadow: 0 0 6px var(--cc-glow);
}
.call:hover { box-shadow: 0 0 0 1px var(--cc-line), 0 6px 22px rgba(0,0,0,0.5); }
.call .tag { color: var(--text); }
.results::-webkit-scrollbar-thumb { background: var(--cc-line); }

/* ---------- Scanner toggle / chips re-glow ---------- */
.scanner-toggle { background: var(--cc-cyan); border-color: var(--cc-cyan); color: #04090f; }
.scanner-bar[data-state="playing"] .scanner-toggle { animation: scanner-pulse-cc 1.8s ease-out infinite; }
@keyframes scanner-pulse-cc {
  0%   { box-shadow: 0 0 0 0 rgba(55,245,166,0.6); }
  70%  { box-shadow: 0 0 0 16px rgba(55,245,166,0); }
  100% { box-shadow: 0 0 0 0 rgba(55,245,166,0); }
}

/* ---------- Map: dark basemap + overlay toggles + OSINT column ---------- */
/* OpenStreetMap tiles live in a dedicated "basemap" pane; dark-filter only that
   pane so weather/traffic overlays and markers keep their real colors. */
.map-pane .leaflet-basemap-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9) saturate(0.85);
}
/* map + OSINT column side by side (OSINT column only present in demo mode) */
.map-pane { display: flex; }
.map-pane > #map { flex: 1 1 auto; height: 100%; }

.map-layer-toggles { display: flex; flex-direction: column; gap: 6px; }
.maplayer-btn {
  font-family: var(--font-mono); font-size: 11px;
  background: rgba(8,16,24,0.9); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 8px; cursor: pointer; text-align: left;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.maplayer-btn:hover { border-color: var(--cc-cyan); }
.maplayer-btn.on { color: var(--cc-cyan); border-color: var(--cc-cyan); box-shadow: 0 0 10px var(--cc-glow); }
.maplayer-btn.disabled { opacity: 0.45; cursor: not-allowed; }

.osint-rail {
  flex: 0 0 248px;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(8,16,24,0.95), rgba(5,10,16,0.95));
  border-left: 1px solid var(--border);
  min-height: 0;
}
.osint-rail-hdr {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em;
  color: var(--cc-cyan); text-shadow: 0 0 8px var(--cc-glow);
  padding: 10px 12px; border-bottom: 1px dashed var(--cc-line);
}
.osint-rail-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1 1 auto; }
.osint-rail-empty { color: var(--text-faint); font-size: 12px; padding: 10px; font-family: var(--font-mono); }
.osint-rail-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 5px; cursor: pointer;
  border: 1px solid transparent;
}
.osint-rail-item:hover { background: rgba(53,227,255,0.08); border-color: var(--cc-line); }
.osint-rail-name { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); min-width: 0; }
.osint-rail-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.osint-rail-name .osint-silhouette { width: 20px; height: 22px; flex: 0 0 auto; }
.osint-rail-src { font-size: 10px; color: var(--text-faint); font-family: var(--font-mono); white-space: nowrap; }
.osint-rail-manual {
  margin: 8px; padding: 8px; flex: 0 0 auto;
  background: rgba(53,227,255,0.06); border: 1px dashed rgba(53,227,255,0.4);
  color: var(--cc-cyan); border-radius: 5px; cursor: pointer;
  font-family: var(--font-mono); font-size: 12px;
}
.osint-rail-manual:hover { background: rgba(53,227,255,0.14); }

@media (max-width: 760px) {
  .osint-rail { flex-basis: 150px; }
}

/* ---------- Radar scope (toggleable panel in the timeline) ---------- */
.cc-radar-pane {
  flex: 0 0 auto;
  height: 46vh;
  max-height: 460px;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(circle at 50% 50%, #04140f, #02060a 75%);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
}
.cc-radar-pane.collapsed { display: none !important; }
#cc-radar { display: block; width: 100%; height: 100%; }
.cc-radar-title {
  position: absolute; top: 10px; left: 16px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em;
  color: var(--cc-green); text-shadow: 0 0 8px rgba(55,245,166,0.6);
  text-transform: uppercase; z-index: 2;
}
.cc-radar-legend {
  position: absolute; top: 10px; right: 16px; z-index: 2;
  font-family: var(--font-mono); font-size: 10px; color: var(--text-dim);
  display: flex; gap: 12px;
}
.cc-radar-legend b { font-weight: 400; }
.cc-radar-legend .d { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }

/* ---------- Agency patch / badge ---------- */
.agency-patch { display: inline-block; line-height: 0; }
.agency-patch svg { display: block; }
.call .svc-col .agency-patch { filter: drop-shadow(0 0 4px rgba(0,0,0,0.6)); }
.scanner-now-patch {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  /* 2x2: scanner | spectrum  /  units | telemetry */
  .cc-console { grid-template-columns: 1fr 1fr; height: auto; }
  .cc-metrics { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .cc-console {
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }
  .cc-spectrum-panel { display: none; }          /* keep it feed-first on phones */
  .cc-metrics { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .cc-led, .cc-ticker-track, .scanner-toggle { animation: none !important; }
}

.acd-route .acd-rtsrc { color: var(--text-faint); font-size: 10px; }
