/* ============================================================================
   R&D Atlas — "rustig water"
   HELIX-familie: clinical-white oppervlakken, haarlijnen, WBD-blauw als enige
   zelfverzekerde kleur, Inter voor de UI. De kaart krijgt de ruimte; panelen
   zijn compact, zwevend en inklapbaar. Kleur is gereserveerd voor water en
   data. Donker is een optionele variant met dezelfde tokens.
   ========================================================================== */
@font-face { font-family: 'Inter'; src: url('vendor/fonts/inter-var-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; src: url('vendor/fonts/inter-var-latin-ext.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; src: url('vendor/fonts/jetbrains-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('vendor/fonts/jetbrains-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* WBD brand (HELIX app.css) */
  --wbd-deep: #0a3d80;
  --wbd-blue: #0d4f9e;
  --wbd-cyan: #1fa0db;
  --wbd-lime: #bed137;

  --radius: 12px;
  --radius-sm: 8px;
  --panel-w: 296px;
  --drill-w: 384px;
  --topbar-h: 56px;
  --gap: 12px;
}

/* ---- Light (default) ------------------------------------------------------ */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --map-bg:   #f5f6f4;
  --bg:       #ffffff;
  --panel:    rgba(255, 255, 255, 0.94);
  --panel-2:  #f7f9fb;
  --panel-3:  #eef2f6;
  --panel-solid: #ffffff;
  --line:     #e3e8ee;
  --line-2:   #cfd7e0;
  --ink:      #0f1d2e;
  --ink-dim:  #54657a;
  --ink-mute: #64748a;
  --accent:   var(--wbd-blue);      /* text-safe accent: 8.4:1 on white */
  --accent-2: var(--wbd-cyan);      /* fills, rings, focus */
  --shadow:   0 1px 2px rgba(15, 29, 46, 0.06), 0 8px 24px -6px rgba(15, 29, 46, 0.16);
  --shadow-lg: 0 2px 4px rgba(15, 29, 46, 0.06), 0 18px 44px -12px rgba(15, 29, 46, 0.28);

  /* Maas reference layers (keep in sync with basemap.js REF_COLORS) */
  --maas: #0d4f9e; --trib: #2d86c8; --basin: #0a3d80; --border-line: #6f7c8a;

  /* Data: sensor sources (Okabe-Ito based, CVD-safe, away from water-blue) */
  --src-evolv:  #d17a00;
  --src-geo:    #00916a;
  --src-sensor: #b0468a;
  --live:  #1fa0db;
  --warn:  #b45309;
  --ok:    #15803d;
  --alert: #c2410c;

  /* WBD register hues */
  /* Maas-meetstations per bron */
  --maas-eea: #7462ad; --maas-zinfo: #087f82;
  --maas-rws: #c23a6c; --maas-hq: #8a6d00; --maas-hh: #0f7c8c; --maas-vmm: #2f7a3d; --maas-spw: #6b4fa0;

  --neerslag: #3f83c4; --grondwater: #0f8a5f; --watersysteem: #1f6fd0;
  --afvalwaterketen: #6b52d4; --assets: #d17a00; --energie: #a06a00; --rijkswater: #c23a6c;

  /* Map markers */
  --marker-ring: #ffffff;
  --marker-shadow: rgba(15, 29, 46, 0.28);
  --marker-glyph: #ffffff;
  --map-halo: #ffffff;
  --cluster: #0d4f9e;
  --cluster-ink: #ffffff;
}

/* ---- Dark (optional) ------------------------------------------------------ */
:root[data-theme="dark"] {
  color-scheme: dark;
  --map-bg:   #0f1922;
  --bg:       #0d1720;
  --panel:    rgba(17, 28, 38, 0.94);
  --panel-2:  #16232f;
  --panel-3:  #1c2b38;
  --panel-solid: #121e29;
  --line:     #24333f;
  --line-2:   #33465a;
  --ink:      #e7eef4;
  --ink-dim:  #a9b8c6;
  --ink-mute: #8b9bab;
  --accent:   #6cc6f5;
  --accent-2: #38b2ec;
  --shadow:   0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 20px 48px -12px rgba(0, 0, 0, 0.7);

  --maas: #6cc6f5; --trib: #3f9bd6; --basin: #8fd3f7; --border-line: #8a98a6;

  --src-evolv:  #f0a020;
  --src-geo:    #2fc493;
  --src-sensor: #df82bf;
  --live:  #38b2ec;
  --warn:  #f0b44a;
  --ok:    #4ccf82;
  --alert: #f08060;

  --maas-eea: #b4a1ee; --maas-zinfo: #4bd5cc;
  --maas-rws: #e0709a; --maas-hq: #d6b84a; --maas-hh: #4fc3d0; --maas-vmm: #6fcf84; --maas-spw: #a98fe0;

  --neerslag: #6aa9e0; --grondwater: #2fb985; --watersysteem: #5a9ef0;
  --afvalwaterketen: #a597f0; --assets: #f0a020; --energie: #d9a030; --rijkswater: #e0709a;

  --marker-ring: #0d1720;
  --marker-shadow: rgba(0, 0, 0, 0.5);
  --marker-glyph: #0d1720;
  --map-halo: #0d1720;
  --cluster: #6cc6f5;
  --cluster-ink: #0d1720;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.4;
  background: var(--map-bg);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}
button { font-family: inherit; font-size: inherit; cursor: pointer; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
::selection { background: var(--wbd-cyan); color: #fff; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

#map { position: fixed; inset: 0; background: var(--map-bg); }
.maplibregl-map { font: inherit; }
.maplibregl-ctrl-attrib { font-size: 10.5px; }
.maplibregl-ctrl-attrib.maplibregl-compact { background: var(--panel); color: var(--ink-dim); }
.maplibregl-ctrl-attrib a { color: var(--ink-dim); }
.maplibregl-ctrl-top-right { top: calc(var(--topbar-h) + 4px); }
.maplibregl-ctrl-group { background: var(--panel); border-radius: var(--radius-sm); box-shadow: var(--shadow) !important; border: 1px solid var(--line); overflow: hidden; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
:root[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.88); }
.maplibregl-ctrl-scale { background: var(--panel); border-color: var(--ink-dim); color: var(--ink-dim); font-size: 10.5px; }

/* ---- Shared controls --------------------------------------------------------- */
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; flex: none;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim);
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn.small { width: 28px; height: 28px; border-color: transparent; background: transparent; }
.icon-btn.small svg { width: 12px; height: 12px; }
.tool-btn {
  height: 36px; padding: 0 12px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim);
}
a.tool-btn { display: inline-flex; align-items: center; text-decoration: none; }
.tool-btn .tb-ico { display: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tool-btn:hover { color: var(--ink); border-color: var(--line-2); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--panel-3); border-radius: 9px; }
.segmented button {
  border: 0; background: transparent; color: var(--ink-dim); font-size: 12.5px; font-weight: 500;
  padding: 0 12px; height: 30px; border-radius: 7px; transition: background .15s, color .15s;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--panel-solid); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 29, 46, 0.12); }
.segmented.wide { display: flex; margin: 2px 0 6px; }
.segmented.wide button { flex: 1; }

/* ---- Topbar ---------------------------------------------------------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 30;
  display: flex; align-items: center; gap: 16px; padding: 0 var(--gap);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none; border-radius: var(--radius-sm); }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-mark rect { fill: var(--wbd-blue); }
.brand-mark path { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; }
:root[data-theme="dark"] .brand-mark rect { fill: #1d5fae; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.015em; }
.brand-sub { font-size: 11.5px; color: var(--ink-dim); }

.search { position: relative; flex: 1; max-width: 420px; margin-left: 12px; }
.search-ico { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); fill: none; stroke: var(--ink-mute); stroke-width: 1.6; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 33px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink); font: inherit; font-size: 13px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search input::placeholder { color: var(--ink-mute); }
.search input:focus { outline: none; background: var(--panel-solid); border-color: var(--accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 22%, transparent); }
.search-results {
  position: absolute; top: 42px; left: 0; right: 0; max-height: 52vh; overflow-y: auto;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 40;
}
.search-results .hit { padding: 8px 10px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.search-results .hit:hover, .search-results .hit.active { background: var(--panel-3); }
.search-results .hit b { font-weight: 550; }
.search-results .hit small { color: var(--ink-mute); margin-left: auto; font-size: 11.5px; }
.search-group { font-size: 11.5px; font-weight: 600; color: var(--ink-mute); padding: 8px 10px 3px; }
.search-marker {
  width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--wbd-blue); border: 2.5px solid #fff; box-shadow: var(--shadow);
}

.topbar-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#view-switch { margin-left: auto; }
#view-switch + .topbar-tools { margin-left: 8px; }
#theme-toggle .ico-sun { display: none; }
:root[data-theme="dark"] #theme-toggle .ico-sun { display: block; }
:root[data-theme="dark"] #theme-toggle .ico-moon { display: none; }

/* ---- Left column: layer panel + legend ---------------------------------------- */
.leftcol {
  position: fixed; top: calc(var(--topbar-h) + var(--gap)); left: var(--gap); bottom: var(--gap);
  width: var(--panel-w); z-index: 25;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.leftcol > * { pointer-events: auto; }
.panel {
  flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(16px); overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 6px 16px; }
.panel-head h1 { font-size: 13.5px; font-weight: 600; }
.panel-head .icon-btn svg { transition: transform .2s; }
.leftcol[data-collapsed="true"] .panel-head .icon-btn svg { transform: rotate(180deg); }
.leftcol[data-collapsed="true"] .panel-body { display: none; }
.panel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 8px 8px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

.grp { border-top: 1px solid var(--line); }
.grp:first-child { border-top: 0; }
.grp-head {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent;
  padding: 10px 8px 8px; text-align: left; border-radius: var(--radius-sm); color: var(--ink);
}
.grp-head:hover { background: var(--panel-2); }
.grp-title { font-size: 12.5px; font-weight: 600; }
.grp-count { margin-left: auto; font-size: 11px; color: var(--accent); font-weight: 500; }
.grp-head .chev { width: 12px; height: 12px; flex: none; color: var(--ink-mute); transition: transform .2s; }
.grp-count[hidden] + .chev { margin-left: auto; }
.grp[data-open="false"] .chev { transform: rotate(-90deg); }
.grp[data-open="false"] .grp-body { display: none; }
.grp-body { padding: 0 0 8px; display: flex; flex-direction: column; gap: 1px; }
.sub { padding-top: 4px; }
.sub-title { font-size: 11.5px; color: var(--ink-mute); padding: 6px 8px 2px; }

.layer {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 5px 8px;
  border: 0; background: transparent; border-radius: var(--radius-sm); text-align: left;
  color: var(--ink-dim); font-size: 13px;
}
.layer:hover { background: var(--panel-2); color: var(--ink); }
.layer[aria-checked="true"] { color: var(--ink); }
.layer-label { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.layer-label small { font-size: 11.5px; color: var(--ink-mute); line-height: 1.3; }
.layer-label .count { display: inline; font-size: 11.5px; color: var(--ink-mute); font-variant-numeric: tabular-nums; margin-left: 4px; }

/* switch */
.switch { position: relative; width: 28px; height: 16px; flex: none; border-radius: 10px; background: var(--line-2); transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s; }
.layer[aria-checked="true"] .switch { background: var(--wbd-blue); }
:root[data-theme="dark"] .layer[aria-checked="true"] .switch { background: #2f8fd0; }
.layer[aria-checked="true"] .switch::after { transform: translateX(12px); }
.layer.loading .switch { background: repeating-linear-gradient(90deg, var(--line-2) 0 6px, var(--accent-2) 6px 12px); background-size: 24px 100%; animation: loading 0.8s linear infinite; }
@keyframes loading { to { background-position: 24px 0; } }

/* swatches */
.swatch { width: 22px; height: 16px; flex: none; position: relative; display: inline-block; }
.swatch.point::before { content: ""; position: absolute; inset: 3px 6px; border-radius: 50%; background: var(--panel-solid); border: 2.2px solid var(--c); }
.swatch.line::before { content: ""; position: absolute; left: 2px; right: 2px; top: 7px; height: 2.5px; border-radius: 2px; background: var(--c); }
.swatch.line.thick::before { height: 4px; top: 6px; }
.swatch.area::before { content: ""; position: absolute; inset: 2px 3px; border-radius: 3px; background: color-mix(in srgb, var(--c) 22%, transparent); border: 1.5px solid var(--c); }
.swatch.ref-stroomgebied::before { content: ""; position: absolute; inset: 2px 3px; border-radius: 4px; border: 1.6px solid var(--basin); background: color-mix(in srgb, var(--wbd-cyan) 8%, transparent); }
.swatch.ref-rivieren::before { content: ""; position: absolute; left: 1px; right: 1px; top: 4px; height: 8px; background:
  linear-gradient(var(--maas), var(--maas)) 0 3px / 100% 3px no-repeat; border-radius: 2px; }
.swatch.ref-rivieren::after { content: ""; position: absolute; left: 11px; top: 1px; width: 1.6px; height: 8px; background: var(--trib); transform: rotate(35deg); border-radius: 1px; }
.swatch.ref-grenzen::before { content: ""; position: absolute; left: 2px; right: 2px; top: 6px; height: 1.6px; background: var(--border-line); box-shadow: 0 0 0 1.5px var(--panel-solid); }
.swatch.dots { display: inline-flex; align-items: center; gap: 1px; }
.swatch.dots i { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 1px var(--panel-solid); }
.swatch.rel::before { content: ""; position: absolute; left: 3px; right: 3px; top: 3px; height: 10px; border: 1.6px solid var(--live); border-color: var(--live) transparent transparent transparent; border-radius: 50% 50% 0 0; }
.swatch.relief::before { content: ""; position: absolute; inset: 2px 2px; background: linear-gradient(135deg, transparent 35%, var(--ink-mute) 36% 40%, transparent 41% 58%, var(--ink-mute) 59% 63%, transparent 64%); opacity: .7; }
.swatch.photo::before { content: ""; position: absolute; inset: 2px 3px; border-radius: 3px; background: linear-gradient(135deg, #6c8a5a, #a9a17a 55%, #6d93b0); }

.nolocation { margin: 2px 0 0 32px; }
.nl-head { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 3px 6px; border-radius: 6px; color: var(--warn); font-size: 12px; font-weight: 500; }
.nl-head:hover { background: var(--panel-2); }
.nl-head .chev { width: 11px; height: 11px; transition: transform .2s; }
.nolocation[data-open="false"] .nl-head .chev { transform: rotate(-90deg); }
.nolocation[data-open="false"] .nl-list { display: none; }
.nl-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.nl-list { display: flex; flex-direction: column; max-height: 22vh; overflow-y: auto; padding: 2px 0 4px; }
.nl-item { border: 0; background: transparent; text-align: left; padding: 4px 6px; border-radius: 6px; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-dim); }
.nl-item:hover { background: var(--panel-2); color: var(--ink); }

.rain-ctl { padding: 0 8px 6px 40px; }
.rain-ctl .rain-step { width: 100%; accent-color: var(--neerslag); }
.rain-ctl .rain-time { font-size: 11.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

.user-layers { border-top: 1px solid var(--line); padding: 10px 8px 2px; }
.ul-head { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.ul-upload { font-size: 12px; font-weight: 500; color: var(--accent); cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.ul-upload:hover { background: var(--panel-2); }
.ul-upload:focus-within { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.ul-list { margin-top: 4px; display: flex; flex-direction: column; gap: 1px; }
.ul-empty { font-size: 12px; color: var(--ink-mute); padding: 2px 0 6px; line-height: 1.4; }
.ul-item { display: flex; align-items: center; gap: 2px; }
.ul-item .layer { flex: 1; }
.ul-del { border: 0; background: transparent; width: 28px; height: 28px; border-radius: 6px; color: var(--ink-mute); display: grid; place-items: center; }
.ul-del svg { width: 15px; height: 15px; }
.ul-del:hover { color: var(--alert); background: var(--panel-2); }

.panel-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 8px 16px 10px;
  border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-mute); font-variant-numeric: tabular-nums;
}
.panel-status .stat:empty { display: none; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-mute); margin-right: -4px; }
.live-dot[data-state="live"] { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.live-dot[data-state="connecting"] { background: var(--warn); }

/* ---- Legend (one, below the panel, never overlapping) --------------------------- */
.legend {
  flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(16px); overflow: hidden;
}
.legend:empty { display: none; }
.legend-toggle { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 9px 12px 9px 16px; font-size: 12.5px; font-weight: 600; color: var(--ink); text-align: left; }
.legend-toggle .chev { width: 12px; height: 12px; margin-left: auto; color: var(--ink-mute); transition: transform .2s; }
.legend[data-open="false"] .legend-toggle .chev { transform: rotate(-90deg); }
.legend[data-open="false"] .legend-body { display: none; }
.legend-body { padding: 0 16px 12px; display: grid; gap: 10px; max-height: 34vh; overflow-y: auto; }
.lg-group { display: grid; gap: 3px; }
.lg-label { font-size: 11.5px; color: var(--ink-mute); margin-bottom: 1px; }
.lg-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-dim); min-height: 18px; }
.lg-row .swatch { width: 22px; height: 14px; }
.lg-dot { border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px var(--panel-solid), 0 1px 2px var(--marker-shadow); }
.lg-sizes { display: flex; align-items: center; gap: 5px; }
.lg-fresh { display: flex; align-items: center; gap: 6px; }
.lg-fresh span { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--ink-mute); }

.panel-fab {
  position: fixed; left: var(--gap); top: calc(var(--topbar-h) + var(--gap)); z-index: 25;
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 12px;
  border-radius: 19px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow);
  font-weight: 550; color: var(--ink);
}
.panel-fab svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }

/* ---- Right drill-down ------------------------------------------------------------- */
.drill {
  position: fixed; top: calc(var(--topbar-h) + var(--gap)); right: var(--gap); bottom: var(--gap);
  width: var(--drill-w); max-width: calc(100vw - 24px); z-index: 26; display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: slide-in .28s cubic-bezier(.22,.61,.36,1);
}
@keyframes slide-in { from { transform: translateX(16px); opacity: 0; } }
body:has(#drill:not([hidden])) .maplibregl-ctrl-top-right { right: calc(var(--drill-w) + var(--gap)); }
.drill-head { padding: 16px 18px 14px; border-bottom: 1px solid var(--line); position: relative; }
.drill-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink-mute); font-size: 15px; display: grid; place-items: center; }
.drill-close:hover { color: var(--ink); background: var(--panel-2); }
.drill-kicker { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-dim); flex-wrap: wrap; padding-right: 34px; }
.drill-kicker .dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 3px var(--line-2); }
.drill-title { font-size: 19px; margin: 8px 0 2px; font-family: var(--font-mono); font-weight: 500; letter-spacing: -.02em; word-break: break-word; padding-right: 30px; }
.drill-desc { font-size: 13px; color: var(--ink-dim); line-height: 1.5; margin: 4px 0 0; max-width: 60ch; }
.drill-body { flex: 1; overflow-y: auto; padding: 12px 18px 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 4px; }
.chip { font-size: 11.5px; padding: 3px 9px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-dim); }
.chip b { color: var(--ink); font-weight: 550; }

.section-label { font-size: 12px; font-weight: 600; color: var(--ink); margin: 20px 0 8px; }

.passport-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--panel-2); }
.verif { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 550; padding: 2px 9px; border-radius: 20px; }
.verif[data-v="confirmed"] { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.verif[data-v="identified"] { color: var(--accent); background: color-mix(in srgb, var(--accent-2) 13%, transparent); }
.verif[data-v="provisional"] { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.verif[data-v="retired"] { color: var(--ink-mute); background: var(--panel-3); }

.ds-list { display: flex; flex-direction: column; gap: 6px; }
.ds {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
  padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.ds:hover { border-color: var(--line-2); }
.ds.open { border-color: var(--accent-2); background: var(--panel-solid); }
.ds-name { font-size: 12.5px; color: var(--ink); line-height: 1.35; }
.ds-val { font-size: 15px; font-weight: 600; text-align: right; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ds-val.stale { color: var(--ink-mute); font-weight: 500; }
.ds-unit { font-size: 11px; color: var(--ink-mute); font-weight: 400; }
.ds-meta { font-size: 11px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.ds-spark { grid-column: 1 / -1; margin-top: 8px; }
.ds-analyse { border: 1px solid var(--line); background: var(--panel-solid); color: var(--accent); font-size: 11px; font-weight: 550; justify-self: end; padding: 2px 8px; border-radius: 12px; }
.ds-analyse:hover { border-color: var(--accent-2); }
.spark-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.spark-range { font-size: 11px; padding: 2px 9px; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--ink-dim); }
.spark-range.on { background: var(--panel-3); color: var(--ink); border-color: var(--line-2); }
.spark-live { margin-left: auto; font-size: 11px; color: var(--ok); display: inline-flex; align-items: center; gap: 5px; }
.spark-live::before { content:""; width:6px;height:6px;border-radius:50%;background:var(--ok); }
svg.spark { width: 100%; height: 64px; display: block; overflow: visible; }
svg.spark path.area { opacity: .14; }
svg.spark path.line { fill: none; stroke-width: 1.6; }

.topo { display: flex; flex-direction: column; gap: 1px; }
.topo-node { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; font-size: 12.5px; color: var(--ink-dim); cursor: pointer; background: transparent; border: 0; text-align: left; }
.topo-node:hover { background: var(--panel-2); color: var(--ink); }
.topo-node.self { color: var(--ink); background: var(--panel-2); }
.topo-node b { font-family: var(--font-mono); font-weight: 500; font-size: 12px; }
.topo-node .role { font-size: 11px; color: var(--ink-mute); margin-left: auto; }
.muted { color: var(--ink-mute); font-size: 12.5px; }
.topo-schema-btn { margin-left: 8px; font-size: 11px; font-weight: 550; padding: 2px 9px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-solid); color: var(--accent); }
.topo-schema-btn:hover { border-color: var(--accent-2); }

/* ---- Bottom dock (analysis today; Maas length profile + time slider later) ----- */
.dock {
  position: fixed; z-index: 29; bottom: var(--gap);
  left: calc(var(--gap) + var(--panel-w) + var(--gap)); right: var(--gap);
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.dock > * { pointer-events: auto; }
body:has(#drill:not([hidden])) .dock { right: calc(var(--drill-w) + var(--gap) * 2); }
body:has(.leftcol[data-collapsed="true"]) .dock { left: var(--gap); }
.analysis {
  height: min(40vh, 360px); display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.an-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.an-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.an-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px;
  padding: 2px 4px 2px 9px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink-dim); border-left: 3px solid var(--c, var(--live));
}
.an-chip button { border: 0; background: transparent; color: var(--ink-mute); font-size: 11px; padding: 0 3px; border-radius: 8px; }
.an-chip button:hover { color: var(--alert); }
.an-tools { display: flex; align-items: center; gap: 4px; }
.an-range, .an-btn { font-size: 11.5px; padding: 3px 9px; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--ink-dim); }
.an-range.on { background: var(--panel-3); color: var(--ink); border-color: var(--line-2); }
.an-btn:hover, .an-range:hover { color: var(--ink); border-color: var(--line-2); }
.an-plot { flex: 1; min-height: 0; }
.an-note { margin: 0; padding: 4px 12px 8px; font-size: 11.5px; color: var(--warn); }
.an-tabs { display: flex; gap: 2px; background: var(--panel-3); border-radius: 8px; padding: 2px; }
.an-tab { font-size: 11.5px; font-weight: 500; padding: 3px 10px; border-radius: 6px; border: 0; background: transparent; color: var(--ink-dim); }
.an-tab.on { background: var(--panel-solid); color: var(--ink); box-shadow: 0 1px 2px rgba(15,29,46,.12); }

.an-schema { flex: 1; min-height: 0; overflow: auto; padding: 6px 10px; }
svg.schematic { display: block; height: 100%; max-height: 100%; margin: 0 auto; font-family: var(--font-ui); }
.sch-edge { fill: none; stroke: var(--live); stroke-width: 1.8; opacity: .6; stroke-dasharray: 6 5; animation: sch-flow 1.2s linear infinite; }
@keyframes sch-flow { to { stroke-dashoffset: -11; } }
.sch-node { cursor: pointer; }
.sch-node rect { fill: var(--panel-solid); stroke: var(--line-2); stroke-width: 1.2; transition: stroke .15s; }
.sch-node:hover rect, .sch-node.hover rect { stroke: var(--live); stroke-width: 1.8; }
.sch-node.selected rect { stroke: var(--live); stroke-width: 2.2; }
.sch-node.hub rect { stroke: var(--src-evolv); }
.sch-node.ghost rect { stroke-dasharray: 5 4; opacity: .75; }
.sch-node.virtual rect { stroke-dasharray: 2 3; }
.sch-name { fill: var(--ink); font-size: 11.5px; font-family: var(--font-mono); font-weight: 500; }
.sch-role { fill: var(--ink-mute); font-size: 9.5px; }

/* ---- Beheerconsole ------------------------------------------------------------- */
.admin {
  position: fixed; top: calc(var(--topbar-h) + var(--gap)); right: var(--gap); bottom: var(--gap);
  width: min(460px, calc(100vw - 24px)); z-index: 31; display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.ad-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ad-head b { font-size: 13.5px; font-weight: 600; }
.ad-tabs { display: flex; gap: 2px; background: var(--panel-3); border-radius: 8px; padding: 2px; margin-left: auto; }
.ad-tab { font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 6px; border: 0; background: transparent; color: var(--ink-dim); }
.ad-tab.on { background: var(--panel-solid); color: var(--ink); box-shadow: 0 1px 2px rgba(15,29,46,.12); }
.ad-close { border: 1px solid var(--line); background: transparent; color: var(--ink-dim); border-radius: 8px; width: 28px; height: 28px; }
.ad-body { flex: 1; overflow-y: auto; padding: 10px 14px 16px; }
.ad-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ad-pill { font-size: 11.5px; padding: 3px 9px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.ad-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 7px; font-size: 12.5px; }
.ad-row:hover { background: var(--panel-2); }
.ad-row b { font-family: var(--font-mono); font-weight: 500; font-size: 12px; }
.ad-row small { color: var(--ink-mute); margin-left: auto; white-space: nowrap; }
.ad-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.ad-dot[data-s="fresh"] { background: var(--live); }
.ad-dot[data-s="recent"] { background: var(--ok); }
.ad-dot[data-s="stale"] { background: var(--warn); }
.ad-dot[data-s="silent"] { background: var(--alert); }
.ad-dot[data-s="nodata"] { background: var(--ink-mute); }
.ad-actions { display: flex; gap: 2px; }
.ad-actions button { border: 0; background: transparent; font-size: 12px; opacity: .6; padding: 1px 3px; }
.ad-actions button:hover { opacity: 1; }

/* ---- Map popups, pulse, toasts ----------------------------------------------------- */
.maplibregl-popup-content { background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; font-family: var(--font-ui); font-size: 12.5px; box-shadow: var(--shadow-lg); padding: 12px 14px; }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { color: var(--ink-mute); font-size: 16px; padding: 2px 6px; }
.tp-title { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.tp .chips { margin: 8px 0 4px; }
.tp-analyse { margin-top: 4px; font-size: 11.5px; font-weight: 550; padding: 4px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-solid); color: var(--accent); }
.tp-analyse:hover { border-color: var(--accent-2); }

.pulse-ring { position: absolute; border: 2px solid var(--live); border-radius: 50%; pointer-events: none; animation: ring 1.4s cubic-bezier(.2,.6,.3,1) forwards; }
@keyframes ring { from { width: 6px; height: 6px; opacity: .95; border-width: 3px; } to { width: 52px; height: 52px; opacity: 0; border-width: 1px; } }

#toast-host { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); border-radius: 10px; padding: 9px 14px; font-size: 12.5px; box-shadow: var(--shadow-lg); transition: opacity .4s, transform .4s; }
.toast.gone { opacity: 0; transform: translateY(6px); }

/* Keyboard focus: one consistent, high-contrast ring */
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.layer:focus-visible, .grp-head:focus-visible { outline-offset: -2px; }

/* ---- Maas: lengteprofiel (dock), drill-badges, schematische rivier ---------- */
.profile {
  position: relative; display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.pf-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px; flex-wrap: wrap; }
.profile[data-collapsed="false"] .pf-head { border-bottom: 1px solid var(--line); }
.pf-toggle { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--ink); font-size: 13px; padding: 4px 4px; }
.pf-toggle .chev { width: 12px; height: 12px; transition: transform .15s; }
.profile[data-collapsed="true"] .pf-toggle .chev { transform: rotate(180deg); }
.profile[data-collapsed="true"] .pf-body, .profile[data-collapsed="true"] .pf-log { display: none; }
.pf-params button { font-size: 12px; padding: 4px 9px; }
.pf-log { font-size: 12px; color: var(--ink-dim); display: inline-flex; align-items: center; gap: 4px; }
.pf-note { font-size: 12px; color: var(--ink-mute); margin-left: auto; }
.pf-body { padding: 4px 10px 8px; position: relative; }
/* Laadtoestand: golf + tekst + balk over de grafiek; oude stippen gedimd. */
.pf-busy {
  position: absolute; left: 10px; right: 10px; top: 4px; height: 160px; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: color-mix(in srgb, var(--panel-solid) 70%, transparent); border-radius: 8px; cursor: progress;
}
.pf-busy[hidden] { display: none; }
.profile[data-busy] .pf-svg { opacity: .3; transition: opacity .2s; }
.pf-wave { width: 150px; height: 14px; overflow: hidden; }
.pf-wave path { fill: none; stroke: var(--accent-2); stroke-width: 2.2; stroke-linecap: round; animation: pf-wave 1.1s linear infinite; }
@keyframes pf-wave { to { transform: translateX(-30px); } }
.pf-busy-t { font-size: 12.5px; font-weight: 550; color: var(--ink); font-variant-numeric: tabular-nums; text-align: center; padding: 0 8px; }
.pf-bar { width: min(240px, 70%); height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.pf-bar i { display: block; height: 100%; background: var(--accent-2); border-radius: 2px; }
.pf-bar[data-mode="det"] i { transition: width .25s ease-out; }
.pf-bar[data-mode="indet"] i { width: 35%; animation: pf-indet 1.2s ease-in-out infinite; }
@keyframes pf-indet { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.pf-params button[aria-busy="true"] { position: relative; padding-right: 23px; cursor: progress; }
.pf-params button[aria-busy="true"]::after {
  content: ""; position: absolute; right: 8px; top: 50%; width: 9px; height: 9px; margin-top: -5.5px;
  border-radius: 50%; border: 1.7px solid var(--accent-2); border-right-color: transparent; animation: pf-spin .7s linear infinite;
}
@keyframes pf-spin { to { transform: rotate(360deg); } }
.pf-plot { height: 160px; position: relative; overflow: hidden; }
.pf-empty { position: absolute; inset: 40% 0 auto; text-align: center; }
.pf-svg { display: block; overflow: visible; font-family: var(--font-ui); }
.pf-band[data-i="0"] { fill: var(--panel-2); }
.pf-band[data-i="1"] { fill: var(--panel-3); opacity: .55; }
.pf-country, .sch-country { font-size: 10.5px; font-weight: 600; fill: var(--ink-mute); letter-spacing: .06em; }
.pf-grid { stroke: var(--line); stroke-width: 1; }
.pf-ytick, .pf-xtick, .pf-unit { font-size: 10px; fill: var(--ink-mute); font-variant-numeric: tabular-nums; }
.pf-ytick { text-anchor: end; }
.pf-xtick { text-anchor: middle; }
.pf-conf { stroke: var(--trib); stroke-width: 1.5; }
.pf-line { fill: none; stroke: var(--ink-mute); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
.pf-pt { cursor: pointer; transition: r .12s; }
.pf-pt.stale { opacity: .35; }
.pf-pt.cens { stroke-dasharray: 2 1.5; }
.pf-pt.hl { r: 7.5; stroke: var(--ink); stroke-width: 2; opacity: 1; }
.pf-time { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.pf-play { width: 30px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font-size: 11px; }
.pf-slider { flex: 1; accent-color: var(--accent-2); }
.pf-when { font-size: 12px; color: var(--ink-dim); min-width: 180px; font-variant-numeric: tabular-nums; }
.pf-tip {
  position: absolute; z-index: 5; pointer-events: none; font-size: 12px; line-height: 1.45; color: var(--ink);
  background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; box-shadow: var(--shadow); max-width: 230px;
}
.pf-tip span { color: var(--ink-mute); }
.kind-tag { font-size: 10.5px; color: var(--ink-mute); border: 1px solid var(--line); border-radius: 10px; padding: 0 6px; margin-left: 4px; }
.st-badge { font-size: 10.5px; padding: 0 6px; border-radius: 10px; background: var(--panel-3); color: var(--ink-dim); }
.st-badge[data-st="ongecontroleerd"] { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.st-badge[data-st="gecontroleerd"], .st-badge[data-st="definitief"] { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.st-badge[data-st="twijfelachtig"] { color: var(--alert); background: color-mix(in srgb, var(--alert) 12%, transparent); }
.st-badge[data-st="loq"] { color: var(--accent); background: color-mix(in srgb, var(--accent-2) 12%, transparent); }
.swatch.lint-swatch::before { content: ""; position: absolute; left: 2px; right: 2px; top: 5.5px; height: 5px; border-radius: 3px; background: linear-gradient(90deg, #f4e9a8, #4fb3b0, #3b3f9e); }
.lg-ramp { height: 8px; border-radius: 4px; margin: 4px 0 2px; }
.lg-ramp-lbl { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }

.schema-view {
  position: fixed; z-index: 24; top: calc(var(--topbar-h) + var(--gap));
  left: calc(var(--gap) + var(--panel-w) + var(--gap)); right: var(--gap); bottom: 240px;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.schema-view[hidden] { display: none; }
body:has(#drill:not([hidden])) .schema-view { right: calc(var(--drill-w) + var(--gap) * 2); }
body:has(.leftcol[data-collapsed="true"]) .schema-view { left: var(--gap); }
.schema-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.schema-head span { color: var(--ink-dim); font-size: 12px; }
.schema-svg { flex: 1; display: block; width: 100%; }
.schema-svg text, .pf-svg text { font-family: var(--font-ui); }
.schema-view > svg { min-height: 0; }
.sch-line { stroke: var(--maas); stroke-width: 7; stroke-linecap: round; }
.sch-end { fill: var(--panel-solid); stroke: var(--maas); stroke-width: 3; }
.sch-km { font-size: 10px; fill: var(--ink-mute); text-anchor: middle; }
.sch-conf line { stroke: var(--trib); stroke-width: 2; }
.sch-conf text { font-size: 10px; fill: var(--trib); font-style: italic; }
.sch-stop { cursor: pointer; outline: none; }
.sch-stop .stale { opacity: .4; }
.sch-name { font-size: 11px; fill: var(--ink); }
.sch-val { font-weight: 650; fill: var(--accent); font-variant-numeric: tabular-nums; }
.sch-val.stale { fill: var(--ink-mute); font-weight: 500; }
.sch-stop.hl circle, .sch-stop:focus circle { r: 8; stroke: var(--ink); stroke-width: 2.5; }
.sch-stop.hl .sch-name { font-weight: 650; }
body.view-schema .maplibregl-ctrl-top-right { display: none; }

/* ---- Responsive ------------------------------------------------------------------ */
@media (max-width: 1100px) {
  :root { --drill-w: 352px; }
  .brand-sub { display: none; }
}
@media (max-width: 860px) {
  #camera-tools, #home-btn { display: none; }
  .search { margin-left: 4px; }
}
/* Phone: the layer panel + legend become a bottom sheet behind a "Lagen"
   button; the drill is a bottom sheet over the lower 62% of the screen. */
@media (max-width: 640px) {
  :root { --topbar-h: 56px; --gap: 10px; }
  .brand-text { display: none; }
  .topbar { gap: 8px; }
  #share-btn { display: none; }
  .leftcol {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72vh; gap: 0;
    background: var(--panel-solid); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-lg); padding-bottom: env(safe-area-inset-bottom);
  }
  .leftcol .panel, .leftcol .legend { border: 0; border-radius: 0; box-shadow: none; background: transparent; backdrop-filter: none; }
  .leftcol .legend { border-top: 1px solid var(--line); }
  .leftcol .panel { flex: 1 1 auto; }
  .leftcol[data-collapsed="true"] { display: none; }
  .leftcol[data-collapsed="false"] .panel-head .icon-btn svg { transform: rotate(180deg); }
  .maplibregl-ctrl-bottom-right { bottom: 0; }
  .panel-fab { top: auto; bottom: calc(52px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); box-shadow: var(--shadow-lg); }
  .drill { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none; height: 62vh; border-radius: 16px 16px 0 0; }
  @keyframes slide-in { from { transform: translateY(24px); opacity: 0; } }
  body:has(#drill:not([hidden])) .maplibregl-ctrl-top-right { right: 0; }
  .dock, body:has(#drill:not([hidden])) .dock, body:has(.leftcol[data-collapsed="true"]) .dock { left: 8px; right: 8px; }
  .analysis { height: 46vh; }
  .dock { bottom: calc(60px + env(safe-area-inset-bottom)); }   /* boven de "Lagen"-knop */
  .pf-params { overflow-x: auto; max-width: 100%; }
  .pf-plot { height: 150px; }
  .pf-busy { height: 150px; }
  .pf-when { min-width: 0; font-size: 11px; }
  .schema-view, body:has(#drill:not([hidden])) .schema-view, body:has(.leftcol[data-collapsed="true"]) .schema-view { left: 8px; right: 8px; }
  .search { min-width: 0; }
  .search:focus-within, .search:has(.search-results:not([hidden])) { position: absolute; left: 48px; right: 132px; max-width: none; z-index: 10; background: var(--panel-solid); }
  #view-switch button { padding: 5px 8px; font-size: 12px; }
  /* Rapport en Inloggen als icoonknop: met tekst past de balk niet (zoekveld → 0). */
  a.tool-btn { width: 36px; padding: 0; justify-content: center; }
  .tool-btn .tb-ico { display: block; }
  .tool-btn .tb-txt { display: none; }
  .admin { left: 8px; right: 8px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .sch-edge { animation: none; }
  /* Zonder beweging blijft het leesbaar: tekst + volle, rustige balk. */
  .pf-bar[data-mode="indet"] i { animation: none; width: 100%; opacity: .45; }
}
