/* ═══════════════════════════════════════════════════════════
   MaandaMonitor v3 — style.css
   Aesthetic: editorial intelligence — dark newsroom meets
   field operations. Clean hierarchy, instant scanability.
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  /* Dark mode (default) */
  --bg:       #07090d;
  --surface:  #0d1117;
  --card:     #111820;
  --border:   #1a2332;
  --border2:  #243040;
  --text:     #e2eaf5;
  --sub:      #8a99ad;
  --muted:    #4d5f72;

  --red:      #e8413a;
  --amber:    #f5a623;
  --green:    #27c47e;
  --blue:     #3d8ef0;
  --blue-dim: rgba(61,142,240,.12);

  --f-display: 'Bebas Neue', sans-serif;
  --f-mono:    'Space Mono', monospace;
  --f-body:    'Syne', sans-serif;

  --radius:    4px;
  --header-h:  52px;
  --bar-h:     36px;
  --ticker-h:  26px;
  --chrome-h:  114px; /* header + bar + ticker */
}

/* Light mode */
[data-theme="light"] {
  --bg:      #f0f4f8;
  --surface: #ffffff;
  --card:    #f7f9fc;
  --border:  #dde4ed;
  --border2: #c8d4e0;
  --text:    #1a2535;
  --sub:     #4a5f72;
  --muted:   #8a9aad;
}

[data-theme="light"] .leaflet-tile {
  filter: none !important;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--f-body); }

/* ── HEADER ──────────────────────────────────────────────── */
#site-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 400;
  backdrop-filter: blur(12px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.logo-mark {
  width: 28px; height: 28px;
  background: var(--red);
  clip-path: polygon(50% 0%,93% 25%,93% 75%,50% 100%,7% 75%,7% 25%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-size: 13px; color: #fff;
  animation: hexPulse 3s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes hexPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(232,65,58,.4); }
  50%     { box-shadow: 0 0 0 7px rgba(232,65,58,0); }
}
.logo-name {
  font-family: var(--f-display);
  font-size: 1.3rem; letter-spacing: 0.06em;
  line-height: 1;
}
.logo-name span { color: var(--red); }

/* Desktop nav */
.desktop-nav {
  display: flex;
  margin-left: 1.25rem;
}
.desktop-nav button {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--sub);
  font-family: var(--f-body); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
  padding: 0 0.85rem; height: var(--header-h);
  transition: color .15s, border-color .15s;
}
.desktop-nav button:hover { color: var(--text); }
.desktop-nav button.active { color: var(--red); border-bottom-color: var(--red); }

.header-actions {
  display: flex; align-items: center; gap: 0.75rem;
  margin-left: auto; flex-shrink: 0;
}

.live-pill {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--f-mono); font-size: 0.58rem;
  color: var(--red); letter-spacing: 0.1em;
}
.live-dot {
  width: 6px; height: 6px;
  background: var(--red); border-radius: 50%;
  animation: blink 1.1s step-start infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

#last-updated {
  font-family: var(--f-mono); font-size: 0.56rem; color: var(--muted);
  white-space: nowrap;
}

.theme-toggle {
  background: var(--card); border: 1px solid var(--border2);
  border-radius: 20px; padding: 4px 10px;
  font-size: 0.8rem; color: var(--sub);
  transition: all .15s;
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--sub); }

/* ── STATUS BAR ──────────────────────────────────────────── */
#status-bar {
  height: var(--bar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}
#status-bar::-webkit-scrollbar { display: none; }

.s-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 0 1rem;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  font-family: var(--f-mono); font-size: 0.62rem;
  flex-shrink: 0;
}
.s-pill:last-child { border-right: none; margin-left: auto; }

.s-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.d-red    { background: var(--red);   box-shadow: 0 0 5px var(--red);   }
.d-amber  { background: var(--amber); box-shadow: 0 0 5px var(--amber); }
.d-yellow { background: #fbbf24;      box-shadow: 0 0 5px #fbbf2466;    }
.d-green  { background: var(--green); box-shadow: 0 0 5px var(--green); }

.s-label { color: var(--muted); }
.s-value { color: var(--text); font-weight: 700; }

/* ── TICKER ──────────────────────────────────────────────── */
#ticker-wrap {
  height: var(--ticker-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.ticker-badge {
  flex-shrink: 0;
  height: 100%;
  min-width: 88px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 0.56rem;
  font-weight: 700; letter-spacing: 0.14em;
  color: #fff;
  background: var(--red);
  transition: background .3s;
  z-index: 1;
}
.ticker-overflow {
  overflow: hidden;
  flex: 1;
  height: 100%;
  position: relative;
  /* left fade mask */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 3%, black 97%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, black 3%, black 97%, transparent 100%);
}
.ticker-track {
  display: inline-flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  animation: ticker 50s linear infinite;
  font-family: var(--f-mono); font-size: 0.6rem;
  color: var(--text); letter-spacing: 0.06em;
}
@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-sep { color: var(--muted); margin: 0 1rem; }

/* ── TABS (content areas) ────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── DASHBOARD LAYOUT ────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  grid-template-rows: 1fr;
  height: calc(100vh - var(--chrome-h));
  overflow: hidden;
}

/* ── COLUMNS ─────────────────────────────────────────────── */
.col {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
}
.col-l { border-right: 1px solid var(--border); background: var(--bg); gap: 0; }
.col-c { background: var(--bg); gap: 0; overflow: hidden; }
.col-r { border-left:  1px solid var(--border); background: var(--bg); gap: 0; }

/* ── CARDS / PANELS ──────────────────────────────────────── */
.card {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.card-hd {
  padding: 0.5rem 0.9rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-family: var(--f-mono);
  font-size: 0.56rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
}
.card-bd { padding: 0.85rem 0.9rem; }

/* ── GRIEVANCE RING ──────────────────────────────────────── */
.ring-wrap {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.ring-svg-wrap { position: relative; flex-shrink: 0; }
.ring-svg { transform: rotate(-90deg); }
.ring-bg  { fill: none; stroke: var(--border2); stroke-width: 7; }
.ring-fg  { fill: none; stroke-width: 7; stroke-linecap: round;
            transition: stroke-dashoffset 1.4s cubic-bezier(.4,0,.2,1),stroke 0.5s; }
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-num {
  font-family: var(--f-display); font-size: 1.55rem; line-height: 1;
}
.ring-denom { font-family: var(--f-mono); font-size: 0.46rem; color: var(--muted); }
.ring-meta h3 { font-size: 0.9rem; font-weight: 800; }
.ring-meta p  { font-size: 0.65rem; color: var(--sub); line-height: 1.45; margin-top: 2px; }

.factor { display: flex; align-items: center; gap: 0.4rem; padding: 0.26rem 0.9rem; }
.factor-lbl { font-size: 0.62rem; color: var(--sub); flex: 1; }
.factor-track { width: 60px; height: 3px; background: var(--border2); border-radius: 2px; overflow: hidden; }
.factor-fill  { height: 100%; border-radius: 2px; transition: width 1.2s ease; }
.factor-val   { font-family: var(--f-mono); font-size: 0.58rem; width: 22px; text-align: right; }

/* ── AI BRIEF ────────────────────────────────────────────── */
.ai-brief {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.ai-status-row {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.status-chip {
  font-family: var(--f-mono); font-size: 0.54rem;
  padding: 2px 7px; border-radius: 2px;
  font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase;
}
.status-calm     { background: rgba(39,196,126,.15); color: var(--green); }
.status-watch    { background: rgba(245,166,35,.15);  color: var(--amber); }
.status-elevated { background: rgba(232,65,58,.15);  color: var(--red);   }
.status-critical { background: var(--red);            color: #fff;         }

.ai-areas {
  font-family: var(--f-mono); font-size: 0.55rem; color: var(--muted);
}
.ai-headline {
  font-size: 0.88rem; font-weight: 800; line-height: 1.3;
  margin-bottom: 0.35rem;
}
.ai-body {
  font-size: 0.72rem; color: var(--sub); line-height: 1.65;
}
.ai-confidence {
  display: flex; align-items: center; gap: 0.5rem;
  margin-top: 0.55rem;
  font-family: var(--f-mono); font-size: 0.54rem; color: var(--muted);
}
.conf-track { flex: 1; height: 2px; background: var(--border2); border-radius: 1px; }
.conf-fill  { height: 100%; background: var(--blue); border-radius: 1px; transition: width 1s ease; }
.ai-gen-time { font-family: var(--f-mono); font-size: 0.52rem; color: var(--muted); margin-top: .3rem; }

.ai-placeholder {
  font-family: var(--f-mono); font-size: 0.62rem; color: var(--muted);
  padding: 0.85rem 0.9rem; line-height: 1.6;
}

/* ── STATS STRIP ─────────────────────────────────────────── */
.stats-strip {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--border);
  margin: 1px 0;
}
.stat-cell {
  background: var(--surface);
  padding: 0.65rem 0.75rem; text-align: center;
}
.stat-n { font-family: var(--f-display); font-size: 1.5rem; line-height: 1; }
.stat-l { font-size: 0.58rem; color: var(--muted); margin-top: 1px; letter-spacing: 0.04em; }

/* ── MAP CENTER ──────────────────────────────────────────── */
.map-section {
  flex: 1; position: relative; min-height: 0;
  overflow: hidden;
}
#main-map { position: absolute; inset: 0; }

/* Map controls */
.map-controls {
  position: absolute; top: 0.65rem; left: 0.65rem;
  z-index: 500; display: flex; flex-direction: column; gap: 0.3rem;
}
.filter-row  { display: flex; gap: 2px; }
.map-btn {
  background: rgba(7,9,13,.88);
  border: 1px solid var(--border2);
  color: var(--sub);
  font-family: var(--f-mono); font-size: 0.54rem;
  padding: 3px 8px; border-radius: 2px;
  letter-spacing: 0.05em; backdrop-filter: blur(8px);
  transition: all .14s;
}
.map-btn:hover  { color: var(--text); }
.map-btn.active { background: var(--red); border-color: var(--red); color: #fff; }

[data-theme="light"] .map-btn { background: rgba(255,255,255,.88); }

.layer-panel {
  position: absolute; bottom: 0.65rem; left: 0.65rem;
  z-index: 500;
  background: rgba(7,9,13,.88);
  border: 1px solid var(--border2);
  border-radius: 3px; padding: 0.45rem 0.6rem;
  backdrop-filter: blur(8px);
}
[data-theme="light"] .layer-panel { background: rgba(255,255,255,.92); }

.layer-title {
  font-family: var(--f-mono); font-size: 0.52rem;
  color: var(--muted); letter-spacing: 0.12em; margin-bottom: 0.3rem;
}
.layer-row {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.63rem; color: var(--sub); margin-bottom: 0.15rem; cursor: pointer;
}
.layer-row input { cursor: pointer; accent-color: var(--red); }

/* Calm overlay */
.calm-overlay {
  display: none;
  position: absolute; inset: 0; z-index: 450;
  align-items: center; justify-content: center;
  background: rgba(7,9,13,.45); pointer-events: none;
}
.calm-badge {
  background: rgba(39,196,126,.1);
  border: 1px solid rgba(39,196,126,.3);
  border-radius: 6px; padding: 1rem 1.5rem; text-align: center;
}
.calm-badge .icon { font-size: 1.8rem; margin-bottom: 0.3rem; }
.calm-badge h3 { font-size: 0.95rem; font-weight: 800; color: var(--green); }
.calm-badge p  { font-size: 0.7rem; color: var(--sub); margin-top: 0.15rem; }

/* ── TIMELINE ────────────────────────────────────────────── */
.timeline-section {
  height: 220px; flex-shrink: 0;
  overflow-y: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.section-hd {
  padding: 0.4rem 0.9rem;
  font-family: var(--f-mono); font-size: 0.54rem;
  color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 2;
}
.t-list { position: relative; padding: 0.6rem 0.9rem; }
.t-list::before {
  content: ''; position: absolute;
  left: calc(0.9rem + 44px); top: 0; bottom: 0;
  width: 1px; background: var(--border2);
}
.t-item {
  display: grid; grid-template-columns: 44px 1fr;
  margin-bottom: 0.85rem; cursor: pointer;
  transition: opacity .14s;
}
.t-item:hover { opacity: .72; }
.t-dt {
  font-family: var(--f-mono); font-size: 0.52rem; color: var(--muted);
  text-align: right; padding-right: 0.6rem; padding-top: 3px; line-height: 1.4;
}
.t-body { padding-left: 0.9rem; position: relative; }
.t-body::before {
  content: ''; position: absolute;
  left: -4.5px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dot-c, var(--blue));
  border: 2px solid var(--bg);
}
.t-name { font-size: 0.74rem; font-weight: 700; margin-bottom: 0.1rem; }
.t-sub  { font-size: 0.64rem; color: var(--sub); }
.t-tags { display: flex; gap: 0.25rem; margin-top: 0.2rem; flex-wrap: wrap; }

/* ── PREDICTIONS ─────────────────────────────────────────── */
.pred-item {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  cursor: default;
}
.pred-item:last-child { border-bottom: none; }
.pred-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 0.25rem;
}
.pred-region { font-size: 0.78rem; font-weight: 800; }
.pred-pct {
  font-family: var(--f-display); font-size: 1.1rem; line-height: 1;
  flex-shrink: 0; margin-left: 0.5rem;
}
.pred-trigger { font-size: 0.68rem; color: var(--sub); line-height: 1.5; }
.pred-window  { font-family: var(--f-mono); font-size: 0.55rem; color: var(--muted); margin-top: 0.25rem; }

.watch-list { padding: 0 0.9rem 0.75rem; }
.watch-hd   { font-family: var(--f-mono); font-size: 0.54rem; color: var(--muted);
              letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.4rem; }
.watch-item {
  font-size: 0.68rem; color: var(--sub);
  padding: 0.28rem 0; border-bottom: 1px solid var(--border);
  display: flex; gap: 0.45rem; align-items: flex-start; line-height: 1.45;
}
.watch-item::before { content: '→'; color: var(--amber); flex-shrink: 0; }

/* ── NEWS ────────────────────────────────────────────────── */
.news-item {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.news-item:hover { background: var(--card); }
.news-meta {
  display: flex; justify-content: space-between;
  font-family: var(--f-mono); font-size: 0.54rem; color: var(--muted);
  margin-bottom: 0.2rem;
}
.news-dot {
  display: inline-block; width: 5px; height: 5px;
  border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.news-title { font-size: 0.73rem; font-weight: 600; line-height: 1.4; }
.no-news {
  padding: 1.25rem 0.9rem; text-align: center;
  font-family: var(--f-mono); font-size: 0.62rem; color: var(--muted);
  line-height: 1.6;
}

/* ── TAGS ────────────────────────────────────────────────── */
.tag {
  font-family: var(--f-mono); font-size: 0.5rem;
  padding: 1px 5px; border-radius: 2px; letter-spacing: 0.04em;
}
.tag-muted  { background: var(--border2); color: var(--sub); }
.tag-red    { background: rgba(232,65,58,.15);  color: var(--red); }
.tag-amber  { background: rgba(245,166,35,.15); color: var(--amber); }
.tag-blue   { background: rgba(61,142,240,.15); color: var(--blue); }
.tag-green  { background: rgba(39,196,126,.15); color: var(--green); }
.tag-new    { background: rgba(39,196,126,.2);  color: var(--green); font-weight: 700; }
.tag-ongoing{ background: rgba(245,166,35,.2);  color: var(--amber); font-weight: 700; }

.cause-chip {
  font-family: var(--f-mono); font-size: 0.56rem;
  padding: 2px 7px; border-radius: 2px; white-space: nowrap;
}
.sev-chip {
  font-family: var(--f-mono); font-size: 0.55rem;
  padding: 2px 6px; border-radius: 2px;
}

/* ── EVENTS TABLE ────────────────────────────────────────── */
.events-page { padding: 1.25rem; overflow-x: auto; }
.events-page h2 {
  font-family: var(--f-mono); font-size: 0.58rem;
  color: var(--muted); letter-spacing: 0.16em; text-transform: uppercase;
  margin-bottom: 1rem;
}
.ev-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.ev-table th {
  text-align: left; padding: 0.42rem 0.65rem;
  font-family: var(--f-mono); font-size: 0.54rem;
  color: var(--muted); font-weight: 400;
  letter-spacing: 0.1em; text-transform: uppercase;
  border-bottom: 2px solid var(--border2);
  white-space: nowrap;
}
.ev-row { border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.ev-row:hover { background: var(--card); }
td { padding: 0.52rem 0.65rem; }
.td-m { font-family: var(--f-mono); font-size: 0.63rem; color: var(--sub); }
.td-t { font-weight: 700; }
.td-l { font-size: 0.71rem; color: var(--sub); }
.td-n { text-align: right; font-family: var(--f-mono); font-weight: 700; }

/* ── PREDICT PAGE ────────────────────────────────────────── */
.predict-page {
  padding: 1.25rem;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1.1rem; overflow-y: auto;
  max-height: calc(100vh - var(--chrome-h));
}
.predict-full { grid-column: 1/-1; }
.eco-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.52rem 0; border-bottom: 1px solid var(--border);
}
.eco-name { font-size: 0.76rem; font-weight: 700; }
.eco-note { font-size: 0.62rem; color: var(--muted); margin-top: 1px; }
.eco-val  { font-family: var(--f-display); font-size: 1.05rem; flex-shrink: 0; }
.leg-row  { padding: 0.52rem 0; border-bottom: 1px solid var(--border); }
.leg-name { font-size: 0.75rem; font-weight: 600; }
.leg-meta { font-size: 0.62rem; color: var(--muted); margin-top: 1px; }
.risk-row {
  display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.52rem;
}
.risk-place { font-size: 0.74rem; width: 80px; flex-shrink: 0; }
.risk-track { flex: 1; background: var(--border2); height: 4px; border-radius: 2px; overflow: hidden; }
.risk-fill  { height: 100%; border-radius: 2px; transition: width 1.2s ease; }
.risk-pct   { font-family: var(--f-display); font-size: 0.92rem; width: 32px; text-align: right; }

/* ── SAFETY PAGE ─────────────────────────────────────────── */
.safety-page {
  display: grid; grid-template-columns: 1fr 260px;
  height: calc(100vh - var(--chrome-h));
  overflow: hidden;
}
.safety-map-wrap { position: relative; }
#safety-map { position: absolute; inset: 0; }
.safety-panel {
  border-left: 1px solid var(--border);
  overflow-y: auto; background: var(--surface);
  display: flex; flex-direction: column;
}
.disclaimer {
  margin: 0.75rem; padding: 0.6rem 0.75rem;
  background: rgba(232,65,58,.07);
  border: 1px solid rgba(232,65,58,.25);
  border-radius: 3px; font-size: 0.68rem; line-height: 1.55;
}
.disclaimer strong { color: var(--red); }
.loc-btn {
  margin: 0 0.75rem 0.65rem;
  background: var(--blue); border: none; color: #fff;
  font-family: var(--f-body); font-weight: 700; font-size: 0.74rem;
  padding: 0.48rem; border-radius: 3px; width: calc(100% - 1.5rem);
  transition: opacity .18s;
}
.loc-btn:hover { opacity: .85; }
.pin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; padding: 0 0.75rem 0.75rem; }
.pin-btn {
  background: var(--card); border: 1px solid var(--border2);
  color: var(--text); font-family: var(--f-body); font-size: 0.67rem; font-weight: 600;
  padding: 0.45rem 0.35rem; border-radius: 3px; text-align: center;
  transition: all .13s; line-height: 1.35;
}
.pin-btn:hover { border-color: var(--amber); color: var(--amber); }
.pin-btn.danger:hover { border-color: var(--red); color: var(--red); }
.pin-btn span { display: block; font-size: 0.95rem; margin-bottom: 1px; }
.pin-row {
  display: flex; align-items: flex-start; gap: 0.4rem;
  padding: 0.52rem 0.75rem; border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
}
.pi { font-size: 0.95rem; flex-shrink: 0; padding-top: 1px; }
.pi-info { flex: 1; }
.pi-lbl  { font-size: 0.74rem; font-weight: 700; }
.pi-note { font-size: 0.65rem; color: var(--sub); margin-top: 1px; }
.pi-meta { font-family: var(--f-mono); font-size: 0.57rem; color: var(--muted); margin-top: 2px; }
.pi-acts { display: flex; flex-direction: column; gap: 2px; }
.vote-btn {
  border: none; border-radius: 2px; padding: 2px 6px;
  font-size: 0.63rem; transition: opacity .13s;
}
.vote-btn.y { background: rgba(39,196,126,.2); color: var(--green); }
.vote-btn.n { background: rgba(232,65,58,.2);  color: var(--red);   }
.e-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border);
  text-decoration: none; color: var(--text); transition: background .12s;
}
.e-link:hover { background: var(--card); }
.e-ico  { font-size: 0.95rem; flex-shrink: 0; }
.e-name { font-size: 0.74rem; font-weight: 700; }
.e-num  { font-family: var(--f-mono); font-size: 0.63rem; color: var(--green); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.7); z-index: 1000;
  backdrop-filter: blur(5px);
  align-items: center; justify-content: center;
}
.modal-bg.open { display: flex; }
.modal-box {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 5px; width: 580px;
  max-width: 95vw; max-height: 88vh; overflow-y: auto;
}
.modal-hd {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.m-title { font-size: 0.97rem; font-weight: 800; }
.m-sub   { font-size: 0.65rem; color: var(--muted); margin-top: 0.15rem; }
.m-close { background: none; border: none; color: var(--muted); font-size: 1rem; flex-shrink: 0; padding: 0 .2rem; }
.modal-body { padding: 1.25rem; }
.d-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.8rem; margin-bottom: 1rem;
}
.d-item label {
  font-family: var(--f-mono); font-size: 0.54rem; color: var(--muted);
  display: block; margin-bottom: 0.15rem; letter-spacing: 0.1em; text-transform: uppercase;
}
.d-item .v { font-size: 0.9rem; font-weight: 700; }
.d-section  { margin-bottom: 0.9rem; }
.d-section h4 {
  font-family: var(--f-mono); font-size: 0.55rem; letter-spacing: 0.12em;
  color: var(--muted); text-transform: uppercase; margin-bottom: 0.32rem;
}
.d-section p { font-size: 0.76rem; line-height: 1.65; color: var(--sub); }

/* ── MOBILE BOTTOM NAV ───────────────────────────────────── */
.mob-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  z-index: 500;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mob-nav-inner {
  display: flex;
}
.mob-tab {
  flex: 1; background: none; border: none;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 0.5rem 0.3rem;
  color: var(--muted); font-family: var(--f-body);
  font-size: 0.6rem; font-weight: 600; letter-spacing: 0.04em;
  transition: color .15s;
}
.mob-tab .mob-icon { font-size: 1.15rem; }
.mob-tab.active { color: var(--red); }
.mob-tab-safety.active { color: var(--amber); }

/* ── MISC ────────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 10px; height: 10px;
  border: 2px solid var(--border2); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .55s linear infinite;
  vertical-align: middle; margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-line {
  font-family: var(--f-mono); font-size: 0.62rem; color: var(--muted);
  padding: 0.85rem 0.9rem;
}

@keyframes fadeUp {
  from { opacity:0; transform: translateY(6px); }
  to   { opacity:1; transform: none; }
}

/* Leaflet */
.leaflet-container { background: #050709 !important; }
[data-theme="light"] .leaflet-container { background: #e8ecf0 !important; }
.leaflet-tile { filter: brightness(.52) saturate(.18) hue-rotate(195deg); }
[data-theme="light"] .leaflet-tile { filter: none; }
.leaflet-popup-content-wrapper {
  background: var(--surface) !important; border: 1px solid var(--border2) !important;
  color: var(--text) !important; border-radius: 4px !important;
  box-shadow: 0 6px 28px rgba(0,0,0,.55) !important;
}
.leaflet-popup-tip { background: var(--surface) !important; }
.leaflet-popup-content { font-family: var(--f-body) !important; }

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 240px 1fr 0; }
  .col-r { display: none; }
}

@media (max-width: 860px) {
  :root { --chrome-h: 114px; }
  .dash-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    overflow: visible;
  }
  .col-l { border-right: none; border-bottom: 1px solid var(--border); }
  .col-c { height: auto; overflow: visible; }
  .map-section { height: 55vw; min-height: 260px; position: relative; }
  #main-map { position: absolute; inset: 0; }
  .timeline-section { height: auto; max-height: 280px; }

  /* Show mobile nav, hide desktop nav */
  .desktop-nav { display: none; }
  .mob-nav     { display: flex; }

  /* Add bottom padding so content isn't behind nav */
  .tab-content.active { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0)); }

  .safety-page { grid-template-columns: 1fr; height: auto; }
  .safety-map-wrap { height: 55vw; min-height: 260px; position: relative; }
  #safety-map { position: absolute; inset: 0; }
  .safety-panel { max-height: 60vh; }

  .predict-page { grid-template-columns: 1fr; max-height: none; }
  .events-page  { padding: 0.75rem; }

  #last-updated { display: none; }
}

@media (max-width: 480px) {
  .d-grid { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: repeat(3,1fr); }
  .logo-name { font-size: 1.1rem; }
  .s-pill:nth-child(n+4) { display: none; } /* hide lower-priority pills on small screens */
}
