  :root {
    --sun: #FFB300; --blue: #4285F4; --blue-d: #1A56C4;
    --bg: #f3f7fc; --surface: #ffffff; --ink: #12202f; --ink-2: #4a5a6b; --ink-3: #6b7a89; --line: #dde5ee;
    --accent: var(--blue);
    --font: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
    --hdr: 56px;
    color-scheme: light;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; height: 100%; }
  body {
    display: flex; flex-direction: column;
    height: 100vh; height: 100svh; overflow: hidden;
    background: var(--bg); color: var(--ink);
    font: 16px/1.55 var(--font);
    -webkit-text-size-adjust: 100%;
  }
  h1, h2, h3 { line-height: 1.2; margin: 0; }
  a { color: var(--blue-d); }
  :focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
  .i { width: 1.15em; height: 1.15em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; flex: none; }

  /* ---------- Kopbalk ---------- */
  .site-header {
    flex: none; position: relative; z-index: 1200;
    background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #ffd54f));
    color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18);
  }
  .site-header .wrap { width: min(1280px, 100%); margin: 0 auto; padding: 0 16px; height: var(--hdr); display: flex; align-items: center; gap: 12px; }
  .brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
  .brand .logo { width: 36px; height: 36px; flex: none; border-radius: 50%; background: #fff; color: var(--blue-d); display: grid; place-items: center; }
  .brand .logo .i { width: 22px; height: 22px; vertical-align: 0; }
  .brand .txt { min-width: 0; }
  .brand .ttl { margin: 0; font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; display: block; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand small { display: block; font-size: .72rem; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hdr-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex: none; }
  .btn-pill {
    display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
    font: 500 .9rem var(--font); border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer;
    background: #fff; color: var(--blue-d); box-shadow: 0 1px 3px rgba(0,0,0,.2);
  }
  .btn-pill:hover { filter: brightness(.96); }
  .btn-pill .i { width: 16px; height: 16px; vertical-align: 0; }
  .hdr-back { padding: 8px 14px 8px 8px; }
  .hdr-back .i { width: 18px; height: 18px; }

  /* ---------- Kaart ---------- */
  .mapwrap { position: relative; flex: 1; min-height: 0; }
  #map { position: absolute; inset: 0; z-index: 1; background: #cfe3f7; font-family: var(--font); }
  .leaflet-bar { border: 0 !important; border-radius: 14px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.25) !important; }
  .leaflet-bar a, .leaflet-bar a:hover { background-color: var(--surface); color: var(--ink); border-bottom-color: var(--line); }
  .leaflet-control-attribution { font-family: var(--font); border-top-left-radius: 8px; }
  .leaflet-tooltip.nk-tip { background: var(--surface); color: var(--ink); border: 0; border-radius: 999px; padding: 5px 12px; font: 500 .85rem var(--font); box-shadow: 0 2px 8px rgba(0,0,0,.3); white-space: nowrap; }
  .leaflet-tooltip-top.nk-tip::before { border-top-color: var(--surface); }

  /* ---------- Plakkers ---------- */
  .stn-marker, .landelijk-marker { cursor: pointer; }
  .value-badge {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    font-family: var(--font); font-weight: 700; white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,.4); transition: transform .15s;
  }
  .value-badge:hover { transform: scale(1.12); }
  .value-badge.stn { font-size: 11px; border-radius: 999px; border: 2px solid #fff; padding: 0 5px; }
  .value-badge.landelijk { font-size: 12px; border-radius: 999px; border: 3px solid #fff; padding: 0 7px; box-shadow: 0 2px 6px rgba(0,0,0,.5); }

  /* ---------- Legenda ---------- */
  .legend { background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.25); font: 400 12px/1.6 var(--font); }
  .legend-title { font-weight: 700; margin-bottom: 4px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .legend-caret { font-size: 11px; color: var(--ink-3); transition: transform 0.15s ease; }
  .legend-caret.collapsed { transform: rotate(-90deg); }
  #legend-body.collapsed { display: none; }
  .legend-sub { color: var(--ink-3); }
  .legend-note { font-size: 10px; color: var(--ink-3); margin-top: 4px; width: 0; min-width: 100%; line-height: 1.4; }
  .legend-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: middle; border: 1px solid #fff; box-shadow: 0 0 2px rgba(0,0,0,.4); }

  /* ---------- Zoekbalk ---------- */
  .searchbox { position: absolute; z-index: 900; top: 10px; left: 56px; width: min(320px, calc(100% - 66px)); }
  .searchbox input { width: 100%; font: 400 .95rem var(--font); padding: 10px 14px 10px 38px; border-radius: 999px; border: 0; box-shadow: 0 2px 10px rgba(0,0,0,.3); background: var(--surface); color: var(--ink); }
  .searchbox input::placeholder { color: var(--ink-3); }
  .searchbox .search-ico { position: absolute; left: 13px; top: 11px; width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; vertical-align: 0; }
  .searchres { list-style: none; margin: 6px 0 0; padding: 4px; background: var(--surface); border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.3); max-height: 50vh; overflow: auto; }
  .searchres:empty { display: none; }
  .searchres li { padding: 9px 12px; border-radius: 10px; cursor: pointer; display: flex; gap: 10px; align-items: center; color: var(--ink); }
  .searchres li small { color: var(--ink-3); margin-left: 4px; }
  .searchres li:hover, .searchres li[aria-selected="true"] { background: color-mix(in srgb, var(--blue) 14%, transparent); }
  .res-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 1px solid #fff; box-shadow: 0 0 2px rgba(0,0,0,.4); }
  .res-ico { display: inline-flex; color: var(--ink-2); }
  .res-ico .i { width: 18px; height: 18px; vertical-align: 0; }
  .plaats-marker .plaats-pin { width: 100%; height: 100%; border-radius: 50%; background: var(--blue-d); color: #fff; display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
  .plaats-pin .i { width: 16px; height: 16px; vertical-align: 0; }
  .leaflet-popup-content-wrapper { border-radius: 14px; background: var(--surface); color: var(--ink); }
  .leaflet-popup-tip { background: var(--surface); }
  .leaflet-popup-content { margin: 14px 16px; font-family: var(--font); min-width: 210px; }
  .pop .kind { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--ink-3); }
  .pop h3 { font-size: 1.05rem; margin: 2px 0 4px; }
  .pop p { margin: 0 0 6px; color: var(--ink-2); font-size: .85rem; }
  .pop-stn { display: flex; align-items: center; gap: 10px; width: 100%; margin: 4px 0 0; padding: 6px 12px 6px 6px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--ink); font: 500 .85rem var(--font); cursor: pointer; text-align: left; }
  .pop-stn:hover { background: color-mix(in srgb, var(--blue) 24%, transparent); }
  .pop-stn .badge { font-weight: 700; font-size: .78rem; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
  .pop-stn .naam { flex: 1; }
  .pop-stn .km { color: var(--ink-3); font-weight: 400; white-space: nowrap; }
  .pop-hint { font-size: .72rem; color: var(--ink-3); margin-top: 6px; }

  /* ---------- Gedeelde knoppen ---------- */
  .deel-icon-btn, .icon-close { border: 0; background: transparent; padding: 6px; margin: 0; border-radius: 50%; cursor: pointer; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; }
  .deel-icon-btn:hover, .icon-close:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--ink); }
  .icon-close:hover { color: #d62728; }
  .deel-icon-btn .i, .icon-close .i { width: 20px; height: 20px; vertical-align: 0; }
  .head-actions { display: flex; align-items: center; gap: 2px; flex: none; }

  /* ---------- Desktop: zwevend paneel ---------- */
  #chart-panel {
    position: absolute; width: 640px; max-width: calc(100% - 16px);
    height: 760px; max-height: calc(100% - 16px);
    background: var(--surface); color: var(--ink);
    border-radius: 14px; box-shadow: 0 6px 22px rgba(0,0,0,.35);
    z-index: 1000; display: none; flex-direction: column; overflow: hidden;
  }
  #panel-head { display: flex; justify-content: space-between; align-items: center; flex: none; padding: 12px 12px 10px 18px; }
  #panel-title { font-weight: 700; font-size: 1.1rem; }

  /* ---------- Mobiel: beeldvullend ---------- */
  #chart-fullscreen { position: fixed; inset: 0; background: var(--surface); color: var(--ink); z-index: 4000; display: none; flex-direction: column; }
  #cf-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #ffd54f)); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); flex-shrink: 0; }
  #cf-back { display: inline-flex; align-items: center; gap: 2px; font: 500 .9rem var(--font); background: #fff; color: var(--blue-d); border-radius: 999px; padding: 7px 14px 7px 8px; box-shadow: 0 1px 3px rgba(0,0,0,.2); cursor: pointer; white-space: nowrap; }
  #cf-back .i { width: 18px; height: 18px; vertical-align: 0; }
  #cf-title { font-size: 1.05rem; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #cf-header .deel-icon-btn { margin-left: auto; color: #fff; background: rgba(255,255,255,.2); padding: 9px; }
  #cf-header .deel-icon-btn:hover { background: rgba(255,255,255,.32); color: #fff; }

  /* ---------- Inhoud van paneel en beeldvullend scherm: statuskaart + grafiek ---------- */
  .pb {
    --rc-bg: #eef2f6; --rc-surface: #fff; --rc-fg: #0f1d2e; --rc-mute: #5b6a7b; --rc-line: #dfe5ec; --rc-accent: #0b5cab;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--rc-bg); color: var(--rc-fg); line-height: 1.4;
    flex: 1; min-height: 0; overflow-y: auto; padding: 12px;
    display: flex; flex-direction: column; gap: 12px;
  }
  .pb * { box-sizing: border-box; }
  .pb h3, .pb p { margin: 0; padding: 0; font-family: inherit; color: var(--rc-fg); }
  .pb > * { flex: none; min-width: 0; }
  .rc-card { background: var(--rc-surface); border: 1px solid var(--rc-line); border-radius: 14px; padding: 14px; }
  .pb .rc-card h3 { font-size: 15px; font-weight: 700; }
  /* icoonkleur = kleur van de plakker (NIV in het script) */
  .rc-st { --bg: #fffaeb; --bd: #f0d98c; --ico-bg: #f2c230; --ico-fg: #2b2000; --wbd: #e6b83c; --wtx: #8a5a00; background: var(--bg); border-color: var(--bd); }
  .rc-l1 { --bg: #d6e8fb; --bd: #7fb2e5; --ico-bg: #1f6fbf; --ico-fg: #fff; }
  .rc-l3 { --bg: #fff4e8; --bd: #f6c995; --ico-bg: #f58a1f; --ico-fg: #2b1500; --wbd: #e88a2a; --wtx: #8a3d00; }
  .rc-l4 { --bg: #fdeeee; --bd: #f2b8b5; --ico-bg: #d62728; --ico-fg: #fff; --wbd: #d9534f; --wtx: #8a1410; }
  .rc-st-top { display: flex; gap: 12px; align-items: center; }
  .rc-ico { width: 36px; height: 36px; border-radius: 50%; background: var(--ico-bg); color: var(--ico-fg); display: grid; place-items: center; flex: none; }
  .rc-ico svg { width: 18px; height: 18px; }
  .pb .rc-st h3 { font-size: 17px; }
  .pb .rc-st-top p { font-size: 12.5px; color: var(--rc-mute); }
  .rc-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
  .rc-tile { background: #fff; border: 1px solid var(--rc-line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  /* tegels onder de drempel: gekleurde rand, getinte achtergrond en een lichte schaduw */
  .rc-tile.warn { border: 2px solid var(--wbd); background: color-mix(in srgb, var(--wbd) 14%, #fff); box-shadow: 0 2px 8px color-mix(in srgb, var(--wbd) 40%, transparent); }
  .rc-tile.warn b { color: var(--wtx); }
  .rc-tile.warn .rc-tl { color: var(--wtx); font-weight: 600; }
  .rc-tile.warn .rc-tag { font-weight: 700; }
  .rc-tl { font-size: 12px; color: var(--rc-mute); }
  .rc-tile b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
  .rc-tile small { font-size: 12px; font-weight: 500; color: var(--rc-mute); }
  .rc-tag { font-size: 11px; font-weight: 600; display: flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--rc-mute); }
  .rc-tag svg { width: 13px; height: 13px; flex: none; }
  .rc-tile.warn .rc-tag { color: var(--wtx); }
  @media (min-width: 640px) { .rc-tile b { font-size: 22px; } .rc-tile { padding: 12px; } }

  .rc-plot { position: relative; height: 320px; margin: 0 -4px; }
  .rc-plot > .rc-plotdiv { height: 100%; width: 100%; }
  .rc-tip { position: absolute; z-index: 5; display: none; pointer-events: none; min-width: 150px; padding: 8px 10px; background: rgba(255,255,255,.96); border: 1px solid var(--rc-line); border-radius: 10px; box-shadow: 0 4px 14px rgba(15,29,46,.18); font-size: 12px; font-variant-numeric: tabular-nums; }
  .rc-tip .t { font-weight: 700; margin-bottom: 4px; }
  .rc-tip .r { display: flex; align-items: center; gap: 6px; padding: 1px 0; white-space: nowrap; }
  .rc-tip .r i { width: 10px; height: 3px; border-radius: 2px; flex: none; }
  .rc-tip .r em { font-style: normal; color: var(--rc-mute); }
  .rc-tip .r b { margin-left: auto; padding-left: 12px; font-weight: 600; }
  .rc-tip .r.now { font-weight: 700; }
  .rc-cross { position: absolute; width: 0; border-left: 1px dotted var(--rc-mute); pointer-events: none; display: none; }
  .rc-periods { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
  .rc-per { padding: 5px 12px; }
  @media (max-width: 640px) { .rc-per .lang { display: none; } }
  .rc-legend { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 12px; }
  .rc-chip { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--rc-fg); padding: 6px 12px; border: 1px solid var(--rc-line); border-radius: 999px; background: #fff; font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }
  .rc-chip[aria-pressed="true"] { background: #e8f1fb; border-color: #9cc3ec; }
  .rc-chip[aria-pressed="false"] .rc-sw { opacity: .4; }
  .rc-chip[aria-pressed="false"] { color: var(--rc-mute); }
  .rc-chip:focus-visible, .pb summary:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: 2px; }
  .rc-sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
  .rc-sw.band { border-radius: 3px; }
  .rc-chip em { font-style: normal; font-size: 12px; color: var(--rc-mute); }
  .pb details { width: 100%; }
  .pb summary { cursor: pointer; font-size: 13px; color: var(--rc-accent); font-weight: 500; list-style: none; padding: 6px 4px; }
  .pb summary::-webkit-details-marker { display: none; }
  .rc-more { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 6px; }
  .rc-src { font-size: 11px; color: var(--rc-mute); padding: 0 4px; }

  /* ---------- Modals ---------- */
  .modal { position: fixed; inset: 0; background: rgba(8,20,36,.5); z-index: 3500; display: none; align-items: center; justify-content: center; }
  .modal-content { background: var(--surface); color: var(--ink); border-radius: 14px; box-shadow: 0 6px 28px rgba(0,0,0,.4); overflow-y: auto; box-sizing: border-box; }
  .modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
  .modal-head h3 { font-size: 1.2rem; }
  #info-modal-content { width: 90%; max-width: 580px; max-height: 80vh; padding: 20px 24px 22px; font-size: .9rem; line-height: 1.6; color: var(--ink-2); }
  #info-modal-content p { margin: 0 0 8px; }
  #info-modal-content strong { color: var(--ink); }
  #info-modal-content ul { padding-left: 18px; margin: 8px 0 0; }
  #info-modal-content li { margin-bottom: 6px; }
  #deel-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: #12202f; color: #fff; padding: 10px 18px; border-radius: 999px; font: 400 .9rem var(--font); z-index: 5000; opacity: 0; pointer-events: none; transition: .3s; }
  #deel-toast.show { opacity: 1; transform: translate(-50%, 0); }
  @media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; } }

  /* ---------- Mobiel (<=640px) ---------- */
  @media (max-width: 640px) {
    .brand small .d-only { display: none; }
    .brand .ttl { font-size: 1.02rem; letter-spacing: 0; }
    /* korte kop op mobiel: staat wel in de HTML (crawlers, screenreaders), maar niet zichtbaar */
    .brand .m-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
    .site-header .wrap { gap: 8px; padding: 0 12px; }
    .hdr-actions { gap: 6px; }
    .btn-pill { padding: 0; width: 40px; height: 40px; justify-content: center; }
    .btn-pill span { display: none; }
    .btn-pill .i { width: 19px; height: 19px; }
    .searchbox input { font-size: 1rem; }
    .legend { font-size: 13px; padding: 9px 12px; margin-bottom: 30px !important; }
    .legend-swatch { width: 11px; height: 11px; }
    .legend-note { font-size: 11.5px; }
    #chart-panel { display: none !important; }
    #info-modal-content { font-size: 1rem; width: 90%; max-height: 74vh; }
    .deel-icon-btn .i, .icon-close .i { width: 23px; height: 23px; }
  }
  @media (max-width: 380px) { .brand .logo { display: none; } }

  /* ---------- Advertentie (zwevend rechtsonder, net als op weerdata.nl) ---------- */
  .adfloat { position: absolute; z-index: 600; right: 10px; bottom: 28px; width: 336px; max-width: calc(100% - 20px); background: var(--surface); border-radius: 14px; box-shadow: 0 6px 22px rgba(0,0,0,.35); padding: 6px; overflow: hidden; }
  .adfloat:has(ins[data-ad-status="unfilled"]) { display: none; }   /* geen advertentie beschikbaar: blok weg */
  .adlabel { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3, #7b8a99); display: flex; justify-content: space-between; align-items: center; padding: 0 4px 2px; }
  .adfloat .close { border: 0; background: transparent; color: var(--ink-3, #7b8a99); cursor: pointer; padding: 2px 6px; line-height: 1; }
  .adfloat .close .i { width: 14px; height: 14px; vertical-align: 0; }
  .adfloat ins { display: block; min-height: 50px; }
  .adph { min-height: 100px; display: grid; place-items: center; border: 1px dashed var(--line, #dde5ee); border-radius: 8px; color: var(--ink-3, #7b8a99); font-size: .8rem; }
  @media (max-width: 640px) {
    .adfloat { left: 10px; right: 10px; width: auto; max-width: none; bottom: 22px; }
    .legend { margin-bottom: calc(30px + var(--ad-h, 0px)) !important; }   /* legenda boven het advertentieblok */
  }

  /* ---------- Google privacy-balk (CMP): compacte regel onderaan i.p.v. een groot blok ---------- */
  .cmp-bar { flex: none !important; position: static !important; display: flex !important; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 10px;
    height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 3px 10px !important; text-align: center;
    background: var(--surface, #fff); color: var(--ink-3, #6b7a89); border-top: 1px solid var(--line, #dde5ee); font-size: 11px !important; line-height: 1.3 !important; }
  .cmp-bar * { display: inline !important; margin: 0 !important; padding: 0 !important; font-size: 11px !important; line-height: 1.3 !important; }

  /* Foutmelding als data.json niet geladen kan worden */
  .laad-fout {
    position: absolute; z-index: 5; left: 16px; right: 16px; bottom: 24px; margin: 0;
    padding: 12px 16px; border-radius: 14px; background: var(--surface); color: var(--ink);
    box-shadow: 0 2px 8px rgba(0,0,0,.3); text-align: center;
  }
