/* Ukraine Weekly SITREP — tactical-intel dashboard styles */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;

  --font-body: 'Inter', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

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

html { -webkit-text-size-adjust: none; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: #c7ccd4;
  background-color: #0a0e14;
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(208,138,40,0.06), transparent 60%),
    radial-gradient(900px 600px at 92% 0%, rgba(56,122,168,0.06), transparent 55%);
  background-attachment: fixed;
}

/* THEME TOKENS (dark, single mode) */
:root {
  --bg: #0a0e14;
  --surface: #11161f;
  --surface-2: #161c27;
  --surface-3: #1c2330;
  --border: #2a3340;
  --border-soft: #202936;
  --text: #e6e9ee;
  --text-muted: #8a93a3;
  --text-faint: #5b6473;
  --accent: #d08a28;        /* amber */
  --accent-soft: rgba(208,138,40,0.14);
  --ru: #d0463a;             /* red — Russian strikes on Ukraine */
  --ru-soft: rgba(208,70,58,0.16);
  --ua: #46a0c8;             /* cyan — Ukrainian strikes on Russia */
  --ua-soft: rgba(70,160,200,0.16);
  --warn: #d8a13a;           /* contested/frontline */
  --warn-soft: rgba(216,161,58,0.16);
  --ok: #5fae5a;             /* success */
  --ok-soft: rgba(95,174,90,0.16);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.18);
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; transition: color .18s; }
a:hover { color: #e6a648; }
button { cursor: pointer; font: inherit; color: inherit; background: none; border: none; }
table { border-collapse: collapse; width: 100%; }

::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* layout shell */
.shell { max-width: 1280px; margin: 0 auto; padding: 0 var(--space-5) var(--space-20); }

/* HEADER */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,14,20,0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 100%; margin: 0 220px 0 220px; padding: var(--space-4) var(--space-5); display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-mark svg { width: 100%; height: 100%; }
.brand-title { font-family: var(--font-mono); font-weight: 700; font-size: var(--text-lg); letter-spacing: 0.04em; color: var(--text); line-height: 1.1; }
.brand-title small { display: block; font-family: var(--font-body); font-weight: 400; font-size: var(--text-xs); color: var(--text-muted); letter-spacing: 0.18em; text-transform: uppercase; margin-top: 2px; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }
.meta-pair { font-family: var(--font-mono); font-size: var(--text-xs); line-height: 1.3; }
.meta-pair b { display: block; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; }
.meta-pair span { color: var(--text); }

/* HERO / WEEK BANNER */
.hero { padding: var(--space-10) 0 var(--space-6); border-bottom: 1px solid var(--border-soft); margin-bottom: var(--space-8); }
.hero-eyebrow { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--space-3); }
.hero h1 { font-size: var(--text-xl); font-weight: 700; line-height: 1.15; color: var(--text); }
.hero-sub { margin-top: var(--space-3); color: var(--text-muted); }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--space-3); margin-bottom: var(--space-10); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.kpi[data-tone="danger"]::before { background: var(--ru); }
.kpi[data-tone="primary"]::before { background: var(--accent); }
.kpi[data-tone="success"]::before { background: var(--ok); }
.kpi[data-tone="warning"]::before { background: var(--warn); }
.kpi-val { font-family: var(--font-mono); font-weight: 700; font-size: 1.6rem; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-2); line-height: 1.35; }
.kpi-sub { font-size: var(--text-xs); color: var(--text-faint); margin-top: var(--space-1); line-height: 1.3; }
.kpi-src { display: inline-block; margin-top: var(--space-2); font-family: var(--font-mono); font-size: 10px; color: var(--accent); }

/* SECTION */
.section { margin-bottom: var(--space-12); scroll-margin-top: 80px; }
.section-head { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.section-head .num { font-family: var(--font-mono); color: var(--accent); font-weight: 600; font-size: var(--text-sm); }
.section-head h2 { font-size: var(--text-lg); font-weight: 700; color: var(--text); letter-spacing: 0.01em; }
.section-head .rule { flex: 1; height: 1px; background: var(--border); }
.section-intro { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--space-5); }

/* ASSESSMENT list */
.assessment { display: grid; gap: var(--space-3); }
.assessment li { list-style: none; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: var(--space-4) var(--space-5); color: var(--text); position: relative; }
.assessment li::before { content: counter(assess); counter-increment: assess; position: absolute; left: -1px; top: -1px; font-family: var(--font-mono); font-size: 10px; background: var(--accent); color: #11161f; padding: 2px 6px; border-radius: 0 0 8px 0; font-weight: 700; }
.assessment { counter-reset: assess; }
.assessment li { padding-left: var(--space-8); }
.assess-src { font-family: var(--font-mono); font-size: var(--text-xs); margin-left: var(--space-1); }
.pop-src { display: inline-block; margin-top: 6px; font-family: var(--font-mono); font-size: 11px; color: var(--accent); }

/* MAP */
.map-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
#map-section .map-wrap { width: 66%; margin: 0 auto; }
#map { height: 560px; width: 100%; background: #0c1117; }
#battlefield-map { height: calc(100vh - 160px); min-height: 500px; width: 100%; background: #0c1117; }
#tab-battlefield { max-width: 100%; }
#tab-battlefield .map-wrap { border-radius: 0; }
.map-legend { display: flex; gap: var(--space-6); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); }
.legend-item { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--text-muted); }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.85); }
.leaflet-container { font-family: var(--font-body); background: #0c1117; }
.leaflet-popup-content-wrapper { background: #11161f; color: var(--text); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: var(--space-4); font-size: var(--text-sm); line-height: 1.5; }
.leaflet-popup-tip { background: #11161f; border: 1px solid var(--border); }
.leaflet-popup-content .pop-title { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.leaflet-popup-content .pop-meta { font-family: var(--font-mono); font-size: 11px; color: var(--accent); margin-bottom: 6px; }
.leaflet-popup-content .pop-detail { color: var(--text-muted); margin-bottom: 6px; }
.leaflet-popup-content .pop-conf { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; }
.leaflet-bar a { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.leaflet-bar a:hover { background: var(--surface-3); color: var(--text); }

/* custom markers */
.marker-pin { display: flex; align-items: center; justify-content: center; }
.marker-pin .dot { width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(0,0,0,0.35); }
.cat-ru-strike .dot { background: var(--ru); }
.cat-ua-strike .dot { background: var(--ua); }
.cat-frontline .dot { background: var(--warn); }
.cat-infra .dot { background: #9b6fd8; }
.marker-pulse { position: relative; }
.marker-pulse .dot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1.5px solid currentColor; opacity: 0.5; }

/* battlefield unit markers */
.bf-unit-marker { background: none !important; border: none !important; }

/* TOP 10 cards */
.top-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.dev-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4) var(--space-5); display: flex; gap: var(--space-4); align-items: stretch; }
.dev-num { font-family: var(--font-mono); font-weight: 700; font-size: 1.4rem; color: var(--accent); line-height: 1; flex: none; min-width: 1.6em; display: flex; align-items: flex-start; }
.dev-img { flex: none; width: 80px; height: 80px; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.dev-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dev-body { flex: 1; min-width: 0; }
.dev-date { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-faint); letter-spacing: 0.08em; }
.dev-title { font-weight: 600; color: var(--text); margin: 2px 0 var(--space-2); font-size: var(--text-base); }
.dev-summary { color: var(--text-muted); font-size: var(--text-sm); }
.dev-sources { margin-top: var(--space-3); display: flex; flex-wrap: wrap; gap: var(--space-2); }
.src-chip { font-family: var(--font-mono); font-size: 10px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 9999px; color: var(--text-muted); background: var(--surface-2); transition: all .18s; }
.src-chip:hover { color: var(--accent); border-color: var(--accent); }

/* TIMELINE */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: linear-gradient(var(--accent), var(--border) 60%, transparent); }
.tl-day { position: relative; margin-bottom: var(--space-5); }
.tl-day::before { content: ""; position: absolute; left: -22px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.tl-day-header { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 600; color: var(--text); margin-bottom: var(--space-2); }
.tl-items { display: grid; gap: var(--space-2); }
.tl-item { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px; padding: var(--space-3) var(--space-4); font-size: var(--text-sm); color: var(--text-muted); }
.tl-item:hover { border-color: var(--border); }
.tl-item a { font-family: var(--font-mono); font-size: var(--text-xs); }

/* TABLES */
.tbl-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table.data { font-size: var(--text-sm); }
table.data thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-muted); text-align: left; font-weight: 600; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data tbody td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-soft); color: var(--text); vertical-align: top; line-height: 1.5; overflow-wrap: anywhere; word-break: break-word; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-src { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); }

/* confidence / divergence badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 9999px; white-space: nowrap; }
.badge.high { color: var(--ok); background: var(--ok-soft); }
.badge.medium { color: var(--warn); background: var(--warn-soft); }
.badge.low, .badge.n\.a\. { color: #b06fd8; background: rgba(155,111,216,0.16); }
.badge.na { color: var(--text-faint); background: var(--surface-3); }
.badge.Major { color: var(--ru); background: var(--ru-soft); }
.badge.Notable { color: var(--warn); background: var(--warn-soft); }
.badge.Minor { color: var(--text-muted); background: var(--surface-3); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* fact-row list (used by Kherson/POW/Energy) */
.fact-list { display: grid; gap: var(--space-3); }
.fact-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4) var(--space-5); display: grid; grid-template-columns: 150px 90px 1fr auto; gap: var(--space-4); align-items: start; }
.fact-tag { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); }
.fact-text { color: var(--text); font-size: var(--text-sm); line-height: 1.55; overflow-wrap: anywhere; word-break: break-word; }

/* comparison table tweaks */
table.cmp td { font-size: var(--text-xs); }
.cmp-event { font-weight: 600; color: var(--text); white-space: normal; min-width: 120px; }
table.cmp { min-width: 900px; }

/* sources */
.src-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px var(--space-6); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); }
.src-grid a { font-size: var(--text-xs); color: var(--text-muted); padding: var(--space-1) 0; font-family: var(--font-body); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-grid a:hover { color: var(--accent); }

/* footer */
.foot { margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid var(--border-soft); color: var(--text-faint); font-size: var(--text-xs); }
.foot p { }

/* nav chips */
.nav-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-10); }
.nav-chip { font-family: var(--font-mono); font-size: var(--text-xs); padding: 6px 12px; border: 1px solid var(--border); border-radius: 9999px; color: var(--text-muted); background: var(--surface); transition: all .18s; }
.nav-chip:hover { color: var(--accent); border-color: var(--accent); }

/* responsive */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .top-grid { grid-template-columns: 1fr; }
  .src-grid { grid-template-columns: 1fr; }
  #map { height: 440px; width: 100%; }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .fact-row { grid-template-columns: 1fr; gap: var(--space-2); }
  #map { height: 360px; width: 100%; }
  .topbar-meta { width: 100%; }
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-wrap table { min-width: 600px; }
  .shell { padding: 0 var(--space-3) var(--space-10); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ═══ APP LAYOUT (sidebar + main) ═══ */
.app-layout {
  display: flex;
  min-height: 100dvh;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
  width: 220px;
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  height: 100dvh;
  overflow-y: hidden;
  z-index: 60;
  transition: transform .2s ease;
}
.sidebar-inner {
  padding: var(--space-4) 0;
}
.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  padding: var(--space-3) var(--space-4) var(--space-2);
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: all .15s;
  border-left: 2px solid transparent;
  cursor: pointer;
}
.sidebar-item:hover {
  color: var(--text);
  background: var(--surface-2);
}
.sidebar-item.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.sidebar-item.sidebar-db {
  color: var(--ua);
}
.sidebar-item.sidebar-db:hover {
  color: var(--text);
  background: var(--ua-soft);
}
.sidebar-item.sidebar-db.active {
  color: var(--ua);
  background: var(--ua-soft);
  border-left-color: var(--ua);
}

/* Sidebar toggle button (mobile) */
.sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.2rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-right: var(--space-2);
}
.sidebar-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* ═══ MAIN CONTENT ═══ */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 0 var(--space-5) var(--space-20);
  margin-left: 220px;
}
.main-content > div {
  margin-left: auto;
  margin-right: auto;
}
/* Battlefield tab: full width, no padding constraints */
.main-content:has(#tab-battlefield[style*="display: block"]) {
  max-width: 100%;
  padding: 0 0 var(--space-20) 0;
  margin-left: 220px;
}
#tab-battlefield { width: 100%; }
#tab-battlefield .map-wrap { border-radius: 0; border: none; }

/* ═══ HARDWARE SUB-TABS ═══ */
.hw-sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.hw-sub-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--text-muted);
  background: var(--surface);
  cursor: pointer;
  transition: all .18s;
}
.hw-sub-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.hw-sub-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* ═══ FILTER ROW ═══ */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.filter-row select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  min-width: 140px;
}
.filter-row select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ═══ DATABASE CARDS (Hardware & Leadership) ═══ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}
.db-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .18s, transform .15s;
  cursor: pointer;
}
.db-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.db-card.side-ua {
  border-left: 3px solid var(--ua);
}
.db-card.side-ru {
  border-left: 3px solid var(--ru);
}
.db-card.side-both,
.db-card.side-int {
  border-left: 3px solid var(--warn);
}
.db-card-img {
  width: 100%;
  height: 120px;
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.db-card-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.db-card-body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.db-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.db-card-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text);
}
.db-card-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.db-card-badge.side-ua {
  color: var(--ua);
  background: var(--ua-soft);
}
.db-card-badge.side-ru {
  color: var(--ru);
  background: var(--ru-soft);
}
.db-card-badge.side-both,
.db-card-badge.side-int {
  color: var(--warn);
  background: var(--warn-soft);
}
.db-card-designation {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
}
.db-card-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.55;
}
.db-card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: auto;
}
.spec-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
}
.spec-tag b {
  color: var(--text-muted);
}
.db-card-role {
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-top: auto;
  line-height: 1.4;
}
.db-card-role b {
  color: var(--text-muted);
}

/* ═══ SIDEBAR RESPONSIVE ═══ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-toggle {
    display: inline-flex;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  /* Remove sidebar margin on mobile — content fills full width */
  .main-content {
    margin-left: 0;
  }
  .topbar-inner {
    margin-left: 0;
    margin-right: 0;
  }
  .main-content:has(#tab-battlefield[style*="display: block"]) {
    margin-left: 0;
  }
}

/* ═══ DETAIL MODAL ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  width: 100%;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
}
.modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  color: var(--text);
  border-color: var(--accent);
}
.modal-body {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.modal-img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Image gallery for hardware/leadership cards */
.modal-gallery { position: relative; margin-bottom: 12px; }
.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0;
}
.gallery-prev, .gallery-next {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.gallery-prev:hover, .gallery-next:hover {
  background: var(--surface-3);
}
.gallery-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  min-width: 50px;
  text-align: center;
}
.gallery-thumbs {
  display: flex;
  gap: 6px;
  padding: 4px 0;
  overflow-x: auto;
}
.gallery-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s;
}
.gallery-thumb:hover { opacity: 0.9; }
.gallery-thumb.active {
  border-color: var(--accent);
  opacity: 1;
}
.modal-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.modal-section h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: 700;
}
.modal-section p {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.6;
}
.modal-badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.modal-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
}
.modal-badge.side-ua { background: var(--ua-soft); color: var(--ua); }
.modal-badge.side-ru { background: var(--ru-soft); color: var(--ru); }
.modal-badge.side-int { background: var(--warn-soft); color: var(--warn); }
.modal-specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}
.modal-spec-item {
  background: var(--surface-2);
  padding: var(--space-2) var(--space-3);
  border-radius: 4px;
  font-size: var(--text-xs);
}
.modal-spec-item b {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}
.modal-spec-item span {
  color: var(--text);
}

@media (max-width: 640px) {
  .main-content {
    padding: 0 var(--space-3) var(--space-10);
  }
  /* KPI grid: 2 columns on phone */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Tables: horizontal scroll */
  .tbl-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tbl-wrap table {
    min-width: 600px;
  }
  /* Maps: shorter on mobile */
  #map {
    height: 360px;
  }
  #battlefield-map {
    height: calc(100vh - 120px);
    min-height: 350px;
  }
  /* Topbar: stack meta below brand */
  .topbar-meta {
    width: 100%;
    margin-left: 0;
  }
  .meta-pair {
    font-size: 10px;
  }
  /* Date pickers: smaller */
  #meta-window-start, #meta-window-end {
    font-size: 10px;
    width: 120px;
  }
  /* Nav chips: horizontal scroll */
  .nav-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: var(--space-2);
  }
  .nav-chip {
    white-space: nowrap;
  }
  /* Fact rows: stack vertically */
  .fact-row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
  /* Section heads: smaller */
  .section-head h2 {
    font-size: var(--text-base);
  }
  /* Hardware sub-tabs: horizontal scroll */
  .hw-sub-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .hw-sub-btn {
    white-space: nowrap;
  }
  /* Modal: full width */
  .modal {
    max-width: 95vw;
    max-height: 90vh;
  }
  .modal-specs {
    grid-template-columns: 1fr;
  }
}

/* ═══ SEARCH INPUT ═══ */
.search-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  padding: 6px 10px;
  border-radius: 6px;
  width: 200px;
  transition: border-color .18s, width .2s;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  width: 260px;
}
.search-input::placeholder {
  color: var(--text-faint);
}

/* ═══ SEARCH RESULTS DROPDOWN ═══ */
.search-results {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 200;
  padding: var(--space-2);
}
.search-results .sr-item {
  padding: var(--space-2) var(--space-3);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: var(--text-sm);
  transition: background .12s;
}
.search-results .sr-item:hover {
  background: var(--surface-2);
}
.search-results .sr-item .sr-section {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.search-results .sr-item .sr-preview {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin-top: 2px;
}

/* ═══ EXPORT BUTTON ═══ */
.export-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  background: var(--surface-2);
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.export-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ═══ THEME TOGGLE ═══ */
.theme-toggle {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  background: var(--surface-2);
  cursor: pointer;
  transition: all .18s;
  line-height: 1;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ═══ TIMELINE BAR ═══ */
.timeline-bar {
  position: relative;
  height: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-6);
  overflow: visible;
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
}
.timeline-bar::before {
  content: "";
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  height: 2px;
  background: var(--border);
  top: 50%;
  transform: translateY(-50%);
}
.timeline-bar .tl-marker {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  cursor: pointer;
  z-index: 2;
  transition: transform .15s, background .15s;
  top: 50%;
  transform: translate(-50%, -50%);
}
.timeline-bar .tl-marker:hover {
  transform: translate(-50%, -50%) scale(1.4);
  background: var(--text);
}
.timeline-bar .tl-marker-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-faint);
  white-space: nowrap;
  margin-top: 2px;
  pointer-events: none;
}

/* ═══ CONFIDENCE DOTS ═══ */
.conf-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.conf-dot.high {
  background: var(--ok);
}
.conf-dot.medium {
  background: var(--accent);
}
.conf-dot.low {
  background: var(--ru);
}

/* ═══ KEYBOARD HELP OVERLAY ═══ */
.keyboard-help {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.keyboard-help-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
  padding: var(--space-5);
}
.keyboard-help-inner h3 {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: var(--space-4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.kb-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-soft);
}
.kb-row:last-child {
  border-bottom: none;
}
.kb-row kbd {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--text);
  min-width: 80px;
  text-align: center;
}
.kb-row span {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ═══ LIGHT THEME ═══ */
body.light {
  color: #1a1a2e;
  background-color: #f5f7fa;
  background-image: none;
}
body.light,
body.light :root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --surface-3: #e8ebf0;
  --border: #e0e5ee;
  --border-soft: #d8dde6;
  --text: #1a1a2e;
  --text-muted: #6a7280;
  --text-faint: #9ca3af;
  --accent: #b8731e;
  --accent-soft: rgba(184,115,30,0.10);
  --ru: #c0392b;
  --ru-soft: rgba(192,57,43,0.10);
  --ua: #2980b9;
  --ua-soft: rgba(41,128,185,0.10);
  --warn: #b8860b;
  --warn-soft: rgba(184,134,11,0.10);
  --ok: #27ae60;
  --ok-soft: rgba(39,174,96,0.10);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
}
body.light .topbar {
  background: rgba(245,247,250,0.90);
}
body.light .sidebar {
  background: var(--surface);
}
body.light .kpi {
  background: var(--surface);
}
body.light .assessment li {
  background: var(--surface);
}
body.light .assessment li::before {
  color: #ffffff;
}
body.light .dev-card {
  background: var(--surface);
}
body.light .tl-item {
  background: var(--surface);
}
body.light .tbl-wrap {
  background: var(--surface);
}
body.light table.data thead th {
  background: var(--surface-2);
}
body.light .fact-row {
  background: var(--surface);
}
body.light .src-grid {
  background: var(--surface);
}
body.light .nav-chip {
  background: var(--surface);
}
body.light .db-card {
  background: var(--surface);
}
body.light .hw-sub-btn {
  background: var(--surface);
}
body.light .map-wrap {
  background: var(--surface);
}
body.light .search-input {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
body.light .search-results {
  background: var(--surface);
}
body.light .export-btn {
  background: var(--surface-2);
  color: var(--text-muted);
}
body.light .theme-toggle {
  background: var(--surface-2);
  color: var(--text-muted);
}
body.light .timeline-bar {
  background: var(--surface);
}
body.light .keyboard-help-inner {
  background: var(--surface);
}
body.light .kb-row kbd {
  background: var(--surface-2);
  color: var(--text);
}
body.light .modal {
  background: var(--surface);
}
body.light .modal-overlay {
  background: rgba(0,0,0,0.3);
}
body.light .leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
}
body.light .leaflet-popup-tip {
  background: var(--surface);
}
body.light .leaflet-bar a {
  background: var(--surface-2);
  color: var(--text-muted);
}
body.light .leaflet-bar a:hover {
  background: var(--surface-3);
  color: var(--text);
}
body.light .db-card-img {
  background: var(--surface-2);
}
body.light .about-content {
  color: var(--text-muted);
}

/* ═══ LOADING SKELETONS ═══ */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}
.skeleton {
  background: var(--surface-2);
  border-radius: 6px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-line {
  height: 14px;
  width: 100%;
  margin-bottom: var(--space-2);
  background: var(--surface-2);
  border-radius: 4px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
.skeleton-line:last-child {
  width: 60%;
}
.skeleton-card {
  height: 120px;
  width: 100%;
  background: var(--surface-2);
  border-radius: var(--radius);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* ═══ SOURCE DIVERSITY BADGES ═══ */
.src-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.src-badge.multi {
  background: rgba(95,174,90,0.2);
  color: #5fae5a;
}
.src-badge.single {
  background: rgba(138,147,163,0.15);
  color: #8a93a3;
}

/* ═══ ABOUT PAGE ═══ */
.about-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.about-content h3 {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: var(--space-2);
}
.about-content p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.7;
}

/* ═══ CASUALTY KPI ═══ */
#casualty-kpi .kpi-val {
  color: var(--ru);
}

/* ═══ KPI GRID RESPONSIVE (7-col) ═══ */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══ SEARCH RESPONSIVE ═══ */
@media (max-width: 900px) {
  .search-input {
    width: 140px;
  }
  .search-input:focus {
    width: 180px;
  }
  .search-results {
    width: 90vw;
    left: 5vw;
    transform: none;
  }
}
@media (max-width: 640px) {
  .search-input {
    width: 100%;
  }
  .search-input:focus {
    width: 100%;
  }
  .export-btn {
    font-size: 10px;
    padding: 4px 8px;
  }
  .theme-toggle {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }
}

/* ═══ MOBILE BOTTOM NAV BAR ═══ */
.bottom-nav {
  display: none;
}
@media (max-width: 900px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: center;
    height: 56px;
    padding: 0 env(safe-area-inset-bottom, 0);
  }
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 44px;
    min-height: 44px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    background: none;
    border: none;
    cursor: pointer;
    transition: color .15s;
    padding: 0 4px;
  }
  .bottom-nav-item:hover {
    color: var(--text-muted);
  }
  .bottom-nav-item.active {
    color: var(--accent);
  }
  /* Add padding to main content so content doesn't hide behind bottom nav */
  .main-content {
    padding-bottom: calc(var(--space-20) + 56px);
  }
}

/* ═══ STICKY SECTION HEADERS (mobile) ═══ */
@media (max-width: 900px) {
  .section-head {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
    margin-left: calc(-1 * var(--space-3));
    margin-right: calc(-1 * var(--space-3));
    padding-left: var(--space-3);
    padding-right: var(--space-3);
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--space-2);
  }
  /* Hide the decorative rule line on mobile — it competes with h2 for space */
  .section-head .rule {
    display: none;
  }
  /* h2 takes remaining space, wraps to 2 lines if needed, never truncates */
  .section-head h2 {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--text-base);
    line-height: 1.3;
    word-break: break-word;
  }
  /* +/- toggle stays fixed width at the end */
  .section-head::after {
    flex: none;
    margin-left: var(--space-1);
  }
}

/* ═══ STICKY KPI STRIP (mobile) ═══ */
@media (max-width: 900px) {
  .kpi-grid {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: var(--space-3);
    position: sticky;
    top: 48px;
    z-index: 9;
    background: var(--bg);
    padding: var(--space-2) 0;
    scroll-snap-type: x mandatory;
  }
  .kpi {
    flex: 0 0 160px;
    scroll-snap-align: start;
  }
}

/* ═══ COLLAPSIBLE SECTIONS (mobile) ═══ */
@media (max-width: 900px) {
  .section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .section.expanded .section-body {
    max-height: none;
  }
  .section-head {
    cursor: pointer;
    user-select: none;
  }
  .section-head::after {
    content: "+";
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-faint);
    margin-left: auto;
    transition: transform 0.3s;
  }
  .section.expanded .section-head::after {
    content: "-";
  }
}

/* ═══ MAP FULLSCREEN BUTTON (mobile) ═══ */
@media (max-width: 900px) {
  .map-fullscreen-btn {
    display: block;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 6px 12px;
    min-height: 36px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .15s;
  }
  .map-fullscreen-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
  }
  .map-wrap {
    position: relative;
  }
}

/* ═══ LARGER TAP TARGETS (mobile) ═══ */
@media (max-width: 900px) {
  .sidebar-item {
    min-height: 44px;
    padding: 12px;
  }
  .nav-chip {
    min-height: 44px;
    padding: 10px 16px;
  }
  .src-chip,
  .assess-src {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* ═══ FULL-SCREEN SEARCH (mobile) ═══ */
@media (max-width: 640px) {
  #search-results {
    position: fixed;
    inset: 60px 0 0 0;
    max-height: 100vh;
    width: 100%;
    left: 0;
    transform: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}

/* ═══ CARD TAP FEEDBACK ═══ */
.db-card:active {
  transform: scale(0.98);
  background: var(--surface-2);
}
.feed-item:active {
  background: var(--surface-2);
}
.db-card {
  transition: transform 0.1s, background 0.1s, border-color .18s;
}
.feed-item {
  transition: transform 0.1s, background 0.1s;
}

/* ═══ BOTTOM SHEET MAP POPUPS (mobile) ═══ */
@media (max-width: 900px) {
  .leaflet-popup {
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    bottom: 0 !important;
  }
  .leaflet-popup-content-wrapper {
    border-radius: 12px 12px 0 0;
  }
  .leaflet-popup-tip {
    display: none;
  }
}
