/* DutchAtlas — global styles */
/* The hidden attribute must win over component display rules (the info modal
   backdrop used display:flex and covered the map on load). */
[hidden] { display: none !important; }

:root {
  --bg: #0e1a2b;
  --panel: #16243a;
  --panel-2: #1d2e49;
  --ink: #e8eef6;
  --ink-dim: #9fb0c8;
  --accent: #4fc3f7;
  --accent-2: #ffb300;
  --danger: #ff5252;
  --ok: #6fcf97;
  --radius: 10px;
  --shadow: 0 4px 18px rgba(0,0,0,.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
#app { height: 100vh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #14233b, #0f1a2d);
  border-bottom: 1px solid #22365a;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: linear-gradient(135deg, #1e4d8c, #0d3b66);
  display: grid; place-items: center;
  font-weight: 800; color: #fff; font-size: 13px;
  border: 1px solid #2d5f9e;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .3px; }

.search-wrap { position: relative; flex: 1; max-width: 480px; margin-left: 8px; }
.search-wrap input {
  width: 100%; padding: 8px 12px;
  background: var(--panel-2); border: 1px solid #2c4470; border-radius: 8px;
  color: var(--ink); font-size: 14px; outline: none;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--panel); border: 1px solid #2c4470; border-radius: 8px;
  max-height: 320px; overflow-y: auto; box-shadow: var(--shadow); z-index: 50;
}
.search-results.hidden { display: none; }
.search-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #1c2f4d; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--panel-2); }
.search-item.active { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.search-item .sr-name { font-weight: 600; font-size: 14px; }
.search-item .sr-meta { color: var(--ink-dim); font-size: 12px; }
.search-empty { cursor: default; color: var(--ink-dim); font-style: italic; }

.topbar-actions { display: flex; gap: 8px; margin-left: auto; }
.icon-btn {
  background: var(--panel-2); border: 1px solid #2c4470; color: var(--ink);
  border-radius: 8px; width: 34px; height: 34px; cursor: pointer;
  display: grid; place-items: center; font-size: 15px;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.pinned { border-color: var(--accent-2); color: var(--accent-2); }

/* ---------- map ---------- */
.map { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

/* ---------- controls ---------- */
.controls {
  /* below the 51px top bar (the panel is positioned against the viewport) */
  position: absolute; top: 64px; right: 14px; width: 230px;
  max-height: calc(100vh - 80px); overflow-y: auto;
  background: rgba(22,36,58,.94); border: 1px solid #2c4470; border-radius: 12px;
  padding: 12px; z-index: 20; box-shadow: var(--shadow); backdrop-filter: blur(4px);
  display: flex; flex-direction: column; gap: 10px;
}
.control-block { display: flex; flex-direction: column; gap: 4px; }
.ctrl-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-dim); }
.ctrl-select {
  width: 100%; padding: 6px 8px;
  background: var(--panel-2); border: 1px solid #2c4470; border-radius: 7px;
  color: var(--ink); font-size: 13px; outline: none;
}
.period-block { border-top: 1px solid #22365a; padding-top: 10px; }
.period-row { display: flex; gap: 6px; align-items: center; }
.period-select { flex: 1; }
.period-btn {
  width: 30px; height: 30px; background: var(--panel-2); border: 1px solid #2c4470;
  color: var(--ink); border-radius: 7px; cursor: pointer; font-size: 14px;
}
.period-btn:hover { border-color: var(--accent); }
.period-animate { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.period-status { font-size: 12px; color: var(--ink-dim); }
.speed-select { width: 58px; flex-shrink: 0; padding: 4px 6px; font-size: 12px; }

/* ---------- legend ---------- */
.legend {
  position: absolute; left: 14px; bottom: 14px;
  background: rgba(22,36,58,.94); border: 1px solid #2c4470; border-radius: 12px;
  padding: 10px 12px; z-index: 20; box-shadow: var(--shadow); min-width: 190px; max-width: 290px;
  backdrop-filter: blur(4px);
}
.legend-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.legend-scale { display: grid; gap: 2px; }
.legend-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; align-items: center; font-size: 11px; }
.legend-row .swatch { width: 14px; height: 10px; border-radius: 2px; }
.legend-row .n { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.legend-warn { color: var(--accent-2); margin-top: 4px; }
.legend-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-dim); margin-top: 4px; }
.legend-note { font-size: 10px; color: var(--ink-dim); margin-top: 6px; line-height: 1.35; }

/* ---------- drawer ---------- */
.drawer {
  position: absolute; top: 0; bottom: 0; right: 0; width: 380px; max-width: 92vw;
  background: var(--panel); border-left: 1px solid #2c4470;
  box-shadow: var(--shadow); z-index: 40; display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .22s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 16px 10px; border-bottom: 1px solid #22365a;
  gap: 8px;
}
.drawer-actions { display: flex; gap: 6px; flex-shrink: 0; }
.drawer-breadcrumb { font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .5px; }
.drawer-title { margin: 2px 0 0; font-size: 19px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px 24px; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.kpi {
  background: var(--panel-2); border-radius: 10px; padding: 10px 12px;
}
.kpi .kpi-val { font-size: 20px; font-weight: 700; }
.kpi .kpi-label { font-size: 11px; color: var(--ink-dim); }
.kpi.full { grid-column: 1 / -1; }

.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-dim); margin: 16px 0 6px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table th, .mini-table td { text-align: right; padding: 5px 6px; border-bottom: 1px solid #1c2f4d; }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; }
.mini-table th { color: var(--ink-dim); font-weight: 500; font-size: 11px; }

.trend { margin-top: 6px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 3px 0; }
.bar-row .bar-label { width: 130px; color: var(--ink-dim); flex-shrink: 0; text-align: right; }
.bar-row .bar-track { flex: 1; background: #0e1a2b; border-radius: 4px; height: 12px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; background: linear-gradient(90deg, #2d6fd6, var(--accent)); }
.bar-row .bar-val { width: 44px; text-align: right; }

.provenance { font-size: 11px; color: var(--ink-dim); line-height: 1.5; margin-top: 14px; }
.provenance a { color: var(--accent); }
.source-list { margin: 4px 0 6px; padding-left: 16px; }
.source-list li { margin: 2px 0; }

/* ---------- compare ---------- */
.compare {
  position: absolute; left: 14px; top: 64px; width: 300px; max-width: 90vw;
  background: rgba(22,36,58,.96); border: 1px solid #2c4470; border-radius: 12px;
  box-shadow: var(--shadow); z-index: 40; overflow: hidden;
}
.compare-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid #22365a; }
.compare-head h3 { margin: 0; font-size: 14px; }
.compare-count { color: var(--ink-dim); font-weight: 400; font-size: 12px; }
.compare-body { padding: 10px 12px; max-height: 50vh; overflow-y: auto; }
.compare-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.compare-row { display: flex; justify-content: space-between; padding: 6px; margin: 0 -6px; border-bottom: 1px dashed #1c2f4d; font-size: 13px; border-radius: 6px; cursor: pointer; }
.compare-row:last-child { border-bottom: none; }
.compare-row:hover { background: rgba(255,255,255,.05); }
.compare-hint { font-size: 12px; color: var(--ink-dim); line-height: 1.45; }
.pin-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid #2c4470; border-radius: 20px;
  padding: 4px 10px; font-size: 12px; margin: 2px 4px 2px 0;
  cursor: pointer; transition: border-color .12s ease;
}
.pin-chip:hover { border-color: var(--accent); }
.pin-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pin-chip button { background: none; border: none; color: var(--ink-dim); cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; }
.pin-chip button:hover { color: var(--danger); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: grid; place-items: center; z-index: 100;
}
.modal {
  width: min(620px, 92vw); max-height: 84vh; overflow-y: auto;
  background: var(--panel); border: 1px solid #2c4470; border-radius: 14px;
  box-shadow: var(--shadow); padding: 18px 20px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.modal-body { font-size: 13.5px; line-height: 1.55; color: #c9d6e8; }
.modal-body h4 { margin: 14px 0 4px; color: var(--ink); }
.modal-body code { background: #0e1a2b; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- status toast ---------- */
.status {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid #2c4470; color: var(--ink);
  padding: 9px 16px; border-radius: 24px; font-size: 13px; z-index: 200;
  box-shadow: var(--shadow);
}
.status.error { border-color: var(--danger); color: #ffb4a8; }

.hidden { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .controls { top: auto; bottom: 14px; right: 10px; left: 10px; width: auto; max-height: 46vh; overflow-y: auto; }
  .legend { bottom: auto; top: 64px; left: 10px; }
  .drawer { width: 100vw; max-width: 100vw; }
  .drawer-head { flex-wrap: wrap; }
  .compare { top: auto; bottom: 14px; left: 10px; max-width: calc(100vw - 20px); background: var(--panel); }
  .brand-name { display: none; }
  .search-wrap { max-width: none; }
  .search-results { max-height: 44vh; }
}
.note { font-size: 12px; color: var(--ink-dim); line-height: 1.45; margin: 8px 0; }
.ci { color: var(--ink-dim); font-size: 11px; }
.bar-row.current .bar-label { color: var(--accent); font-weight: 600; }

.insights, .flags { list-style: none; margin: 6px 0 10px; padding: 0; display: grid; gap: 4px; }
.insight, .flag { background: var(--panel-2); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; line-height: 1.4; }
.insight.warning { border-left: 3px solid var(--accent-2); }
.insight.info { border-left: 3px solid var(--accent); }
.flag { font-size: 11.5px; color: var(--ink-dim); }
.flag.warning { color: var(--accent-2); }
.insights summary, .flags summary { cursor: pointer; }
.insights details p, .flags details p { margin: 5px 0 1px; color: var(--ink-dim); font-size: 11.5px; }
.flag code { font-size: 10px; background: #0e1a2b; padding: 0 4px; border-radius: 3px; }

/* Sampling-point popup (contract point metrics, e.g. PFAS soil samples) */
.maplibregl-popup-content { background: var(--panel); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; font: 13px var(--font); }
.maplibregl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.maplibregl-popup-close-button { color: var(--ink-dim); font-size: 16px; }
.point-popup .mini-table { margin: 6px 0; }
.point-popup .mini-table td:last-child { text-align: left; font-size: 11.5px; color: var(--ink-dim); }
.point-popup tr.muted td { opacity: .5; }
.ctrl-select:disabled, .period-btn:disabled { opacity: .45; cursor: not-allowed; }

/* 3D toggle (contract point metrics) */
.ctrl-toggle { width: 100%; padding: 7px 8px; background: var(--panel-2); color: var(--ink);
  border: 1px solid #2c4470; border-radius: 7px; font-size: 13px; cursor: pointer; }
.ctrl-toggle[aria-pressed="true"] { background: #1e4a6b; border-color: var(--accent); color: #fff; }
.ctrl-toggle:disabled { opacity: .5; cursor: progress; }
.legend-sub { margin-top: 8px; padding-top: 8px; border-top: 1px solid #2c4470; }
.legend-note-inline { font-size: 11px; color: var(--ink-dim); margin: 2px 0 4px; }

/* Subsurface viewer */
.subsurface { position: fixed; inset: 60px 18px 18px 18px; z-index: 60; display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid #2c4470; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.subsurface[hidden] { display: none; }
.subsurface-head { display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-bottom: 1px solid #22365a; }
.subsurface-head h3 { margin: 0; font-size: 16px; }
.subsurface-head > div:first-child { flex: 1; min-width: 0; }
.subsurface-sub { font-size: 12px; color: var(--ink-dim); }
.subsurface-ctl { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-dim); }
.subsurface-ctl .ctrl-select { width: auto; }
.subsurface-view { position: relative; flex: 1; min-height: 0; }
.subsurface-view canvas { display: block; }
.subsurface-tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid #2c4470;
  border-radius: 8px; padding: 6px 8px; font-size: 12px; max-width: 260px; box-shadow: var(--shadow); }
.subsurface-foot { padding: 8px 14px; font-size: 11.5px; color: var(--ink-dim); border-top: 1px solid #22365a; }
.drawer-action { margin: 4px 0 10px; width: 100%; }
/* Cross-section knife panel (docs/engine.md §17) */
.section-panel { position: fixed; left: 18px; right: 18px; bottom: 18px; height: 260px; z-index: 55; display: flex; flex-direction: column;
  background: rgba(14, 26, 43, .94); border: 1px solid #2c4470; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.section-panel[hidden] { display: none; }
.section-grip { height: 8px; cursor: ns-resize; flex: none; background: linear-gradient(#2c4470, #2c4470) center / 40px 2px no-repeat; touch-action: none; }
.section-head { display: flex; align-items: flex-start; gap: 12px; padding: 2px 12px 4px; }
.section-head > div { flex: 1; min-width: 0; }
.section-head h3 { margin: 0; font-size: 14px; }
.section-sub { font-size: 11.5px; color: var(--ink-dim); }
.section-body { position: relative; flex: 1; min-height: 0; overflow: hidden; padding: 0 4px; }
.section-hint { margin: 10px; font-size: 12.5px; color: var(--ink-dim); }
.section-read { min-height: 18px; padding: 2px 12px 6px; font-size: 11.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-svg { display: block; font: 10.5px var(--font); }
.sec-grid { stroke: #22365a; stroke-width: 1; }
.sec-axis, .sec-zero { stroke: #5a7299; stroke-width: 1; }
.sec-bound { stroke: #3b5582; stroke-dasharray: 3 3; }
.sec-tick { fill: var(--ink-dim); }
.sec-field-tick { fill: #7fe7ff; }
.sec-name { fill: var(--ink); font-size: 10.5px; }
.sec-step { fill: none; stroke: var(--accent); stroke-width: 2; }
.sec-field { fill: none; stroke: #7fe7ff; stroke-width: 1.5; stroke-dasharray: 5 3; opacity: .9; }
.sec-dot { stroke: #0e1a2b; stroke-width: 1; }
.sec-cursor { stroke: #fff; stroke-width: 1; opacity: .7; }
.sec-key { display: inline-block; width: 14px; height: 0; vertical-align: middle; border-top: 2px solid var(--accent); }
.sec-key-field { border-top: 2px dashed #7fe7ff; }
#theme-tools [data-tool="section"][aria-pressed="true"] { background: #1e4a6b; border-color: var(--accent); color: #fff; }
@media (max-width: 720px) { .section-panel { left: 0; right: 0; bottom: 0; border-radius: 0; } }
@media (max-width: 720px) {
  .subsurface { inset: 56px 0 0 0; border-radius: 0; }
  .subsurface-head { flex-wrap: wrap; gap: 8px; }
}

/* ---------- periods (Epic 17) ---------- */
.period-coverage { font-size: 11px; color: var(--ink-dim); line-height: 1.35; margin-top: 4px; }
.period-coverage .warn { color: var(--accent-2); }
#theme-select option:disabled { color: #6b7a93; }

/* ---------- drawer additions (Epic 12, 15, 20, 21) ---------- */
.kpi .kpi-sub { font-size: 11px; color: var(--ink-dim); }
.kpi .kpi-sub.up { color: #ff8a80; }
.kpi .kpi-sub.down { color: var(--ok); }
.kpi.parent { border: 1px dashed #5d6f93; }
.chart { width: 100%; height: auto; display: block; margin: 4px 0 2px; }
.chart .ch-grid { stroke: #22365a; stroke-width: 1; }
.chart .ch-ylab, .chart .ch-xlab, .chart .ch-breaklab { fill: var(--ink-dim); font-size: 9px; font-family: var(--font); }
.chart .ch-main { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .ch-prev { fill: none; stroke: #8aa0c0; stroke-width: 1.3; stroke-dasharray: 4 3; }
.chart .ch-dashed { stroke-dasharray: 3 3; }
.chart .ch-inc { fill: var(--panel); stroke: var(--accent-2); stroke-width: 1.6; }
.chart .ch-hatch { stroke: rgba(255, 179, 0, .28); stroke-width: 2; }
.chart .ch-anom { fill: var(--accent-2); stroke: var(--panel); stroke-width: .8; }
.chart .ch-break { stroke: #c3a6ff; stroke-width: 1.2; stroke-dasharray: 1 3; }
.chart .ch-sel { stroke: rgba(255,255,255,.35); stroke-width: 1; }
.chart .ch-seldot { fill: #fff; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 10.5px; color: var(--ink-dim); }
.ch-legend i { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--accent); vertical-align: middle; margin-right: 4px; }
.ch-legend i.k-prev { border-top: 2px dashed #8aa0c0; }
.ch-legend i.k-anom { width: 0; height: 0; border: 5px solid transparent; border-bottom: 7px solid var(--accent-2); border-top: 0; }
.ch-legend i.k-inc { width: 10px; height: 10px; border: 1.6px solid var(--accent-2); border-radius: 50%; }
.ch-legend i.k-break { border-top: 2px dotted #c3a6ff; }
.ch-table summary, details.explain summary { cursor: pointer; font-size: 11.5px; color: var(--accent); margin: 4px 0; }
.ch-table .mini-table { font-size: 11.5px; }
.cat-table td.sub { padding-left: 18px; color: var(--ink-dim); }
.cat-table td.sub2 { padding-left: 30px; color: var(--ink-dim); }
.cat-table details summary { cursor: pointer; }
.chg-up { color: #ff8a80; }
.chg-down { color: var(--ok); }
.sev-bar { display: flex; height: 12px; border-radius: 4px; overflow: hidden; margin: 6px 0 4px; background: #0e1a2b; }
.sev-bar span { display: block; height: 100%; }
.sev-bar .s-serious { background: #e3533f; }
.sev-bar .s-mixed { background: #f0a53a; }
.sev-bar .s-rest { background: #5b7fb3; }
.sev-key { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--ink-dim); }
.sev-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
details.explain { background: var(--panel-2); border-radius: 8px; padding: 4px 9px; margin: 8px 0; }
details.explain ul { margin: 4px 0 6px; padding-left: 16px; font-size: 11.5px; color: #c9d6e8; line-height: 1.45; }
.flag.info code, .flag.warning code { white-space: nowrap; }
.prov-table { width: 100%; font-size: 11px; color: var(--ink-dim); border-collapse: collapse; }
.prov-table td { padding: 2px 4px 2px 0; vertical-align: top; }
.prov-table td:first-child { white-space: nowrap; color: #b7c6dc; }
.prov-table a { color: var(--accent); word-break: break-all; }

/* ---------- BOSZ (Epic 20.2) ---------- */
.modal-wide { width: min(760px, 94vw); }
.bosz-flow { display: grid; gap: 4px; margin: 8px 0 12px; }
.bosz-row { display: grid; grid-template-columns: 190px 1fr 70px; gap: 8px; align-items: center; font-size: 12.5px; }
.bosz-row.sub .bosz-lab { padding-left: 14px; color: var(--ink-dim); }
.bosz-row.sub2 .bosz-lab { padding-left: 28px; color: var(--ink-dim); }
.bosz-track { background: #0e1a2b; height: 12px; border-radius: 3px; overflow: hidden; }
.bosz-track span { display: block; height: 100%; background: linear-gradient(90deg, #2d6fd6, var(--accent)); }
.bosz-row .bosz-val { text-align: right; font-variant-numeric: tabular-nums; }
.bosz-cite { font-size: 11px; color: var(--ink-dim); }
.bosz-limits { font-size: 12px; color: #c9d6e8; padding-left: 18px; }

/* ---------- compare (Epic 19.2) ---------- */
.compare.wide { width: min(calc(170px + var(--pins, 3) * 118px), calc(100vw - 28px)); max-width: calc(100vw - 28px); }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.cmp-table th, .cmp-table td { padding: 4px 5px; border-bottom: 1px solid #1c2f4d; text-align: right; vertical-align: middle; }
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; color: var(--ink-dim); font-weight: 500; }
.cmp-table th { font-weight: 600; font-size: 11.5px; }
.cmp-table .lvl { display: block; font-size: 10px; color: var(--ink-dim); font-weight: 400; }
.cmp-scroll { overflow-x: auto; max-width: 100%; overscroll-behavior-x: contain; }
/* First column stays visible while the area columns scroll (4–5 pins, 390 px). */
.cmp-table th:first-child, .cmp-table td:first-child { position: sticky; left: 0; z-index: 1; background: #16243a; box-shadow: 1px 0 0 #22365a; }
.cmp-table .cmp-name { display: block; max-width: 110px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare.many .cmp-table { font-size: 11px; }
.compare.many .cmp-table th, .compare.many .cmp-table td { padding: 3px 4px; }
.compare.many .cmp-table .lvl { font-size: 9.5px; }
.compare.many .cmp-table .cmp-name { max-width: 84px; }
.compare.many .cmp-table td:not(:first-child) { min-width: 58px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.4; }
.spark circle { fill: var(--accent); }
.spark-empty { color: var(--ink-dim); }

@media (max-width: 720px) {
  .compare.wide { width: auto; right: 10px; }
  .bosz-row { grid-template-columns: 120px 1fr 56px; font-size: 11.5px; }
  .controls { max-height: 40vh; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer { transition: none; }
}
.linklike { background: none; border: 0; padding: 0; color: var(--ink); font: inherit; cursor: pointer; text-align: left; text-decoration: underline dotted #4a6390; text-underline-offset: 3px; }
.linklike:hover, .linklike:focus-visible { color: var(--accent); }
.cat-tree { list-style: none; margin: 4px 0; padding-left: 0; font-size: 12.5px; display: grid; gap: 3px; }
.cat-tree .cat-tree { padding-left: 16px; margin-top: 3px; }
.cat-tree summary { cursor: pointer; }
.subrow td { font-size: 11.5px; }
.cmp-table td:first-child { max-width: 112px; min-width: 88px; }
.cmp-table td { white-space: normal; }
@media (max-width: 720px) {
  .legend { max-height: 32vh; overflow-y: auto; }
  .cmp-table td:first-child { max-width: 96px; min-width: 80px; }
  .compare.many .cmp-table .cmp-name { max-width: 70px; }
}

/* Weergave panel (style-panel.js) */
.sty-reset { width: auto; padding: 0 10px; margin-top: 6px; }
/* Settings popover (⚙, top right): scale, palette and Weergave */
.settings-pop {
  position: fixed; top: 58px; right: 14px; width: 300px; max-height: calc(100vh - 76px); overflow-y: auto;
  background: var(--panel, rgba(14, 24, 40, 0.94)); border: 1px solid rgba(41, 211, 255, 0.25); border-radius: 12px;
  padding: 12px; z-index: 45; box-shadow: var(--shadow); backdrop-filter: blur(6px);
}
.settings-title { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 8px; color: #9fdfff; }
.settings-sub { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; margin: 10px 0 6px; color: #8fb8d8; }
#map { isolation: isolate; }
@media (max-width: 600px) { .settings-pop { left: 10px; right: 10px; width: auto; } }
/* Contouren theme: labels with a solid dark halo for maximum contrast */
.atlas-labels.contrast .atlas-label { color: #ffffff !important; font-weight: 600; text-shadow: 0 0 2px #000, 0 0 4px #000, 0 0 8px #000 !important; }

.theme-tools { display: contents; }

/* ☰ / ▤ header toggles */
body.hide-controls #controls, body.hide-legend #legend { display: none !important; }
.icon-btn[aria-pressed="false"] { opacity: .55; }

/* ---------- PFAS in kraanwater (panels/drinkwater.js) ---------- */
.oordeel-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  color: #fff; background: var(--oc, #888); box-shadow: 0 0 8px var(--oc, #888); }
.dw-peq { margin: 6px 0; display: flex; gap: 8px; align-items: center; }
.dw-peq-v { font-size: 15px; font-weight: 600; color: var(--ink); }
.dw-table-wrap { max-height: 56vh; overflow: auto; }
.dw-table td { vertical-align: top; }
.dw-table td:nth-child(2), .dw-table th:nth-child(2) { text-align: left; }
.dw-table .dw-meas { font-size: 11px; color: var(--ink-dim); white-space: nowrap; }
.dw-sort { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
/* Mobile navigation (≤ 720 px): bottom bar; panels open one at a time as sheets */
.mobile-nav { display: none; }
@media (max-width: 720px) {
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(8, 16, 28, 0.94);
    border-top: 1px solid rgba(41, 211, 255, 0.25); backdrop-filter: blur(6px);
  }
  .mobile-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px;
    background: none; border: 0; color: #9fb8d0; font-size: 11px; cursor: pointer;
  }
  .mobile-nav button span { font-size: 18px; line-height: 1; }
  .mobile-nav button[aria-pressed="true"] { color: #29d3ff; }
  .controls, .legend, .settings-pop, .drawer { bottom: calc(64px + env(safe-area-inset-bottom)) !important; }
  .controls, .legend, .settings-pop { left: 8px !important; right: 8px !important; width: auto !important; max-width: none !important; max-height: 60vh; overflow-y: auto; }
  .settings-pop { top: auto !important; }
  .topbar-actions #btn-toggle-controls, .topbar-actions #btn-toggle-legend, .topbar-actions #btn-settings { display: none; }
  body:not(.mobile-search) .search-wrap { display: none; }
}
