/* ========== TOKENS ========== */
:root {
  --bg:      #0a0e14;
  --bg2:     #111720;
  --bg3:     #161d28;
  --bdr:     #1e2a3a;
  --bdr2:    #2a3a4e;
  --t1:      #c8d0dc;
  --t2:      #6b7a8d;
  --t3:      #3a4a5c;
  --red:     #e63946;
  --orange:  #f4a236;
  --yellow:  #f0c040;
  --green:   #2ec486;
  --blue:    #4a9eff;
  --purple:  #9b72cf;
  --cyan:    #00d4ff;
}

/* ========== RESET ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg);
  color: var(--t1);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ========== TOP BAR ========== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bdr);
  height: 34px;
  z-index: 100;
}
.topbar-title {
  font-family: 'Orbitron', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
}
.topbar-time {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--t2);
  letter-spacing: 1px;
}
.topbar-btn {
  background: none;
  border: 1px solid var(--bdr);
  color: var(--t2);
  width: 26px;
  height: 22px;
  cursor: pointer;
  font-size: 12px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.topbar-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ========== LAYOUT ========== */
.layout {
  display: grid;
  grid-template-rows: 1fr 1fr;
  height: calc(100vh - 34px);
}

/* ========== MAP ========== */
.map-wrap { position: relative; overflow: hidden; border-bottom: 1px solid var(--bdr); }
#map { width: 100%; height: 100%; background: var(--bg); }
.leaflet-container { background: #0a0e14 !important; }
.leaflet-tile-pane { filter: saturate(0.3) brightness(0.45) contrast(1.2); }
.leaflet-control-attribution { display: none !important; }
.leaflet-control-zoom { display: none !important; }

/* Map overlays */
.ov {
  position: absolute;
  z-index: 1000;
  background: rgba(13, 18, 25, 0.92);
  border: 1px solid var(--bdr);
  border-radius: 3px;
  backdrop-filter: blur(6px);
}

/* Time selector */
.time-sel { top: 10px; left: 10px; display: flex; overflow: hidden; }
.time-sel button {
  background: transparent;
  border: none;
  border-right: 1px solid var(--bdr);
  color: var(--t2);
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.2s;
}
.time-sel button:last-child { border-right: none; }
.time-sel button.act { background: var(--blue); color: #fff; }
.time-sel button:hover:not(.act) { background: var(--bg3); color: var(--t1); }

/* Layers panel */
.layers { top: 46px; left: 10px; padding: 8px 10px; min-width: 175px; }
.layers-hd {
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--t3);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.layers-hd .qm {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1px solid var(--t3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: var(--t3);
  cursor: help;
}
.ly {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2.5px 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--t3);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}
.ly:hover { color: var(--t2); }
.ly.on { color: var(--t1); }
.ly-ck {
  width: 13px; height: 13px;
  border: 1px solid var(--bdr2);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  transition: all 0.2s;
}
.ly.on .ly-ck { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Zoom controls */
.mzoom { top: 10px; right: 10px; display: flex; flex-direction: column; overflow: hidden; }
.mzoom button {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--bdr);
  color: var(--t2);
  width: 26px; height: 26px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.mzoom button:last-child { border-bottom: none; }
.mzoom button:hover { background: var(--bg3); color: var(--t1); }

/* Map legend */
.mlegend {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(13, 18, 25, 0.88);
  border: 1px solid var(--bdr);
  border-radius: 3px;
  padding: 4px 12px;
  backdrop-filter: blur(6px);
  font-size: 9px;
  font-weight: 600;
}
.mlegend .ll { font-family: 'Orbitron', monospace; font-size: 8px; letter-spacing: 2px; color: var(--t3); }
.mlegend .li { display: flex; align-items: center; gap: 4px; color: var(--t2); }
.ldot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.ltri { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid; display: inline-block; }
.lsq  { width: 6px; height: 6px; border-radius: 1px; display: inline-block; }

/* Map popup */
.mpop {
  position: absolute;
  z-index: 1000;
  background: rgba(13, 18, 25, 0.94);
  border: 1px solid var(--bdr2);
  border-radius: 3px;
  padding: 8px 12px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.mpop-t { font-family: 'Orbitron', monospace; font-size: 11px; font-weight: 700; letter-spacing: 1px; margin-bottom: 2px; }
.mpop-d { font-family: 'Share Tech Mono', monospace; font-size: 9px; color: var(--t2); line-height: 1.6; }

/* Leaflet tooltip override */
.ctip {
  background: rgba(13, 18, 25, 0.94) !important;
  border: 1px solid #2a3a4e !important;
  border-radius: 3px !important;
  color: #c8d0dc !important;
  padding: 6px 10px !important;
  font-family: 'Rajdhani', sans-serif !important;
  font-size: 11px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}
.ctip::before,
.leaflet-tooltip-top::before,
.leaflet-tooltip-bottom::before,
.leaflet-tooltip-left::before,
.leaflet-tooltip-right::before { display: none !important; }

/* ========== BOTTOM PANELS ========== */
.bottom {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.8fr;
  overflow: hidden;
}
.pnl {
  border-right: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pnl:last-child { border-right: none; }
.pnl-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--bdr);
  background: var(--bg2);
  min-height: 30px;
}
.pnl-t {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--t2);
}

/* Badges */
.bdg {
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  padding: 2px 7px;
  border-radius: 2px;
  font-weight: 600;
  letter-spacing: 1px;
}
.bdg-live  { background: var(--red);  color: #fff; animation: pulse-badge 2s infinite; }
.bdg-cache { background: var(--bg3); color: var(--t2); border: 1px solid var(--bdr); }
.bdg-new   { background: var(--blue); color: #fff; }
.bdg-crit  { background: var(--red);  color: #fff; }

@keyframes pulse-badge { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Tabs */
.tbs {
  display: flex;
  background: var(--bg3);
  border-bottom: 1px solid var(--bdr);
  overflow-x: auto;
}
.tb {
  font-family: 'Rajdhani', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 5px 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--t3);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.tb.a  { color: #fff; background: rgba(74, 158, 255, 0.12);  border-bottom-color: var(--blue); }
.tb.ag { color: #fff; background: rgba(46, 196, 134, 0.12);  border-bottom-color: var(--green); }
.tb:hover:not(.a):not(.ag) { color: var(--t2); background: rgba(255, 255, 255, 0.02); }

/* ========== NEWS PANEL ========== */
.nbody { flex: 1; position: relative; overflow: hidden; background: #000; }
.nbg   { position: absolute; inset: 0; background: linear-gradient(135deg, #1a1a2e, #0f0f1a 40%, #16213e); }
.nscan { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.06) 2px, rgba(0,0,0,.06) 4px); pointer-events: none; z-index: 2; }

.ncity { position: absolute; bottom: 0; left: 0; right: 0; height: 45%; z-index: 1; }
.ntop  { position: absolute; top: 8px; left: 10px; z-index: 3; }

.nlive {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--red);
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 2px 7px;
  border-radius: 2px;
}
.nlive .dt { width: 5px; height: 5px; background: #fff; border-radius: 50%; animation: pulse-dot 1.5s infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.nloc { font-family: 'Share Tech Mono', monospace; font-size: 9px; color: var(--cyan); letter-spacing: 1px; margin-top: 3px; }

.nbar {
  position: absolute;
  bottom: 22px;
  left: 0; right: 0;
  z-index: 3;
  background: rgba(0, 0, 0, 0.85);
  padding: 7px 10px;
  border-top: 2px solid var(--red);
}
.nhl {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.nbrk {
  font-family: 'Orbitron', monospace;
  font-size: 8px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 2px;
  margin-top: 3px;
  animation: blink 1s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.ntk {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  z-index: 3;
  background: rgba(0, 0, 0, 0.7);
  padding: 3px 10px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 8px;
  color: var(--t2);
  overflow: hidden;
  white-space: nowrap;
}
.tktxt { display: inline-block; animation: ticker 40s linear infinite; }
@keyframes ticker { 0% { transform: translateX(100%); } 100% { transform: translateX(-200%); } }

/* ========== WEBCAMS PANEL ========== */
.wcgrid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  padding: 4px;
  overflow: hidden;
}
.wcc { position: relative; border-radius: 2px; overflow: hidden; background: #080a0f; }
.wcc canvas { width: 100%; height: 100%; display: block; }
.wcl {
  position: absolute; top: 3px; left: 5px;
  font-family: 'Orbitron', monospace;
  font-size: 7px; font-weight: 600;
  letter-spacing: 2px; color: #fff;
  background: rgba(0, 0, 0, 0.65);
  padding: 2px 5px; border-radius: 2px; z-index: 2;
}
.wcr {
  position: absolute; top: 3px; right: 5px;
  display: flex; align-items: center; gap: 3px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 7px; color: var(--red); z-index: 2;
}
.wcr .dt { width: 4px; height: 4px; background: var(--red); border-radius: 50%; animation: pulse-dot 1.5s infinite; }
.wct {
  position: absolute; bottom: 3px; right: 5px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 7px; color: rgba(255, 255, 255, 0.45); z-index: 2;
}

/* ========== INSIGHTS PANEL ========== */
.ibody { flex: 1; overflow-y: auto; padding: 6px; }
.ibody::-webkit-scrollbar { width: 3px; }
.ibody::-webkit-scrollbar-track { background: var(--bg); }
.ibody::-webkit-scrollbar-thumb { background: var(--bdr); border-radius: 2px; }

.icard {
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: 3px;
  padding: 7px 9px;
  margin-bottom: 5px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--t2);
  transition: border-color 0.2s;
}
.icard:hover { border-color: var(--bdr2); }
.icard .ts { font-family: 'Share Tech Mono', monospace; font-size: 8px; color: var(--t3); margin-bottom: 3px; }

/* Strategic posture */
.strat { border-top: 1px solid var(--bdr); }
.strat-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bdr);
}
.strat-t { font-family: 'Orbitron', monospace; font-size: 9px; font-weight: 600; letter-spacing: 2px; color: var(--t2); }

.thc {
  background: rgba(230, 57, 70, 0.1);
  border: 1px solid rgba(230, 57, 70, 0.35);
  border-radius: 3px;
  margin: 6px;
  padding: 8px;
}
.thc-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.thc-n  { font-size: 14px; font-weight: 700; }
.thc-g  {
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr 1fr;
  gap: 1px 6px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  color: var(--t2);
  margin-bottom: 4px;
}
.thc-g .lb { color: var(--t3); font-size: 8px; }
.vr { color: var(--red); }
.vg { color: var(--green); }
.thc-s { font-size: 9px; color: var(--t3); display: flex; gap: 14px; }

/* ========== AMBIENT ========== */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 65% 25%, rgba(230, 57, 70, 0.06), transparent 55%);
  animation: ambient-glow 8s ease-in-out infinite;
  z-index: 0;
}
@keyframes ambient-glow { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
