:root {
  --bg: #f2f5fa;
  --card: #ffffff;
  --ink: #0b1b34;
  --ink-2: #21324d;
  --muted: #60708a;
  --muted-2: #8794a8;
  --line: #e5eaf3;
  --line-2: #eef2f8;
  --accent: #0f766e;
  --accent-2: #0d9488;
  --accent-soft: #e6f5f2;
  --amber: #b45309;
  --amber-soft: #fdf3e3;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgba(16, 32, 56, .05), 0 8px 24px rgba(16, 32, 56, .06);
  --radius: 16px;
  --font: 'Noto Sans Thai', 'Leelawadee UI', 'Tahoma', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

h1, h2, h3, p, ul { margin: 0; }

button, select, input { font-family: inherit; }

button { cursor: pointer; }

svg { display: block; }

/* ------------------------------------------------------------------ */
/* header                                                             */
/* ------------------------------------------------------------------ */
.topbar {
  position: relative;
  background:
    radial-gradient(1100px 320px at 12% -40%, rgba(45, 212, 191, .18), transparent 65%),
    radial-gradient(900px 260px at 88% 120%, rgba(251, 191, 36, .13), transparent 60%),
    linear-gradient(115deg, #07162b 0%, #0a2338 52%, #0b3341 100%);
  color: #fff;
  overflow: hidden;
}
.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(90deg, transparent 35%, #000 100%);
  pointer-events: none;
}
.topbar-inner {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 15px; }
.brand-mark {
  width: 48px;
  height: 48px;
  color: #5eead4;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  padding: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.brand-text h1 {
  font-size: 23px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .1px;
}
.eyebrow {
  font-size: 9.5px;
  letter-spacing: 1.8px;
  color: #7dd3c7;
  font-weight: 600;
}
.brand-text .sub { font-size: 12px; color: #a9bdd2; margin-top: 1px; }
.brand-text .sub span { color: #7d93ad; }

.topbar-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.pill svg { width: 14px; height: 14px; }
.pill-warn {
  color: #ffdfa3;
  background: rgba(245, 158, 11, .14);
  border: 1px solid rgba(245, 158, 11, .35);
}
.pill-ok {
  color: #a7f3d0;
  background: rgba(16, 185, 129, .14);
  border: 1px solid rgba(16, 185, 129, .34);
}
.pill-plain {
  color: #c7d7e8;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
}

/* ------------------------------------------------------------------ */
/* layout                                                             */
/* ------------------------------------------------------------------ */
.page {
  max-width: 1560px;
  margin: 0 auto;
  padding: 22px 28px 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 17px 18px;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-head h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .1px;
  color: var(--ink);
}
.hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}
.hint.center { text-align: center; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f1f5fa;
  color: #4a5c76;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid #e8eef6;
}
.chip-amber { background: var(--amber-soft); color: #92400e; border-color: #f8e5c9; }

/* ------------------------------------------------------------------ */
/* KPI                                                                */
/* ------------------------------------------------------------------ */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.kpi {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 17px 15px;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16, 32, 56, .05), 0 14px 30px rgba(16, 32, 56, .09); }
.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--kpi-accent, var(--accent));
  opacity: .9;
}
.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.kpi-label { font-size: 11.5px; color: var(--muted); font-weight: 500; line-height: 1.4; }
.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--kpi-tint, var(--accent-soft));
  color: var(--kpi-accent, var(--accent));
  flex: none;
}
.kpi-icon svg { width: 17px; height: 17px; }
.kpi-value {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -.4px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.kpi-foot {
  margin-top: 5px;
  font-size: 10.5px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 16px;
}
.kpi-foot .up { color: #0f766e; font-weight: 600; }
.kpi-foot .warn { color: #b45309; font-weight: 600; }

/* ------------------------------------------------------------------ */
/* workspace                                                          */
/* ------------------------------------------------------------------ */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 348px;
  gap: 16px;
  align-items: stretch;
}
.map-card { display: flex; flex-direction: column; padding-bottom: 14px; }
.map-head { align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.map-title h2 { margin-bottom: 2px; }
.map-controls { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.control { display: flex; flex-direction: column; gap: 4px; }
.control > span {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted-2);
  letter-spacing: .4px;
  padding-left: 2px;
}
select, .search-wrap input {
  height: 33px;
  border: 1px solid #dbe3ee;
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  padding: 0 28px 0 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%2360708a' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 12px;
  max-width: 190px;
}
select:focus, .search-wrap input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .12);
}
#metricSelect { max-width: 215px; }
.btn-ghost {
  height: 33px;
  padding: 0 13px;
  border: 1px solid #dbe3ee;
  border-radius: 9px;
  background: #fff;
  color: #41536c;
  font-size: 12px;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: #f6f9fc; border-color: #c7d3e3; }
.btn-ghost:active { background: #eef3f9; }

.search-wrap { position: relative; }
.search-wrap input {
  width: 218px;
  padding-left: 30px;
  padding-right: 10px;
}
.search-wrap input::placeholder { color: #9aa7ba; }
.search-icon {
  position: absolute;
  left: 10px;
  top: 9.5px;
  width: 15px;
  height: 15px;
  color: #8b99ad;
  pointer-events: none;
}
.search-results {
  position: absolute;
  top: 38px;
  left: 0;
  width: 268px;
  max-height: 290px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 12px 36px rgba(10, 25, 48, .16);
  z-index: 1300;
  padding: 4px;
  display: none;
}
.search-results.open { display: block; }
.sr-item {
  padding: 7px 9px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sr-item:hover, .sr-item.active { background: #f1f7f6; }
.sr-name { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.sr-meta { font-size: 10.5px; color: var(--muted-2); }
.sr-empty { padding: 12px 10px; font-size: 12px; color: var(--muted-2); text-align: center; }

.map-stage { position: relative; flex: 1; min-height: 620px; border-radius: 12px; overflow: hidden; background: #eef2f7; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; background: #eef2f7; }
.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(245, 248, 252, .86);
  z-index: 900;
  font-size: 12.5px;
  color: var(--muted);
  transition: opacity .3s;
}
.map-loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  border-top-color: var(--accent-2);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.map-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 700;
  background: rgba(255, 255, 255, .93);
  border: 1px solid rgba(219, 227, 238, .9);
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 10.5px;
  color: #4b5d76;
  box-shadow: 0 2px 8px rgba(15, 30, 55, .07);
  pointer-events: none;
}
.map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 11px;
  flex-wrap: wrap;
}
.legend { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; }
.legend-title { font-size: 10.5px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.lg-item { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lg-swatch { width: 15px; height: 11px; border-radius: 3px; border: 1px solid rgba(11, 27, 52, .06); }
.map-tip { font-size: 10.5px; color: var(--muted-2); }

/* leaflet overrides */
.leaflet-container { font-family: var(--font); background: #eef2f7; }
.leaflet-control-zoom { border: none !important; box-shadow: 0 4px 14px rgba(10, 25, 48, .14) !important; border-radius: 9px !important; overflow: hidden; }
.leaflet-control-zoom a {
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  color: #33475f !important;
  background: #fff !important;
  border-bottom: 1px solid #edf1f7 !important;
  font-size: 17px !important;
}
.leaflet-control-zoom a:hover { background: #f4f8fc !important; }
.leaflet-control-attribution { display: none; }
.leaflet-tooltip.map-tooltip {
  background: rgba(8, 24, 44, .94);
  border: none;
  border-radius: 9px;
  color: #fff;
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(8, 20, 40, .25);
  white-space: nowrap;
}
.leaflet-tooltip.map-tooltip::before { display: none; }
.tt-name { font-size: 12.5px; font-weight: 600; }
.tt-meta { color: #a9bdd4; font-size: 10.5px; }
.tt-val { margin-top: 4px; color: #fde68a; font-weight: 600; font-variant-numeric: tabular-nums; }
.prov-label {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #3d506a;
  font-size: 10px;
  font-weight: 600;
  text-shadow: 0 0 3px #fff, 0 0 6px #fff, 0 0 8px rgba(255, 255, 255, .9);
  padding: 0 !important;
  pointer-events: none;
  white-space: nowrap;
}
.prov-label::before { display: none !important; }

/* ------------------------------------------------------------------ */
/* side column                                                        */
/* ------------------------------------------------------------------ */
.side-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.top-list { display: flex; flex-direction: column; gap: 2px; }
.top-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 58px;
  gap: 8px;
  align-items: center;
  padding: 5px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .13s;
}
.top-row:hover { background: #f5f9fc; }
.top-rank {
  font-size: 10.5px;
  font-weight: 700;
  color: #9aa8bb;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.top-row:nth-child(-n+3) .top-rank { color: #b45309; }
.top-main { min-width: 0; }
.top-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-meta {
  font-size: 9.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: -1px;
}
.top-bar {
  height: 3px;
  border-radius: 2px;
  background: #edf1f7;
  margin-top: 3px;
  overflow: hidden;
}
.top-bar > i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #f4b183, #c2410c);
}
.top-val {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.chart { width: 100%; }
.chart-age { height: 196px; }
.chart-region { height: 292px; }
.chart-trend { height: 292px; }
.chart-note { font-size: 9.5px; color: var(--muted-2); text-align: right; margin-top: 4px; }
.top-empty { font-size: 12px; color: var(--muted-2); padding: 30px 10px; text-align: center; }

/* insights */
.insight-card { display: flex; flex-direction: column; }
.insights { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.insights li {
  position: relative;
  padding-left: 18px;
  font-size: 12px;
  color: #3c4f68;
  line-height: 1.6;
}
.insights li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
}
.insights li:nth-child(2)::before { background: #f59e0b; }
.insights li:nth-child(3)::before { background: #e0663e; }
.insights li:nth-child(4)::before { background: #7c8aa0; }
.insights b { color: var(--ink); font-weight: 700; }
.insight-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 10px;
  color: var(--muted-2);
  line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* grid-3                                                             */
/* ------------------------------------------------------------------ */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* ------------------------------------------------------------------ */
/* table                                                              */
/* ------------------------------------------------------------------ */
.table-card { padding-bottom: 8px; }
.table-head { align-items: center; }
.table-actions { display: flex; align-items: center; gap: 8px; }
.table-wrap {
  max-height: 470px;
  overflow: auto;
  border: 1px solid var(--line-2);
  border-radius: 10px;
}
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafd;
  color: #566981;
  font-size: 10.5px;
  font-weight: 600;
  text-align: left;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--accent); }
thead th.num { text-align: right; }
thead th.sort-asc::after { content: " ↑"; color: var(--accent); }
thead th.sort-desc::after { content: " ↓"; color: var(--accent); }
tbody td {
  padding: 7.5px 11px;
  border-bottom: 1px solid #f1f5fa;
  color: #33465f;
  white-space: nowrap;
}
tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f7fafc; }
tbody tr.active { background: #eef8f6; }
tbody tr.active td { color: var(--ink); }
tbody tr:last-child td { border-bottom: none; }
td.prov-name { font-weight: 600; color: var(--ink-2); }
.mini-bar {
  display: inline-block;
  width: 52px;
  height: 4px;
  border-radius: 2px;
  background: #eef2f8;
  margin-left: 7px;
  vertical-align: middle;
  overflow: hidden;
}
.mini-bar > i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #f6c78d, #c2410c); }

/* ------------------------------------------------------------------ */
/* footer                                                             */
/* ------------------------------------------------------------------ */
.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 2px 4px 6px;
  font-size: 10.5px;
  color: var(--muted-2);
}
.foot-left, .foot-right { display: flex; gap: 14px; flex-wrap: wrap; }
.foot-left strong { color: var(--muted); font-weight: 600; }

/* ------------------------------------------------------------------ */
/* drawer                                                             */
/* ------------------------------------------------------------------ */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 18, 34, .34);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  z-index: 1900;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(390px, 94vw);
  background: #fff;
  z-index: 2000;
  box-shadow: -18px 0 46px rgba(8, 22, 42, .18);
  transform: translateX(104%);
  transition: transform .26s cubic-bezier(.32, .72, .28, 1);
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, #fbfdfe, #fff);
}
.drawer-head h2 { font-size: 19px; font-weight: 700; line-height: 1.35; margin-top: 2px; }
.drawer-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: #4a5c74;
  display: grid;
  place-items: center;
  flex: none;
}
.icon-btn:hover { background: #f5f8fc; }
.icon-btn svg { width: 15px; height: 15px; }
.drawer-body { padding: 18px 20px 28px; overflow-y: auto; }
.hero-metric {
  border-radius: 13px;
  background: linear-gradient(135deg, #0c3b3a, #0f766e 70%, #14867c);
  color: #fff;
  padding: 16px 17px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.hero-metric::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.hero-label { font-size: 10.5px; color: #b8ded9; }
.hero-value { font-size: 34px; font-weight: 700; letter-spacing: -.8px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.hero-value small { font-size: 14px; font-weight: 500; color: #cbe8e4; margin-left: 3px; }
.hero-note { font-size: 10.5px; color: #cbe8e4; margin-top: 2px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 16px; }
.stat-box { border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 11px; background: #fbfcfe; }
.stat-label { font-size: 10px; color: var(--muted-2); }
.stat-value { font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 10.5px; color: var(--muted); font-weight: 500; }
.block-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.band-bar { display: flex; height: 17px; border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.band-bar > i { display: block; height: 100%; }
.band-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; margin-bottom: 16px; }
.band-item { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.band-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.band-item b { margin-left: auto; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.drawer-note {
  font-size: 10px;
  color: var(--muted-2);
  line-height: 1.6;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.drawer-actions { display: flex; gap: 8px; margin-top: 14px; }
.drawer-actions button { flex: 1; }

/* ------------------------------------------------------------------ */
/* toast                                                              */
/* ------------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: rgba(9, 24, 44, .94);
  color: #fff;
  font-size: 12px;
  padding: 9px 16px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(8, 20, 40, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 2500;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ */
/* responsive                                                         */
/* ------------------------------------------------------------------ */
@media (max-width: 1240px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .side-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .map-stage { min-height: 560px; }
}
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .insight-card { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .page { padding: 16px 16px 24px; }
  .topbar-inner { padding: 16px 18px; }
  .map-head { align-items: flex-start; }
  .map-controls { width: 100%; }
  #metricSelect { max-width: none; }
  .control { flex: 1 1 140px; }
  .control select { width: 100%; max-width: none; }
  .search-wrap { flex: 1 1 190px; }
  .search-wrap input { width: 100%; }
  .search-results { width: 100%; min-width: 230px; }
}
@media (max-width: 780px) {
  #provTable th:nth-child(n + 7),
  #provTable td:nth-child(n + 7),
  #provTable th:nth-child(3),
  #provTable td:nth-child(3),
  #provTable th:nth-child(4),
  #provTable td:nth-child(4) { display: none; }
  .table-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .table-actions { width: 100%; justify-content: flex-end; }
}
@media (max-width: 720px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .side-col { grid-template-columns: 1fr; }
  .map-stage { min-height: 440px; }
  .topbar-meta .pill-plain { display: none; }
  .map-tip { display: none; }
  .kpi-value { font-size: 23px; }
  .page-footer { flex-direction: column; gap: 6px; }
  .foot-left, .foot-right { gap: 8px; }
  .brand-text h1 { font-size: 19px; }
  .brand-mark { width: 40px; height: 40px; }
  .table-wrap { max-height: 420px; }
}
@media (max-width: 560px) {
  .topbar-inner { flex-direction: column; align-items: stretch; gap: 12px; }
  .topbar-meta { justify-content: flex-start; }
}
@media (max-width: 460px) {
  .kpis { grid-template-columns: 1fr; }
  .pill-warn { font-size: 10.5px; padding: 0 9px; }
  .map-stage { min-height: 380px; }
  .drawer { width: 100vw; }
  .mini-bar { display: none; }
}
@media (max-width: 380px) {
  #provTable th:nth-child(1),
  #provTable td:nth-child(1) { display: none; }
  #provTable th,
  #provTable td { padding-left: 8px; padding-right: 8px; }
}
