/* ==========================================================================
   SWARMWATCH // Movie-Grade SIGINT / C4ISR Global Bot Swarm Command Console
   Palette: Deep Tactical Obsidian, Phosphor Cyan, Critical Crimson, Signal Amber
   ========================================================================== */

:root {
  --bg-void: #04080e;
  --bg-panel: rgba(7, 15, 25, 0.92);
  --bg-panel-solid: #070f19;
  --bg-elevated: rgba(12, 25, 41, 0.88);
  --bg-hover: rgba(20, 44, 70, 0.72);

  --border-dim: rgba(56, 189, 248, 0.16);
  --border-mid: rgba(56, 189, 248, 0.34);
  --border-bright: rgba(0, 229, 255, 0.65);

  --text-primary: #e6f2ff;
  --text-secondary: #8eb0cc;
  --text-muted: #55728c;

  --cyan: #00e5ff;
  --cyan-soft: #38bdf8;
  --crimson: #ff3b5c;
  --amber: #ffb020;
  --emerald: #10f5a0;
  --violet: #c084fc;
  --orange: #ff6b35;

  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Custom Tactical Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(4, 10, 18, 0.7);
}
::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.28);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 229, 255, 0.55);
}

/* Console Shell Grid (100vh Full Viewport) */
.console-shell {
  position: relative;
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr) 32px;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-void);
}

/* Subtle CRT Scanline & Vignette Overlay */
.crt-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 900;
  opacity: 0;
  transition: opacity 0.25s ease;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 229, 255, 0.022) 0px,
      rgba(0, 229, 255, 0.022) 1px,
      transparent 1px,
      transparent 3px
    ),
    radial-gradient(circle at center, transparent 58%, rgba(0, 0, 0, 0.45) 100%);
}
.console-shell.scanlines-on .crt-overlay {
  opacity: 1;
}

/* ==========================================================================
   TOP COMMAND HEADER
   ========================================================================== */
.cmd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #091423 0%, #050c16 100%);
  border-bottom: 1px solid var(--border-mid);
  z-index: 40;
  user-select: none;
}

.cmd-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-emblem {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--cyan);
  border: 1px solid var(--border-mid);
  background: rgba(0, 229, 255, 0.06);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.16);
  flex-shrink: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
}

.class-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  color: var(--amber);
  border: 1px solid rgba(255, 176, 32, 0.45);
  background: rgba(255, 176, 32, 0.1);
  white-space: nowrap;
}

.stream-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border: 1px solid rgba(16, 245, 160, 0.35);
  background: rgba(16, 245, 160, 0.08);
  color: var(--emerald);
  white-space: nowrap;
}
.stream-pill.offline {
  border-color: rgba(255, 59, 92, 0.45);
  background: rgba(255, 59, 92, 0.1);
  color: var(--crimson);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: blinkPulse 1.8s ease-in-out infinite;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center KPI Strip */
.cmd-metrics {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.swarmcon-box,
.kpi-box,
.clock-box {
  display: flex;
  flex-direction: column;
  padding: 3px 8px;
  border-left: 1px solid var(--border-dim);
  white-space: nowrap;
}

.swarmcon-box {
  border-left: 2px solid var(--amber);
  background: rgba(255, 176, 32, 0.08);
  padding: 3px 9px;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.swarmcon-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--amber);
  white-space: nowrap;
}

.kpi-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}
.kpi-crit .kpi-val {
  color: var(--crimson);
  text-shadow: 0 0 10px rgba(255, 59, 92, 0.4);
}
.mono-cyan {
  color: var(--cyan);
}

.clock-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan);
  letter-spacing: 0.03em;
  min-width: 138px;
}

/* Header Action Buttons */
.cmd-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: rgba(10, 23, 38, 0.9);
  border: 1px solid var(--border-dim);
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.hud-btn:hover {
  color: #ffffff;
  border-color: var(--border-bright);
  background: rgba(16, 40, 66, 0.95);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.18);
}
.hud-btn.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.12);
}
.hud-btn-accent {
  color: var(--cyan);
  border-color: var(--border-mid);
}
.hud-btn-labs {
  color: var(--amber);
  border-color: rgba(255, 176, 32, 0.42);
  background: rgba(255, 176, 32, 0.08);
  text-decoration: none;
}
.hud-btn-labs:hover {
  color: #ffffff;
  border-color: var(--amber);
  background: rgba(255, 176, 32, 0.2);
  box-shadow: 0 0 12px rgba(255, 176, 32, 0.24);
}
.hud-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--crimson);
}
.hud-btn.active .btn-dot {
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: blinkPulse 1s infinite;
}

/* ==========================================================================
   MAIN WORKSPACE
   ========================================================================== */
.cmd-workspace {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.hud-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
}
.dossier-drawer.hud-panel,
.modal-card.hud-panel {
  backdrop-filter: blur(10px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-dim);
  background: rgba(0, 229, 255, 0.035);
}

.panel-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--cyan);
}

.panel-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   LEFT INTERCEPT FEED RAIL
   ========================================================================== */
.intercept-rail {
  width: 310px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-top: none;
  border-bottom: none;
  border-left: none;
  border-right: 1px solid var(--border-mid);
  z-index: 25;
  transition: margin-left 0.24s ease, opacity 0.24s ease;
}

.intercept-rail.collapsed {
  margin-left: -310px;
  opacity: 0;
  pointer-events: none;
}

.rail-controls {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-wrap {
  position: relative;
}

.hud-input {
  width: 100%;
  padding: 7px 26px 7px 9px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-primary);
  background: rgba(3, 8, 15, 0.9);
  border: 1px solid var(--border-dim);
  outline: none;
  transition: border-color 0.15s ease;
}
.hud-input::placeholder {
  color: var(--text-muted);
}
.hud-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.14);
}

.search-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
}
.search-clear:hover {
  color: #ffffff;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  padding: 3px 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: rgba(8, 18, 30, 0.85);
  border: 1px solid var(--border-dim);
  cursor: pointer;
  transition: all 0.14s ease;
}
.chip:hover {
  border-color: var(--border-mid);
  color: #ffffff;
}
.chip.active {
  background: rgba(0, 229, 255, 0.14);
  border-color: var(--cyan);
  color: var(--cyan);
}
.chip-ddos.active {
  background: rgba(255, 59, 92, 0.16);
  border-color: var(--crimson);
  color: var(--crimson);
}
.chip-disinfo.active {
  background: rgba(255, 176, 32, 0.16);
  border-color: var(--amber);
  color: var(--amber);
}
.chip-scraper.active {
  background: rgba(0, 229, 255, 0.16);
  border-color: var(--cyan);
  color: var(--cyan);
}
.chip-c2.active {
  background: rgba(255, 107, 53, 0.16);
  border-color: var(--orange);
  color: var(--orange);
}
.chip-takedown.active {
  background: rgba(16, 245, 160, 0.15);
  border-color: var(--emerald);
  color: var(--emerald);
}

.severity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sev-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.sev-pills {
  display: flex;
  gap: 4px;
}

.sev-pill {
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-dim);
  cursor: pointer;
}
.sev-pill.active {
  color: #ffffff;
  border-color: var(--cyan-soft);
  background: rgba(56, 189, 248, 0.16);
}

/* Scrollable Incident Cards */
.incident-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.incident-card {
  position: relative;
  padding: 9px 10px 9px 12px;
  background: rgba(9, 19, 32, 0.78);
  border: 1px solid rgba(56, 189, 248, 0.12);
  border-left: 3px solid var(--cyan);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
  color: inherit;
  font-family: inherit;
}
.incident-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-mid);
}
.incident-card.selected {
  background: rgba(0, 229, 255, 0.11);
  border-color: var(--cyan);
  box-shadow: inset 0 0 18px rgba(0, 229, 255, 0.08);
}

.incident-card[data-cat="DDOS_BOTNET"] { border-left-color: var(--crimson); }
.incident-card[data-cat="DISINFO_SWARM"] { border-left-color: var(--amber); }
.incident-card[data-cat="AI_SCRAPER"] { border-left-color: var(--cyan); }
.incident-card[data-cat="C2_LIVE"] { border-left-color: var(--orange); }
.incident-card[data-cat="INFRA_TAKEDOWN"] { border-left-color: var(--emerald); }

.ic-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
}

.ic-cat-tag {
  font-weight: 700;
  letter-spacing: 0.08em;
}
.cat-DDOS_BOTNET { color: var(--crimson); }
.cat-DISINFO_SWARM { color: var(--amber); }
.cat-AI_SCRAPER { color: var(--cyan); }
.cat-C2_LIVE { color: var(--orange); }
.cat-INFRA_TAKEDOWN { color: var(--emerald); }

.ic-badges {
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge-live {
  padding: 1px 4px;
  font-size: 8px;
  font-weight: 700;
  color: #04080e;
  background: var(--orange);
  letter-spacing: 0.06em;
}

.badge-sev {
  padding: 1px 4px;
  font-size: 8px;
  font-weight: 700;
  border: 1px solid currentColor;
}
.sev-CRITICAL { color: var(--crimson); }
.sev-HIGH { color: var(--amber); }
.sev-ELEVATED { color: var(--cyan-soft); }

.ic-title {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.32;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.ic-meta-bot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
}

.rail-footer {
  padding: 9px 11px;
  border-top: 1px solid var(--border-dim);
  background: rgba(4, 10, 18, 0.85);
}

.vector-dist-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.vector-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vbar-row {
  display: grid;
  grid-template-columns: 74px 1fr 24px;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
}

.vbar-track {
  height: 5px;
  background: rgba(56, 189, 248, 0.08);
  overflow: hidden;
}

.vbar-fill {
  height: 100%;
  transition: width 0.4s ease;
}

/* ==========================================================================
   CENTER MERCATOR PROJECTION STAGE
   ========================================================================== */
.map-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  contain: layout paint;
  touch-action: none;
  background: #030810;
  cursor: grab;
  user-select: none;
}
.map-stage.dragging {
  cursor: grabbing;
}

.mercator-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Framing L-Brackets */
.corner-bracket {
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  z-index: 15;
  border-color: rgba(0, 229, 255, 0.5);
  border-style: solid;
}
.corner-bracket.tl { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.corner-bracket.tr { top: 8px; right: 8px; border-width: 2px 2px 0 0; }
.corner-bracket.bl { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; }
.corner-bracket.br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

/* Floating Map HUD */
.map-hud-tl {
  position: absolute;
  top: 16px;
  left: 18px;
  z-index: 16;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}

.sector-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  background: rgba(5, 12, 22, 0.82);
  border: 1px solid var(--border-dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
}
.tag-key {
  color: var(--text-muted);
  letter-spacing: 0.1em;
}
.tag-val {
  color: var(--cyan);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.map-hud-tr {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.control-group {
  display: flex;
  gap: 3px;
}

.map-ctrl-btn {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: rgba(6, 15, 26, 0.88);
  border: 1px solid var(--border-dim);
  cursor: pointer;
  transition: all 0.14s ease;
}
.map-ctrl-btn:hover {
  color: #ffffff;
  border-color: var(--cyan);
}
.map-ctrl-btn.active {
  color: var(--cyan);
  border-color: var(--border-bright);
  background: rgba(0, 229, 255, 0.12);
}

.map-hud-bl {
  position: absolute;
  bottom: 14px;
  left: 18px;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.coord-chip {
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--cyan-soft);
  background: rgba(5, 12, 22, 0.84);
  border: 1px solid var(--border-dim);
  letter-spacing: 0.05em;
}
.coord-chip.dim {
  color: var(--text-muted);
}

/* Bottom-Center Interactive Legend */
.map-hud-legend {
  position: absolute;
  bottom: 14px;
  right: 18px;
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: rgba(5, 12, 22, 0.86);
  border: 1px solid var(--border-dim);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  background: transparent;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
}
.legend-item:hover,
.legend-item.active {
  color: #ffffff;
  border-color: var(--border-mid);
  background: rgba(0, 229, 255, 0.08);
}

.leg-icon {
  width: 8px;
  height: 8px;
  display: inline-block;
}
.leg-ddos { background: var(--crimson); transform: rotate(45deg); box-shadow: 0 0 6px var(--crimson); }
.leg-disinfo { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid var(--amber); filter: drop-shadow(0 0 4px var(--amber)); }
.leg-scraper { background: var(--cyan); border-radius: 2px; box-shadow: 0 0 6px var(--cyan); }
.leg-c2 { background: var(--orange); border-radius: 50%; box-shadow: 0 0 6px var(--orange); }
.leg-takedown { background: var(--emerald); clip-path: polygon(50% 0%, 100% 35%, 82% 100%, 18% 100%, 0% 35%); }

/* Incoming Intercept Toast */
.intercept-toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: rgba(7, 16, 28, 0.95);
  border: 1px solid var(--crimson);
  box-shadow: 0 0 24px rgba(255, 59, 92, 0.28);
  font-family: var(--font-mono);
  font-size: 10.5px;
  max-width: 520px;
  animation: toastSlideIn 0.25s ease;
}
.intercept-toast[hidden] {
  display: none;
}
.toast-badge {
  padding: 2px 6px;
  background: var(--crimson);
  color: #ffffff;
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}
.toast-body {
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hover Tooltip */
.map-tooltip {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  max-width: 280px;
  padding: 8px 10px;
  background: rgba(5, 12, 22, 0.96);
  border: 1px solid var(--cyan);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65), 0 0 14px rgba(0, 229, 255, 0.2);
  font-family: var(--font-mono);
}
.tt-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 9px;
  font-weight: 700;
  margin-bottom: 4px;
}
.tt-title {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.3;
  margin-bottom: 5px;
}
.tt-foot {
  font-size: 9px;
  color: var(--text-secondary);
}

/* ==========================================================================
   SVG MAP LAYER STYLES
   ========================================================================== */
.grat-line {
  stroke: rgba(56, 189, 248, 0.08);
  stroke-width: 0.6;
  fill: none;
}
.grat-line.major {
  stroke: rgba(56, 189, 248, 0.16);
  stroke-dasharray: 4 4;
}
.grat-label {
  fill: rgba(142, 176, 204, 0.42);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.country-path {
  fill: #0b1927;
  stroke: rgba(56, 189, 248, 0.24);
  stroke-width: 0.55;
  vector-effect: non-scaling-stroke;
  transition: fill 0.15s ease;
}
.country-path:hover {
  fill: #11263b;
}

.country-grid-overlay {
  fill: url(#landGrid);
  pointer-events: none;
}

.solar-night {
  fill: rgba(1, 5, 12, 0.42);
  stroke: none;
  pointer-events: none;
}
.solar-terminator-line {
  fill: none;
  stroke: rgba(255, 176, 32, 0.34);
  stroke-width: 1.1;
  stroke-dasharray: 5 5;
  pointer-events: none;
}

.radar-sweep-bar {
  animation: radarSweep 14s linear infinite;
  pointer-events: none;
}

.vector-arc {
  fill: none;
  stroke-width: 1.35;
  stroke-dasharray: 5 5;
  opacity: 0.56;
  pointer-events: none;
}
.vector-arc.highlighted {
  stroke-width: 2.2;
  opacity: 0.95;
  animation: arcFlow 1.6s linear infinite;
}

/* Map Markers */
.marker-group {
  cursor: pointer;
}
.marker-hit-area {
  fill: transparent;
}
.marker-pulse-ring {
  fill: none;
  stroke-width: 1.4;
  transform-box: fill-box;
  transform-origin: center;
  animation: markerPulse 2.6s ease-out infinite;
  pointer-events: none;
}
.marker-core {
  transition: transform 0.16s ease;
  transform-box: fill-box;
  transform-origin: center;
}
.marker-group:hover .marker-core,
.marker-group.selected .marker-core {
  transform: scale(1.28);
}

.marker-tag {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  fill: rgba(230, 242, 255, 0.85);
  pointer-events: none;
  text-shadow: 0 1px 4px #000000;
}

/* Shockwave animation for Replay / Live Alert */
.shockwave-ring {
  fill: none;
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: shockwaveExpand 1.4s ease-out forwards;
  pointer-events: none;
}

/* Target Lock Reticle */
.reticle-ring {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.2;
  stroke-dasharray: 6 4;
  transform-box: fill-box;
  transform-origin: center;
  animation: reticleSpin 10s linear infinite;
  pointer-events: none;
}
.reticle-brackets {
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.6;
  pointer-events: none;
}

/* ==========================================================================
   RIGHT INTELLIGENCE DOSSIER DRAWER
   ========================================================================== */
.dossier-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  border-top: none;
  border-bottom: none;
  border-right: none;
  border-left: 1px solid var(--border-bright);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.72);
  z-index: 35;
  transform: translateX(102%);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.dossier-drawer.open {
  transform: translateX(0);
}

.dossier-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(0, 229, 255, 0.06);
  border-bottom: 1px solid var(--border-mid);
}

.dossier-id-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-family: var(--font-mono);
}

.dossier-class {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 2px 6px;
  background: rgba(0, 229, 255, 0.14);
  color: var(--cyan);
  border: 1px solid var(--border-mid);
  white-space: nowrap;
  flex-shrink: 0;
}

.dossier-id {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dossier-top-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: rgba(8, 19, 32, 0.9);
  border: 1px solid var(--border-dim);
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover {
  color: #ffffff;
  border-color: var(--cyan);
}

.dossier-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dos-pill-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.dos-tag {
  padding: 2px 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
}

.dos-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.32;
  color: #ffffff;
}

.dos-geo-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(4, 10, 18, 0.85);
  border: 1px solid var(--border-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.dos-geo-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.dos-geo-row strong {
  color: var(--cyan-soft);
  font-weight: 600;
}

.dos-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.dos-metric-card {
  padding: 8px 9px;
  background: rgba(10, 22, 36, 0.85);
  border: 1px solid var(--border-dim);
}
.dos-metric-label {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.dos-metric-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.dos-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dos-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--cyan);
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 4px;
}

.dos-summary {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: #d6e7f7;
}

.dos-bullets {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  line-height: 1.48;
  color: var(--text-secondary);
}

.ttp-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ttp-chip {
  padding: 3px 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--amber);
  background: rgba(255, 176, 32, 0.08);
  border: 1px solid rgba(255, 176, 32, 0.28);
}

.ioc-box {
  padding: 8px 10px;
  background: #03070d;
  border: 1px solid var(--border-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.55;
  color: var(--emerald);
  word-break: break-word;
}

.sources-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.source-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 10px;
  background: rgba(8, 20, 34, 0.9);
  border: 1px solid var(--border-mid);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}
.source-card:hover {
  border-color: var(--cyan);
  background: rgba(14, 34, 56, 0.95);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.16);
}

.source-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.source-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
}

.rating-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  color: var(--emerald);
  border: 1px solid rgba(16, 245, 160, 0.45);
  background: rgba(16, 245, 160, 0.1);
  flex-shrink: 0;
}

.source-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
}

.dossier-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-top: 1px solid var(--border-dim);
  background: rgba(4, 10, 18, 0.94);
}
.dossier-nav-pos {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   BOTTOM LIVE OSINT TICKER & FEED HEALTH BAR
   ========================================================================== */
.cmd-footer {
  display: flex;
  align-items: center;
  background: #050b14;
  border-top: 1px solid var(--border-mid);
  font-family: var(--font-mono);
  font-size: 10px;
  z-index: 40;
  overflow: hidden;
}

.ticker-label {
  padding: 0 12px;
  height: 100%;
  display: flex;
  align-items: center;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #04080e;
  background: var(--cyan);
  flex-shrink: 0;
}

.ticker-track {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.ticker-content {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  will-change: transform;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 28px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.ticker-item:hover {
  color: #ffffff;
}
.ticker-sep {
  color: var(--border-mid);
  margin-left: 10px;
}

.feed-health-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 12px;
  background: rgba(9, 20, 34, 0.95);
  border: none;
  border-left: 1px solid var(--border-mid);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.feed-health-btn:hover {
  background: rgba(16, 36, 58, 0.98);
  color: #ffffff;
}

.health-leds {
  display: flex;
  gap: 4px;
}

.health-mobile-pill {
  display: none;
  align-items: center;
  gap: 5px;
  color: var(--emerald);
  font-weight: 700;
  font-size: 10px;
}

.led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}
.led.ONLINE { background: var(--emerald); box-shadow: 0 0 6px var(--emerald); }
.led.PENDING { background: var(--amber); }
.led.OFFLINE { background: var(--crimson); }

/* ==========================================================================
   SOURCE RELIABILITY MATRIX MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(2, 6, 12, 0.78);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(880px, 95vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-bright);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(0, 229, 255, 0.14);
}

.modal-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.modal-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  padding: 10px 12px;
  background: rgba(0, 229, 255, 0.05);
  border-left: 2px solid var(--cyan);
}
.modal-note strong {
  color: var(--text-primary);
}

.sources-table-wrap {
  overflow-x: auto;
}

.sources-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.sources-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-mid);
  font-size: 9.5px;
  letter-spacing: 0.1em;
}
.sources-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  color: var(--text-primary);
  vertical-align: middle;
}
.sources-table a {
  color: var(--cyan);
  text-decoration: none;
}
.sources-table a:hover {
  text-decoration: underline;
}
.status-pill {
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  border: 1px solid currentColor;
}
.status-ONLINE { color: var(--emerald); }
.status-PENDING { color: var(--amber); }
.status-OFFLINE { color: var(--crimson); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border-dim);
  background: rgba(4, 10, 18, 0.9);
}
.modal-sync-ts {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   ANIMATIONS & RESPONSIVE
   ========================================================================== */
@keyframes blinkPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes radarSweep {
  0% { transform: translateX(0); }
  100% { transform: translateX(1380px); }
}

@keyframes arcFlow {
  0% { stroke-dashoffset: 20; }
  100% { stroke-dashoffset: 0; }
}

@keyframes markerPulse {
  0% { transform: scale(0.75); opacity: 0.85; }
  100% { transform: scale(2.4); opacity: 0; }
}

@keyframes shockwaveExpand {
  0% { transform: scale(0.4); opacity: 0.95; }
  100% { transform: scale(5.5); opacity: 0; }
}

@keyframes reticleSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Pause all CSS animations cleanly when tab is backgrounded or reduced motion is preferred */
.tab-hidden *,
.tab-hidden *::before,
.tab-hidden *::after {
  animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
  .radar-sweep-bar,
  .marker-pulse-ring,
  .vector-arc.highlighted,
  .reticle-ring,
  .pulse-dot {
    animation: none !important;
  }
}

@media (max-width: 1620px) {
  .brand-sub,
  .kpi-box:nth-child(5),
  .map-hud-bl .coord-chip.dim {
    display: none;
  }
}

@media (max-width: 1380px) {
  .kpi-box:nth-child(4),
  .clock-box {
    display: none;
  }
  .intercept-rail {
    width: 276px;
  }
}

@media (max-width: 1180px) {
  .kpi-box:nth-child(3),
  .class-badge {
    display: none;
  }
  .intercept-rail {
    width: 256px;
  }
}

@media (max-width: 860px) {
  .console-shell {
    grid-template-rows: auto minmax(0, 1fr) 34px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Two-row non-overlapping tactical header on mobile */
  .cmd-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 6px 8px;
    padding: 8px 10px 7px;
    height: auto;
    overflow: visible;
  }

  .cmd-brand {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-content: space-between;
  }

  .brand-emblem {
    width: 28px;
    height: 28px;
  }
  .brand-emblem svg {
    width: 20px;
    height: 20px;
  }

  .brand-copy {
    flex: 1;
    min-width: 0;
  }

  .brand-title-row {
    justify-content: space-between;
    width: 100%;
  }

  .brand-title {
    font-size: 13px;
    letter-spacing: 0.14em;
  }

  .class-badge,
  .brand-sub {
    display: none;
  }

  .cmd-metrics {
    display: none;
  }

  .cmd-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding-bottom: 1px;
  }
  .cmd-actions::-webkit-scrollbar {
    display: none;
  }

  .hud-btn {
    padding: 5px 6px;
    font-size: 8.5px;
    letter-spacing: 0.04em;
    min-height: 29px;
    flex-shrink: 0;
  }

  /* Split portrait workspace: Mercator map on top, Live Intercept Stream below */
  .cmd-workspace {
    flex-direction: column;
  }

  .map-stage {
    order: 1;
    flex: 0 0 45%;
    min-height: 230px;
    width: 100%;
    height: auto;
  }

  .intercept-rail {
    order: 2;
    position: relative;
    width: 100%;
    flex: 1 1 55%;
    min-height: 0;
    margin-left: 0;
    border-right: none;
    border-top: 1px solid var(--border-mid);
    transition: none;
  }

  .intercept-rail.collapsed {
    display: none;
    margin-left: 0;
  }

  /* When feed is collapsed on mobile, map expands full height */
  .cmd-workspace:has(.intercept-rail.collapsed) .map-stage {
    flex: 1 1 auto;
  }

  .panel-header {
    padding: 7px 10px;
  }

  .rail-controls {
    padding: 7px 10px 6px;
    gap: 6px;
  }

  .hud-input {
    font-size: 16px; /* prevents iOS Safari auto-zoom on focus */
    padding: 5px 28px 5px 9px;
  }
  .hud-input::placeholder {
    font-size: 11px;
  }

  .filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex-shrink: 0;
    padding: 5px 8px;
    font-size: 9.5px;
  }

  .severity-row {
    gap: 4px;
  }
  .sev-pill {
    padding: 4px 8px;
  }

  .rail-footer {
    display: none;
  }

  /* Clean, zero-collision map HUD overlays on mobile */
  .corner-bracket {
    width: 12px;
    height: 12px;
  }
  .corner-bracket.tl { top: 5px; left: 5px; }
  .corner-bracket.tr { top: 5px; right: 5px; }
  .corner-bracket.bl { bottom: 5px; left: 5px; }
  .corner-bracket.br { bottom: 5px; right: 5px; }

  .map-hud-tl {
    top: 8px;
    left: 10px;
    max-width: 52%;
  }
  .map-hud-tl .sector-tag:first-child {
    display: none;
  }
  .sector-tag {
    padding: 3px 6px;
    font-size: 8.5px;
    gap: 5px;
  }
  .tag-val {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .map-hud-tr {
    top: 8px;
    right: 10px;
    gap: 4px;
  }

  .map-ctrl-btn {
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    font-size: 9px;
  }

  .layer-toggles .map-ctrl-btn:last-child {
    display: none;
  }

  .map-hud-bl {
    bottom: 8px;
    left: 10px;
  }
  #cursorCoords,
  .map-hud-bl .coord-chip.dim {
    display: none;
  }

  .map-hud-legend {
    display: none;
  }

  .intercept-toast {
    top: auto;
    bottom: 8px;
    left: 10px;
    right: 10px;
    transform: none;
    max-width: none;
    padding: 6px 10px;
    font-size: 9.5px;
  }

  /* Full-screen mobile dossier drawer */
  .dossier-drawer {
    width: 100%;
    max-width: 100vw;
    border-left: none;
  }

  .dossier-top-bar {
    padding: 9px 12px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .dossier-scroll {
    padding: 12px;
  }

  .dos-title {
    font-size: 15px;
  }

  .dos-geo-row {
    flex-direction: column;
    gap: 2px;
  }

  /* Wide mobile OSINT wire scroller */
  .ticker-label {
    padding: 0 8px;
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  .feed-health-btn {
    padding: 0 10px;
  }

  .health-leds,
  .health-summary {
    display: none;
  }

  .health-mobile-pill {
    display: inline-flex;
  }

  /* Mobile Sources Modal */
  .modal-backdrop {
    padding: 10px;
  }
  .modal-card {
    width: 100%;
    max-height: 90dvh;
  }
  .sources-table th,
  .sources-table td {
    padding: 7px 6px;
    font-size: 9.5px;
  }
}
