/* ============================================================
   SIGNET // Terminal theme
   Dark, monospace, green/amber/red accents, glow effects.
   ============================================================ */

:root {
  --bg0: #050705;
  --bg1: #0a0d0a;
  --bg2: #101510;
  --bg3: #161d16;
  --line: #1e2a1e;
  --grn: #33ff66;
  --grn-dim: #1d8a3d;
  --amb: #ffb020;
  --red: #ff3b3b;
  --cyn: #37d0ff;
  --txt: #b8ccb8;
  --txt-dim: #5f745f;
  --mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg0);
  color: var(--txt);
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
}

body::after { /* scanline overlay */
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.12) 0 1px, transparent 1px 3px);
  z-index: 9999;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg1); }
::-webkit-scrollbar-thumb { background: var(--grn-dim); border-radius: 3px; }

/* ================= STATUS BAR ================= */
#statusbar {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--bg2), var(--bg1));
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
  gap: 12px;
  position: relative;
  z-index: 500;
}
.sb-left, .sb-center, .sb-right { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.logo {
  color: var(--grn);
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 14px;
  text-shadow: 0 0 8px rgba(51,255,102,0.6);
}
.sb-item { color: var(--txt); font-size: 11px; letter-spacing: 1px; }
.sb-item b { color: var(--grn); }
.dim { color: var(--txt-dim); }
.sb-btn {
  background: var(--bg3);
  color: var(--grn);
  border: 1px solid var(--grn-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all .15s;
}
.sb-btn:hover { background: var(--grn-dim); color: #fff; box-shadow: 0 0 10px rgba(51,255,102,0.4); }

.alert-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}
.alert-dot.green { background: var(--grn); box-shadow: 0 0 8px var(--grn); animation: pulse 2.4s infinite; }
.alert-dot.amber { background: var(--amb); box-shadow: 0 0 8px var(--amb); animation: pulse 1.4s infinite; }
.alert-dot.red   { background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 0.7s infinite; }
#alert-level-text.green { color: var(--grn); }
#alert-level-text.amber { color: var(--amb); }
#alert-level-text.red   { color: var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ================= GRID LAYOUT ================= */
#grid {
  display: grid;
  grid-template-columns: 275px 1fr 330px;
  height: calc(100vh - 38px - 30px);
}
#left, #right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  overflow-y: auto;
  background: var(--bg0);
}
#left { border-right: 1px solid var(--line); }
#right { border-left: 1px solid var(--line); }

.panel {
  background: var(--bg1);
  border: 1px solid var(--line);
  padding: 8px;
  flex-shrink: 0;
}
.panel.grow { flex: 1 1 auto; min-height: 180px; display: flex; flex-direction: column; }
.panel.grow .scroll-list { flex: 1; }
.panel h2 {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--grn);
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px;
  margin-bottom: 7px;
  text-shadow: 0 0 6px rgba(51,255,102,0.35);
}
.panel h3.subhead {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--txt-dim);
  margin: 8px 0 4px;
}
.small-label { font-size: 8px; letter-spacing: 1px; }

.scroll-list { overflow-y: auto; max-height: 240px; }
.scroll-list.small { max-height: 120px; }

/* ================= SENSOR GRID ================= */
#sensor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.sensor {
  background: var(--bg2);
  border: 1px solid var(--line);
  padding: 5px 7px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sensor .s-name { font-size: 8.5px; letter-spacing: 1px; color: var(--txt-dim); display: flex; justify-content: space-between; align-items: center; }
.sensor .s-count { font-size: 15px; font-weight: 700; color: var(--grn); text-shadow: 0 0 6px rgba(51,255,102,0.4); }
.sensor .s-dot { width: 6px; height: 6px; border-radius: 50%; }
.s-dot.UP { background: var(--grn); box-shadow: 0 0 5px var(--grn); }
.s-dot.DEGRADED { background: var(--amb); box-shadow: 0 0 5px var(--amb); }
.s-dot.DOWN { background: var(--red); box-shadow: 0 0 5px var(--red); animation: pulse 1s infinite; }
.s-dot.NO_KEY { background: #555; }
.s-dot.INIT { background: #333; }
.sensor.offline .s-count { color: var(--txt-dim); text-shadow: none; }

/* ================= NUCLEAR WATCH ================= */
.nw-summary { display: flex; gap: 6px; margin-bottom: 6px; }
.nw-stat {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--line);
  padding: 5px;
  text-align: center;
}
.nw-label { display: block; font-size: 8px; color: var(--txt-dim); letter-spacing: 1px; }
.nw-val { display: block; font-size: 15px; font-weight: 700; color: #7CFC00; text-shadow: 0 0 6px rgba(124,252,0,0.5); }
.nw-unit { display: block; font-size: 7.5px; color: var(--txt-dim); }
.rad-row { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px dotted var(--line); font-size: 10px; }
.rad-row .loc { color: var(--txt-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.rad-row .val { color: #7CFC00; }
.rad-row .val.hot { color: var(--red); animation: pulse 1s infinite; }

/* ================= RISK GAUGES ================= */
.gauge { margin-bottom: 7px; }
.gauge .g-head { display: flex; justify-content: space-between; font-size: 10px; margin-bottom: 3px; }
.gauge .g-name { color: var(--txt-dim); letter-spacing: 1px; }
.gauge .g-val { font-weight: 700; }
.gauge .g-bar { height: 5px; background: var(--bg3); border: 1px solid var(--line); position: relative; overflow: hidden; }
.gauge .g-fill { height: 100%; transition: width 1s ease, background .5s; box-shadow: 0 0 6px currentColor; }

/* ================= SPACE WATCH ================= */
.sp-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dotted var(--line); font-size: 10.5px; }
.sp-row .n { color: var(--txt-dim); }
.sp-row .c { color: var(--cyn); font-weight: 700; }
.launch-row { font-size: 9.5px; padding: 2px 0; color: var(--txt); border-bottom: 1px dotted var(--line); }
.launch-row .d { color: var(--txt-dim); }

/* ================= CENTER / MAP ================= */
#center { position: relative; background: #000; overflow: hidden; }
#map { position: absolute; inset: 0; background: #000308; z-index: 1; }
#globe-container { position: absolute; inset: 0; z-index: 2; background: #000308; }
.leaflet-container { background: #000308; font-family: var(--mono); }
.leaflet-popup-content-wrapper {
  background: var(--bg2);
  color: var(--txt);
  border: 1px solid var(--grn-dim);
  border-radius: 0;
  font-family: var(--mono);
  font-size: 11px;
}
.leaflet-popup-tip { background: var(--bg2); border: 1px solid var(--grn-dim); }
.leaflet-popup-content a { color: var(--cyn); }

#map-legend {
  position: absolute;
  bottom: 10px; left: 10px;
  z-index: 400;
  background: rgba(5,7,5,0.85);
  border: 1px solid var(--line);
  padding: 6px 10px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
#map-legend .lg { font-size: 9px; letter-spacing: 1px; color: var(--txt-dim); cursor: pointer; user-select: none; }
#map-legend .lg.off { opacity: 0.3; }
#map-legend .lg i {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  box-shadow: 0 0 5px currentColor;
}

#map-mode {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 400;
  display: flex;
  gap: 4px;
}
.mm-btn {
  background: rgba(5,7,5,0.85);
  color: var(--txt-dim);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
  padding: 5px 10px;
  cursor: pointer;
}
.mm-btn.active { color: var(--grn); border-color: var(--grn-dim); box-shadow: 0 0 8px rgba(51,255,102,0.25); }

/* ================= OSINT STREAM ================= */
.osint-item {
  padding: 5px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  line-height: 1.45;
}
.osint-item:hover { background: var(--bg2); }
.osint-item .oi-head { display: flex; gap: 6px; align-items: center; margin-bottom: 2px; flex-wrap: wrap; }
.osint-item .oi-time { color: var(--txt-dim); font-size: 9px; }
.osint-item .oi-src { color: var(--cyn); font-size: 9px; }
.osint-item a { color: var(--txt); text-decoration: none; }
.osint-item a:hover { color: #fff; text-decoration: underline; }

.tag {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 1px 5px;
  border: 1px solid;
  border-radius: 2px;
}
.tag.FLASH    { color: var(--red); border-color: var(--red); background: rgba(255,59,59,0.1); animation: pulse 1.2s infinite; }
.tag.PRIORITY { color: var(--amb); border-color: var(--amb); background: rgba(255,176,32,0.08); }
.tag.ROUTINE  { color: var(--grn-dim); border-color: var(--grn-dim); }
.tag.type { color: var(--cyn); border-color: rgba(55,208,255,0.5); background: rgba(55,208,255,0.06); }

/* ================= MARKETS ================= */
.mkt-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3.5px 2px;
  border-bottom: 1px dotted var(--line);
  font-size: 11px;
}
.mkt-row .m-name { color: var(--txt-dim); letter-spacing: 1px; font-size: 10px; }
.mkt-row .m-price { font-weight: 700; color: var(--txt); }
.mkt-row .m-chg { width: 64px; text-align: right; font-size: 10px; }
.up { color: var(--grn) !important; }
.down { color: var(--red) !important; }
.flat { color: var(--txt-dim) !important; }
.mkt-row.flash-up { animation: flashGreen 0.8s; }
.mkt-row.flash-down { animation: flashRed 0.8s; }
@keyframes flashGreen { 0% { background: rgba(51,255,102,0.25); } 100% { background: transparent; } }
@keyframes flashRed { 0% { background: rgba(255,59,59,0.25); } 100% { background: transparent; } }

/* ================= SIGNAL CORE ================= */
.delta-row { padding: 3px 2px; border-bottom: 1px dotted var(--line); font-size: 10px; line-height: 1.4; }
.delta-row .d-dom { color: var(--cyn); font-size: 8.5px; letter-spacing: 1px; margin-right: 5px; }
.delta-row .d-time { color: var(--txt-dim); font-size: 8.5px; float: right; }
.delta-row.up .d-text { color: var(--grn); }
.delta-row.down .d-text { color: var(--red); }
.delta-row.new .d-text { color: var(--amb); }

/* ================= TICKER ================= */
#ticker-bar {
  height: 30px;
  display: flex;
  align-items: center;
  background: var(--bg1);
  border-top: 1px solid var(--line);
  overflow: hidden;
}
.ticker-label {
  flex-shrink: 0;
  background: var(--red);
  color: #000;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 2px;
  padding: 4px 12px;
  height: 100%;
  display: flex;
  align-items: center;
  animation: labelPulse 3s infinite;
}
@keyframes labelPulse {
  0%, 100% { background: var(--red); }
  50% { background: #a11; }
}
.ticker-viewport { flex: 1; overflow: hidden; height: 100%; display: flex; align-items: center; }
.ticker-track {
  display: inline-flex;
  white-space: nowrap;
  animation: tick 300s linear infinite;
  gap: 40px;
  padding-left: 100%;
}
@keyframes tick {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
.tick-item { font-size: 11px; color: var(--txt); }
.tick-item .t-src { color: var(--amb); font-weight: 700; margin-right: 6px; font-size: 9px; }
.tick-item a { color: inherit; text-decoration: none; }
.tick-item a:hover { color: #fff; }

/* ================= MODAL ================= */
#modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal.hidden { display: none; }
.modal-box {
  width: min(720px, 92vw);
  max-height: 80vh;
  background: var(--bg1);
  border: 1px solid var(--grn-dim);
  box-shadow: 0 0 40px rgba(51,255,102,0.15);
  display: flex;
  flex-direction: column;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { color: var(--grn); font-size: 12px; letter-spacing: 2px; }
#modal-close {
  background: none; border: none;
  color: var(--txt-dim);
  font-size: 20px;
  cursor: pointer;
  font-family: var(--mono);
}
#modal-close:hover { color: var(--red); }
#modal-body {
  padding: 14px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--txt);
}

/* ================= MAP MARKERS ================= */
.pulse-marker { border-radius: 50%; }
.marker-flash {
  animation: markerPulse 1.2s infinite;
}
@keyframes markerPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.6; }
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1280px) {
  #grid { grid-template-columns: 240px 1fr 290px; }
}
@media (max-width: 1000px) {
  #grid {
    grid-template-columns: 1fr;
    grid-template-rows: 45vh auto auto;
    overflow-y: auto;
    height: auto;
  }
  html, body { overflow: auto; }
  #center { height: 45vh; }
  #left, #right { border: none; }
  .sb-center .dim { display: none; }
}
