/* ============================================================
   INFRAIMPACT Dashboard — Stylesheet
   Palet: ColorBrewer-inspired, color-blind safe (Okabe-Ito).
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #64748b;
  --primary: #0f3d5b;
  --primary-soft: #1d5b85;
  --accent: #f5c518;

  /* Diagnostic palette (color-blind safe) */
  --q-res: #117733;       /* Resilient — green */
  --q-od:  #DDCC77;       /* Operational Decay — yellow */
  --q-cf:  #88CCEE;       /* Compensated Failure — sky */
  --q-iif: #CC6677;       /* Investment-in-Failure — rose */
  --q-gray: #BBBBBB;

  --risk-green: #117733;
  --risk-yellow: #DDCC77;
  --risk-red: #882255;
  --risk-gray: #BBBBBB;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.16);

  --radius: 10px;
  --radius-sm: 6px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
code { font-family: var(--font-mono); font-size: 12px; }

/* ===================== TOPBAR ===================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-md);
  position: sticky; top: 0; z-index: 50;
}
.topbar__brand { display: flex; align-items: center; gap: 12px; }
.topbar__logo {
  display: grid; place-items: center;
  background: rgba(255,255,255,0.08);
  border-radius: 8px; padding: 4px;
}
.topbar__title-main { font-size: 16px; font-weight: 700; letter-spacing: 0.2px; }
.topbar__title-sub  { font-size: 11px; color: rgba(255,255,255,0.7); margin-top: 1px; }

.topbar__controls { display: flex; align-items: center; gap: 14px; }
.control-group { display: flex; align-items: center; gap: 8px; font-size: 12px; color: rgba(255,255,255,0.85); }
.control-group label { font-weight: 500; }
.control-group--slider input[type="range"] { width: 180px; accent-color: var(--accent); }
.select {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 4px 8px; border-radius: 6px;
  font-family: inherit; font-size: 12px;
}
.select option { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: 6px;
  transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn--ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.25);
  color: #fff;
}
.btn--ghost:hover { background: rgba(255,255,255,0.08); }
.btn--primary {
  background: var(--accent); color: var(--primary);
  font-weight: 600;
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--mini { font-size: 11px; padding: 4px 10px; }
.btn--block { width: 100%; justify-content: center; }

/* ===================== TEMPORAL BAR ===================== */
.temporal-bar {
  display: flex; flex-wrap: wrap; gap: 18px;
  align-items: center;
  padding: 10px 20px;
  background: var(--primary-soft);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
}
.t-block { display: flex; align-items: center; gap: 8px; }
.t-block label { color: rgba(255,255,255,0.85); }
.t-block strong { color: var(--accent); font-family: var(--font-mono); }
.t-block input[type="range"] { width: 160px; accent-color: var(--accent); }
.t-hint { margin-left: auto; color: rgba(255,255,255,0.7); font-size: 11px; font-style: italic; }
.t-block .dash { color: rgba(255,255,255,0.5); }
.select--dark {
  background: rgba(255,255,255,0.10);
  color: #fff; border-color: rgba(255,255,255,0.2);
  padding: 4px 8px;
}
.select--dark option { color: var(--text); background: #fff; }
.t-block[hidden] { display: none !important; }

.t-presets { display: flex; align-items: center; gap: 6px; }
.t-presets__label { color: rgba(255,255,255,0.7); font-size: 11px; margin-right: 2px; }
.chip {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.chip:hover { background: rgba(255,255,255,0.18); }
.chip--active { background: var(--accent); color: var(--primary); border-color: var(--accent); font-weight: 600; }

/* ===================== BREADCRUMB ===================== */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.crumb {
  background: transparent; border: none;
  color: var(--text-mute); cursor: pointer;
  font-family: inherit; font-size: 12px;
  padding: 4px 8px; border-radius: 4px;
}
.crumb:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.crumb--active { color: var(--primary); font-weight: 600; }
.crumb:disabled { color: var(--border-strong); cursor: default; }
.crumb-sep { color: var(--border-strong); }

/* ===================== KPI ROW ===================== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  padding: 12px 20px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.kpi-card__label { font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-card__value { font-size: 22px; font-weight: 700; margin: 4px 0 2px; color: var(--text); }
.kpi-card__hint  { font-size: 10px; color: var(--text-mute); }
.kpi-card__hint--warn { color: #b45309; }

.kpi-delta { font-size: 11px; font-weight: 600; margin-left: 4px; }
.kpi-delta--bad  { color: var(--q-iif); }
.kpi-delta--good { color: var(--q-res); }
.kpi-delta--flat { color: var(--text-mute); }

.quad-mini { display: flex; height: 14px; margin: 6px 0 2px; border-radius: 3px; overflow: hidden; background: var(--surface-2); }
.quad-mini__bar { display: block; height: 100%; transition: flex .3s; }
.quad-mini__bar[data-q="resilient"]              { background: var(--q-res); }
.quad-mini__bar[data-q="operational_decay"]      { background: var(--q-od); }
.quad-mini__bar[data-q="compensated_failure"]    { background: var(--q-cf); }
.quad-mini__bar[data-q="investment_in_failure"]  { background: var(--q-iif); }

/* ===================== LAYOUT ===================== */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr 380px;
  gap: 10px;
  padding: 0 20px;
  height: calc(100vh - 320px);
  min-height: 480px;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.sidebar__title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-mute); margin-bottom: 10px; }
.filter-block { margin-bottom: 16px; }
.filter-block__label { display: block; font-size: 11px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.checkbox-group { display: flex; flex-direction: column; gap: 4px; }
.checkbox-group label { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; color: var(--text); padding: 2px 4px; border-radius: 4px; }
.checkbox-group label:hover { background: var(--surface-2); }
.checkbox-group input { accent-color: var(--primary); }
.input {
  width: 100%; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 4px;
  font-family: inherit; font-size: 12px;
  background: var(--surface);
}
.input:focus { outline: 2px solid var(--primary-soft); outline-offset: 1px; }
.search-results { list-style: none; padding: 0; margin: 4px 0 0; max-height: 160px; overflow-y: auto; border: 1px solid var(--border); border-radius: 4px; }
.search-results:empty { display: none; }
.search-results li { padding: 6px 8px; font-size: 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.search-results li:hover { background: var(--surface-2); }
.search-results li:last-child { border-bottom: none; }
.search-results li small { color: var(--text-mute); }

.filter-meta { margin: 12px 0 16px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot--res  { background: var(--q-res); }
.dot--od   { background: var(--q-od); }
.dot--cf   { background: var(--q-cf); }
.dot--iif  { background: var(--q-iif); }
.dot--gray { background: var(--q-gray); }

.sidebar__legend h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-mute); margin-bottom: 6px; }
.legend-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-soft); }
.legend-list li { display: flex; align-items: center; gap: 6px; }

/* ===================== MAP ===================== */
.map-wrap {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
#map { width: 100%; height: 100%; background: #eaf1f5; }
.leaflet-container { font-family: var(--font-sans); }

.hover-tooltip {
  position: fixed;
  z-index: 1000;
  background: rgba(15,23,42,0.95);
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: var(--shadow-lg);
  max-width: 280px;
  pointer-events: none;
  line-height: 1.4;
}
.hover-tooltip h4 { font-size: 13px; margin-bottom: 4px; color: var(--accent); }
.hover-tooltip .ht-row { display: flex; justify-content: space-between; gap: 10px; }
.hover-tooltip .ht-row span:last-child { font-weight: 600; }
.hover-tooltip .ht-dist { display: flex; gap: 2px; margin-top: 4px; }
.hover-tooltip .ht-dist span { display: block; height: 6px; border-radius: 1px; }
.hover-tooltip .ht-meta { font-size: 10px; color: rgba(255,255,255,0.55); margin-top: 4px; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 4px; }

.map-overlay { position: absolute; z-index: 600; display: flex; gap: 8px; }
.map-overlay--bottom-left { left: 12px; bottom: 12px; }
.overlay-card { background: rgba(255,255,255,0.95); padding: 6px 10px; border-radius: 6px; box-shadow: var(--shadow-sm); font-size: 11px; }
.overlay-card__label { color: var(--text-mute); text-transform: uppercase; font-size: 9px; letter-spacing: 0.5px; }
.overlay-card__value { color: var(--text); font-weight: 600; font-size: 13px; }

.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.85);
  display: grid; place-items: center;
  z-index: 700;
  color: var(--text-soft);
  font-size: 13px;
  gap: 10px;
  flex-direction: column;
  display: flex; align-items: center; justify-content: center;
}
.loading-overlay[hidden] { display: none; }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== DETAIL PANEL ===================== */
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
  padding: 14px;
}
.detail-panel__placeholder { color: var(--text-mute); }
.detail-panel__placeholder h3 { color: var(--text); margin-bottom: 8px; font-size: 14px; }
.detail-panel__placeholder p { font-size: 12px; margin: 0 0 12px; }
.detail-panel__steps { font-size: 12px; padding-left: 18px; line-height: 1.7; }

.dp-header { border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 12px; }
.dp-header h3 { font-size: 15px; margin-bottom: 4px; }
.dp-header__sub { font-size: 11px; color: var(--text-mute); }
.dp-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.dp-stat { background: var(--surface-2); padding: 8px 10px; border-radius: 6px; }
.dp-stat__label { font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.4px; }
.dp-stat__value { font-size: 16px; font-weight: 700; margin-top: 2px; }
.dp-stat__value--small { font-size: 13px; }

.dp-section { margin-bottom: 16px; }
.dp-section__title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-mute); margin-bottom: 6px; }
.dp-list { list-style: none; padding: 0; margin: 0; font-size: 12px; }
.dp-list li { padding: 6px 8px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.dp-list li:hover { background: var(--surface-2); }
.dp-list li:last-child { border-bottom: none; }
.dp-list .dp-list__sub { font-size: 11px; color: var(--text-mute); }

.dp-quad { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.dp-quad--resilient            { background: rgba(17,119,51,0.15);  color: var(--q-res); }
.dp-quad--operational_decay    { background: rgba(221,204,119,0.25); color: #806a1a; }
.dp-quad--compensated_failure  { background: rgba(136,204,238,0.25); color: #1a5b78; }
.dp-quad--investment_in_failure { background: rgba(204,102,119,0.18); color: var(--q-iif); }
.dp-quad--unknown              { background: rgba(187,187,187,0.25); color: var(--text-mute); }

.dp-asset-list-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent; border: 1px solid var(--border);
  padding: 4px 8px; border-radius: 4px; cursor: pointer;
  font-size: 11px; color: var(--primary);
  font-family: inherit; margin-top: 8px;
}
.dp-asset-list-btn:hover { background: var(--surface-2); }

/* ===================== BOTTOM CHARTS ===================== */
.bottom-charts {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr;
  gap: 10px;
  padding: 12px 20px 20px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  min-height: 280px;
}
.chart-card__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.chart-card__header h3 { font-size: 13px; font-weight: 600; color: var(--text); }
.info-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 11px; cursor: pointer; color: var(--text-mute);
}
.info-btn:hover { background: var(--border); color: var(--text); }
.chart-card__body { flex: 1; padding: 12px; position: relative; min-height: 220px; }
.chart-card__body canvas { width: 100% !important; height: 100% !important; }

/* ===================== MATRIX 2x2 ===================== */
#matrix2x2 { width: 100%; height: 100%; min-height: 220px; }
#matrix2x2 svg { width: 100%; height: 100%; display: block; }
#matrix2x2 .q-cell { stroke: var(--border); stroke-width: 1; }
#matrix2x2 .q-cell--resilient            { fill: rgba(17,119,51,0.10); }
#matrix2x2 .q-cell--operational_decay    { fill: rgba(221,204,119,0.18); }
#matrix2x2 .q-cell--compensated_failure  { fill: rgba(136,204,238,0.16); }
#matrix2x2 .q-cell--investment_in_failure { fill: rgba(204,102,119,0.14); }
#matrix2x2 .q-label { font-size: 10px; fill: var(--text-mute); text-transform: uppercase; letter-spacing: 0.4px; }
#matrix2x2 .q-axis  { stroke: var(--text-mute); stroke-width: 1; stroke-dasharray: 3,3; }
#matrix2x2 .q-tick  { font-size: 9px; fill: var(--text-mute); }
#matrix2x2 .q-point { cursor: pointer; transition: r .15s, stroke-width .15s; }
#matrix2x2 .q-point:hover { stroke: var(--primary); stroke-width: 2; }

/* ===================== FOOTER ===================== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  font-size: 11px;
  color: var(--text-soft);
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
}
.footer__block code { background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }
.footer__block--warn { color: #92400e; }

/* ===================== MODAL ===================== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,0.6); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal__panel {
  position: relative;
  width: min(960px, 92vw);
  max-height: 86vh;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: zoom .15s;
}
.modal__panel--narrow { width: min(640px, 92vw); }
@keyframes zoom { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal__header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal__header h2 { font-size: 18px; margin: 4px 0 2px; }
.modal__subtitle { font-size: 12px; color: var(--text-mute); }
.modal__close {
  background: transparent; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text-mute);
}
.modal__close:hover { color: var(--text); }

.quad-badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 999px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--surface-2);
  color: var(--text-soft);
}
.quad-badge.q-resilient            { background: rgba(17,119,51,0.18);  color: var(--q-res); }
.quad-badge.q-operational_decay    { background: rgba(221,204,119,0.28); color: #806a1a; }
.quad-badge.q-compensated_failure  { background: rgba(136,204,238,0.28); color: #1a5b78; }
.quad-badge.q-investment_in_failure { background: rgba(204,102,119,0.22); color: var(--q-iif); }

.modal__tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tab {
  background: transparent; border: none; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 500;
  padding: 10px 14px; color: var(--text-mute);
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab--active { color: var(--primary); border-bottom-color: var(--primary); background: var(--surface); }

.modal__body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.modal__body--prose { font-size: 13px; line-height: 1.65; color: var(--text-soft); }
.modal__body--prose h3 { color: var(--text); margin: 18px 0 6px; font-size: 14px; }
.modal__body--prose p { margin: 6px 0; }
.modal__body--prose ul { padding-left: 20px; margin: 6px 0; }

.pane { display: none; }
.pane--active { display: block; }

.indicator-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.indicator-table th, .indicator-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.indicator-table th { color: var(--text-mute); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; }
.indicator-table tr.is-red td { background: rgba(204,102,119,0.06); }
.indicator-bar { display: inline-block; vertical-align: middle; width: 80px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.indicator-bar__fill { display: block; height: 100%; background: var(--primary-soft); }
.indicator-bar__fill--neg { background: var(--q-iif); }

/* ===================== STORY ===================== */
.story { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; }
.story[hidden] { display: none; }
.story__backdrop { position: absolute; inset: 0; background: rgba(15,23,42,0.85); }
.story__panel {
  position: relative;
  width: min(820px, 92vw);
  max-height: 86vh;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.story__header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.story__header h2 { font-size: 16px; color: var(--primary); }
.story__body { padding: 26px 28px; overflow-y: auto; flex: 1; font-size: 14px; line-height: 1.7; color: var(--text); min-height: 320px; }
.story__body h3 { font-size: 20px; margin-bottom: 12px; color: var(--primary); }
.story__body p { margin: 0 0 12px; }
.story__body .story-callout {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: 10px 14px; margin: 14px 0;
  font-size: 13px; color: var(--text-soft);
}
.story__body .story-quadrants { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.story__body .story-q { padding: 10px 12px; border-radius: 6px; font-size: 12px; }
.story__body .story-q strong { display: block; margin-bottom: 4px; font-size: 13px; }
.story__body .story-q.q-res { background: rgba(17,119,51,0.10); border: 1px solid rgba(17,119,51,0.25); }
.story__body .story-q.q-od  { background: rgba(221,204,119,0.18); border: 1px solid rgba(221,204,119,0.4); }
.story__body .story-q.q-cf  { background: rgba(136,204,238,0.18); border: 1px solid rgba(136,204,238,0.4); }
.story__body .story-q.q-iif { background: rgba(204,102,119,0.16); border: 1px solid rgba(204,102,119,0.4); }
.story__nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}
.story__progress { font-size: 12px; color: var(--text-mute); font-family: var(--font-mono); }

/* ===================== UTILITY ===================== */
[hidden] { display: none !important; }

/* Responsive */
@media (max-width: 1280px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .layout { grid-template-columns: 240px 1fr 340px; }
  .bottom-charts { grid-template-columns: 1fr 1fr; }
  .bottom-charts .chart-card:nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .sidebar { max-height: 240px; }
  .detail-panel { max-height: 320px; }
  .map-wrap { height: 480px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .bottom-charts { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar__controls { width: 100%; justify-content: flex-start; }
}

/* Accessibility focus */
button:focus-visible, .crumb:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
