/* ═══════════════════════════════════════════════════
   WorldMonitor Local — Dark Intelligence Theme
════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --bg-primary:    #070b0f;
  --bg-secondary:  #0d1117;
  --bg-panel:      #111820;
  --bg-panel-hov:  #16202b;
  --bg-header:     #0a0f15;
  --bg-card:       #131c26;
  --bg-input:      #0e1620;

  --border:        #1e2d3d;
  --border-bright: #243547;
  --divider:       rgba(255,255,255,0.04);

  --text-primary:  #e4eaf0;
  --text-secondary:#8fa3b8;
  --text-muted:    #4d6070;
  --text-accent:   #00d4ff;
  --text-link:     #38bdf8;

  --accent-blue:   #0ea5e9;
  --accent-cyan:   #00d4ff;
  --accent-green:  #10b981;
  --accent-yellow: #f59e0b;
  --accent-orange: #f97316;
  --accent-red:    #ef4444;
  --accent-purple: #a855f7;

  --sev-critical:  #ff2a2a;
  --sev-high:      #ff8800;
  --sev-medium:    #f59e0b;
  --sev-low:       #22d3ee;
  --sev-info:      #6b7280;

  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", "Consolas", "DejaVu Sans Mono", monospace;
  --font-sans: "Inter", "Segoe UI", "SF Pro Display", system-ui, sans-serif;

  --radius-sm: 3px;
  --radius:    6px;
  --radius-lg: 10px;

  --sidebar-w: 320px;
  --header-h:  48px;
  --transition: 0.15s ease;

  --shadow: 0 2px 12px rgba(0,0,0,0.5);
  --glow-cyan: 0 0 12px rgba(0,212,255,0.25);
}

[data-theme="light"] {
  --bg-primary:    #f0f4f8;
  --bg-secondary:  #e8edf3;
  --bg-panel:      #ffffff;
  --bg-panel-hov:  #f5f8fb;
  --bg-header:     #1a2840;
  --bg-card:       #ffffff;
  --bg-input:      #f3f6f9;
  --border:        #d1dce7;
  --border-bright: #b8ccd8;
  --divider:       rgba(0,0,0,0.06);
  --text-primary:  #1a2840;
  --text-secondary:#4a5568;
  --text-muted:    #9aaaba;
  --text-accent:   #0284c7;
  --text-link:     #0369a1;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-family: var(--font-sans); background: var(--bg-primary); color: var(--text-primary); font-size: 13px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ════════════════════════════════════════
   HEADER
═════════════════════════════════════════ */
.header {
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  gap: 12px;
}

.header-left { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.logo { display: flex; align-items: center; gap: 7px; font-family: var(--font-mono); }
.logo-icon { font-size: 18px; color: var(--accent-cyan); filter: drop-shadow(0 0 6px var(--accent-cyan)); }
.logo-text { font-size: 13px; font-weight: 700; letter-spacing: 2px; color: var(--text-primary); }
.logo-accent { color: var(--accent-cyan); }
.logo-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 1px 5px;
  background: rgba(0,212,255,0.12);
  border: 1px solid rgba(0,212,255,0.3);
  color: var(--accent-cyan);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}
.header-time { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); letter-spacing: 0.5px; }

.header-nav { display: flex; gap: 4px; }
.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-mono);
}
.nav-btn:hover { color: var(--text-primary); background: var(--bg-panel); border-color: var(--border); }
.nav-btn.active { color: var(--accent-cyan); border-color: rgba(0,212,255,0.4); background: rgba(0,212,255,0.06); }

.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.status-indicators { display: flex; gap: 5px; }
.status-dot {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: default;
  transition: var(--transition);
}
.status-dot.ok    { color: var(--accent-green);  border-color: rgba(16,185,129,0.4);  background: rgba(16,185,129,0.07);  }
.status-dot.err   { color: var(--sev-critical);   border-color: rgba(255,42,42,0.4);   background: rgba(255,42,42,0.07);   }
.status-dot.loading { color: var(--accent-yellow); border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.07);  }

.btn-icon {
  width: 28px; height: 28px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { color: var(--text-primary); border-color: var(--border-bright); }

/* ════════════════════════════════════════
   MAIN LAYOUT
═════════════════════════════════════════ */
.main-layout {
  display: grid;
  grid-template-columns: auto 1fr auto;
  height: calc(100vh - var(--header-h));
  margin-top: var(--header-h);
  overflow: hidden;
}

/* ════════════════════════════════════════
   MAP SHADERS
═════════════════════════════════════════ */
.map-container.shader-crt::after {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 4px, 3px 100%;
  pointer-events: none;
  z-index: 1001;
  opacity: 0.6;
}
.map-container.shader-crt {
  filter: contrast(1.2) brightness(1.1) sepia(0.2);
}

.map-container.shader-nvg {
  filter: sepia(1) hue-rotate(60deg) saturate(4) brightness(0.8) contrast(1.5);
}
.map-container.shader-nvg::after {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.4) 100%), url('https://www.transparenttextures.com/patterns/stardust.png');
  pointer-events: none;
  z-index: 1001;
  opacity: 0.3;
}

.map-container.shader-flir {
  filter: invert(1) grayscale(1) contrast(2) brightness(0.9);
}
.map-container.shader-flir .leaflet-tile-container {
  filter: blur(0.5px);
}

/* ════════════════════════════════════════
   SIDEBAR
═════════════════════════════════════════ */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  transition: width 0.22s ease, min-width 0.22s ease,
              border-width 0.22s ease, opacity 0.22s ease;
}
.sidebar-right { border-right: none; border-left: 1px solid var(--border); }

/* Collapsed sidebar state */
.sidebar.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border-color: transparent !important;
  opacity: 0;
}

/* Sidebar-ear toggle buttons (always visible on map edges) */
.sidebar-ear {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 600;
  width: 18px;
  height: 64px;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition),
              box-shadow var(--transition);
  padding: 0;
  flex-shrink: 0;
}
.sidebar-ear:hover {
  background: var(--bg-panel-hov);
  color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
}
.left-ear  {
  left: 0;
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.right-ear {
  right: 0;
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* ════════════════════════════════════════
   FULLSCREEN / CINEMA MODE
═════════════════════════════════════════ */
body.cinema-mode .header {
  transform: translateY(-100%);
  transition: transform 0.25s ease;
}
body.cinema-mode .main-layout {
  margin-top: 0;
  height: 100vh;
  transition: margin-top 0.25s ease, height 0.25s ease;
}
.header { transition: transform 0.25s ease; }

/* Fullscreen button active state */
#fullscreen-btn.active {
  color: var(--accent-cyan);
  text-shadow: 0 0 8px var(--accent-cyan);
}

/* ════════════════════════════════════════
   PANELS
═════════════════════════════════════════ */
.panel {
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.panel-compact .panel-body { max-height: 120px; }

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
}
.panel-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  text-transform: uppercase;
  flex: 1;
}
.panel-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-muted);
  min-width: 22px;
  text-align: center;
}

/* ════════════════════════════════════════
   AVIATION CANVAS
═════════════════════════════════════════ */
#aviation-canvas {
  pointer-events: auto;
  z-index: 1001;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Ensure leaflet panes don't overlap in a way that hides the canvas */
.leaflet-overlay-pane {
  z-index: 400 !important;
}

.leaflet-marker-pane {
  z-index: 600 !important;
}

/* Pulse markers for low zoom */
@keyframes pulse-ring {
  0% { transform: scale(0.33); opacity: 0.7; }
  80%, 100% { transform: scale(1.2); opacity: 0; }
}
.panel-badge.has-data { color: var(--accent-cyan); border-color: rgba(0,212,255,0.3); }

.panel-filters {
  display: flex;
  gap: 4px;
  padding: 5px 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-btn {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover { color: var(--text-primary); }
.filter-btn.active { color: var(--accent-cyan); border-color: rgba(0,212,255,0.4); background: rgba(0,212,255,0.07); }

.panel-controls { margin-left: auto; }
.mini-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.panel-body {
  overflow-y: auto;
  max-height: 220px;
  flex: 1;
}

/* ════════════════════════════════════════
   MAP
═════════════════════════════════════════ */
.map-container {
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

#map {
  width: 100%;
  height: calc(100% - 0px);
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Leaflet dark tiles hack */
.leaflet-tile { filter: brightness(0.88) saturate(0.75) hue-rotate(180deg) invert(0.85); }
[data-theme="light"] .leaflet-tile { filter: none; }
.leaflet-container { background: #0a0e14; }

/* Leaflet popup dark style */
.leaflet-popup-content-wrapper {
  background: var(--bg-panel) !important;
  border: 1px solid var(--border-bright) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.7) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
}
.leaflet-popup-tip { background: var(--bg-panel) !important; }
.leaflet-popup-close-button { color: var(--text-muted) !important; top: 6px !important; right: 8px !important; }

.popup-content h4 { color: var(--accent-cyan); font-size: 13px; margin-bottom: 6px; }
.popup-content p { color: var(--text-secondary); margin: 3px 0; font-size: 11px; }
.popup-content .popup-sev { font-weight: 700; }
.popup-content .sev-critical { color: var(--sev-critical); }
.popup-content .sev-high     { color: var(--sev-high); }
.popup-content .sev-medium   { color: var(--sev-medium); }
.popup-content .sev-low      { color: var(--sev-low); }
.popup-content .sev-info     { color: var(--sev-info); }

.map-controls {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,212,255,0.3) transparent;
}
.layer-group { display: flex; flex-wrap: wrap; gap: 4px; max-width: 300px; }
.layer-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  background: rgba(10,14,20,0.85);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}
.layer-btn:hover { color: var(--text-primary); }
.layer-btn.active { color: var(--accent-cyan); border-color: rgba(0,212,255,0.5); background: rgba(0,212,255,0.1); }

/* ── Basemap switcher row ─────────────────────────────── */
.basemap-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.basemap-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 7px;
  background: rgba(10,14,20,0.85);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}
.basemap-btn:hover { color: var(--text-primary); }
/* Active basemap uses amber/gold accent instead of cyan */
.basemap-btn.active {
  color: #f59e0b;
  border-color: rgba(245,158,11,0.55);
  background: rgba(245,158,11,0.12);
}

.region-presets {
  position: absolute;
  bottom: 38px; left: 12px;
  z-index: 500;
  display: flex;
  gap: 4px;
}
.region-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  background: rgba(10,14,20,0.85);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
}
.region-btn:hover { color: var(--text-primary); border-color: var(--border-bright); }

.map-stats-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 28px;
  background: rgba(7,11,15,0.88);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  z-index: 500;
  backdrop-filter: blur(8px);
}
.map-stats-bar span { letter-spacing: 0.3px; }

/* ════════════════════════════════════════
   LIST ITEMS — Signals / Earthquakes etc.
═════════════════════════════════════════ */
.signal-item, .eq-item, .disaster-item, .news-item, .fire-item {
  display: flex;
  flex-direction: column;
  padding: 7px 10px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: background var(--transition);
  gap: 2px;
}
.signal-item:hover, .eq-item:hover, .disaster-item:hover, .news-item:hover, .fire-item:hover {
  background: var(--bg-panel-hov);
}

.item-row { display: flex; align-items: center; gap: 6px; }
.item-title {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.item-meta { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

.sev-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  flex-shrink: 0;
}
.sev-badge.critical { background: rgba(255,42,42,0.15);  color: var(--sev-critical);  border: 1px solid rgba(255,42,42,0.3); }
.sev-badge.high     { background: rgba(255,136,0,0.15);  color: var(--sev-high);      border: 1px solid rgba(255,136,0,0.3); }
.sev-badge.medium   { background: rgba(245,158,11,0.1);  color: var(--sev-medium);    border: 1px solid rgba(245,158,11,0.3); }
.sev-badge.low      { background: rgba(34,211,238,0.08); color: var(--sev-low);       border: 1px solid rgba(34,211,238,0.25); }
.sev-badge.info     { background: rgba(107,114,128,0.1); color: var(--sev-info);      border: 1px solid rgba(107,114,128,0.3); }

.mag-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  min-width: 36px;
  text-align: center;
}
.mag-badge.mag-critical { background: rgba(255,42,42,0.15);  color: var(--sev-critical);  }
.mag-badge.mag-high     { background: rgba(255,136,0,0.15);  color: var(--sev-high);      }
.mag-badge.mag-medium   { background: rgba(245,158,11,0.1);  color: var(--sev-medium);    }
.mag-badge.mag-low      { background: rgba(34,211,238,0.08); color: var(--sev-low);       }

/* ════════════════════════════════════════
   NEWS ITEMS
═════════════════════════════════════════ */
.news-item { gap: 4px; }
.news-source-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: rgba(14,165,233,0.1);
  border: 1px solid rgba(14,165,233,0.25);
  color: var(--accent-blue);
  text-transform: uppercase;
  flex-shrink: 0;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.news-item a { color: inherit; text-decoration: none; }
.news-item a:hover .item-title { color: var(--text-link); }

/* ════════════════════════════════════════
   MARKETS
═════════════════════════════════════════ */
.market-item {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--divider);
  gap: 8px;
  transition: background var(--transition);
}
.market-item:hover { background: var(--bg-panel-hov); }
.market-name { flex: 1; font-size: 12px; color: var(--text-secondary); }
.market-ticker { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.market-price { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--text-primary); }
.market-change {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  min-width: 52px;
  text-align: right;
}
.market-change.up   { color: var(--accent-green); }
.market-change.down { color: var(--sev-critical); }
.market-change.flat { color: var(--text-muted); }

.fg-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 10px;
  gap: 8px;
}
.fg-number {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
}
.fg-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.fg-bar-track { width: 100%; height: 6px; background: var(--bg-card); border-radius: 99px; overflow: hidden; }
.fg-bar-fill { height: 100%; border-radius: 99px; transition: width 0.4s ease; }
.fg-extreme-fear  { color: var(--sev-critical); }
.fg-fear          { color: var(--sev-high); }
.fg-neutral       { color: var(--sev-medium); }
.fg-greed         { color: var(--accent-green); }
.fg-extreme-greed { color: var(--accent-cyan); }

/* ════════════════════════════════════════
   CYBER THREATS
═════════════════════════════════════════ */
.threat-item {
  padding: 6px 10px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.threat-group {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--sev-critical);
}
.threat-victim { font-size: 12px; color: var(--text-primary); }
.threat-meta   { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.threat-ip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sev-high);
  letter-spacing: 0.3px;
}

/* ════════════════════════════════════════
   ALTERNATE VIEWS
═════════════════════════════════════════ */
.view-panel {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: var(--bg-primary);
  overflow-y: auto;
  z-index: 100;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.view-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.view-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.view-header .last-updated { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); margin-left: auto; }

/* News Grid */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
  align-content: start;
}
.news-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  text-decoration: none;
  color: inherit;
}
.news-card:hover { border-color: var(--border-bright); box-shadow: var(--shadow); }
.news-card.sev-critical { border-left: 3px solid var(--sev-critical); }
.news-card.sev-high     { border-left: 3px solid var(--sev-high); }
.news-card.sev-medium   { border-left: 3px solid var(--sev-medium); }
.news-card.sev-low      { border-left: 3px solid var(--sev-low); }
.news-card.sev-info     { border-left: 3px solid var(--border); }
.news-card-title { font-size: 13px; font-weight: 600; line-height: 1.45; color: var(--text-primary); }
.news-card-desc  { font-size: 11px; color: var(--text-muted); line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.news-card-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.news-card-source { font-family: var(--font-mono); font-size: 9px; color: var(--accent-blue); text-transform: uppercase; letter-spacing: 0.5px; }
.news-card-time   { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); margin-left: auto; }

/* Markets Layout */
.markets-layout { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; align-content: start; }
.markets-col h3 { font-size: 12px; font-family: var(--font-mono); color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }

.markets-table { width: 100%; border-collapse: collapse; }
.markets-table th { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); letter-spacing: 0.8px; text-transform: uppercase; padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.markets-table td { padding: 7px 8px; border-bottom: 1px solid var(--divider); font-size: 12px; }
.markets-table tr:hover td { background: var(--bg-panel-hov); }
.markets-table td.ticker { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.markets-table td.price  { font-family: var(--font-mono); font-weight: 700; }
.markets-table td.chg.up   { color: var(--accent-green); font-family: var(--font-mono); font-weight: 700; }
.markets-table td.chg.down { color: var(--sev-critical);  font-family: var(--font-mono); font-weight: 700; }

/* Threats layout */
.threats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; align-content: start; }
.threat-col {}
.threat-col--apt { min-width: 280px; display: flex; flex-direction: column; gap: 0; }
.threat-h3 { font-size: 12px; font-family: var(--font-mono); color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.threats-full-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.threats-full-table th { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.8px; }
.threats-full-table td { padding: 6px 8px; border-bottom: 1px solid var(--divider); font-size: 11px; font-family: var(--font-mono); }
.threats-full-table tr:hover td { background: var(--bg-panel-hov); }

/* APT Search */
.apt-search-wrap {
  margin: 8px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.apt-search-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  padding: 7px 10px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.apt-search-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(14,165,233,0.15);
}
.apt-search-count {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: right;
}
.apt-results {
  flex: 1;
  overflow-y: auto;
  max-height: 480px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
}
.apt-results::-webkit-scrollbar { width: 4px; }
.apt-results::-webkit-scrollbar-track { background: transparent; }
.apt-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.apt-loading {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 12px 4px;
  text-align: center;
}
.apt-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.apt-item:hover {
  border-color: var(--accent-blue);
  background: var(--bg-panel-hov);
}
.apt-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.apt-item-name {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.apt-item-sev {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}
.apt-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.apt-item-country {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-weight: 700;
}
.apt-item-alias {
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  padding: 6px 12px;
  cursor: pointer;
  margin-right: 6px;
  margin-top: 4px;
  transition: border-color 0.12s, background 0.12s;
}
.modal-action-btn:hover {
  border-color: var(--accent-blue);
  background: var(--bg-panel-hov);
}

/* Infra grid */
.infra-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; align-content: start; }
.infra-col h3 { font-size: 12px; font-family: var(--font-mono); color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.infra-table  { width: 100%; border-collapse: collapse; }
.infra-table th { font-family: var(--font-mono); font-size: 9px; color: var(--text-muted); padding: 4px 8px; text-align: left; border-bottom: 1px solid var(--border); text-transform: uppercase; }
.infra-table td { padding: 6px 8px; border-bottom: 1px solid var(--divider); font-size: 11px; }
.infra-table tr:hover td { background: var(--bg-panel-hov); }

.chokepoint-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chokepoint-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.chokepoint-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); display: flex; gap: 12px; }

.climate-item { padding: 7px 0; border-bottom: 1px solid var(--divider); display: flex; flex-direction: column; gap: 3px; }
.climate-zone { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.climate-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.climate-anomaly { font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.8px; padding: 1px 5px; border-radius: var(--radius-sm); }
.climate-anomaly.extreme { background: rgba(255,42,42,0.1); color: var(--sev-critical); border: 1px solid rgba(255,42,42,0.3); }
.climate-anomaly.normal  { background: rgba(16,185,129,0.08); color: var(--accent-green); border: 1px solid rgba(16,185,129,0.25); }

/* ════════════════════════════════════════
   MODAL
═════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  width: min(600px, 94vw);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8);
}
.modal-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  z-index: 5;
}
.modal-title { font-size: 14px; font-weight: 700; color: var(--text-primary); flex: 1; }
.modal-close {
  width: 26px; height: 26px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text-primary); border-color: var(--border-bright); }
.modal-body { padding: 16px; }

.modal-detail-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--divider); }
.modal-detail-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; min-width: 100px; margin-top: 1px; }
.modal-detail-value { font-size: 12px; color: var(--text-primary); flex: 1; word-break: break-word; }

/* ════════════════════════════════════════
   TOAST
═════════════════════════════════════════ */
.toast-container { position: fixed; bottom: 40px; right: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast {
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
  max-width: 320px;
  font-family: var(--font-mono);
}
.toast.ok   { border-left: 3px solid var(--accent-green); }
.toast.err  { border-left: 3px solid var(--sev-critical); }
.toast.info { border-left: 3px solid var(--accent-cyan); }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ════════════════════════════════════════
   LOADING / MISC
═════════════════════════════════════════ */
.loading-pulse {
  padding: 14px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.empty-state {
  padding: 20px 10px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ════════════════════════════════════════
   SCROLLBAR VISIBILITY
═════════════════════════════════════════ */
.news-panel { max-height: 500px; }

/* ════════════════════════════════════════
   RESPONSIVE
═════════════════════════════════════════ */
@media (max-width: 1200px) {
  :root { --sidebar-w: 270px; }
}
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { width: 0; min-width: 0; opacity: 0; border-color: transparent; }
  .header-nav .nav-btn span { display: none; }
}

/* ════════════════════════════════════════
   LEAFLET MARKER CLUSTERS DARK OVERRIDE
═════════════════════════════════════════ */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
  background-color: rgba(0,212,255,0.18) !important;
}
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
  background-color: rgba(0,212,255,0.32) !important;
  color: #fff !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

/* Country boundary hover */
.leaflet-interactive:hover { cursor: pointer; }

/* ════════════════════════════════════════
   DATA FRESHNESS BAR
═════════════════════════════════════════ */
.data-freshness {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.freshness-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-green); animation: blink 2s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ═══════════════════════════════════════════════════
   BLOOMBERG TERMINAL STYLES
════════════════════════════════════════════════════ */
.bb-ticker-wrap {
  background: #000;
  border-bottom: 1px solid #fbbf24;
  overflow: hidden;
  height: 28px;
  display: flex;
  align-items: center;
}
.bb-ticker {
  display: inline-flex;
  gap: 0;
  white-space: nowrap;
  animation: ticker-scroll 60s linear infinite;
  font-family: var(--font-mono);
  font-size: 11px;
}
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.tape-item { padding: 0 12px; display: inline-flex; gap: 6px; align-items: center; }
.tape-name  { color: #94a3b8; font-size: 10px; text-transform: uppercase; }
.tape-price { color: #e4eaf0; font-weight: 600; }
.tape-chg   { font-weight: 700; }
.tape-sep   { color: #1e2d3d; }

.bb-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #080808;
  border-bottom: 1px solid #1a2535;
}

.bb-layout {
  display: flex;
  gap: 8px;
  padding: 8px;
  overflow: auto;
  flex: 1;
  background: var(--bg-primary);
}
.bb-col { overflow-y: auto; padding: 4px; }
.bb-col-wide  { flex: 3; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.bb-col-narrow { flex: 1; min-width: 220px; }

.bb-section { min-width: 260px; background: #0d1117; border: 1px solid #1e2d3d; border-radius: 4px; padding: 8px; }
.bb-section-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #fbbf24;
  text-transform: uppercase;
  margin-bottom: 6px;
  border-bottom: 1px solid #1e2d3d;
  padding-bottom: 4px;
}
.bb-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 11px; }
.bb-table th { color: #4d6070; font-size: 9px; letter-spacing: 1px; padding: 3px 6px; border-bottom: 1px solid #1e2d3d; text-align: right; }
.bb-table th:first-child { text-align: left; }
.bb-table td { padding: 3px 6px; border-bottom: 1px solid #0d1117; text-align: right; }
.bb-table td:first-child { text-align: left; color: #cbd5e1; }
.bb-table tr:hover td { background: #111820; }
.bb-up   td:nth-child(3) { color: #4ade80; font-weight: 600; }
.bb-down td:nth-child(3) { color: #ef4444; font-weight: 600; }
.bb-flat td:nth-child(3) { color: #94a3b8; }
.bb-up   td:nth-child(4) { color: #4ade80; }
.bb-down td:nth-child(4) { color: #ef4444; }
.bb-up   td:nth-child(5) { color: #86efac; }
.bb-down td:nth-child(5) { color: #fca5a5; }

/* Fear & Greed gauge */
.fg-gauge { display: flex; justify-content: center; padding: 8px 0 0; }
.fg-history { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.fg-day { font-size: 11px; font-family: var(--font-mono); text-align: center; font-weight: 700; line-height: 1.4; }


/* ── Bloomberg Tab System ──────────────────────────────── */
.bb-tabs {
  display: flex;
  gap: 2px;
  background: #050a0f;
  border-bottom: 2px solid #fbbf24;
  padding: 0 8px;
  flex-wrap: wrap;
}
.bb-tab {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 14px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  text-transform: uppercase;
}
.bb-tab:hover { color: #e2e8f0; }
.bb-tab.active { color: #fbbf24; border-bottom-color: #fbbf24; background: rgba(251,191,36,0.06); }

.bb-tab-panel {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-primary);
}

/* Stock search bar in header */
.bb-search-row {
  display: flex;
  gap: 4px;
  flex: 1;
  max-width: 300px;
}
.bb-search-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: #0d1117;
  border: 1px solid #1e2d3d;
  color: #e4eaf0;
  padding: 4px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  outline: none;
  letter-spacing: 1px;
}
.bb-search-input:focus { border-color: #fbbf24; }
.bb-search-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  background: #fbbf24;
  color: #000;
  border: none;
  cursor: pointer;
  border-radius: 3px;
  letter-spacing: 1px;
}
.bb-search-btn:hover { background: #fcd34d; }

/* Price hero in stock detail */
.bb-price-hero { display: flex; align-items: baseline; gap: 8px; margin: 8px 0; }
.bb-price-big { font-size: 1.8rem; font-weight: 700; color: #e4eaf0; font-family: var(--font-mono); }

/* Options chain header badges */
.bb-options-header {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 4px 8px;
  margin-bottom: 4px;
  border-radius: 3px;
}
.bb-options-header.bb-up   { background: rgba(74,222,128,0.1); color: #4ade80; }
.bb-options-header.bb-down { background: rgba(239,68,68,0.1); color: #ef4444; }

/* Empty state */
.bb-empty {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #4d6070;
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed #1e2d3d;
  border-radius: 4px;
  margin: 16px;
}

/* General up/down row coloring (no td:nth override) */
.bb-up   { color: #4ade80; }
.bb-down { color: #ef4444; }

/* Yield bar rows */
tr td .yield-bar { vertical-align: middle; margin-right: 4px; }

/* view-markets override for flex column */
#view-markets { flex-direction: column !important; overflow: hidden; height: 100%; }

/* ──────────────────────────────────────────────────────────
   SATELLITE ICONS
────────────────────────────────────────────────────────── */
.sat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.4);
  transition: transform 0.2s;
}
.sat-dot:hover { transform: scale(1.8); }
.sat-iss { font-size: 18px; line-height: 1; filter: drop-shadow(0 0 6px #facc15); }

/* ──────────────────────────────────────────────────────────
   SHIP ICONS
────────────────────────────────────────────────────────── */
.ship-icon-wrap {
  position: relative;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
}
.ship-emoji { font-size: 13px; line-height: 1; }
.ship-arrow-dir {
  position: absolute;
  font-size: 9px;
  line-height: 1;
  bottom: -4px; right: -4px;
  transform-origin: center;
  font-weight: 900;
  text-shadow: 0 0 3px currentColor;
}
/* Legacy fallback */
.ship-arrow {
  font-size: 14px; line-height: 1; display: inline-block;
  transform-origin: center center; text-shadow: 0 0 4px currentColor;
}
/* High-zoom (≥10) directional icon with name label */
.ship-icon-hi {
  display: flex; flex-direction: column; align-items: center;
  gap: 1px;
}
.ship-hi-arrow {
  font-size: 13px; line-height: 1; font-weight: 900;
  color: var(--sc, #94a3b8);
  text-shadow: 0 0 5px var(--sc, #94a3b8), 0 0 1px #000;
  transform-origin: center;
}
.ship-hi-label {
  font-size: 8px; font-family: var(--font-mono);
  color: #fff; background: rgba(0,0,0,0.6);
  padding: 0 2px; border-radius: 2px;
  white-space: nowrap; max-width: 66px;
  overflow: hidden; text-overflow: ellipsis;
  text-transform: uppercase; letter-spacing: 0.03em;
}
/* Layer button loading pulse */
.layer-btn[data-loading] {
  opacity: 0.55;
  animation: layer-loading 0.85s infinite ease-in-out;
}
@keyframes layer-loading {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 1; border-color: var(--accent-cyan); }
}

/* ──────────────────────────────────────────────────────────
   ALWAYS-ACTIVE LAYER BUTTON (Countries)
────────────────────────────────────────────────────────── */
.layer-btn.always-active {
  opacity: 0.65;
  cursor: default !important;
  pointer-events: none;
  border-style: solid;
}

/* ──────────────────────────────────────────────────────────
   RANSOMWARE GROUP DETAIL MODAL
────────────────────────────────────────────────────────── */
.rw-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.rw-modal-box {
  background: var(--bg-panel, #18181b);
  border: 1px solid var(--border, #27272a);
  border-radius: 10px;
  width: min(720px, 95vw);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.6);
}
.rw-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, #27272a);
  background: var(--bg-header, #09090b);
  font-size: 14px;
  font-weight: 700;
  color: var(--sev-critical, #ef4444);
}
.rw-modal-close {
  background: transparent;
  border: 1px solid var(--border, #27272a);
  color: var(--text-muted, #71717a);
  border-radius: 4px;
  width: 26px; height: 26px;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.rw-modal-close:hover { background: #ef444422; color: #ef4444; }
.rw-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}
.rw-detail-section {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border, #27272a);
}
.rw-detail-section:last-child { border-bottom: none; margin-bottom: 0; }
.rw-stat-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.rw-stat {
  background: var(--bg-card, #27272a);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
}
.rw-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rw-tag {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.rw-tag-sector {
  background: rgba(251,191,36,0.12);
  border-color: rgba(251,191,36,0.3);
  color: #fcd34d;
}
.rw-group-link:hover {
  text-decoration: underline;
  color: var(--sev-critical, #ef4444) !important;
}

/* ──────────────────────────────────────────────────────────
   FLOATING AI PANEL (FAB + Chat)
────────────────────────────────────────────────────────── */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 8000;
  font-size: 22px;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid rgba(255,255,255,0.15);
  user-select: none;
}
.ai-fab:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(99,102,241,0.7); }
.ai-fab.ai-fab-open { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); box-shadow: 0 4px 20px rgba(239,68,68,0.5); }

.ai-floating-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 400px;
  max-height: 72vh;
  background: var(--bg-panel, #18181b);
  border: 1px solid var(--border, #27272a);
  border-radius: 14px;
  z-index: 7999;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(99,102,241,0.2);
  overflow: hidden;
  animation: aiPanelIn 0.2s ease;
}
@keyframes aiPanelIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 480px) {
  .ai-floating-panel { width: calc(100vw - 32px); right: 16px; bottom: 84px; }
  .ai-fab { bottom: 16px; right: 16px; }
}

.ai-fp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(90deg, #1e1e2e, #1a1a2e);
  border-bottom: 1px solid var(--border, #27272a);
}
.ai-fp-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
}
.ai-fp-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(59,130,246,0.2);
  color: #60a5fa;
  border: 1px solid rgba(59,130,246,0.3);
  font-family: monospace;
  letter-spacing: 0.5px;
}
.ai-fp-btns { display: flex; gap: 4px; }
.ai-fp-btn {
  background: transparent;
  border: 1px solid var(--border, #27272a);
  color: var(--text-muted, #71717a);
  border-radius: 4px;
  width: 26px; height: 26px;
  cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.ai-fp-btn:hover { background: rgba(239,68,68,0.15); color: #ef4444; }

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
  max-height: 45vh;
  scroll-behavior: smooth;
}
.ai-chat-messages::-webkit-scrollbar { width: 4px; }
.ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 2px; }

.ai-msg { display: flex; }
.ai-msg-inner { display: flex; gap: 8px; align-items: flex-start; max-width: 100%; }
.ai-msg-user  { justify-content: flex-end; }
.ai-msg-user .ai-msg-inner { flex-direction: row-reverse; }
.ai-msg-assistant .ai-msg-inner {}

.ai-role { font-size: 16px; flex-shrink: 0; margin-top: 2px; }
.ai-text {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary, #cbd5e1);
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--bg-card, #27272a);
  word-break: break-word;
}
.ai-msg-user .ai-text {
  background: rgba(59,130,246,0.18);
  color: #e2e8f0;
  border-bottom-right-radius: 3px;
}
.ai-msg-assistant .ai-text { border-bottom-left-radius: 3px; }
.ai-text strong { color: var(--text-primary, #f1f5f9); }
.ai-text em { color: #94a3b8; font-style: italic; }
.ai-text code { background: #1e293b; padding: 1px 4px; border-radius: 3px; font-size: 11px; }

.ai-thinking {
  display: flex; gap: 4px; align-items: center;
  padding: 10px 14px;
  background: var(--bg-card, #27272a);
  border-radius: 10px; border-bottom-left-radius: 3px;
  width: fit-content;
}
.ai-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #60a5fa;
  animation: aiDotBounce 1.2s ease-in-out infinite;
}
.ai-dot:nth-child(2) { animation-delay: 0.2s; background: #818cf8; }
.ai-dot:nth-child(3) { animation-delay: 0.4s; background: #a78bfa; }
@keyframes aiDotBounce {
  0%,80%,100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-6px); opacity: 1; }
}

.ai-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 12px;
  border-top: 1px solid var(--border, #27272a);
  background: rgba(0,0,0,0.2);
}
.ai-quick {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  color: #93c5fd;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.ai-quick:hover { background: rgba(59,130,246,0.25); border-color: rgba(59,130,246,0.5); color: #fff; }

.ai-chat-input-row {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--border, #27272a);
  background: rgba(0,0,0,0.3);
}
.ai-input {
  flex: 1;
  background: var(--bg-card, #27272a);
  border: 1px solid var(--border, #3f3f46);
  color: var(--text-primary, #f1f5f9);
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.ai-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.ai-send-btn {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: opacity 0.15s;
}
.ai-send-btn:hover { opacity: 0.85; }

/* ── Bloomberg Terminal — New Components ───────────────────────── */
.bb-select {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}
.bb-select:focus { outline: none; border-color: #fbbf24; }

/* Sector Heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  padding: 8px 0;
}
.heatmap-cell {
  padding: 14px 12px;
  border-radius: 6px;
  cursor: default;
  transition: transform 0.15s, filter 0.15s;
  border: 1px solid rgba(255,255,255,0.06);
}
.heatmap-cell:hover { transform: scale(1.03); filter: brightness(1.15); }
.heatmap-sector { font-size: 0.8rem; font-weight: 600; margin-bottom: 2px; }
.heatmap-etf    { opacity: 0.65; }
.heatmap-chg    { margin-top: 4px; }
.heatmap-price  { margin-top: 2px; }

/* ═══════════════════════════════════════════════════
   BOOT LOADING SCREEN
════════════════════════════════════════════════════ */

/* Full-screen overlay */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #02060a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.8s ease;
}
#boot-screen.boot-fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ── Background animated grid ── */
.boot-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: boot-grid-drift 20s linear infinite;
}
@keyframes boot-grid-drift {
  0%   { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}

/* Radial vignette over the grid */
#boot-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, transparent 30%, #02060a 100%);
  pointer-events: none;
}

/* ── Scan-line sweep ── */
.boot-scanline {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,0.5), transparent);
  animation: boot-scan 4s linear infinite;
  pointer-events: none;
}
@keyframes boot-scan {
  0%   { top: 0%; opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 0.6; }
  100% { top: 100%; opacity: 0; }
}

/* ── Corner decorations ── */
.boot-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  opacity: 0.55;
}
.boot-corner-tl { top: 20px; left: 20px;   border-top: 2px solid #00d4ff;  border-left:  2px solid #00d4ff; }
.boot-corner-tr { top: 20px; right: 20px;  border-top: 2px solid #00d4ff;  border-right: 2px solid #00d4ff; }
.boot-corner-bl { bottom: 20px; left: 20px;  border-bottom: 2px solid #00d4ff; border-left:  2px solid #00d4ff; }
.boot-corner-br { bottom: 20px; right: 20px; border-bottom: 2px solid #00d4ff; border-right: 2px solid #00d4ff; }

/* ── Centered content ── */
.boot-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  z-index: 1;
  animation: boot-center-in 0.9s ease both;
}
@keyframes boot-center-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ── Logo rings ── */
.boot-logo-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.boot-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(0,212,255,0.35);
}
.boot-ring-outer {
  width: 120px; height: 120px;
  animation: boot-spin-cw 8s linear infinite;
  border-top-color: #00d4ff;
  border-right-color: rgba(0,212,255,0.15);
  border-bottom-color: rgba(0,212,255,0.15);
  border-left-color:  rgba(0,212,255,0.15);
  box-shadow: 0 0 18px rgba(0,212,255,0.12);
}
.boot-ring-inner {
  width: 80px; height: 80px;
  animation: boot-spin-ccw 5s linear infinite;
  border-top-color: rgba(0,212,255,0.15);
  border-right-color: #00d4ff;
  border-bottom-color: rgba(0,212,255,0.15);
  border-left-color:  rgba(0,212,255,0.15);
}
.boot-logo-core {
  position: relative;
  width: 52px; height: 52px;
  background: rgba(0,212,255,0.06);
  border: 1px solid rgba(0,212,255,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.boot-logo-icon {
  font-size: 24px;
  color: #00d4ff;
  filter: drop-shadow(0 0 8px #00d4ff);
  animation: boot-pulse-glow 2.4s ease-in-out infinite;
}
@keyframes boot-spin-cw  { to { transform: rotate(360deg);  } }
@keyframes boot-spin-ccw { to { transform: rotate(-360deg); } }
@keyframes boot-pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 6px #00d4ff);  opacity: 0.9; }
  50%       { filter: drop-shadow(0 0 16px #00d4ff); opacity: 1;   }
}

/* ── Brand text ── */
.boot-brand { text-align: center; }
.boot-brand-name {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 6px;
  color: #e4eaf0;
  text-transform: uppercase;
}
.boot-accent {
  color: #00d4ff;
  text-shadow: 0 0 14px rgba(0,212,255,0.7);
}
.boot-brand-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 4px;
  color: rgba(0,212,255,0.6);
  text-transform: uppercase;
  margin-top: 6px;
}

/* ── Divider ── */
.boot-divider {
  width: 340px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #00d4ff, transparent);
  opacity: 0.4;
}

/* ── Boot terminal ── */
.boot-terminal {
  width: 520px;
  max-width: 90vw;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: rgba(0,212,255,0.75);
  line-height: 1.7;
  letter-spacing: 0.3px;
  text-align: left;
}
.boot-log-line {
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.boot-log-line.visible { opacity: 1; }

/* ── Progress bar ── */
.boot-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 520px;
  max-width: 90vw;
}
.boot-progress-track {
  position: relative;
  flex: 1;
  height: 3px;
  background: rgba(0,212,255,0.1);
  border-radius: 2px;
  overflow: visible;
}
.boot-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0ea5e9, #00d4ff);
  border-radius: 2px;
  transition: width 0.12s linear;
  position: relative;
  z-index: 1;
}
.boot-progress-glow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 8px;
  width: 0%;
  background: rgba(0,212,255,0.4);
  filter: blur(4px);
  border-radius: 4px;
  transition: width 0.12s linear;
}
.boot-progress-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(0,212,255,0.7);
  width: 34px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Status row (intelligence disciplines) ── */
.boot-status-row {
  display: flex;
  gap: 10px;
}
.boot-status-item {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 3px 9px;
  border: 1px solid rgba(0,212,255,0.2);
  border-radius: 2px;
  color: rgba(0,212,255,0.3);
  background: transparent;
  transition: color 0.3s, border-color 0.3s, background 0.3s, box-shadow 0.3s;
}
.boot-status-item.online {
  color: #00d4ff;
  border-color: rgba(0,212,255,0.6);
  background: rgba(0,212,255,0.07);
  box-shadow: 0 0 8px rgba(0,212,255,0.2);
}

/* ── Classification banner ── */
.boot-classification {
  position: absolute;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2px;
  color: rgba(0,212,255,0.28);
  text-transform: uppercase;
  text-align: center;
}
