      :root {
        /* Effen achtergrondkleur voor de kaart bij "Geen achtergrond" -
           neutraal en licht, zodat het contrasteert met de kleuren die de
           app zelf gebruikt (rood/groen/oranje/blauw, donkere kruinlijn). */
        --no-background-color: #f4f4f4;
      }

      html,
      body {
        margin: 0;
        padding: 0;
        height: 100%;
        width: 100%;
        font-family: system-ui, sans-serif;
      }

      #app {
        position: absolute;
        inset: 0;
        display: flex;
      }

      #mapPane {
        flex: 1 1 auto;
        height: 100%;
        min-width: 0;
        display: flex;
        flex-direction: column;
      }

      #mapControls {
        flex: 0 0 auto;
        padding: 6px 10px;
        background: #f5f5f5;
        border-bottom: 1px solid #ccc;
        font-size: 13px;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px 16px;
      }

      #mapControlsLeft {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 16px;
      }

      /* margin-left: auto duwt deze groep naar de rechterkant van de balk,
         zolang er op de huidige regel nog ruimte is - bij een smal scherm
         wrapt #mapControls zelf (flex-wrap hierboven) naar een tweede regel
         i.p.v. dat deze groep overloopt. */
      #mapControlsRight {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: auto;
      }

      /* Los van #mapControlsLeft/#mapControlsRight (die laatste heeft
         margin-left:auto) - staat daardoor altijd meteen na de linkse
         instellingen, vóór Legenda/Help. */
      #pdokSearchWrap {
        position: relative;
      }

      #pdokSearchInput {
        width: 220px;
        box-sizing: border-box;
        padding: 3px 6px;
        font-size: 12px;
      }

      /* Zelfde opzet als .legend-panel: max-width voorkomt dat het paneel
         breder dan het scherm kan worden op een smal venster, z-index
         houdt het boven de kaarten. */
      .pdok-results-panel {
        position: absolute;
        top: 100%;
        left: 0;
        margin-top: 4px;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
        z-index: 3000;
        min-width: 280px;
        max-width: calc(100vw - 16px);
        max-height: 320px;
        overflow-y: auto;
        font-size: 12px;
        box-sizing: border-box;
      }

      .pdok-group-title {
        font-weight: 600;
        color: #555;
        padding: 5px 10px 2px;
      }

      .pdok-result-row {
        padding: 4px 10px;
        cursor: pointer;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .pdok-result-row:hover,
      .pdok-result-row.pdok-highlighted {
        background: #eef5fc;
      }

      .pdok-message {
        padding: 8px 10px;
        color: #666;
      }

      #legendWrap {
        position: relative;
      }

      #legendToggleBtn {
        font-size: 12px;
        cursor: pointer;
      }

      #backgroundModeSelect {
        font-size: 12px;
      }

      #helpToggleBtn {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        cursor: pointer;
      }

      /* Vast overlay-element, los van #app, zodat de kaarten en de rest van
         de pagina nooit van grootte veranderen als de handleiding open- of
         dichtgaat. */
      .help-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 5000;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
        box-sizing: border-box;
      }

      .help-overlay[hidden] {
        display: none;
      }

      /* width: min(...) + box-sizing: border-box garanderen dat het venster
         nooit breder is dan het scherm, ook niet op een smal scherm. */
      .help-dialog {
        background: #fff;
        border-radius: 6px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
        width: min(640px, 100%);
        max-height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        box-sizing: border-box;
      }

      .help-dialog-header {
        position: sticky;
        top: 0;
        background: #fff;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 12px 16px;
        border-bottom: 1px solid #e0e0e0;
      }

      .help-dialog-header h2 {
        margin: 0;
        font-size: 15px;
      }

      #helpCloseBtn {
        flex: 0 0 auto;
        width: 26px;
        height: 26px;
        padding: 0;
        border: 1px solid #ccc;
        border-radius: 4px;
        background: #fff;
        font-size: 13px;
        line-height: 1;
        cursor: pointer;
      }

      #helpCloseBtn:hover {
        background: #eee;
      }

      .help-dialog-body {
        padding: 14px 16px 18px;
        font-size: 13px;
        line-height: 1.5;
        color: #222;
      }

      .help-dialog-body h3 {
        margin: 14px 0 4px;
        font-size: 13px;
      }

      .help-dialog-body h3:first-child {
        margin-top: 0;
      }

      .help-dialog-body p {
        margin: 4px 0 10px;
      }

      .help-dialog-body ul {
        margin: 4px 0 10px 18px;
        padding: 0;
      }

      .help-dialog-body li {
        margin-bottom: 4px;
      }

      .help-dialog-body code {
        font-family: ui-monospace, monospace;
        font-size: 11.5px;
        background: #f0f0f0;
        padding: 1px 4px;
        border-radius: 3px;
      }

      .help-swatch {
        display: inline-block;
        width: 13px;
        height: 13px;
        border-radius: 2px;
        vertical-align: middle;
        margin-right: 2px;
      }

      .legend-panel {
        position: absolute;
        top: 100%;
        right: 0;
        left: auto;
        margin-top: 4px;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
        padding: 8px 10px;
        font-size: 12px;
        z-index: 3000;
        min-width: 260px;
        max-width: calc(100vw - 16px);
        box-sizing: border-box;
      }

      .legend-section-title {
        font-weight: 600;
        margin: 8px 0 4px 0;
      }

      .legend-section-title:first-child {
        margin-top: 0;
      }

      .legend-row {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 2px 0;
      }

      .legend-swatch {
        flex: 0 0 auto;
        width: 26px;
        height: 26px;
        display: flex;
        align-items: center;
        justify-content: center;
      }

      .legend-swatch-line {
        width: 20px;
        height: 3px;
        border-radius: 1px;
      }

      .legend-swatch-outline {
        width: 16px;
        height: 16px;
        box-sizing: border-box;
      }

      #mapsRow {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
      }

      .mapHalf {
        flex: 1 1 50%;
        min-width: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
      }

      .mapHalf + .mapHalf {
        border-left: 1px solid #ccc;
      }

      .mapHalfTitle {
        flex: 0 0 auto;
        padding: 5px 10px;
        background: #e8e8e8;
        border-bottom: 1px solid #ccc;
        font-size: 13px;
        font-weight: 600;
        text-align: center;
      }

      .mapCanvasWrap {
        position: relative;
        flex: 1 1 auto;
        min-height: 100px;
      }

      .attrPanelResizer {
        flex: 0 0 auto;
        height: 6px;
        cursor: row-resize;
        background: #e0e0e0;
        border-top: 1px solid #ccc;
        border-bottom: 1px solid #ccc;
      }

      .attrPanelResizer:hover,
      .attrPanelResizer.resizing {
        background: #b0b0b0;
      }

      .attrPanel {
        flex: 0 0 auto;
        height: 70px;
        min-height: 60px;
        overflow-y: auto;
        padding: 8px 10px;
        font-size: 12px;
        background: #fafafa;
      }

      /* Straatnaamlabel (ORL openbareRuimteNaam): zelfde rotatie-aanpak als
         het huisnummerlabel, maar groter, cursief en licht geel zodat het
         duidelijk anders oogt dan een huisnummer. */
      .orl-label-icon {
        background: transparent;
        border: none;
      }

      .orl-label-text {
        display: inline-block;
        white-space: nowrap;
        font-size: clamp(6px, calc(13px * var(--label-scale, 1)), 20px);
        font-style: italic;
        font-weight: 600;
        letter-spacing: 0.3px;
        color: #ffe9a3;
        text-shadow:
          -1px -1px 0 #000,
          1px -1px 0 #000,
          -1px 1px 0 #000,
          1px 1px 0 #000;
        transform-origin: center;
        pointer-events: none;
      }

      /* Huisnummerlabel (PND nummeraanduidingreeks): geroteerde tekst op
         het plaatsingspunt. Wit met een donkere outline zodat het label
         leesbaar blijft op elke achtergrond (kaart, luchtfoto, gekleurd
         vlak). */
      .huisnummer-label-icon {
        background: transparent;
        border: none;
      }

      .huisnummer-label-text {
        display: inline-block;
        white-space: nowrap;
        font-size: clamp(6px, calc(11px * var(--label-scale, 1)), 20px);
        font-weight: 600;
        color: #fff;
        text-shadow:
          -1px -1px 0 #000,
          1px -1px 0 #000,
          -1px 1px 0 #000,
          1px 1px 0 #000;
        transform-origin: center;
        pointer-events: none;
      }

      .attr-panel-header {
        margin: 0 0 6px 0;
      }

      .attr-panel-empty {
        margin: 0;
        color: #888;
        font-style: italic;
      }

      /* Melding dat er geen corresponderend object op de andere kaart
         bestaat (nieuw/vervallen/geen match) - de enige plek waar deze
         melding nu staat, dus bewust opvallend: lichte achtergrond,
         gekleurde balk links, normale (niet-cursieve) donkere tekst. */
      .attr-panel-info {
        margin: 0;
        display: flex;
        align-items: flex-start;
        gap: 8px;
        background: #e8f1fb;
        border-left: 4px solid #3f7cc9;
        border-radius: 3px;
        padding: 10px 12px;
        font-size: 13px;
        color: #15284a;
      }

      .attr-panel-info-icon {
        flex: 0 0 auto;
        font-size: 15px;
        line-height: 1.3;
        color: #3f7cc9;
      }

      .attr-panel-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 11px;
      }

      .attr-panel-table th,
      .attr-panel-table td {
        border: 1px solid #ddd;
        padding: 2px 5px;
        text-align: left;
        vertical-align: top;
      }

      tr.attr-changed td {
        background: #fff3b0;
      }

      .attr-changed-marker {
        color: #8a6d00;
        font-weight: 600;
        font-size: 0.9em;
      }

      .mapCanvas {
        position: absolute;
        inset: 0;
      }

      .mapCanvas.no-background {
        background: var(--no-background-color);
      }

      .zoomLabel {
        position: absolute;
        top: 8px;
        right: 8px;
        z-index: 2000;
        background: rgba(255, 255, 255, 0.9);
        padding: 4px 10px;
        border-radius: 4px;
        font-size: 13px;
        font-weight: 600;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
        pointer-events: none;
      }

      /* Coördinatenlabel (wordt-kaart): hetzelfde lettertype als de rest,
         met cijfers van gelijke breedte en een vaste minimumbreedte, zodat
         het label niet heen en weer springt terwijl de cijfers tijdens het
         bewegen veranderen. */
      .zoomLabel.coordLabel {
        font-variant-numeric: tabular-nums;
        white-space: pre;
        min-width: 230px;
        text-align: right;
      }

      #panel {
        flex: 0 0 420px;
        width: 420px;
        height: 100%;
        box-sizing: border-box;
        background: #fff;
        border-right: 1px solid #ccc;
        box-shadow: 1px 0 6px rgba(0, 0, 0, 0.15);
        padding: 12px 14px;
        font-size: 13px;
        z-index: 1000;
        /* Vast bovenste deel (#panelTop) + apart scrollend tabelgebied
           (#tableContainer) i.p.v. het hele paneel te laten scrollen. */
        display: flex;
        flex-direction: column;
        overflow: hidden;
      }

      #panelTop {
        flex: 0 0 auto;
      }

      .search-marker-icon {
        background: transparent;
        border: none;
      }

      /* Vertex-diff-markers (verwijderd/toegevoegd punt BINNEN een vlak/
         lijn): bewust een andere vorm dan de rode/groene circleMarker die
         voor een compleet toegevoegd/vervallen puntobject wordt gebruikt. */
      .vertex-diff-icon {
        background: transparent;
        border: none;
      }

      .vertex-diff-symbol {
        font-weight: 900;
        font-size: 15px;
        line-height: 16px;
        text-align: center;
        text-shadow:
          0 0 2px #fff,
          0 0 2px #fff,
          0 0 2px #fff;
      }

      .vertex-removed-icon .vertex-diff-symbol {
        color: #c62828;
      }

      .vertex-added-icon .vertex-diff-symbol {
        color: #2e7d32;
        /* "+" oogt bij gelijke font-size beduidend kleiner/dunner dan "✕":
           iets groter zetten om ze visueel in verhouding te brengen. */
        font-size: 21px;
        line-height: 20px;
      }

      /* RD-coördinaatregel(s) onder de hoofdtekst van een vertex-tooltip
         (verwijderd/toegevoegd/ongewijzigd) - bewust kleiner en
         lichter dan de hoofdtekst, puur ter referentie. */
      .vertex-tooltip-coord {
        font-size: 11px;
        color: #777;
        margin-top: 2px;
      }

      #panel.drop-active {
        outline: 3px dashed #4a90d9;
        outline-offset: -3px;
        background: #eef5fc;
      }

      #panel h2 {
        margin: 0 0 8px 0;
        font-size: 15px;
      }

      /* Verborgen maar nog bruikbaar met toetsenbord/Tab: NIET display:none
         (dat zou het volledig uit de tab-volgorde halen). De zichtbare
         "knop" is de <label for="fileInput">, die het klikken op het
         (onzichtbare) native bestandsveld activeert - zelfde gedrag als een
         gewone bestandsknop, alleen het uiterlijk is eigen CSS. */
      .visually-hidden-input {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
      }

      #fileChooserRow {
        display: flex;
        align-items: center;
        gap: 8px;
      }

      #fileChooserLabel {
        flex: 0 0 auto;
        display: inline-block;
        padding: 3px 10px;
        border: 1px solid #888;
        border-radius: 3px;
        background: #f0f0f0;
        font-size: 12px;
        cursor: pointer;
      }

      #fileChooserLabel:hover {
        background: #e2e2e2;
      }

      /* Toetsenbordfocus zit op het (onzichtbare) input-element, niet op het
         label zelf - via de aangrenzende-sibling-selector krijgt de
         zichtbare "knop" toch een focusring. */
      #fileInput:focus-visible + #fileChooserLabel {
        outline: 2px solid #1e6bff;
        outline-offset: 1px;
      }

      /* flex: 1 1 auto + min-width: 0 is vereist, anders negeert een flex-
         item overflow/text-overflow en duwt een lange bestandsnaam de rij
         (en daarmee het paneel) juist breder i.p.v. af te kappen. */
      #loadedFileLabel {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12px;
        color: #333;
      }

      #status {
        margin-top: 6px;
        color: #333;
      }

      #warnings {
        margin-top: 8px;
        color: #8a5a00;
        background: #fff6e0;
        border: 1px solid #f0d080;
        border-radius: 4px;
        padding: 6px 8px;
      }

      #warnings ul {
        margin: 4px 0 0 0;
        padding-left: 18px;
      }

      #tableSearchRow {
        margin-top: 8px;
        display: flex;
        gap: 6px;
      }

      #lokaalIdSearch {
        flex: 1 1 auto;
        min-width: 0;
        box-sizing: border-box;
        padding: 3px 6px;
        font-size: 12px;
      }

      #searchZoomBtn {
        flex: 0 0 auto;
        font-size: 11px;
        cursor: pointer;
      }

      /* Bestandsnummer-label, alleen zichtbaar bij >1 geladen bestand (zie
         #fileListWrap) - neutraal grijs, want rood/groen/oranje/blauw
         betekenen al iets anders in de viewer. padding/line-height klein
         genoeg om de rijhoogte niet te verhogen. */
      .file-badge {
        display: inline-block;
        padding: 0 4px;
        border-radius: 3px;
        background: #ddd;
        color: #333;
        font-size: 9px;
        line-height: 1.5;
        vertical-align: middle;
        margin-left: 3px;
      }

      /* Ingeklapt: alleen de knop, dus precies één regel - zie ook
         #fileListPanel (hidden/zichtbaar togglet door JS). Zit in #panelTop
         (vast bovenste deel), dus dit verandert nooit de hoogte van de
         kaarten - alleen de verdeling binnen #panel tussen #panelTop en de
         scrollbare #tableContainer (flex: 1 1 auto) past automatisch aan. */
      #fileListWrap {
        margin-top: 8px;
      }

      #fileListToggleBtn {
        font-size: 12px;
        cursor: pointer;
      }

      #fileListPanel {
        margin-top: 4px;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 4px 8px;
        max-height: 140px;
        overflow-y: auto;
        font-size: 12px;
      }

      .file-list-row {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 2px 0;
      }

      .file-list-name {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .file-list-count {
        flex: 0 0 auto;
        color: #666;
      }

      #tableContainer {
        margin-top: 10px;
        /* Neemt de resterende hoogte van #panel in en scrolt zelfstandig.
           min-height: 0 is vereist, anders blijft deze container op zijn
           inhoudshoogte staan en krimpt hij niet mee - dan verschijnt er
           geen scrollbalk en duwt de tabel het paneel juist groter. */
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
      }

      table {
        border-collapse: collapse;
        width: 100%;
        font-size: 12px;
      }

      th,
      td {
        border: 1px solid #ccc;
        padding: 3px 6px;
        text-align: left;
        vertical-align: top;
      }

      th {
        background: #eee;
        position: sticky;
        top: 0;
        /* Kolomkoppen zijn losse woorden zonder natuurlijk breekpunt: nooit
           midden in het woord afbreken, desnoods (licht) overlopen. Iets
           kleinere letter dan de databody geeft ze net genoeg ruimte om
           binnen hun kolombreedte te passen. */
        overflow-wrap: normal;
        word-break: normal;
        font-size: 9.5px;
      }

      td {
        /* Standaardgedrag: alleen op een spatie/koppelteken afbreken. Enige
           uitzondering is de lokaalID-kolom (td.mono), die expliciet
           word-break: break-all gebruikt hieronder. */
        overflow-wrap: normal;
      }

      #tableContainer table {
        table-layout: fixed;
        width: 100%;
        font-size: 11px;
      }

      tr.data-row:nth-child(4n + 1) {
        background: #f9f9f9;
      }

      tr.data-row.selected-row {
        background: #bfe0ff;
      }

      td.mono {
        font-family: ui-monospace, monospace;
        font-size: 11px;
        word-break: break-all;
      }

      .details-row pre {
        margin: 0;
        max-height: 300px;
        overflow: auto;
        white-space: pre-wrap;
        font-size: 11px;
      }

      td.actions-cell {
        padding: 2px 4px;
        vertical-align: middle;
      }

      .actions-wrap {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
      }

      button.icon-btn {
        flex: 0 0 auto;
        width: 24px;
        height: 24px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #bbb;
        border-radius: 3px;
        background: #fff;
        color: #555;
        cursor: pointer;
      }

      button.icon-btn svg {
        width: 15px;
        height: 15px;
        display: block;
      }

      button.icon-btn:hover {
        background: #eee;
        color: #111;
      }

      button.icon-btn:focus-visible {
        outline: 2px solid #1e6bff;
        outline-offset: 1px;
      }

      /* Driehoekje van de uitklapknop: wijst rechts (ingeklapt) of, 150ms
         gedraaid, naar beneden (uitgeklapt) - hetzelfde SVG, alleen CSS
         transform verandert, niet opnieuw getekend. */
      .chevron-icon {
        display: flex;
      }

      .chevron-icon svg {
        transition: transform 150ms ease;
        transform: rotate(0deg);
      }

      .details-btn.expanded .chevron-icon svg {
        transform: rotate(90deg);
      }

/* Aangemelde gebruiker en afmeldlink, rechts in de balk boven de kaarten. */
#wie {
  font-size: 0.85em;
  color: #444;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#afmelden {
  font-size: 0.85em;
}

/* Lange woorden (zoals "exploratieverzoek") breken binnen hun kolom af in plaats van erover te lopen. */
#tableContainer td {
  overflow-wrap: anywhere;
}

/* Controle per bestand: komen de punten terug en sluit de oppervlakte. Zelfde vorm als de
   waarschuwingen, maar neutraal; groen en oranje alleen in het symbool voor elke regel. */
#controle {
  margin-top: 8px;
  background: #f5f8fb;
  border: 1px solid #c9d6e3;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 0.92em;
}
#controle > ul {
  margin: 4px 0 6px 0;
  padding-left: 0;
  list-style: none;
}
#controle > ul > li {
  padding-left: 20px;
  position: relative;
  margin: 2px 0;
}
#controle > ul > li::before {
  position: absolute;
  left: 2px;
  font-weight: 700;
}
#controle .controle-ok::before { content: "✓"; color: #2e7d32; }
#controle .controle-fout::before { content: "!"; color: #b26a00; left: 6px; }
#controle .controle-info::before { content: "i"; color: #1e6bff; left: 6px; font-style: italic; }
#controle ul ul {
  margin: 3px 0 0 0;
  padding-left: 14px;
}
#controle .controle-punt {
  font: inherit;
  font-variant-numeric: tabular-nums;
  background: none;
  border: none;
  padding: 0;
  color: #1e6bff;
  text-decoration: underline;
  cursor: pointer;
}
