/* ============================================================
   VISHVANETRA — Matrix Dashboard
   Hybrid theme: grid panels + matrix accents
   ============================================================ */

:root {
  /* MATRIX theme (default) */
  --bg-0: #000604;
  --bg-1: #050d09;
  --bg-2: #0a1610;
  --bg-3: #112720;
  --border: #1a3b2c;
  --border-strong: #2a6a4d;
  --text: #c8ffe2;
  --text-dim: #6fa489;
  --text-faint: #3d6e58;
  --accent: #00ff95;
  --accent-2: #00e5ff;
  --warn: #ffd166;
  --danger: #ff3860;
  --verified: #00ff95;
  --unverified: #ffd166;
  --pending: #6fa489;
  --glow: 0 0 12px rgba(0, 255, 149, 0.35);
  --shadow-panel: 0 0 0 1px var(--border), 0 8px 24px rgba(0, 0, 0, 0.5);
  --font-mono: 'JetBrains Mono', 'Share Tech Mono', ui-monospace, Menlo, monospace;
}

/* AMBER theme */
[data-theme="amber"] {
  --bg-0: #0a0500;
  --bg-1: #110a02;
  --bg-2: #1a1004;
  --bg-3: #281a06;
  --border: #3d2806;
  --border-strong: #6a4810;
  --text: #ffe2b0;
  --text-dim: #b0905a;
  --text-faint: #6a542e;
  --accent: #ffb000;
  --accent-2: #ff8c00;
  --verified: #ffb000;
  --glow: 0 0 12px rgba(255, 176, 0, 0.35);
}

/* CYAN theme */
[data-theme="cyan"] {
  --bg-0: #000a0d;
  --bg-1: #021018;
  --bg-2: #051922;
  --bg-3: #0a2a36;
  --border: #103a48;
  --border-strong: #1c6a82;
  --text: #c8f6ff;
  --text-dim: #6fa8c0;
  --text-faint: #3d6a7e;
  --accent: #00e5ff;
  --accent-2: #00ff95;
  --verified: #00e5ff;
  --glow: 0 0 12px rgba(0, 229, 255, 0.35);
}

/* CRIMSON theme */
[data-theme="crimson"] {
  --bg-0: #0a0204;
  --bg-1: #110308;
  --bg-2: #1a060c;
  --bg-3: #2a0a14;
  --border: #3d0e1c;
  --border-strong: #6a1830;
  --text: #ffd1dc;
  --text-dim: #b06a82;
  --text-faint: #6a3a4a;
  --accent: #ff3860;
  --accent-2: #ff7a90;
  --verified: #ff3860;
  --glow: 0 0 12px rgba(255, 56, 96, 0.35);
}

/* ============================================================
   RESET / BASE
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: var(--bg-0);
  overflow-x: hidden;
  letter-spacing: 0.02em;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

/* Matrix rain canvas */
#matrixRain {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.12;
  pointer-events: none;
}

/* Scanlines effect (toggle-able) */
body.scanlines::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border-bottom: 1px solid var(--border-strong);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.6);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  font-size: 28px;
  color: var(--accent);
  text-shadow: var(--glow);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.96); }
}
.brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text);
}
.brand-text .accent {
  color: var(--accent);
  text-shadow: var(--glow);
  margin-left: 6px;
}
.brand-text .subline {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.2em;
}

.topbar-status {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.status-pill .label {
  color: var(--text-faint);
  font-size: 9px;
  letter-spacing: 0.15em;
}
.defcon-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 700;
  border-radius: 2px;
  border: 1px solid var(--border-strong);
  background: var(--bg-2);
  cursor: help;
  transition: all 0.2s ease;
}
.defcon-pill.d5 { color: #00ff95; border-color: #00ff95; }
.defcon-pill.d4 { color: #ffd166; border-color: #ffd166; }
.defcon-pill.d3 { color: #ff9a3c; border-color: #ff9a3c; background: rgba(255,154,60,0.08); }
.defcon-pill.d2 { color: #ff5722; border-color: #ff5722; background: rgba(255,87,34,0.12); animation: blink 1.8s infinite; }
.defcon-pill.d1 { color: #fff; background: var(--danger); border-color: var(--danger); animation: blink 0.8s infinite; }

/* "+ N hidden" pill — appears in topbar whenever any panel is closed */
.hidden-panels-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  font-weight: 700;
  border-radius: 2px;
  border: 1px solid var(--warn);
  background: rgba(255, 209, 102, 0.12);
  color: var(--warn);
  cursor: pointer;
  transition: all 0.15s ease;
}
.hidden-panels-pill:hover {
  background: var(--warn);
  color: var(--bg-0);
}

.status-pill .value {
  color: var(--text);
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-green { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: blink 1.6s ease-in-out infinite; }
.dot-red { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: blink 1s ease-in-out infinite; }
.dot-amber { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.topbar-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.control-input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  border-radius: 2px;
  outline: none;
}
.control-input:focus {
  border-color: var(--accent);
  box-shadow: var(--glow);
}
#globalSearch { min-width: 240px; }

.btn-ghost, .btn-primary, .icon-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
  letter-spacing: 0.08em;
  transition: all 0.15s ease;
}
.btn-ghost:hover, .icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--glow);
}
.btn-primary {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
  font-weight: 700;
}
.btn-primary:hover { box-shadow: var(--glow); }
.icon-btn { padding: 4px 8px; font-size: 14px; }

/* ============================================================
   TICKER
   ============================================================ */
.ticker {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  height: 28px;
}
.ticker-label {
  background: var(--danger);
  color: #000;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  padding: 5px 12px;
  flex-shrink: 0;
  animation: blink 1.6s ease-in-out infinite;
}
.ticker-track {
  display: flex;
  gap: 40px;
  white-space: nowrap;
  animation: ticker-scroll 60s linear infinite;
  padding-left: 16px;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.ticker-item {
  font-size: 12px;
  color: var(--text-dim);
}
.ticker-item.verified::before {
  content: '✓ ';
  color: var(--verified);
}
.ticker-item.unverified::before {
  content: '? ';
  color: var(--unverified);
}

/* ============================================================
   CRYPTO PANEL
   ============================================================ */
.crypto-list { display: flex; flex-direction: column; }
.crypto-row {
  display: grid;
  grid-template-columns: 1fr 60px 100px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.crypto-row:last-child { border-bottom: 0; }
.crypto-name { display: flex; flex-direction: column; min-width: 0; }
.crypto-name .c-sym { font-weight: 700; font-size: 12px; color: var(--text); letter-spacing: 0.08em; }
.crypto-name .c-fullname { font-size: 9px; color: var(--text-faint); text-transform: uppercase; }
.crypto-meta { text-align: right; }
.crypto-meta .c-price { font-size: 12px; font-weight: 700; color: var(--text); }
.crypto-meta .c-pct { font-size: 10px; letter-spacing: 0.08em; }
.crypto-row.up   .c-pct, .crypto-row.up   .c-price { color: #00ff95; }
.crypto-row.down .c-pct, .crypto-row.down .c-price { color: #ff3860; }

/* Service Status (TECH category): roll-up of cloud/SaaS statuspages */
.svc-status-list { display: flex; flex-direction: column; }
.svc-status-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease;
}
.svc-status-row:last-child { border-bottom: 0; }
.svc-status-row:hover { background: var(--bg-2); }
.svc-status-row .svc-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
}
.svc-status-row .svc-name {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text);
}
.svc-status-row .svc-desc {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pyth prices (FINANCE category) — compact symbol · price · pct table */
.pyth-list { display: flex; flex-direction: column; }
.pyth-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}
.pyth-row:last-child { border-bottom: 0; }
.pyth-sym { display: flex; flex-direction: column; min-width: 0; }
.pyth-sym .p-sym  { font-weight: 700; font-size: 12px; color: var(--text); letter-spacing: 0.08em; }
.pyth-sym .p-name { font-size: 9px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.pyth-price { font-size: 12px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.pyth-pct   { font-size: 10px; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.pyth-row.up   .pyth-pct, .pyth-row.up   .pyth-price { color: #00ff95; }
.pyth-row.down .pyth-pct, .pyth-row.down .pyth-price { color: #ff3860; }

/* Stock-exchange open/close clocks */
.exch-list { display: flex; flex-direction: column; }
.exch-row {
  display: grid;
  grid-template-columns: 10px 1fr 56px 1fr;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}
.exch-row:last-child { border-bottom: 0; }
.exch-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.exch-row.state-open  .exch-dot { background: #00ff95; box-shadow: 0 0 6px #00ff95; }
.exch-row.state-closed .exch-dot { background: #6fa489; }
.exch-name { display: flex; flex-direction: column; min-width: 0; }
.exch-name .e-name { font-weight: 700; font-size: 11px; letter-spacing: 0.08em; color: var(--text); }
.exch-name .e-city { font-size: 9px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.exch-clock {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.exch-status {
  display: flex; flex-direction: column;
  align-items: flex-end;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.exch-row.state-open  .exch-status { color: #00ff95; }
.exch-row.state-closed .exch-status { color: var(--text-faint); }
.exch-status .e-sub { font-size: 9px; color: var(--text-faint); font-weight: 400; }

/* Central Bank Watch — policy rate table */
.cb-list { display: flex; flex-direction: column; }
.cb-row {
  display: grid;
  grid-template-columns: 1fr 64px 22px 80px;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease;
}
.svc-status-row:last-child { border-bottom: 0; }
.svc-status-row:hover { background: var(--bg-2); }
.svc-status-row .svc-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
}
.svc-status-row .svc-name {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text);
}
.svc-status-row .svc-desc {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cb-row:last-child { border-bottom: 0; }
.cb-row:hover { background: var(--bg-2); }
.cb-name { font-weight: 700; font-size: 11px; letter-spacing: 0.06em; }
.cb-name .cb-country { display: block; font-size: 9px; color: var(--text-faint); font-weight: 400; text-transform: uppercase; letter-spacing: 0.08em; }
.cb-rate { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; color: var(--text); }
.cb-trend { font-size: 16px; text-align: center; }
.cb-trend.up   { color: #ff3860; }
.cb-trend.down { color: #00ff95; }
.cb-trend.flat { color: var(--text-faint); }
.cb-next { font-size: 10px; color: var(--text-faint); letter-spacing: 0.06em; text-transform: uppercase; text-align: right; }

/* Polymarket — prediction-market top events */
.pm-list { display: flex; flex-direction: column; }
.pm-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease;
}
.pm-row:last-child { border-bottom: 0; }
.pm-row:hover { background: var(--bg-2); }
.pm-title {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  font-weight: 500;
}
.pm-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pm-prob {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: 2px;
}
.pm-prob-na { color: var(--text-faint); border-color: var(--border); }
.pm-vol {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
}

/* Climate Vitals — CO2 keeling curve panel */
.climate-vital { padding: 12px; }
.cv-row { margin-bottom: 8px; }
.cv-label { font-size: 9px; color: var(--text-faint); letter-spacing: 0.18em; text-transform: uppercase; }
.cv-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: 0.02em;
}
.cv-value .cv-unit { font-size: 12px; color: var(--text-faint); margin-left: 6px; letter-spacing: 0.1em; }
.cv-asof { font-size: 10px; color: var(--text-faint); letter-spacing: 0.08em; }
.cv-spark { display: block; margin: 12px 0; }
.cv-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.cv-stat { display: flex; flex-direction: column; }
.cv-stat-label { font-size: 9px; color: var(--text-faint); letter-spacing: 0.12em; text-transform: uppercase; }
.cv-stat-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cv-stat-val.up   { color: #ff3860; }
.cv-stat-val.down { color: #00ff95; }
/* ISS Live panel */
.iss-card { padding: 12px; }
.iss-headline { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.iss-vis-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.iss-label { font-size: 11px; color: var(--text-dim); letter-spacing: 0.15em; font-weight: 700; }
.iss-coords, .iss-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.iss-coords > div, .iss-stats > div {
  display: flex; flex-direction: column;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.iss-k { font-size: 9px; color: var(--text-faint); letter-spacing: 0.18em; text-transform: uppercase; }
.iss-v { font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--text); }
.iss-asof { margin-top: 8px; font-size: 10px; color: var(--text-faint); letter-spacing: 0.05em; }

/* Space Weather panel */
.sw-card { padding: 12px; }
.sw-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.sw-label { font-size: 9px; color: var(--text-faint); letter-spacing: 0.18em; text-transform: uppercase; flex: 1; }
.sw-value { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--text); }
.sw-storm {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 4px 10px;
  border: 1px solid;
  border-radius: 2px;
}
.sw-spark { display: block; margin: 6px 0 8px; }
.sw-foot {
  display: flex; justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 10px;
}
.sw-foot .sw-k { color: var(--text-faint); letter-spacing: 0.1em; text-transform: uppercase; }
.sw-foot .sw-v { color: var(--text); font-weight: 700; }

/* ============================================================
   MACRO STRESS PANEL
   ============================================================ */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 10px;
}
.macro-card {
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: 8px 10px;
  border-radius: 2px;
  border-left-width: 3px;
}
.macro-card.state-calm    { border-left-color: #00ff95; }
.macro-card.state-watch   { border-left-color: #ffd166; }
.macro-card.state-stress  { border-left-color: var(--danger); animation: blink 2.5s infinite; }
.macro-card.state-unknown { border-left-color: var(--text-faint); }
.macro-card .m-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.macro-card .m-label { font-size: 10px; letter-spacing: 0.14em; font-weight: 700; color: var(--text-dim); }
.macro-card .m-state { font-size: 8px; letter-spacing: 0.16em; padding: 1px 4px; border-radius: 2px; }
.macro-card .m-state.state-calm   { background: rgba(0,255,149,0.15); color: #00ff95; }
.macro-card .m-state.state-watch  { background: rgba(255,209,102,0.15); color: var(--warn); }
.macro-card .m-state.state-stress { background: var(--danger); color: #000; }
.macro-card .m-value { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: 0.02em; }
.macro-card .m-change { font-size: 10px; color: var(--text-faint); }
.macro-card .m-desc { font-size: 9px; color: var(--text-faint); margin-top: 4px; }
.macro-card .m-basis { font-size: 9px; color: var(--text-dim); font-style: italic; margin-top: 2px; }

/* ============================================================
   COUNTRY INSTABILITY INDEX
   ============================================================ */
.instab-list { display: flex; flex-direction: column; padding: 8px; gap: 8px; }
.instab-row {
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 2px;
}
.instab-row.state-critical { border-left-color: var(--danger); }
.instab-row.state-high     { border-left-color: #ff7a40; }
.instab-row.state-elevated { border-left-color: var(--warn); }
.instab-row.state-low      { border-left-color: var(--accent); }
.instab-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.instab-state-dot {
  width: 9px; height: 9px; border-radius: 50%;
}
.instab-state-dot.state-critical { background: var(--danger); animation: blink 1.5s infinite; }
.instab-state-dot.state-high     { background: #ff7a40; }
.instab-state-dot.state-elevated { background: var(--warn); }
.instab-state-dot.state-low      { background: var(--accent); }
.instab-country { flex: 1; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--text); }
.instab-src {
  font-size: 8px;
  letter-spacing: 0.12em;
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid currentColor;
  font-weight: 700;
}
.instab-src-gdelt { color: #7eb6ff; background: rgba(126,182,255,0.1); }
.instab-src-local { color: var(--text-faint); background: rgba(255,255,255,0.04); }
.instab-score { font-size: 14px; font-weight: 700; color: var(--text); }
.instab-bar { width: 100%; height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.instab-bar-fill { height: 100%; transition: width 0.4s ease; }
.instab-bar-fill.state-critical { background: var(--danger); }
.instab-bar-fill.state-high     { background: #ff7a40; }
.instab-bar-fill.state-elevated { background: var(--warn); }
.instab-bar-fill.state-low      { background: var(--accent); }
.instab-sub { font-size: 9px; letter-spacing: 0.08em; color: var(--text-faint); margin-top: 4px; }

/* ============================================================
   CATEGORY NAV BAR  (Bloomberg-tab feel, below the markets strip)
   ============================================================ */
/* Compact, worldmonitor-style tab strip pinned to the top. Sits as
   a slim row above the markets ticker. Fixed 38px height so chips
   never get squashed by flex sibling sizing, and a clear shadow
   underneath so it visually separates from whatever sits below. */
.cat-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  gap: 6px;
  align-items: center;
  height: 46px;                 /* roomier so chips never feel pinched */
  min-height: 46px;
  background: var(--bg-1);
  border-top:    1px solid var(--border);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  padding: 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-chip {
  --cat-accent: var(--accent);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.cat-chip:hover {
  color: var(--cat-accent);
  border-color: var(--cat-accent);
}
.cat-chip .cat-icon { color: var(--cat-accent); font-size: 12px; line-height: 1; }
.cat-chip .cat-label { line-height: 1; }
.cat-chip.active {
  color: var(--bg-0);
  background: var(--cat-accent);
  border-color: var(--cat-accent);
}
.cat-chip.active .cat-icon { color: var(--bg-0); }

/* ============================================================
   MARKETS TICKER (top of page, Bloomberg-style)
   ============================================================ */
.markets-strip {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: stretch;
  gap: 0;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-bottom: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  overflow: hidden;
}
.markets-label {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 10px;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: var(--accent);
  border-right: 1px solid var(--border);
  background: var(--bg-1);
  white-space: nowrap;
}
.markets-track {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  height: 32px;
}
.markets-scroll {
  display: flex;
  gap: 28px;
  padding: 0 12px;
  align-items: center;
  animation: ticker-scroll 80s linear infinite;
  white-space: nowrap;
}
.markets-strip:hover .markets-scroll { animation-play-state: paused; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.markets-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text);
}
.markets-item .m-label { color: var(--text-dim); letter-spacing: 0.08em; }
.markets-item .m-price { font-weight: 700; }
.markets-item .m-change { font-size: 10px; }
.markets-item.up   .m-change, .markets-item.up   .m-price { color: #00ff95; }
.markets-item.down .m-change, .markets-item.down .m-price { color: #ff3860; }
.markets-item .m-spark { vertical-align: middle; opacity: 0.8; }
.markets-empty { color: var(--text-faint); font-size: 10px; padding: 0 12px; align-self: center; }

/* ============================================================
   TOP HEADLINES STRIP (above the world map)
   ============================================================ */
.top-headlines {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 8px 10px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border-bottom: 1px solid var(--border-strong);
}
.top-headlines-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--danger);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}
.top-headlines-track {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}
.top-headlines-track::-webkit-scrollbar { height: 5px; }
.top-headlines-track::-webkit-scrollbar-thumb { background: var(--border-strong); }
.top-headlines-empty {
  display: flex;
  align-items: center;
  color: var(--text-faint);
  font-size: 11px;
  padding: 0 12px;
}
.top-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 320px;
  min-width: 280px;
  max-width: 340px;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 2px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.top-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.top-card.priority-hotspot { border-left-color: var(--danger); }
.top-card.priority-breaking { border-left-color: var(--danger); }
.top-card.priority-war      { border-left-color: #ff7a40; }
.top-card.priority-health   { border-left-color: var(--unverified); }
.top-card-meta {
  display: flex;
  gap: 6px;
  font-size: 9px;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  align-items: center;
}
.top-card-source { color: var(--accent); font-weight: 700; }
.top-card-time   { color: var(--text-faint); margin-left: auto; }
.top-card-title {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   MAIN GRID
   ============================================================ */
.grid {
  position: relative;
  z-index: 5;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* Tight fixed rows + dense flow so tall content panels can claim 2
     rows (~660px) and short signal panels naturally pack into a
     single row (~330px). This removes the empty space under shorter
     panels and lets News stretch into the space the signal panels
     don't need. */
  grid-auto-rows: 330px;
  grid-auto-flow: dense;
  gap: 10px;
  padding: 10px;
}
.grid[data-density="compact"]  { gap: 6px;  padding: 6px;  grid-auto-rows: 280px; }
.grid[data-density="spacious"] { gap: 16px; padding: 16px; grid-auto-rows: 380px; }

.panel-wide { grid-column: span 2; }

/* HERO + RAIL: 2 grid rows (~660px) instead of a fixed vh height.
   This lets the grid pack other panels next to the hero+rail without
   leaving empty rows below shorter signal panels. */
.panel-hero {
  grid-column: span 3;
  grid-row: span 2;
  overflow: hidden;
}
.panel-side {
  grid-column: span 1;
  grid-row: span 2;
  overflow: hidden;
}

/* CONTENT PANELS get 2 rows of vertical space (long lists, scrollable).
   SIGNAL PANELS (instability/macro/crypto/alerts) stay 1 row tall so
   their compact widgets aren't padded with whitespace. */
[data-panel="news"],
[data-panel="markets"],
[data-panel="social"] {
  grid-row: span 2;
}

/* min-height: 0 so flex:1 actually shrinks the body to fit the panel
   instead of forcing the whole panel to grow to map-body's content. */
.panel-hero .map-body,
.panel-side .panel-body { min-height: 0; }

@media (max-width: 1400px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .panel-hero { grid-column: span 2; }
  .panel-side { grid-column: span 1; }
}
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .panel-wide { grid-column: span 2; }
  .panel-hero { grid-column: span 2; }
  .panel-side { grid-column: span 2; grid-row: span 1; }
}
@media (max-width: 700px) {
  .grid { grid-template-columns: 1fr; }
  .panel-wide { grid-column: span 1; }
  .panel-hero { grid-column: span 1; }
  .panel-side { grid-column: span 1; grid-row: span 1; }
  /* On phones, content panels also collapse to single-row so the page
     isn't 5000px tall. */
  [data-panel="news"], [data-panel="markets"], [data-panel="social"] { grid-row: span 1; }
}

/* Rail-style video grid (used inside the side LIVE panel). CSS Grid
   was collapsing tiles to ~50px because aspect-ratio on a 1fr-column
   item doesn't always drive row height. Flexbox column + explicit
   width: 100% + flex: 0 0 auto + aspect-ratio gives reliable 16:9
   tiles that scroll inside the panel.
   .video-grid is normally `display: grid` — override to flex. */
.video-grid-rail {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  min-height: 0;
  height: 100%;
}
.video-grid-rail .video-tile {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9;
}

/* ============================================================
   PANELS
   ============================================================ */
.panel {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s ease;
  min-height: 0;
}
.panel:hover { border-color: var(--border-strong); }
.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}
.panel.hidden { display: none; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text);
}
.panel-icon {
  color: var(--accent);
  font-size: 14px;
  text-shadow: var(--glow);
}
.panel-source {
  font-size: 9px;
  color: var(--text-faint);
  font-weight: 400;
  letter-spacing: 0.12em;
}

/* Freshness dot — small "last refreshed" indicator in each panel title.
   Coloured by age: green <60s, amber <5m, red ≥5m, grey if never synced. */
.fresh-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: var(--text-faint);
  box-shadow: none;
  transition: background 0.3s ease, box-shadow 0.3s ease;
  cursor: help;
}
.fresh-dot.fresh-ok      { background: #00ff95; box-shadow: 0 0 5px rgba(0, 255, 149, 0.6); animation: fresh-pulse 2.4s ease-in-out infinite; }
.fresh-dot.fresh-warn    { background: #ffd166; box-shadow: 0 0 5px rgba(255, 209, 102, 0.5); }
.fresh-dot.fresh-old     { background: #ff3860; box-shadow: 0 0 5px rgba(255, 56, 96, 0.5); }
.fresh-dot.fresh-pending { background: var(--text-faint); opacity: 0.5; }
@keyframes fresh-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
.panel-controls {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
/* Inside narrow side panels (LIVE rail), drop chip padding so 10+
   chips fit in the column without clipping. */
.panel-side .panel-controls .chip {
  padding: 2px 5px;
  font-size: 8.5px;
  letter-spacing: 0.08em;
}
.panel-side .panel-source { display: none; }

.chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s ease;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }
.chip.active {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
  font-weight: 700;
}

.mini-select {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 2px;
  outline: none;
}
.mini-select:focus { border-color: var(--accent); color: var(--accent); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 0;
}

/* Scrollbar */
.panel-body::-webkit-scrollbar { width: 6px; }
.panel-body::-webkit-scrollbar-track { background: var(--bg-1); }
.panel-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.panel-body::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   FEED LIST / POSTS
   ============================================================ */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.post {
  background: var(--bg-2);
  border-left: 2px solid var(--border);
  padding: 8px 10px;
  border-radius: 0 2px 2px 0;
  cursor: pointer;
  transition: all 0.15s ease;
}
.post:hover {
  border-left-color: var(--accent);
  background: var(--bg-3);
  transform: translateX(2px);
}
.post.verified { border-left-color: var(--verified); }
.post.unverified { border-left-color: var(--unverified); }
.post.breaking {
  border-left-color: var(--danger);
  animation: breaking-flash 2s ease-in-out infinite;
}
@keyframes breaking-flash {
  0%, 100% { background: var(--bg-2); }
  50% { background: rgba(255, 56, 96, 0.08); }
}

.post-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 10px;
}
.post-source {
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.post-time {
  color: var(--text-faint);
  margin-left: auto;
  font-size: 9px;
}

.post-badge {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 9px;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.tag-pill {
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.tag-pill.tag-breaking {
  background: var(--danger);
  color: #000;
  border-color: var(--danger);
  animation: blink 1s ease-in-out infinite;
}
.tag-pill.tag-war {
  background: rgba(255, 122, 64, 0.15);
  color: #ff7a40;
}
.tag-pill.tag-health {
  background: rgba(255, 209, 102, 0.18);
  color: var(--unverified);
}
.tag-pill.tag-verified {
  background: rgba(0, 255, 149, 0.15);
  color: var(--verified);
}
.tag-pill.tag-hotspot {
  background: var(--danger);
  color: #000;
  border-color: var(--danger);
  letter-spacing: 0.14em;
}
.tag-pill.tag-wire     { background: rgba(0,255,149,0.18); color: #00ff95; border-color: #00ff95; }
.tag-pill.tag-military { background: rgba(126,182,255,0.15); color: #7eb6ff; }
.tag-pill.tag-crime    { background: rgba(183,108,255,0.15); color: #b76cff; }
.tag-pill.tag-env      { background: rgba(168,230,207,0.15); color: #a8e6cf; }
.tag-pill.tag-gov      { background: rgba(0,229,255,0.12); color: #00e5ff; }

/* Subtle left-border tint on the post itself for priority items. */
.post.breaking       { border-left: 2px solid var(--danger); }
.post.priority-war   { border-left: 2px solid #ff7a40; }
.post.priority-health{ border-left: 2px solid var(--unverified); }

/* Filter-chip color hints for the priority chips. */
.chip.chip-breaking.active { border-color: var(--danger); color: var(--danger); }
.chip.chip-war.active      { border-color: #ff7a40; color: #ff7a40; }
.chip.chip-health.active   { border-color: var(--unverified); color: var(--unverified); }

.post-body { margin-bottom: 4px; }
.post-title {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 4px;
  line-height: 1.4;
}
.post-title:hover { color: var(--accent); text-decoration: underline; }
.post-snippet {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-footer {
  display: flex;
  gap: 8px;
  font-size: 9px;
  color: var(--text-faint);
}
.post-meta { letter-spacing: 0.1em; }

/* ============================================================
   VIDEO GRID (YouTube + Webcams)
   ============================================================ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  align-content: start;
}
.panel-wide .video-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) {
  .video-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .video-grid { grid-template-columns: 1fr; }
}
.video-tile {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.video-tile iframe,
.video-tile video,
.video-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}
.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 6px;
  color: var(--text-faint);
  font-size: 10px;
  text-align: center;
  padding: 8px;
}
.video-placeholder .play-icon {
  font-size: 28px;
  color: var(--accent);
  opacity: 0.6;
}
.video-placeholder .hint { color: var(--text-faint); font-size: 9px; opacity: 0.7; }
.video-placeholder p { margin: 0; }

.video-tile.tile-hotspot { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.video-tile .hotspot-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  background: var(--danger);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  letter-spacing: 0.15em;
  border-radius: 2px;
}
.video-tile .live-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--danger);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  letter-spacing: 0.15em;
  border-radius: 2px;
  z-index: 2;
  animation: blink 1.4s ease-in-out infinite;
}
.video-tile .video-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  background: linear-gradient(0deg, rgba(0,0,0,0.85), transparent);
  font-size: 10px;
  color: var(--text);
  letter-spacing: 0.08em;
}

/* ============================================================
   EMPTY STATE / LOADER
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-faint);
  text-align: center;
  font-size: 11px;
}
.empty-state p { font-size: 11px; }
.empty-state .hint { font-size: 10px; opacity: 0.7; }
.empty-state code {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 1px 4px;
  color: var(--accent);
  border-radius: 2px;
  font-size: 10px;
}

.loader {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   WORLD MAP (Leaflet)
   ============================================================ */
.map-body {
  position: relative;
  padding: 0;
  min-height: 420px;
  flex: 1;
}
.world-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 420px;
  background: var(--bg-0);
  filter: saturate(0.85);
}
.world-map.hidden { display: none; }
.world-map-3d .maplibregl-canvas { outline: none; }
.world-map-3d .maplibregl-ctrl-attrib { display: none; }
/* Push the NavigationControl down so it doesn't collide with the
   2D|3D pill that sits at top: 10px right: 10px */
.world-map-3d .maplibregl-ctrl-top-right { top: 56px; }
/* Recolour MapLibre zoom controls to match the matrix theme */
.world-map-3d .maplibregl-ctrl-group {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
.world-map-3d .maplibregl-ctrl-group button {
  background: transparent;
  color: var(--accent);
}
.world-map-3d .maplibregl-ctrl-group button:hover {
  background: var(--bg-3);
}
.world-map-3d .maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--border);
}

/* 2D / 3D mode toggle — compact pill overlaid on the map, top-right.
   Lives in .map-body (position: relative) so it pins inside the panel
   body, above the canvas. Higher z-index than Leaflet/MapLibre controls
   so it sits cleanly above them. */
.map-mode-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 600;
  display: inline-flex;
  background: rgba(5, 13, 9, 0.85);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}
.map-mode-toggle .mode-btn {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.map-mode-toggle .mode-btn:hover { color: var(--accent); }
.map-mode-toggle .mode-btn.active {
  background: var(--accent);
  color: var(--bg-0);
  box-shadow: 0 0 12px rgba(0, 255, 149, 0.4);
}
/* Leaflet wrapper sits inside .world-map */
.world-map .leaflet-container {
  background: var(--bg-0);
  font-family: var(--font-mono);
  color: var(--text);
}
.world-map .leaflet-control-zoom a {
  background: var(--bg-2);
  color: var(--accent);
  border: 1px solid var(--border-strong);
}
.world-map .leaflet-control-zoom a:hover {
  background: var(--bg-3);
  color: var(--accent);
}
.world-map .leaflet-popup-content-wrapper,
.world-map .leaflet-popup-tip {
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  box-shadow: var(--shadow-panel);
}
.world-map .leaflet-popup-content { margin: 10px 12px; font-size: 11px; line-height: 1.5; }
.map-popup-source {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.map-popup-title {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 12px;
  margin-bottom: 4px;
  line-height: 1.35;
}
a.map-popup-title:hover { color: var(--accent); text-decoration: underline; }
.map-popup-snippet { color: var(--text-dim); font-size: 10px; margin-bottom: 4px; }
.map-popup-meta { color: var(--text-faint); font-size: 9px; letter-spacing: 0.08em; }

/* Hover tooltip on route lines — both 2D Leaflet and 3D MapLibre */
.leaflet-tooltip.route-tooltip {
  background: rgba(5, 13, 9, 0.95);
  border: 1px solid var(--accent);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 5px 8px;
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(0, 255, 149, 0.25);
}
.leaflet-tooltip.route-tooltip::before { border-top-color: var(--accent) !important; }
.maplibregl-popup.route-tooltip-globe .maplibregl-popup-content {
  background: rgba(5, 13, 9, 0.95);
  border: 1px solid var(--accent);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 5px 8px;
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(0, 255, 149, 0.25);
}
.maplibregl-popup.route-tooltip-globe .maplibregl-popup-tip { display: none; }

/* Floating LAYERS control inside the map. The overlay variant
   pins to the top-left of .map-body so it survives both 2D
   (Leaflet) and 3D (MapLibre) mode — a Leaflet control would
   be hidden whenever the Leaflet div is display:none. */
.map-layers-control { font-family: var(--font-mono); }
.map-layers-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 700;
}
.map-layers-toggle {
  background: rgba(5, 13, 9, 0.88);
  color: var(--accent);
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.map-layers-toggle:hover {
  background: var(--bg-3);
  box-shadow: 0 2px 14px rgba(0, 255, 149, 0.25);
}
.map-layers-toggle[aria-expanded="true"] {
  background: var(--bg-3);
  box-shadow: 0 0 0 1px var(--accent), 0 2px 14px rgba(0, 255, 149, 0.35);
}
.map-layers-chevron {
  font-size: 9px;
  transition: transform 0.2s ease;
  display: inline-block;
}
.map-layers-toggle[aria-expanded="true"] .map-layers-chevron {
  transform: rotate(180deg);
}
.map-layers-panel {
  margin-top: 6px;
  background: rgba(5, 13, 9, 0.95);
  border: 1px solid var(--border-strong);
  padding: 12px;
  min-width: 240px;
  max-width: 280px;
  max-height: 70vh;
  overflow-y: auto;
  backdrop-filter: blur(8px);
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--accent);
  animation: layers-pop 0.12s ease;
}
@keyframes layers-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.map-layers-panel.hidden { display: none; }
.map-layers-title {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.map-layers-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  user-select: none;
}
.map-layers-row:hover { color: var(--text); }
.map-layers-row input { accent-color: var(--accent); cursor: pointer; }
.map-layers-row.layer-row-hidden { display: none; }
.map-layers-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.map-layers-label { flex: 1; }
.map-layers-count {
  font-size: 9px;
  color: var(--text-faint);
}
.map-layers-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.map-layers-bulk { display: flex; gap: 4px; }
.map-layers-subtitle {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  margin: 10px 0 4px 0;
  text-transform: uppercase;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.map-layers-subtitle:first-of-type { border-top: 0; padding-top: 0; }
.map-bulk-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 2px;
}
.map-bulk-btn:hover { color: var(--accent); border-color: var(--accent); }
/* Standalone TIMELINE control (top-left of map, always visible) */
.map-time-control {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  background: rgba(5, 13, 9, 0.92);
  border: 1px solid var(--border-strong);
  padding: 6px 8px;
  backdrop-filter: blur(6px);
  border-radius: 2px;
  font-family: var(--font-mono);
  max-width: 480px;
}
.map-time-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--accent);
  padding-right: 6px;
  border-right: 1px solid var(--border);
  margin-right: 4px;
}

.map-time-range {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.time-chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s ease;
  min-width: 36px;
}
.time-chip:hover { color: var(--accent); border-color: var(--accent); }
.time-chip.active {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
  font-weight: 700;
}

/* Country drawer (slide-in from the right edge of the viewport) */
.country-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 90vw;
  height: 100vh;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border-left: 1px solid var(--border-strong);
  box-shadow: -8px 0 24px rgba(0,0,0,0.6);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 9999;
  overflow-y: auto;
  font-family: var(--font-mono);
}
.country-drawer.open { transform: translateX(0); }
.cd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}
.cd-country {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-transform: uppercase;
}
.cd-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 14px;
  padding: 2px 8px;
  cursor: pointer;
}
.cd-close:hover { color: var(--danger); border-color: var(--danger); }
.cd-body { padding: 12px 14px; }
.cd-section { margin-bottom: 16px; }
.cd-section h4 {
  margin: 0 0 6px 0;
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 700;
}
.cd-item {
  display: block;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}
.cd-item:hover { color: var(--accent); }
.cd-source { font-size: 9px; color: var(--text-faint); letter-spacing: 0.08em; }
.cd-title { font-size: 11px; line-height: 1.35; margin-top: 2px; }
.cd-empty { color: var(--text-faint); font-size: 11px; }
.map-popup-country {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  margin-left: 4px;
}
.map-popup-country:hover { text-decoration: underline; }

/* Ticker pill inside news cards */
.post-tickers { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ticker-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  font-size: 9px;
  letter-spacing: 0.08em;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  background: var(--bg-2);
}
.ticker-pill.up   { color: #00ff95; border-color: #00ff95; }
.ticker-pill.down { color: #ff3860; border-color: #ff3860; }
.ticker-pill .t-label { color: var(--text-dim); }
.ticker-pill.up .t-label,
.ticker-pill.down .t-label { color: inherit; opacity: 0.85; }

/* Heatmap toggle chip active state */
#heatmapToggle.active {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
  font-weight: 700;
}

/* Marker pulse for breaking */
.map-marker-breaking {
  animation: pulse-marker 1.6s ease-in-out infinite;
}
@keyframes pulse-marker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Legend strip pinned to the bottom of the map */
.map-legend {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  z-index: 500;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  backdrop-filter: blur(4px);
  border-radius: 2px;
  pointer-events: none;
}
.map-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.map-legend span { display: inline-flex; align-items: center; }

/* Chip color hints used by the map filter row */
.chip.chip-news.active   { border-color: #00e5ff; color: #00e5ff; }
.chip.chip-social.active { border-color: #ffd166; color: #ffd166; }
.chip.chip-alert.active  { border-color: #ff3860; color: #ff3860; }
.chip.chip-live.active   { border-color: #00ff95; color: #00ff95; }

/* ============================================================
   STATUS BAR
   ============================================================ */
.statusbar {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px;
  background: var(--bg-1);
  border-top: 1px solid var(--border-strong);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  flex-wrap: wrap;
  gap: 8px;
}
.statusbar-left, .statusbar-right { display: flex; gap: 16px; flex-wrap: wrap; }
.status-item { display: inline-flex; align-items: center; gap: 6px; }
kbd {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
}

/* ============================================================
   AUDIO BRIEFING OVERLAY (▶ BRIEF)
   ============================================================ */
.brief-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 4, 2, 0.82);
  backdrop-filter: blur(8px);
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.brief-backdrop.hidden { display: none; }
.brief-panel {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  width: min(680px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 48px rgba(0, 0, 0, 0.9), 0 0 0 1px var(--accent), var(--glow);
  animation: modal-in 0.18s ease;
}
.brief-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.brief-prompt {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--accent);
  text-shadow: var(--glow);
}
.brief-title {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text);
  margin: 0;
}
.brief-status {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--accent);
  padding: 3px 8px;
  border: 1px solid var(--accent);
  border-radius: 2px;
}
.brief-status.speaking { color: var(--accent); animation: blink 1.6s ease-in-out infinite; }
.brief-status.paused   { color: var(--warn);   border-color: var(--warn); }
.brief-status.done     { color: var(--text-faint); border-color: var(--border); }
.brief-status.error    { color: var(--danger); border-color: var(--danger); }
.brief-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
}
.brief-line {
  padding: 6px 10px;
  border-left: 2px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.brief-line.brief-line-active {
  background: var(--bg-2);
  color: var(--text);
  border-left-color: var(--accent);
  text-shadow: 0 0 8px rgba(0, 255, 149, 0.3);
}
.brief-line.brief-line-section {
  margin-top: 12px;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  text-transform: uppercase;
  border-left: 0;
  padding-left: 10px;
}
.brief-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.1em;
}
.brief-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.brief-meter {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
}
.brief-meter-bar {
  flex: 1;
  background: var(--border-strong);
  height: 25%;
  border-radius: 1px;
  transition: height 0.12s ease, background 0.12s ease;
}
.brief-meter.active .brief-meter-bar {
  background: var(--accent);
  box-shadow: 0 0 4px var(--accent);
  animation: brief-bounce 0.6s ease-in-out infinite;
}
.brief-meter.active .brief-meter-bar:nth-child(1) { animation-delay: 0.0s; }
.brief-meter.active .brief-meter-bar:nth-child(2) { animation-delay: 0.1s; }
.brief-meter.active .brief-meter-bar:nth-child(3) { animation-delay: 0.2s; }
.brief-meter.active .brief-meter-bar:nth-child(4) { animation-delay: 0.3s; }
.brief-meter.active .brief-meter-bar:nth-child(5) { animation-delay: 0.4s; }
@keyframes brief-bounce {
  0%, 100% { height: 20%; }
  50%      { height: 90%; }
}
.brief-controls { display: flex; gap: 8px; align-items: center; }
.brief-voice {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  border-radius: 2px;
  max-width: 160px;
}

/* ============================================================
   MISSIONS DROPDOWN (★ MISSIONS in topbar)
   ============================================================ */
.missions-wrapper { position: relative; display: inline-block; }
#btnMissions {
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 700;
}
#btnMissions[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--glow);
}
.missions-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  z-index: 150;
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--accent), var(--glow);
  animation: modal-in 0.12s ease;
}
.missions-popover.hidden { display: none; }
.missions-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 0.2em;
}
.missions-popover-hint { color: var(--text-faint); font-size: 8px; }
.missions-list { display: flex; flex-direction: column; padding: 4px 0; }
.missions-empty {
  padding: 16px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.12em;
}
.mission-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 14px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.1s ease, border-left-color 0.1s ease;
}
.mission-row:hover, .mission-row.active {
  background: var(--bg-2);
  border-left-color: var(--mission-accent, var(--accent));
}
.mission-row .mission-icon {
  font-size: 16px;
  color: var(--mission-accent, var(--accent));
  text-align: center;
  text-shadow: 0 0 8px var(--mission-accent, var(--accent));
}
.mission-row .mission-text { display: flex; flex-direction: column; min-width: 0; }
.mission-row .mission-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
}
.mission-row .mission-blurb {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   COMMAND PALETTE (Cmd+K)
   ============================================================ */
.palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 4, 2, 0.78);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
}
.palette-backdrop.hidden { display: none; }
.palette {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  width: min(640px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--accent), var(--glow);
  animation: modal-in 0.15s ease;
}
.palette-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.palette-prompt {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--accent);
  text-shadow: var(--glow);
}
.palette-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.04em;
}
.palette-input::placeholder { color: var(--text-faint); }
.palette-hint {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 0.15em;
  border: 1px solid var(--border);
  padding: 3px 6px;
  border-radius: 2px;
}
.palette-results {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.palette-empty {
  padding: 24px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
}
.palette-group {
  padding: 6px 14px 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.palette-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.1s ease;
}
.palette-result:hover,
.palette-result.active {
  background: var(--bg-2);
  border-left-color: var(--accent);
}
.palette-result-type {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--text-faint);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
  min-width: 56px;
  text-align: center;
}
.palette-result-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-result-sub {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.palette-footer {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
}
.palette-footer kbd {
  display: inline-block;
  padding: 1px 5px;
  margin-right: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  width: min(720px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--accent);
  animation: modal-in 0.2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.modal-header h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-shadow: var(--glow);
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}

.config-section h3 {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.config-section h3 .hint {
  font-weight: 400;
  font-size: 9px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  margin-left: 6px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px;
}
.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-dim);
  transition: all 0.15s ease;
}
.toggle:hover { border-color: var(--accent); color: var(--text); }
.toggle input { accent-color: var(--accent); }
.toggle input:checked + span { color: var(--accent); }

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  font-weight: 700;
  transition: all 0.15s ease;
}
.theme-card:hover { border-color: var(--accent); color: var(--text); }
.theme-card.active { border-color: var(--accent); color: var(--accent); box-shadow: var(--glow); }
.theme-swatch {
  width: 100%;
  height: 36px;
  border-radius: 2px;
  border: 1px solid var(--border);
}

.seg-control {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.seg {
  background: var(--bg-2);
  border: 0;
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.seg:last-child { border-right: 0; }
.seg:hover { color: var(--accent); }
.seg.active { background: var(--accent); color: var(--bg-0); font-weight: 700; }

.text-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  border-radius: 2px;
  outline: none;
}
.text-input:focus { border-color: var(--accent); box-shadow: var(--glow); }

/* ============================================================
   GLOW TOGGLES
   ============================================================ */
body.no-glow .brand-mark,
body.no-glow .panel-icon,
body.no-glow .accent,
body.no-glow .control-input:focus,
body.no-glow .btn-ghost:hover,
body.no-glow .icon-btn:hover,
body.no-glow .modal,
body.no-glow .modal-header h2 {
  text-shadow: none;
  box-shadow: none;
}

body.no-rain #matrixRain { display: none; }

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
