:root {
  color-scheme: dark;
  --bg: #08090b;
  --surface: #101217;
  --surface-2: #171a22;
  --line: #272c36;
  --text: #f7f4ef;
  --muted: #a9adb8;
  --red: #e31d1a;
  --red-2: #8f1111;
  --blue: #5db7de;
  --green: #4fd18b;
  --yellow: #e9c46a;
  --violet: #b69cf6;
  --cream: #f0e5d3;
  --radius: 8px;
  --shadow: 0 18px 58px rgb(0 0 0 / 34%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgb(227 29 26 / 13%) 0, transparent 28rem),
    radial-gradient(circle at 78% 0%, rgb(93 183 222 / 10%), transparent 24rem),
    linear-gradient(180deg, #0d0e12, var(--bg) 42rem);
  color: var(--text);
}

button,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgb(17 18 23 / 94%), rgb(9 10 13 / 94%));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--red), var(--red-2));
  color: white;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #c7bfb5;
  font-size: 12px;
}

.nav-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.nav-tab,
.panel-title button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0c0e13;
  color: var(--muted);
  cursor: pointer;
}

.nav-tab.active,
.nav-tab:hover,
.panel-title button:hover {
  border-color: rgb(240 68 68 / 70%);
  background: rgb(227 29 26 / 16%);
  color: var(--text);
}

.filter-panel {
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(16 18 23 / 78%);
}

.panel-title,
.panel-head,
.context-row,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-title {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.panel-title button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: #0d1017;
  color: var(--text);
}

select:focus {
  border-color: var(--red);
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #ff5a54;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 980px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.02;
}

h2 {
  font-size: 17px;
}

.source-status {
  max-width: 360px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(17 20 27 / 76%);
  color: var(--muted);
  font-size: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 5%), rgb(255 255 255 / 1%)),
    radial-gradient(circle at 100% 0%, rgb(227 29 26 / 15%), transparent 10rem);
  box-shadow: var(--shadow);
}

.kpi span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.kpi strong {
  color: var(--cream);
  font-size: clamp(24px, 3vw, 34px);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  min-height: 360px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 3%), rgb(255 255 255 / 1%)),
    rgb(16 18 23 / 86%);
  box-shadow: var(--shadow);
}

.panel.wide,
.map-panel {
  grid-column: span 2;
}

.report-panel {
  min-height: 0;
  margin-bottom: 14px;
}

.panel-head {
  margin-bottom: 12px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.red {
  background: var(--red);
  box-shadow: 0 0 0 3px rgb(240 68 68 / 16%);
}

.legend-dot.gray {
  background: #3a414f;
  box-shadow: 0 0 0 3px rgb(151 160 180 / 12%);
}

.map {
  width: 100%;
  height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 52% 44%, rgb(93 183 222 / 9%), transparent 22rem),
    #0d1017;
}

.map.compact {
  height: 345px;
}

canvas {
  width: 100% !important;
  height: 300px !important;
  max-height: 300px;
}

.wide canvas {
  height: 360px !important;
  max-height: 360px;
}

.context-row {
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgb(227 29 26 / 10%), rgb(17 20 27 / 78%) 45%);
}

.country-report {
  display: grid;
  gap: 14px;
}

.report-summary {
  max-width: 980px;
  margin: 0;
  color: #d7dce8;
  font-size: 14px;
  line-height: 1.65;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.report-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #11141b, #0d1017);
}

.report-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.report-item strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.report-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.context-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.context-metrics span {
  min-width: 116px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d1017;
  color: var(--muted);
  font-size: 12px;
}

.context-metrics strong {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.badge {
  padding: 8px 12px;
  border: 1px solid rgb(79 209 139 / 55%);
  border-radius: 999px;
  background: rgb(79 209 139 / 12%);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.hidden {
  display: none;
}

.leaflet-container {
  background: #10141c;
  color: #141820;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #121722;
  color: var(--text);
}

table.dataTable {
  color: var(--text);
  font-size: 13px;
}

.dt-container .dt-search input,
.dt-container .dt-length select {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius);
  background: #0d1017 !important;
  color: var(--text) !important;
}

.dt-container,
.dt-container .dt-info,
.dt-container .dt-length,
.dt-container .dt-search {
  color: var(--muted) !important;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .kpi-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel.wide,
  .map-panel {
    grid-column: auto;
  }
}

@media (max-width: 680px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .context-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .context-metrics {
    width: 100%;
    margin-left: 0;
  }

  .context-metrics span {
    flex: 1;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 320px;
  }

  .map {
    height: 340px;
  }
}
