    *, *::before, *::after { box-sizing: border-box; }
    html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; font-family: 'Segoe UI', Tahoma, sans-serif; }

    /* -- Heatmap rasteroverlay: altijd pixelscherp renderen -- */
    .hm-raster-layer {
      image-rendering: pixelated;          /* Chrome, Safari, Edge */
      image-rendering: -moz-crisp-edges;   /* Firefox */
    }

    /* -- Layout -- */
    #app { display: flex; flex-direction: column; height: 100vh; }

    #sidebar {
      width: 300px;
      min-width: 300px;
      max-width: 720px;
      background: #ffffff;
      color: #1e293b;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      box-shadow: 4px 0 16px rgba(0,0,0,0.08);
      z-index: 1000;
      flex-shrink: 0;
      position: relative;
    }

    /* -- Sidebar resize-handle -- */
    #sidebar-resize-handle {
      position: absolute;
      top: 0; right: 0; bottom: 0;
      width: 5px;
      cursor: col-resize;
      z-index: 1100;
      background: transparent;
      transition: background 0.15s;
    }
    #sidebar-resize-handle:hover,
    #sidebar-resize-handle.active {
      background: rgba(59, 130, 246, 0.25);
    }
    #sidebar-resize-handle::after {
      content: '';
      position: absolute;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%);
      width: 2px; height: 40px;
      background: #cbd5e1;
      border-radius: 2px;
      transition: background 0.15s;
    }
    #sidebar-resize-handle:hover::after,
    #sidebar-resize-handle.active::after {
      background: #3b82f6;
    }

    /* -- REMOVED: Old sidebar-header (now top-bar) -- */

    /* -- Top Bar -- */

        #top-bar {
      background: linear-gradient(135deg, #059669, #10b981);
      padding: 4px 16px;
      /* iOS notch / Dynamic Island: voeg safe-area toe aan bovenkant */
      padding-top: max(4px, env(safe-area-inset-top, 4px));
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      z-index: 1001;
      box-shadow: 0 2px 8px rgba(0,0,0,0.1);
      position: relative;
    }

    #top-bar-title {
      display: flex;
      align-items: center;
      gap: 10px;
      color: white;
      font-weight: 700;
      position: absolute;
      left: 16px;
      font-size: 15px;
    }
    #top-bar-title i { font-size: 22px; opacity: 0.9; }
    .title-main { font-weight: 700; font-size: 15px; line-height: 1.2; }
    .title-sub { font-size: 11px; opacity: 0.75; }

    /* -- About-knop -- */
    #about-btn {
      position: absolute;
      right: 16px;
      top: 50%;
      transform: translateY(-50%);
      background: rgba(255,255,255,0.15);
      border: 1px solid rgba(255,255,255,0.35);
      color: white;
      padding: 4px 14px;
      border-radius: 20px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.2s;
      display: flex;
      align-items: center;
      gap: 6px;
      white-space: nowrap;
    }
    #about-btn:hover { background: rgba(255,255,255,0.28); }

    /* -- About-modal -- */
    #about-modal {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 9999;
      background: rgba(0,0,0,0.55);
      backdrop-filter: blur(3px);
      align-items: center;
      justify-content: center;
    }
    #about-modal.open { display: flex; }
    #about-modal-box {
      background: #fff;
      border-radius: 12px;
      width: min(760px, 94vw);
      max-height: 84vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 8px 40px rgba(0,0,0,0.25);
      overflow: hidden;
    }
    #about-modal-header {
      background: linear-gradient(135deg, #059669, #10b981);
      color: white;
      padding: 16px 22px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-shrink: 0;
    }
    #about-modal-header span {
      font-weight: 700;
      font-size: 16px;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    #about-modal-close {
      background: rgba(255,255,255,0.2);
      border: none;
      color: white;
      width: 30px;
      height: 30px;
      border-radius: 50%;
      cursor: pointer;
      font-size: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s;
    }
    #about-modal-close:hover { background: rgba(255,255,255,0.35); }
    #about-modal-body {
      padding: 28px 32px;
      overflow-y: auto;
      line-height: 1.7;
      font-size: 14.5px;
      color: #333;
    }
    #about-modal-body h1 { font-size: 22px; font-weight: 700; color: #059669; margin-bottom: 6px; }
    #about-modal-body h2 { font-size: 17px; font-weight: 700; color: #1a5c3a; margin-top: 24px; margin-bottom: 8px; border-bottom: 2px solid #d1fae5; padding-bottom: 4px; }
    #about-modal-body h3 { font-size: 15px; font-weight: 600; color: #333; margin-top: 16px; }
    #about-modal-body a  { color: #059669; text-decoration: underline; }
    #about-modal-body ul, #about-modal-body ol { padding-left: 22px; margin-bottom: 10px; }
    #about-modal-body li { margin-bottom: 4px; }
    #about-modal-body code { background: #f0fdf4; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
    #about-modal-body hr  { border: none; border-top: 1px solid #e5e7eb; margin: 20px 0; }
    #about-modal-loading  { text-align: center; padding: 40px; color: #6b7280; font-size: 14px; }

    #top-bar-tabs {
      display: flex;
      flex-direction: column;
      gap: 2px;
      visibility: hidden;
    }
    .top-bar-row {
      display: flex;
      gap: 4px;
    }

    .tab-btn {
      background: rgba(255,255,255,0.15);
      border: 1px solid rgba(255,255,255,0.2);
      color: rgba(255,255,255,0.85);
      font-size: 13px;
      font-weight: 600;
      padding: 7px 16px;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.2s;
      white-space: nowrap;
    }
    .tab-btn:hover { background: rgba(255,255,255,0.25); color: white; }
    .tab-btn.active {
      background: white;
      color: #059669;
      border-color: white;
      box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }
    /* ── Tab-groepen met sub-nav-balk ────────────────────────────── */
    .tab-group {
      position: relative;
      display: inline-flex;
    }
    /* Tab-knoppen in een groep zijn verborgen uit de nav-balk (zichtbaar in sub-nav) */
    .tab-group .nav-hidden { display: none; }
    .tab-group-btn {
      background: rgba(255,255,255,0.15);
      border: 1px solid rgba(255,255,255,0.2);
      color: rgba(255,255,255,0.85);
      font-size: 13px;
      font-weight: 600;
      padding: 7px 16px;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.2s;
      white-space: nowrap;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .tab-group-btn:hover { background: rgba(255,255,255,0.25); color: white; }
    .tab-group-btn.active {
      background: white;
      color: #059669;
      border-color: white;
      box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }

    /* ── Sub-nav-balk (altijd zichtbaar als groep actief) ─────── */
    #sub-nav-bar {
      background: rgba(255,255,255,0.12);
      border-top: 1px solid rgba(255,255,255,0.15);
      border-bottom: 1px solid rgba(0,0,0,0.08);
      padding: 3px 16px;
      display: flex;
      align-items: center;
      gap: 12px;
      flex-shrink: 0;
      flex-wrap: wrap;
    }
    .sub-nav-section {
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .sub-nav-label {
      font-size: 10px;
      font-weight: 700;
      color: rgba(255,255,255,0.55);
      text-transform: uppercase;
      letter-spacing: 0.6px;
      padding-right: 6px;
      border-right: 1px solid rgba(255,255,255,0.2);
      margin-right: 2px;
      white-space: nowrap;
    }
    .sub-nav-tab {
      background: rgba(255,255,255,0.1);
      border: 1px solid rgba(255,255,255,0.15);
      color: rgba(255,255,255,0.8);
      font-size: 11.5px;
      font-weight: 500;
      padding: 3px 11px;
      border-radius: 5px;
      cursor: pointer;
      transition: all 0.18s;
      white-space: nowrap;
    }
    .sub-nav-tab:hover { background: rgba(255,255,255,0.2); color: white; }
    .sub-nav-tab.active {
      background: white;
      color: #059669;
      border-color: white;
      font-weight: 600;
      box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    }
    .layer-tab-draggable { cursor: grab; }
    .layer-tab-draggable:active { cursor: grabbing; }
    .layer-tab-draggable.dragging { opacity: 0.4; background: rgba(255,255,200,0.3); }
    .layer-tab-draggable.drag-over { border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251,191,36,0.5); }

    /* Bodemdata layer card drag-and-drop */
    .bd-layer-card { transition: transform 0.15s ease, box-shadow 0.15s ease; }
    .bd-layer-card:hover .bd-drag-handle { color: #78716c !important; }
    .bd-drag-handle:hover { transform: scale(1.2); }
    .bd-drag-placeholder { height: 4px; background: #f59e0b; border-radius: 2px; margin: 6px 0; }

    #main-content {
      display: flex;
      flex: 1;
      overflow: hidden;
      position: relative;
    }

    .tab-panel {
      padding: 14px 16px;
      overflow-y: auto;
      flex: 1;
    }
    .tab-panel::-webkit-scrollbar { width: 5px; }
    .tab-panel::-webkit-scrollbar-track { background: #ffffff; }
    .tab-panel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

    #sidebar-body {
      flex: 1;
      overflow: hidden;
      padding: 0;
      display: flex;
      flex-direction: column;
    }

    #status-bar {
      background: #f8fafc;
      border-top: 1px solid #e2e8f0;
      padding: 7px 14px;
      font-size: 11px;
      color: #64748b;
      flex-shrink: 0;
      min-height: 30px;
    }

    #map-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
    #map { flex: 1; min-height: 100px; }
    #map-drag-handle {
      height: 6px; background: #cbd5e1; cursor: ns-resize; flex-shrink: 0;
      display: none; position: relative;
    }
    #map-drag-handle:hover { background: #94a3b8; }
    #map-drag-handle::before {
      content: ''; position: absolute; left: 50%; top: 50%;
      transform: translate(-50%, -50%); width: 40px; height: 2px;
      background: #64748b; border-radius: 2px;
    }
    #bottom-panel {
      height: 40vh; min-height: 120px; max-height: calc(100vh - 200px);
      background: #fff; border-top: 1px solid #e2e8f0;
      display: none; flex-direction: column; overflow: hidden;
    }
    #map-area.panel-open #map-drag-handle,
    #map-area.panel-open #bottom-panel { display: flex; }

    /* -- Gebiedsanalyse bottom bar (altijd zichtbaar na analyse) -- */
    #area-bottom-bar {
      display: none;
      height: 48px;
      background: linear-gradient(135deg, #059669, #10b981);
      color: white;
      align-items: center;
      padding: 0 10px;
      gap: 6px;
      flex-shrink: 0;
      border-top: 2px solid #047857;
      position: relative;
      z-index: 1200;
      transition: opacity 0.2s;
    }
    #map-area.area-bar-active #area-bottom-bar { display: flex; }
    /* Absolute rechter-panelen stoppen boven de bar zodat hun schaduw niet overlapt */
    #map-area.area-bar-active #parcel-panel,
    #map-area.area-bar-active #gv-parcel-panel,
    #map-area.area-bar-active #gwv-right-panel,
    #map-area.area-bar-active #bd-right-panel,
    #map-area.area-bar-active #bp2-parcel-panel { bottom: 48px; }
    #area-bar-toggle {
      background: rgba(255,255,255,0.15);
      border: 1px solid rgba(255,255,255,0.3);
      color: white;
      width: 34px; height: 34px;
      border-radius: 8px;
      cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
      transition: background 0.2s, transform 0.25s;
      font-size: 14px;
    }
    #area-bar-toggle:hover { background: rgba(255,255,255,0.28); }
    #map-area.panel-open #area-bar-toggle { transform: rotate(180deg); }
    /* Tabs in de bottom bar — zelfde stijl als .tab-btn bovenaan */
    #area-bottom-bar .bp-tab-btn {
      background: rgba(255,255,255,0.15);
      border: 1px solid rgba(255,255,255,0.2);
      color: rgba(255,255,255,0.85);
      font-size: 12px; font-weight: 600;
      padding: 6px 14px;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.2s;
      white-space: nowrap;
      display: flex; align-items: center; gap: 5px;
    }
    #area-bottom-bar .bp-tab-btn:hover { background: rgba(255,255,255,0.25); color: white; }
    #area-bottom-bar .bp-tab-btn.active {
      background: white; color: #059669;
      border-color: white;
      box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    }
    /* Compacte KPIs onder taartdiagram in sidebar */
    #area-sidebar-kpis {
      display: flex; flex-wrap: wrap; gap: 3px 10px;
      padding: 6px 2px 2px;
      border-top: 1px solid #e2e8f0;
      margin-top: 6px;
    }
    #area-sidebar-kpis span { font-size: 12px; color: #475569; display: flex; align-items: baseline; gap: 3px; }
    .ski-lbl { color: #94a3b8; font-size: 11px; }
    .ski-val { color: #1e293b; font-weight: 700; font-size: 13px; }
    /* -- Groeivergelijker bodem-paneel -- */
    #gv-bottom-panel {
      height: 42vh; min-height: 200px; max-height: calc(100vh - 160px);
      background: #fff; border-top: 3px solid #0d6efd;
      display: none; flex-direction: column; overflow: hidden;
    }
    #map-area.gv-panel-open #map-drag-handle,
    #map-area.gv-panel-open #gv-bottom-panel { display: flex; }
    #gv-bp-header {
      background: linear-gradient(135deg, #0d6efd, #3b82f6);
      color: white; padding: 7px 14px;
      display: flex; align-items: center; gap: 10px; flex-shrink: 0;
    }
    #gv-bp-controls {
      display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1;
    }
    #gv-bp-controls select {
      background: rgba(255,255,255,0.18); color: white;
      border: 1px solid rgba(255,255,255,0.3);
      border-radius: 4px; font-size: 10px; padding: 2px 5px; cursor: pointer;
    }
    #gv-bp-controls select option { background: #1e40af; color: white; }
    #gv-bp-controls label { font-size: 10px; opacity: 0.85; white-space: nowrap; }
    #gv-bp-body {
      flex: 1; min-height: 0; overflow: hidden;
      padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 2px;
    }
    #gv-bp-year-title {
      font-size: 15px; font-weight: 700; color: #1e293b;
      text-align: center; letter-spacing: 0.04em; flex-shrink: 0;
    }
    #gv-bp-chart-wrap {
      flex: 1; min-height: 0; position: relative;
    }
    #gv-bp-chart-wrap canvas {
      position: absolute; top: 0; left: 0;
      width: 100% !important; height: 100% !important;
    }

    /* -- Gewasverandering cel-statistiekenpaneel (rechts) -- */
    #gwv-right-panel {
      position: absolute;
      top: 0; right: 0; bottom: 0;
      width: var(--gwv-rp-width, 460px);
      background: #ffffff;
      display: none;
      flex-direction: column;
      box-shadow: -4px 0 16px rgba(0,0,0,0.12);
      z-index: 1100;
      border-left: 1px solid #e2e8f0;
    }
    #gwv-right-panel.open { display: flex; }
    #gwv-right-panel.open ~ #map-drag-handle,
    #gwv-right-panel.open ~ #gwv-bottom-panel { margin-right: var(--gwv-rp-width, 460px); }
    #gwv-rp-header {
      background: linear-gradient(135deg, #0284c7, #0ea5e9);
      color: white; padding: 10px 12px;
      display: flex; align-items: center; justify-content: space-between;
      flex-shrink: 0; gap: 8px;
    }
    #gwv-rp-header-title {
      font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 7px;
    }
    #gwv-rp-close {
      background: rgba(255,255,255,0.15); border: none; color: white;
      width: 26px; height: 26px; border-radius: 4px; cursor: pointer;
      font-size: 16px; line-height: 1; flex-shrink: 0;
    }
    #gwv-rp-close:hover { background: rgba(255,255,255,0.28); }
    #gwv-rp-body {
      flex: 1; overflow-y: auto; padding: 0;
    }
    #gwv-rp-body::-webkit-scrollbar { width: 5px; }
    #gwv-rp-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
    .gwv-rp-section {
      padding: 10px 12px; border-bottom: 1px solid #f1f5f9;
    }
    .gwv-rp-section:last-child { border-bottom: none; }
    .gwv-rp-section-title {
      font-size: 10px; font-weight: 700; color: #475569;
      text-transform: uppercase; letter-spacing: 0.06em;
      margin-bottom: 8px; display: flex; align-items: center; gap: 5px;
    }
    .gwv-rp-section-title i { color: #0ea5e9; font-size: 10px; }
    .gwv-stat-grid {
      display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 2px;
    }
    .gwv-stat-box {
      background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
      padding: 6px 8px;
    }
    .gwv-stat-label { font-size: 9px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
    .gwv-stat-value { font-size: 13px; font-weight: 700; color: #1e293b; margin-top: 1px; }
    .gwv-stat-value.pos { color: #15803d; }
    .gwv-stat-value.neg { color: #b91c1c; }
    .gwv-cat-table { width: 100%; border-collapse: collapse; font-size: 11px; }
    .gwv-cat-table th {
      font-size: 9px; color: #94a3b8; text-transform: uppercase;
      letter-spacing: 0.04em; font-weight: 600; padding: 0 4px 5px;
      text-align: right; white-space: nowrap;
    }
    .gwv-cat-table th:first-child { text-align: left; }
    .gwv-cat-table td { padding: 3px 4px; vertical-align: middle; }
    .gwv-cat-table td:not(:first-child) { text-align: right; white-space: nowrap; }
    .gwv-cat-table tr:hover td { background: #f8fafc; }
    .gwv-bar-wrap {
      width: 70px; height: 6px; background: #e2e8f0; border-radius: 3px;
      overflow: hidden; display: inline-block; vertical-align: middle;
    }
    .gwv-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
    .gwv-rank-list { list-style: none; padding: 0; margin: 0; }
    .gwv-rank-item {
      display: flex; align-items: center; justify-content: space-between;
      padding: 3px 0; border-bottom: 1px solid #f8fafc; font-size: 11px;
    }
    .gwv-rank-item:last-child { border-bottom: none; }
    .gwv-rank-name { color: #374151; flex: 1; min-width: 0; overflow: hidden;
      text-overflow: ellipsis; white-space: nowrap; max-width: 58%; }
    .gwv-rank-val { font-weight: 700; white-space: nowrap; margin-left: 8px; }
    .gwv-rank-val.pos { color: #15803d; }
    .gwv-rank-val.neg { color: #b91c1c; }
    .gwv-full-table { width: 100%; border-collapse: collapse; font-size: 10px; }
    .gwv-full-table th {
      position: sticky; top: 0; background: #f8fafc;
      font-size: 9px; color: #64748b; text-transform: uppercase;
      letter-spacing: 0.04em; padding: 4px 5px; border-bottom: 1px solid #e2e8f0;
      cursor: pointer; white-space: nowrap; user-select: none;
    }
    .gwv-full-table th:hover { background: #f1f5f9; color: #0ea5e9; }
    .gwv-full-table th.sort-asc::after  { content: ' ↑'; }
    .gwv-full-table th.sort-desc::after { content: ' ↓'; }
    .gwv-full-table td { padding: 3px 5px; border-bottom: 1px solid #f8fafc;
      color: #1e293b; }
    .gwv-full-table td:not(:first-child) { text-align: right; }
    .gwv-full-table tr:hover td { background: #f0f9ff; }
    .gwv-filter-badge {
      font-size: 9px; background: #e0f2fe; color: #0369a1;
      border-radius: 8px; padding: 1px 7px; font-weight: 600;
    }

    /* -- Gewasverandering tijdreeks bodempaneel -- */
    #gwv-bottom-panel {
      height: 38vh; min-height: 220px; max-height: calc(100vh - 160px);
      background: #fff; border-top: 3px solid #0ea5e9;
      display: none; flex-direction: column; overflow: hidden;
      transition: height 0.15s ease;
    }
    #map-area.gwv-panel-open #map-drag-handle,
    #map-area.gwv-panel-open #gwv-bottom-panel { display: flex; }
    #gwv-bp-header {
      background: linear-gradient(135deg, #0284c7, #0ea5e9);
      color: white; padding: 7px 14px;
      display: flex; align-items: center; gap: 10px; flex-shrink: 0;
    }
    #gwv-bp-controls {
      display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1;
    }
    #gwv-bp-controls label { font-size: 10px; opacity: 0.85; white-space: nowrap; }
    #gwv-bp-controls select {
      background: rgba(255,255,255,0.18); color: white;
      border: 1px solid rgba(255,255,255,0.3);
      border-radius: 4px; font-size: 10px; padding: 2px 5px; cursor: pointer;
    }
    #gwv-bp-controls select option { background: #0369a1; color: white; }
    #gwv-bp-body {
      flex: 1; min-height: 0; overflow: hidden;
      padding: 6px 16px 8px; display: flex; flex-direction: column; gap: 4px;
    }
    #gwv-bp-chart-wrap {
      flex: 1; min-height: 0; position: relative;
    }
    #gwv-bp-chart-wrap canvas {
      position: absolute; top: 0; left: 0;
      width: 100% !important; height: 100% !important;
    }
    #gwv-bp-loading {
      position: absolute; inset: 0; display: flex; align-items: center;
      justify-content: center; font-size: 12px; color: #64748b;
      background: rgba(255,255,255,0.85);
    }

    /* -- Gewasverandering bodempaneel: view-toggle knoppen -- */
    #gwv-bp-view-toggle { display: flex; gap: 2px; flex-shrink: 0; }
    .gwv-vt-btn {
      background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
      color: rgba(255,255,255,0.85); padding: 3px 9px; border-radius: 4px;
      cursor: pointer; font-size: 11px; font-weight: 600;
      transition: all 0.15s; white-space: nowrap; display: flex; align-items: center; gap: 4px;
    }
    .gwv-vt-btn:hover { background: rgba(255,255,255,0.28); color: white; }
    .gwv-vt-btn.active { background: white; color: #0284c7; }

    /* -- Gewasverandering bodempaneel: tabel mode -- */
    #gwv-bottom-panel.gwv-tabel-mode #gwv-bp-body { padding: 0; gap: 0; }
    #gwv-bp-table-wrap {
      display: none; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
    }
    #gwv-bp-table-wrap.active { display: flex; }
    /* Toolbar: export + pin + top-scroll-mirror */
    #gwv-bpt-toolbar {
      display: flex; align-items: center; gap: 6px; padding: 4px 12px;
      border-bottom: 1px solid #e2e8f0; flex-shrink: 0; background: #f8fafc;
      min-height: 30px;
    }
    #gwv-bpt-export {
      background: #0284c7; color: white; border: none; border-radius: 4px;
      font-size: 10px; padding: 3px 9px; cursor: pointer; flex-shrink: 0;
      display: flex; align-items: center; gap: 4px;
    }
    #gwv-bpt-export:hover { background: #0369a1; }
    #gwv-bpt-pin-cell {
      background: none; border: 1px solid #cbd5e1; color: #475569;
      border-radius: 4px; font-size: 10px; padding: 2px 8px; cursor: pointer; flex-shrink: 0;
      display: flex; align-items: center; gap: 3px; transition: all 0.15s;
    }
    #gwv-bpt-pin-cell:hover { border-color: #0d9488; color: #0d9488; background: #f0fdfa; }
    #gwv-bpt-pin-cell.pinned { background: #fef9c3; border-color: #f59e0b; color: #92400e; }
    #gwv-bpt-top-scroll {
      flex: 1; overflow-x: auto; overflow-y: hidden; height: 14px;
    }
    #gwv-bpt-top-scroll::-webkit-scrollbar { height: 6px; }
    #gwv-bpt-top-scroll::-webkit-scrollbar-track { background: #f1f5f9; }
    #gwv-bpt-top-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
    /* Vastgezet (pinned) cel sectie */
    #gwv-bpt-pinned-section {
      flex-shrink: 0; border-bottom: 2px solid #0d9488;
      background: #f0fdfa; max-height: 40%; overflow: hidden;
      display: none; flex-direction: column; min-height: 0;
    }
    #gwv-bpt-pinned-section.active { display: flex; }
    #gwv-bpt-pinned-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 4px 12px; background: #ccfbf1; flex-shrink: 0;
      border-bottom: 1px solid #99f6e4; font-size: 11px; font-weight: 700; color: #0f766e;
    }
    #gwv-bpt-pinned-clear {
      background: none; border: 1px solid #0d9488; color: #0f766e;
      border-radius: 4px; font-size: 10px; padding: 1px 8px; cursor: pointer;
    }
    #gwv-bpt-pinned-clear:hover { background: #0d9488; color: white; }
    #gwv-bpt-pinned-scroll { overflow: auto; flex: 1; min-height: 0; }
    /* Hoofd-scroll wrapper */
    #gwv-bpt-scroll-wrap { overflow: auto; flex: 1; min-height: 0; }
    #gwv-bpt-scroll-wrap::-webkit-scrollbar,
    #gwv-bpt-pinned-scroll::-webkit-scrollbar { width: 5px; height: 6px; }
    #gwv-bpt-scroll-wrap::-webkit-scrollbar-thumb,
    #gwv-bpt-pinned-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
    /* Brede tabel opmaak (gedeeld door hoofd en pinned) */
    .gwv-bpt-table { width: 100%; border-collapse: collapse; font-size: 11px; }
    .gwv-bpt-table th {
      background: #f1f5f9; color: #475569; font-weight: 700; font-size: 10px;
      text-transform: uppercase; letter-spacing: 0.3px; padding: 5px 7px;
      border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 2;
      white-space: nowrap; text-align: right;
    }
    .gwv-bpt-table th:first-child {
      text-align: left; position: sticky; left: 0; z-index: 3; background: #f1f5f9;
    }
    .gwv-bpt-table th.gwv-bpt-ref-col { background: rgba(191,219,254,0.45); color: #1d4ed8; }
    .gwv-bpt-table th.gwv-bpt-vgl-col { background: rgba(167,243,208,0.45); color: #15803d; }
    .gwv-bpt-table th.gwv-bpt-delta-col {
      background: #f1f5f9; border-left: 2px solid #cbd5e1;
    }
    .gwv-bpt-table td {
      padding: 3px 7px; border-bottom: 1px solid #f1f5f9;
      text-align: right; white-space: nowrap;
    }
    .gwv-bpt-table td:first-child {
      text-align: left; position: sticky; left: 0; background: #fff;
      z-index: 1; font-weight: 500; border-right: 1px solid #e2e8f0;
      max-width: 180px; overflow: hidden; text-overflow: ellipsis;
    }
    .gwv-bpt-table tr:hover td { filter: brightness(0.95); }
    .gwv-bpt-table tr:hover td:first-child { background: #f0f9ff; filter: none; }
    .gwv-bpt-table td.gwv-bpt-delta-pos { color: #15803d; font-weight: 700; border-left: 2px solid #cbd5e1; }
    .gwv-bpt-table td.gwv-bpt-delta-neg { color: #b91c1c; font-weight: 700; border-left: 2px solid #cbd5e1; }
    .gwv-bpt-table td.gwv-bpt-delta-zero { color: #64748b; border-left: 2px solid #cbd5e1; }
    /* Pinned tabel afwijkende achtergrond */
    #gwv-bpt-pinned-table { width: 100%; border-collapse: collapse; font-size: 11px; }
    #gwv-bpt-pinned-table th {
      background: #ccfbf1; color: #0f766e; font-weight: 700; font-size: 10px;
      text-transform: uppercase; padding: 5px 7px; border-bottom: 1px solid #99f6e4;
      position: sticky; top: 0; z-index: 2; white-space: nowrap; text-align: right;
    }
    #gwv-bpt-pinned-table th:first-child {
      text-align: left; position: sticky; left: 0; z-index: 3; background: #ccfbf1;
    }
    #gwv-bpt-pinned-table th.gwv-bpt-ref-col { background: rgba(147,223,206,0.5); }
    #gwv-bpt-pinned-table th.gwv-bpt-vgl-col { background: rgba(110,231,183,0.5); }
    #gwv-bpt-pinned-table th.gwv-bpt-delta-col { border-left: 2px solid #99f6e4; }
    #gwv-bpt-pinned-table td {
      padding: 3px 7px; border-bottom: 1px solid #99f6e4; text-align: right; white-space: nowrap;
    }
    #gwv-bpt-pinned-table td:first-child {
      text-align: left; position: sticky; left: 0; background: #f0fdfa;
      z-index: 1; border-right: 1px solid #99f6e4;
      max-width: 180px; overflow: hidden; text-overflow: ellipsis;
    }
    #gwv-bpt-pinned-table td.gwv-bpt-delta-pos { color: #15803d; font-weight: 700; border-left: 2px solid #99f6e4; }
    #gwv-bpt-pinned-table td.gwv-bpt-delta-neg { color: #b91c1c; font-weight: 700; border-left: 2px solid #99f6e4; }
    #gwv-bpt-pinned-table td.gwv-bpt-delta-zero { color: #64748b; border-left: 2px solid #99f6e4; }
    #gwv-bpt-pinned-table tr:hover td:first-child { background: #ccfbf1; }

    /* -- Bodemdata right panel -- */
    #bd-right-panel {
      position: absolute;
      top: 0; right: 0; bottom: 0;
      width: 380px;
      background: #ffffff;
      display: none;
      flex-direction: column;
      box-shadow: -4px 0 16px rgba(0,0,0,0.12);
      z-index: 1100;
      border-left: 1px solid #e2e8f0;
    }
    #bd-right-panel.open { display: flex; }
    .bd-rp-header {
      background: linear-gradient(135deg, #78716c, #a8a29e);
      color: white;
      padding: 10px 14px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .bd-rp-body {
      overflow-y: auto;
      flex: 1;
      padding: 10px;
    }
    .bd-rp-section {
      margin-bottom: 12px;
      padding: 8px 10px;
      border-radius: 8px;
      border: 1px solid #e2e8f0;
    }
    .bd-rp-section-title {
      font-size: 11px;
      font-weight: 700;
      margin-bottom: 6px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .bd-filter-select-wrap {
      position: relative;
      margin-bottom: 6px;
    }
    .bd-filter-select-input {
      width: 100%;
      padding: 6px 30px 6px 10px;
      border: 1px solid #e2e8f0;
      border-radius: 6px;
      font-size: 11px;
      background: #fff;
      cursor: pointer;
    }
    .bd-filter-select-input:focus { outline: none; border-color: #7c3aed; }
    .bd-filter-select-arrow {
      position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
      pointer-events: none; color: #94a3b8; font-size: 10px;
    }
    .bd-filter-dropdown {
      display: none;
      position: absolute;
      top: 100%;
      left: 0; right: 0;
      max-height: 180px;
      overflow-y: auto;
      background: #fff;
      border: 1px solid #e2e8f0;
      border-radius: 0 0 6px 6px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1);
      z-index: 1200;
    }
    .bd-filter-dropdown.open { display: block; }
    .bd-filter-option {
      padding: 5px 10px;
      font-size: 11px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      color: #334155;
    }
    .bd-filter-option:hover { background: #f1f5f9; }
    .bd-filter-option.selected { background: #ede9fe; color: #5b21b6; font-weight: 600; }
    .bd-filter-option .bd-opt-check {
      width: 14px; height: 14px; border: 1.5px solid #cbd5e1; border-radius: 3px;
      display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    }
    .bd-filter-option.selected .bd-opt-check {
      background: #7c3aed; border-color: #7c3aed; color: white;
    }
    .bd-filter-tags {
      display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
    }
    .bd-filter-tag {
      display: inline-flex; align-items: center; gap: 3px;
      padding: 2px 8px; border-radius: 12px; font-size: 10px;
      background: #7c3aed; color: white; user-select: none;
    }
    .bd-filter-tag-x {
      cursor: pointer; font-weight: 700; margin-left: 2px; opacity: 0.8;
    }
    .bd-filter-tag-x:hover { opacity: 1; }
    .bd-gt-desc {
      font-size: 9px; color: #64748b; margin-left: auto; white-space: nowrap;
    }

    /* -- BP2 GebiedsRotatieResidu bottom panel -- */
    #bp2-bottom-panel {
      height: 35vh; min-height: 140px; max-height: calc(100vh - 200px);
      background: #fff; border-top: 2px solid #7c3aed;
      display: none; flex-direction: column; overflow: hidden;
    }

    /* -- Afstroming: Hoogteprofiel bodempaneel -- */
    #afst-profile-panel {
      height: 36vh; min-height: 180px; max-height: calc(100vh - 160px);
      background: #fff; border-top: 3px solid #0891b2;
      display: none; flex-direction: column; overflow: hidden;
    }
    #map-area.afst-profile-open #afst-profile-panel { display: flex; }
    #map-area.afst-profile-open #afst-profile-drag { display: block !important; }
    #afst-profile-header {
      background: linear-gradient(135deg, #0891b2, #38bdf8);
      color: white; padding: 7px 14px;
      display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    }
    #afst-profile-body {
      flex: 1; min-height: 0; overflow: hidden;
      padding: 6px 16px 8px; display: flex; flex-direction: column;
    }
    #afst-profile-chart-wrap {
      flex: 1; min-height: 0; position: relative;
    }
    #afst-profile-chart-wrap canvas {
      position: absolute; top: 0; left: 0;
      width: 100% !important; height: 100% !important;
    }
    #bp2-bottom-drag {
      height: 6px; background: #ddd6fe; cursor: ns-resize; flex-shrink: 0;
      display: none; position: relative;
    }
    #bp2-bottom-drag:hover { background: #c4b5fd; }
    #bp2-bottom-drag::before {
      content: ''; position: absolute; left: 50%; top: 50%;
      transform: translate(-50%, -50%); width: 40px; height: 2px;
      background: #7c3aed; border-radius: 2px;
    }
    #map-area.bp2-panel-open #bp2-bottom-drag,
    #map-area.bp2-panel-open #bp2-bottom-panel { display: flex; }
    #bp2-bp-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 6px 14px; border-bottom: 1px solid #ede9fe; background: #faf5ff;
      flex-shrink: 0;
    }
    #bp2-bp-header .bp2-bp-title { font-size: 13px; font-weight: 700; color: #5b21b6; display: flex; align-items: center; gap: 8px; }
    #bp2-bp-body { flex: 1; overflow: auto; padding: 10px 14px; display: flex; gap: 14px; }
    #bp2-bp-body .bp2-chart-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
    #bp2-bp-body .bp2-table-area { flex: 0 0 320px; overflow-y: auto; font-size: 10px; }
    @media (max-width: 900px) {
      #bp2-bp-body { flex-direction: column; }
      #bp2-bp-body .bp2-table-area { flex: 0 0 auto; }
    }

    /* (bp-header verwijderd — tabs staan nu in de bottom bar) */
    #bp-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
    #bp-table-wrap { flex: 1; overflow: auto; min-height: 0; padding: 0 14px 10px; }
    #bp-wide-table { width: 100%; border-collapse: collapse; font-size: 12px; }
    #bp-wide-table th.bp-gewas-col, #bp-wide-table td.bp-gewas-col {
      width: var(--bp-gewas-w, 154px);
      min-width: var(--bp-gewas-w, 154px);
      max-width: var(--bp-gewas-w, 154px);
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      position: relative;
    }
    #bp-wide-table th.bp-gewas-col { padding-right: 12px; }
    .bp-col-resizer {
      position: absolute; top: 0; right: 0; width: 10px; height: 100%;
      cursor: col-resize; user-select: none;
      background: linear-gradient(to right, transparent 0%, transparent 30%, #94a3b8 30%, #94a3b8 40%, transparent 40%, transparent 60%, #94a3b8 60%, #94a3b8 70%, transparent 70%);
      border-right: 2px solid #64748b;
      transition: background-color 0.15s, border-color 0.15s;
      opacity: 0.7;
    }
    .bp-col-resizer:hover, .bp-col-resizer.active {
      background-color: #dbeafe; border-right-color: #2563eb; opacity: 1;
    }
    /* Sticky kolommen in uitklappaneel — eerste 6 kolommen blijven staan */
    #bp-wide-table th.bp-sticky-col, #bp-wide-table td.bp-sticky-col {
      position: sticky; z-index: 2; background: #fff;
    }
    #bp-wide-table thead th.bp-sticky-col { z-index: 4; background: #f1f5f9; }
    #bp-wide-table tr.bp-cat-row td.bp-sticky-col { background: #f1f5f9; }
    #bp-wide-table tr:hover:not(.bp-cat-row) td.bp-sticky-col { background: #fafafa; }
    /* Rechter rand-schaduw op laatste sticky kolom om scrollbare deel te scheiden */
    #bp-wide-table th.bp-sticky-col.bp-sticky-last,
    #bp-wide-table td.bp-sticky-col.bp-sticky-last {
      box-shadow: 2px 0 4px -2px rgba(0,0,0,0.15);
    }
    #bp-top-scroll { scrollbar-width: thin; flex-shrink: 0; margin: 0 14px; }
    #bp-top-scroll::-webkit-scrollbar { height: 12px; }
    #bp-top-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
    #bp-top-scroll::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
    #bp-wide-table th, #bp-wide-table td {
      padding: 3px 6px; border-bottom: 1px solid #f1f5f9; text-align: right;
      white-space: nowrap;
    }
    #bp-wide-table thead, #bp-pinned-table thead {
      position: sticky; top: 0; z-index: 3;
    }
    #bp-wide-table th {
      background: #f1f5f9; color: #475569; font-weight: 700; font-size: 12px;
    }
    #bp-wide-table tr.bp-th-unit th {
      font-size: 9px; font-weight: 400; color: #94a3b8;
      padding-top: 0; padding-bottom: 3px; border-bottom: 1px solid #e2e8f0;
    }
    #bp-wide-table .bp-col-code, #bp-pinned-table .bp-col-code {
      width: 32px; min-width: 32px; padding-left: 2px; padding-right: 2px;
    }
    #bp-wide-table th.th-left, #bp-wide-table td.td-left { text-align: left; }
    #bp-wide-table tr.bp-cat-row { background: #f1f5f9; font-weight: 700; cursor: pointer; }
    #bp-wide-table tr.bp-cat-row td { border-top: none; border-bottom: 1px solid #cbd5e1; padding-top: 2px; padding-bottom: 2px; }
    #bp-wide-table tr.bp-cat-row:hover td { background: #e2e8f0; }
    .bp-cat-chevron { font-size: 10px; margin-right: 5px; color: #64748b; transition: transform 0.15s; display: inline-block; }
    tr.bp-cat-row.bp-cat-collapsed .bp-cat-chevron { transform: rotate(-90deg); }
    tr.bp-cat-hidden { display: none !important; }
    #bp-wide-table tr:hover:not(.bp-cat-row) { background: #fafafa; }
    /* -- Pinned / aangevinkte gewassen sectie (nu in tab 2, neemt volledige hoogte) -- */
    #bp-pinned-section {
      flex: 1; border-bottom: none;
      background: #f0fdfa; display: flex; flex-direction: column; min-height: 0;
    }
    #bp-pinned-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 5px 14px; background: #ccfbf1; flex-shrink: 0;
      border-bottom: 1px solid #99f6e4;
    }
    #bp-pinned-title { font-size: 11px; font-weight: 700; color: #0f766e; }
    #bp-pinned-clear {
      background: none; border: 1px solid #0d9488; color: #0f766e;
      border-radius: 4px; font-size: 10px; padding: 2px 8px; cursor: pointer; line-height: 1.6;
    }
    #bp-pinned-clear:hover { background: #0d9488; color: #fff; }
    #bp-pinned-wrap { overflow: auto; flex: 1; min-height: 0; padding: 0 14px 10px; }
    #bp-pinned-table { width: 100%; border-collapse: collapse; font-size: 12px; }
    #bp-pinned-table th, #bp-pinned-table td {
      padding: 5px 8px; border-bottom: 1px solid #99f6e4; text-align: right; white-space: nowrap;
    }
    #bp-pinned-table th {
      background: #ccfbf1; color: #0f766e; font-weight: 700; font-size: 11px;
      text-transform: uppercase; letter-spacing: 0.3px;
      position: sticky; top: 0; z-index: 2;
    }
    #bp-pinned-table th.th-left, #bp-pinned-table td.td-left { text-align: left; }
    #bp-pinned-table tr { background: #f0fdfa; }
    #bp-pinned-table tr:hover { background: #ccfbf1; }
    /* Aangevinkte rijen: geen rijkleur, heatmap blijft zichtbaar; checkbox is de enige indicator */
    /* Checkbox styling */
    .bp-pin-cb { cursor: pointer; width: 13px; height: 13px; accent-color: #0d9488; }
    /* Drag handle tussen pinned tabel en hoofdtabel */
    #bp-pinned-drag {
      height: 6px; background: #99f6e4; cursor: ns-resize; flex-shrink: 0; position: relative;
    }
    #bp-pinned-drag:hover, #bp-pinned-drag.dragging { background: #0d9488; }
    #bp-pinned-drag::before {
      content: ''; position: absolute; left: 50%; top: 50%;
      transform: translate(-50%, -50%); width: 40px; height: 2px;
      background: #0f766e; border-radius: 2px;
    }

    /* -- Bottom-panel tabs (stijl gedefinieerd binnen #area-bottom-bar hierboven) -- */

    /* -- Gebiedsanalyse kaartlegenda -- */
    .area-legend-ctrl {
      background: white; border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0,0,0,0.15);
      font-size: 11px; min-width: 150px; max-width: 220px;
      overflow: hidden; pointer-events: auto;
    }
    .alc-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 5px 8px 5px 10px;
      background: linear-gradient(135deg, #059669, #10b981);
      color: white;
    }
    .alc-title { font-weight: 700; font-size: 11px; white-space: nowrap; }
    .alc-toggle {
      background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
      border-radius: 4px; color: white; cursor: pointer;
      width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
      font-size: 9px; flex-shrink: 0; margin-left: 8px;
      transition: background 0.15s;
    }
    .alc-toggle:hover { background: rgba(255,255,255,0.28); }
    .alc-body { padding: 5px 8px 6px; max-height: 280px; overflow-y: auto; }
    .alc-item { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
    .alc-swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
    .alc-name { color: #334155; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .bp-tab-badge {
      font-size: 9px; background: #0d9488; color: #fff;
      border-radius: 8px; padding: 1px 5px; margin-left: 3px;
      display: inline-block; line-height: 1.5;
    }
    .bp-tab-panel { display: none; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
    .bp-tab-panel.active { display: flex; }
    /* -- CBS Data tab: disabled staat -- */
    #area-bottom-bar .bp-tab-btn.bp-tab-disabled {
      opacity: 0.42; cursor: not-allowed; pointer-events: none;
    }
    /* -- CBS Data tab: sub-tabs -- */
    #cbs-subtab-bar {
      display: flex; gap: 2px; padding: 5px 10px 0;
      background: #1e293b; border-bottom: 1px solid #334155; flex-shrink: 0;
    }
    .cbs-sub-btn {
      font-size: 10px; padding: 3px 10px; border-radius: 4px 4px 0 0; border: none;
      background: transparent; color: #94a3b8; cursor: pointer; font-weight: 500;
      transition: background 0.15s, color 0.15s;
    }
    .cbs-sub-btn:hover { background: rgba(255,255,255,0.12); color: #e2e8f0; }
    .cbs-sub-btn.active { background: #f0fdf4; color: #15803d; font-weight: 700; }
    /* -- CBS gebiedsselector -- */
    #cbs-area-selector {
      display: flex; gap: 6px; padding: 6px 10px;
      background: #f8fafc; border-bottom: 1px solid #e2e8f0; flex-shrink: 0;
    }
    #cbs-area-selector select {
      font-size: 11px; padding: 3px 6px; height: 26px;
      border: 1px solid #cbd5e1; border-radius: 4px;
      background: white; color: #334155; cursor: pointer;
    }
    #cbs-sel-type  { flex: 0 0 auto; min-width: 120px; }
    #cbs-sel-gebied { flex: 1; min-width: 0; }
    /* -- CBS sub-panels -- */
    .cbs-sub-panel { display: none; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
    .cbs-sub-panel.active { display: flex; }
    .cbs-sub-content { flex: 1; overflow-y: auto; padding: 8px 12px; min-height: 0; }
    .cbs-view-toggle { display: flex; gap: 4px; padding: 6px 12px 0; flex-shrink: 0; align-items: center; }
    .cbs-view-btn {
      font-size: 10px; padding: 2px 8px; border-radius: 4px; border: 1px solid #e2e8f0;
      background: transparent; color: #64748b; cursor: pointer;
    }
    .cbs-view-btn.active { background: #fef3c7; color: #92400e; border-color: #f59e0b; font-weight: 600; }
    .cbs-chart-wrap { flex: 1; min-height: 0; padding: 4px 12px 8px; position: relative; }
    .cbs-chart-wrap canvas { width: 100% !important; height: 100% !important; }
    .cbs-region-label { font-size: 10px; color: #64748b; padding: 4px 12px 0; flex-shrink: 0; }
    .cbs-source-label { font-size: 9px; color: #94a3b8; padding: 2px 12px 4px; flex-shrink: 0; }
    /* CBS tabel in bodempaneel */
    .cbs-bp-table { width: 100%; border-collapse: collapse; font-size: 11px; }
    .cbs-bp-table .cbs-group-row td { background: #fef3c7; padding: 4px 8px; font-weight: 700; font-size: 10px; color: #92400e; }
    .cbs-bp-table td { padding: 3px 8px; border-bottom: 1px solid #f1f5f9; }
    .cbs-bp-table td:nth-child(2) { text-align: right; font-weight: 600; color: #1e293b; }
    .cbs-bp-table td:nth-child(3) { color: #94a3b8; font-size: 10px; }
    .cbs-bp-table tr:hover td { background: #f8fafc; }
    /* Tab 2 selectie — altijd volledige hoogte, eigen wrapper */
    #bp-tab-selectie { overflow: hidden; }
    #bp-sel-wrap { flex: 1; overflow: auto; padding: 0 14px 10px; min-height: 0; }
    #bp-sel-empty { padding: 24px 14px; color: #94a3b8; font-size: 12px; text-align: center; }
    /* Tab 3 grafiek */
    #bp-tab-grafiek { padding: 0; }
    #bp-chart-controls {
      display: flex; align-items: center; gap: 10px; flex-shrink: 0;
      padding: 7px 14px; border-bottom: 1px solid #e2e8f0; background: #f8fafc;
      flex-wrap: wrap;
    }
    #bp-chart-controls label { font-size: 11px; color: #374151; cursor: pointer; display: flex; align-items: center; gap: 4px; }
    #bp-chart-controls .bp-cc-title { font-size: 11px; font-weight: 700; color: #475569; margin-right: 4px; }
    #bp-chart-wrap {
      flex: 1; min-height: 0; padding: 10px 14px 8px;
      position: relative; overflow: hidden;
    }
    #bp-chart-wrap canvas { width: 100% !important; height: 100% !important; }
    #bp-chart-empty { padding: 24px 14px; color: #94a3b8; font-size: 12px; text-align: center; }

    .expand-table-btn {
      display: inline-flex; align-items: center; gap: 6px;
      background: linear-gradient(135deg, #0d9488, #0ea5e9);
      color: #fff; border: none; padding: 6px 12px; border-radius: 6px;
      font-size: 12px; font-weight: 600; cursor: pointer; margin: 6px 0;
      box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    }
    .expand-table-btn:hover { filter: brightness(1.08); }

    /* -- Perceel detail panel (right side, over map) -- */
    #parcel-panel {
      position: absolute;
      top: 0; right: 0; bottom: 0;
      width: 420px;
      background: #ffffff;
      display: none;
      flex-direction: column;
      box-shadow: -4px 0 16px rgba(0,0,0,0.12);
      z-index: 1100;
      border-left: 1px solid #e2e8f0;
    }
    #parcel-panel.open { display: flex; }

    /* -- Groeivergelijker detailpaneel -- */
    #gv-parcel-panel {
      position: absolute;
      top: 0; right: 0; bottom: 0;
      width: 420px;
      background: #ffffff;
      display: none;
      flex-direction: column;
      box-shadow: -4px 0 16px rgba(0,0,0,0.12);
      z-index: 1100;
      border-left: 1px solid #e2e8f0;
    }
    #gv-parcel-panel.open { display: flex; }
    #gv-parcel-panel.open ~ #map-drag-handle,
    #gv-parcel-panel.open ~ #bottom-panel { margin-right: 420px; }
    #gv-pp-header {
      background: linear-gradient(135deg, #0d6efd, #3b82f6);
      color: white;
      padding: 10px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-shrink: 0;
    }
    #gv-pp-body {
      flex: 1;
      overflow-y: auto;
      padding: 0;
    }
    #gv-pp-body::-webkit-scrollbar { width: 5px; }
    #gv-pp-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
    .gv-section {
      padding: 10px 12px;
      border-bottom: 1px solid #f1f5f9;
    }
    .gv-section:last-child { border-bottom: none; }
    .gv-section-title {
      font-size: 11px;
      font-weight: 700;
      color: #334155;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 5px;
    }
    .gv-section-title i { color: #0d6efd; font-size: 10px; }
    #pp-header {
      background: linear-gradient(135deg, #059669, #10b981);
      color: white;
      padding: 10px 14px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    #pp-header-title { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; }
    #pp-close {
      background: rgba(255,255,255,0.15);
      border: none; color: white;
      width: 26px; height: 26px; border-radius: 4px;
      cursor: pointer; font-size: 16px; line-height: 1;
    }
    #pp-close:hover { background: rgba(255,255,255,0.25); }
    #pp-body {
      flex: 1;
      overflow-y: auto;
      padding: 12px 14px;
    }
    #pp-body::-webkit-scrollbar { width: 5px; }
    #pp-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
    .pp-section {
      margin-bottom: 14px;
      padding-bottom: 10px;
      border-bottom: 1px solid #f1f5f9;
    }
    .pp-section:last-child { border-bottom: none; }
    .pp-section-title {
      font-size: 11px; font-weight: 700; color: #374151;
      margin-bottom: 6px; display: flex; align-items: center; gap: 5px;
    }
    .pp-section-title i { color: #059669; font-size: 10px; }
    .pp-table {
      width: 100%; border-collapse: collapse; font-size: 11px;
    }
    .pp-table th {
      background: #f0fdf4; padding: 4px 6px; text-align: left;
      font-weight: 600; color: #166534; font-size: 10px; border-bottom: 1px solid #e2e8f0;
    }
    .pp-table td {
      padding: 4px 6px; border-bottom: 1px solid #f1f5f9;
    }
    .pp-table tr:hover { background: #f8fafc; }
    .pp-input {
      width: 70px; border: 1px solid #d1d5db; border-radius: 4px;
      padding: 3px 5px; font-size: 11px; text-align: right;
    }
    .pp-input:focus { outline: none; border-color: #059669; box-shadow: 0 0 0 2px rgba(5,150,105,0.15); }
    .pp-gewas-input {
      width: 100%; border: 1px solid #d1d5db; border-radius: 4px;
      padding: 3px 5px; font-size: 11px;
    }
    .pp-gewas-input:focus { outline: none; border-color: #059669; box-shadow: 0 0 0 2px rgba(5,150,105,0.15); }
    .pp-badge {
      display: inline-block; background: #dcfce7; border-radius: 4px;
      padding: 1px 5px; margin: 1px; font-size: 10px; color: #166534;
    }
    .pp-nav { display: flex; gap: 4px; }
    .pp-nav-btn {
      background: rgba(255,255,255,0.2); border: none; color: white;
      width: 26px; height: 26px; border-radius: 4px;
      cursor: pointer; font-size: 12px; line-height: 1;
    }
    .pp-nav-btn:hover { background: rgba(255,255,255,0.35); }
    .pp-nav-btn:disabled { opacity: 0.3; cursor: default; }

    /* -- Gebiedsbouwplan: Perceel detail panel (right side) -- */
    #bp2-parcel-panel {
      position: absolute;
      top: 0; right: 0; bottom: 0;
      width: 440px;
      background: #ffffff;
      display: none;
      flex-direction: column;
      box-shadow: -4px 0 16px rgba(0,0,0,0.12);
      z-index: 1100;
      border-left: 1px solid #e2e8f0;
    }
    #bp2-parcel-panel.open { display: flex; }
    /* Bottom panels: maak ruimte als parcel panel open is */
    #bp2-parcel-panel.open ~ #bp2-bottom-drag,
    #bp2-parcel-panel.open ~ #bp2-bottom-panel { margin-right: 440px; }
    #parcel-panel.open ~ #map-drag-handle,
    #parcel-panel.open ~ #bottom-panel { margin-right: 420px; }
    .bp2-pp-header {
      background: linear-gradient(135deg, #7c3aed, #8b5cf6);
      color: white;
      padding: 10px 14px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .bp2-pp-body {
      overflow-y: auto;
      flex: 1;
      padding: 10px;
    }
    .bp2-crop-grid {
      display: grid;
      grid-template-columns: 38px 1fr 48px 48px 54px;
      gap: 3px 4px;
      align-items: center;
      font-size: 10px;
    }
    .bp2-crop-grid label { font-weight: 600; color: #475569; font-size: 10px; }
    .bp2-crop-grid select { font-size: 10px; padding: 2px 3px; border: 1px solid #cbd5e1; border-radius: 3px; }
    .bp2-crop-grid input[type="number"] { font-size: 9px; padding: 2px 2px; border: 1px solid #cbd5e1; border-radius: 3px; text-align: center; }
    .bp2-crop-grid input[type="number"]::-webkit-inner-spin-button { height: 14px; }
    .bp2-nitrate-preview {
      font-size: 10px; color: #64748b; margin-top: 2px;
      padding: 2px 4px; border-radius: 3px; background: #f1f5f9;
    }
    .bp2-label-icon {
      background: none !important;
      border: none !important;
      box-shadow: none !important;
      width: auto !important;
      height: auto !important;
    }

    /* Gebiedsbouwplan - Samenwerkingsverband indicator */
    .bp2-sv-chip {
      display: inline-block;
      width: 10px; height: 10px;
      border-radius: 50%;
      margin-right: 6px;
      vertical-align: middle;
    }

    /* Instellingen-tab: verberg de kaart, maak sidebar breed */
    body.settings-mode #map-area { display: none !important; }
    body.settings-mode #sidebar { width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
    body.settings-mode #tab-instellingen { max-width: 900px; margin: 0 auto; }

    .sett-cat-row {
      display: flex; align-items: center; gap: 6px;
      padding: 6px 8px; margin-bottom: 4px;
      background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
    }
    .sett-cat-row input[type=text] {
      flex: 1; border: 1px solid #e2e8f0; background: #fff; padding: 4px 6px;
      border-radius: 4px; font-size: 12px;
    }
    .sett-cat-row input[type=color] {
      width: 32px; height: 28px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 4px;
    }
    .sett-cat-row .sett-cat-del {
      background: none; border: none; color: #dc2626; cursor: pointer; padding: 0 6px;
    }
    .sett-cat-row .sett-cat-default-badge {
      font-size: 9px; background: #e0e7ff; color: #4338ca;
      padding: 1px 6px; border-radius: 10px; font-weight: 700;
    }
    .sett-subcat-container {
      margin-left: 20px; margin-top: 4px; margin-bottom: 4px;
      padding-left: 10px; border-left: 2px solid #e2e8f0;
    }
    .sett-subcat-row {
      display: flex; align-items: center; gap: 6px;
      padding: 4px 6px; margin-bottom: 3px;
      background: #fffbeb; border: 1px solid #fde68a; border-radius: 5px; font-size: 11px;
    }
    .sett-subcat-row input[type=text] {
      flex: 1; border: 1px solid #e2e8f0; background: #fff; padding: 3px 5px;
      border-radius: 4px; font-size: 11px;
    }
    .sett-subcat-row input[type=color] {
      width: 26px; height: 24px; padding: 1px; border: 1px solid #cbd5e1; border-radius: 4px;
    }
    .sett-subcat-row .sett-subcat-del {
      background: none; border: none; color: #dc2626; cursor: pointer; padding: 0 4px; font-size: 11px;
    }
    .sett-subcat-add {
      display: flex; align-items: center; gap: 4px; margin-top: 4px;
    }
    .sett-subcat-add input[type=text] {
      flex: 1; border: 1px solid #e2e8f0; padding: 3px 5px; border-radius: 4px; font-size: 11px;
    }
    .sett-subcat-add button {
      border: none; background: #059669; color: #fff; border-radius: 4px;
      padding: 2px 8px; font-size: 11px; cursor: pointer;
    }
    .sett-cat-toggle { cursor: pointer; font-size: 10px; color: #64748b; padding: 0 4px; }
    .sett-ov-row {
      display: grid; grid-template-columns: 60px 1fr 90px 62px 150px 80px 28px;
      align-items: center; gap: 8px;
      padding: 6px 8px; border-bottom: 1px solid #f1f5f9; font-size: 12px;
    }
    .sett-ov-row:hover { background: #fafafa; }
    .sett-ov-row .sett-ov-code { font-family: monospace; color: #64748b; font-weight: 600; }
    .sett-ov-row .sett-ov-name { color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .sett-ov-row select { font-size: 11px; padding: 2px 4px; border-radius: 4px; border: 1px solid #cbd5e1; width: 100%; }
    .sett-ov-row .sett-ov-del { background: none; border: none; color: #dc2626; cursor: pointer; }
    .sett-ov-row .sett-ov-jaren { font-size: 10px; color: #64748b; white-space: nowrap; font-family: monospace; }

    /* -- Section titles -- */
    .section-title {
      font-size: 10.5px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: #64748b;
      border-bottom: 1px solid #e2e8f0;
      padding-bottom: 5px;
      margin: 16px 0 9px;
    }
    .section-title:first-child { margin-top: 4px; }

    details.settings-panel {
      margin: 8px 0;
      border: 1px solid #e2e8f0;
      border-radius: 6px;
      background: #f8fafc;
    }
    details.settings-panel {
      border: 1px solid #e2e8f0;
      border-radius: 6px;
      margin-bottom: 6px;
      overflow: hidden;
    }
    details.settings-panel > summary {
      cursor: pointer;
      padding: 6px 10px;
      font-size: 11px;
      font-weight: 700;
      color: #475569;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      list-style: none;
      user-select: none;
      background: #f1f5f9;
      display: flex;
      align-items: center;
      justify-content: space-between;
      transition: background 0.15s;
    }
    details.settings-panel > summary:hover {
      background: #e2e8f0;
      color: #1e293b;
    }
    details.settings-panel > summary::after {
      content: '▸';
      font-size: 10px;
      color: #94a3b8;
      transition: transform 0.2s;
      flex-shrink: 0;
      margin-left: 6px;
    }
    details.settings-panel[open] > summary::after {
      transform: rotate(90deg);
    }
    details.settings-panel > summary::before { display: none; }
    details.settings-panel > summary::-webkit-details-marker { display: none; }
    details.settings-panel[open] > summary {
      border-bottom: 1px solid #e2e8f0;
    }
    details.settings-panel .settings-body { padding: 8px 10px 10px; }

    /* -- Form controls -- */
    .form-control, .form-select {
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      color: #1e293b;
      font-size: 13px;
      border-radius: 6px;
    }
    .form-control::placeholder { color: #94a3b8; }
    .form-control:focus, .form-select:focus {
      background: #ffffff;
      border-color: #3b82f6;
      color: #1e293b;
      box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
    }
    .form-select option { background: #ffffff; }

    /* -- Buttons -- */
    .btn-load {
      background: #065f46;
      border: none;
      color: white;
      font-size: 13px;
      font-weight: 600;
      border-radius: 6px;
      padding: 8px 14px;
      width: 100%;
      cursor: pointer;
      transition: background 0.2s;
    }
    .btn-load:hover:not(:disabled) { background: #047857; }
    .btn-load:disabled { opacity: 0.5; cursor: not-allowed; }

    .btn-ghost {
      background: #f1f5f9;
      border: 1px solid #e2e8f0;
      color: #475569;
      font-size: 12px;
      border-radius: 6px;
      padding: 6px 12px;
      cursor: pointer;
      transition: all 0.2s;
    }
    .btn-ghost:hover { background: #e2e8f0; color: #1e293b; }

    /* (year-tabs verwijderd — nu dropdowns) */

    /* -- Area analysis result table (categorieën) -- */
    #areaTable::-webkit-scrollbar { width: 5px; }
    #areaTable::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
    .area-cat-row {
      display: flex; align-items: center; gap: 8px;
      padding: 6px 8px 6px 5px; border-bottom: 1px solid #f1f5f9;
      border-left: 3px solid transparent;
      cursor: pointer; transition: background 0.12s, border-left-color 0.12s, opacity 0.12s; font-size: 12px;
      user-select: none;
    }
    .area-cat-row:hover { background: #f0fdf4; }
    .area-cat-row.active {
      background: #dcfce7; border-left-color: #059669;
    }
    .area-cat-row.active:hover { background: #bbf7d0; }
    .area-cat-row.inactive {
      background: #f8fafc; border-left-color: #e2e8f0; opacity: 0.52;
    }
    .area-cat-row.inactive:hover { opacity: 0.75; background: #f1f5f9; }
    .acr-toggle-icon { font-size: 14px; flex-shrink: 0; width: 16px; text-align: center; line-height: 1; transition: color 0.12s; }
    .area-cat-row.active   .acr-toggle-icon { color: #059669; }
    .area-cat-row.inactive .acr-toggle-icon { color: #94a3b8; }
    .area-cat-row .acr-swatch {
      width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0;
    }
    .area-cat-row .acr-name { flex: 1; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .area-cat-row.inactive .acr-name { color: #94a3b8; }
    .area-cat-row .acr-ha { font-size: 11px; color: #475569; white-space: nowrap; }
    .area-cat-row .acr-pct { font-size: 11px; color: #64748b; min-width: 36px; text-align: right; white-space: nowrap; }
    .area-cat-row .acr-trend { font-size: 10px; min-width: 44px; text-align: right; white-space: nowrap; }
    .area-cat-header {
      display: flex; align-items: center; gap: 8px;
      padding: 4px 8px; font-size: 9px; font-weight: 700; color: #64748b;
      text-transform: uppercase; letter-spacing: 0.5px;
      background: #f1f5f9; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 1;
    }
    .area-cat-header .acr-name { flex: 1; }
    .area-cat-header .acr-ha, .area-cat-header .acr-pct, .area-cat-header .acr-trend { font-size: 9px; }

    /* -- Toggle switch -- */
    .form-check-input { cursor: pointer; }
    .form-check-input:checked { background-color: #047857; border-color: #047857; }
    .form-check-label { font-size: 13px; cursor: pointer; }

    /* -- Stats panel -- */
    #stats-panel {
      background: #f1f5f9;
      border: 1px solid #e2e8f0;
      border-radius: 8px;
      padding: 12px;
    }

    .stat-kpi {
      display: flex;
      gap: 8px;
      margin-bottom: 10px;
    }

    .kpi-box {
      flex: 1;
      background: #ffffff;
      border-radius: 6px;
      padding: 8px 10px;
      text-align: center;
    }
    .kpi-value { font-size: 18px; font-weight: 700; color: #059669; line-height: 1.2; }
    .kpi-label { font-size: 10px; color: #64748b; margin-top: 2px; }

    #chart-container { position: relative; height: 180px; cursor: pointer; }

    .stat-row {
      display: flex;
      align-items: center;
      padding: 5px 0;
      border-bottom: 1px solid #e2e8f0;
      font-size: 12px;
      gap: 4px;
    }
    .stat-row:last-child { border-bottom: none; }
    .color-swatch {
      width: 10px;
      height: 10px;
      border-radius: 2px;
      flex-shrink: 0;
    }
    .stat-name { flex: 0 0 var(--stat-name-w, 140px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #334155; }
    .stat-col-resizer {
      width: 6px; align-self: stretch; cursor: col-resize; background: transparent;
      border-left: 1px dashed transparent; flex-shrink: 0;
      transition: background 0.15s, border-color 0.15s;
    }
    .stat-col-resizer:hover, .stat-col-resizer.active { background: #dbeafe; border-left-color: #3b82f6; }
    /* Sorteerbare kolomheaders */
    [data-sort] { cursor: pointer; user-select: none; }
    .stat-header-row [data-sort]:hover { color: #0d9488 !important; }
    #bp-wide-table th[data-sort]:hover, #bp-pinned-table th[data-sort]:hover { color: #0d9488 !important; }
    .sort-arrow { font-size: 9px; margin-left: 2px; opacity: 0.45; vertical-align: middle; }
    .sort-arrow.active { opacity: 1; color: #0d9488; }
    .stat-header-row {
      position: sticky; top: 0; z-index: 3;
      display: flex; align-items: center; gap: 4px;
      padding: 4px 0; background: #e2e8f0;
      font-size: 10px; font-weight: 700; color: #475569;
      text-transform: uppercase; letter-spacing: 0.5px;
      border-bottom: 1px solid #cbd5e1;
    }
    .stat-header-row .color-swatch { background: transparent; }
    .stat-ha { color: #059669; font-weight: 600; min-width: 75px; text-align: right; white-space: nowrap; }
    .stat-cnt { color: #94a3b8; min-width: 44px; text-align: right; white-space: nowrap; }

    /* -- Legend (map control) -- */
    .legend-item {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 11.5px;
      margin-bottom: 3px;
      color: #475569;
    }
    .legend-dot {
      width: 12px;
      height: 12px;
      border-radius: 3px;
      flex-shrink: 0;
    }
    .map-legend-control {
      background: white;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.18);
      font-family: inherit;
      max-width: 220px;
      transition: all 0.2s ease;
    }
    .map-legend-control.collapsed .map-legend-body {
      display: none;
    }
    .map-legend-control .map-legend-header {
      display: flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
      padding: 6px 10px;
      font-size: 11px;
      font-weight: 600;
      color: #334155;
      user-select: none;
    }
    .map-legend-control .map-legend-header i.chevron {
      margin-left: auto;
      font-size: 9px;
      transition: transform 0.2s;
    }
    .map-legend-control.collapsed .map-legend-header i.chevron {
      transform: rotate(-90deg);
    }
    .map-legend-control .map-legend-body {
      padding: 4px 10px 8px;
      border-top: 1px solid #e2e8f0;
    }

    /* -- Alerts / notices -- */
    .notice {
      background: #fffbeb;
      border-left: 3px solid #f59e0b;
      border-radius: 0 5px 5px 0;
      padding: 7px 11px;
      font-size: 11.5px;
      color: #92400e;
      margin-bottom: 8px;
    }

    .info-msg {
      font-size: 12px;
      color: #94a3b8;
      margin-top: 4px;
    }

    /* -- Loading spinner -- */
    .spinner-sm {
      display: inline-block;
      width: 12px;
      height: 12px;
      border: 2px solid #059669;
      border-top-color: transparent;
      border-radius: 50%;
      animation: spin 0.7s linear infinite;
      vertical-align: middle;
      margin-right: 5px;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* -- Leaflet popup light theme -- */
    .leaflet-popup-content-wrapper {
      background: #ffffff !important;
      color: #1e293b !important;
      border: 1px solid #e2e8f0 !important;
      border-radius: 8px !important;
      box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
    }
    .leaflet-popup-tip { background: #ffffff !important; }
    .leaflet-popup-close-button { color: #64748b !important; }

    .popup-prop { margin-bottom: 5px; }
    .popup-label { font-size: 10px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }
    .popup-value { font-size: 13px; color: #1e293b; font-weight: 500; }
    .popup-gewas { font-size: 15px; font-weight: 700; color: #059669; margin-bottom: 10px; }

    /* -- Scrollbar (now on tab panels) -- */

    /* -- Responsive hide sidebar -- */
    /* -- History panel (right side) -- */
    #history-panel {
      width: 425px;
      min-width: 425px;
      background: #ffffff;
      color: #1e293b;
      display: none;
      flex-direction: column;
      box-shadow: -4px 0 16px rgba(0,0,0,0.08);
      z-index: 1000;
      border-left: 1px solid #e2e8f0;
    }
    #history-panel.open { display: flex; }

    #hp-header {
      background: linear-gradient(135deg, #6366f1, #818cf8);
      color: white;
      padding: 12px 14px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    #hp-header-title { font-weight: 700; font-size: 14px; color: white; }
    #hp-close {
      background: rgba(255,255,255,0.15);
      border: none;
      color: white;
      width: 26px;
      height: 26px;
      border-radius: 4px;
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
    }
    #hp-close:hover { background: rgba(255,255,255,0.25); }

    #hp-settings {
      padding: 10px 14px;
      border-bottom: 1px solid #e2e8f0;
      flex-shrink: 0;
    }

    #hp-body {
      flex: 1;
      overflow-y: auto;
      padding: 12px 14px;
    }
    #hp-body::-webkit-scrollbar { width: 5px; }
    #hp-body::-webkit-scrollbar-track { background: #ffffff; }
    #hp-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

    /* -- OBI rechterpaneel -- */
    /* OBI content inside shared bd-right-panel */
    #rp-obi-content { display: none; }
    #rp-obi-content.active { display: block; }
    #rp-bbwp-content { display: none; }
    #rp-bbwp-content.active { display: block; }
    #rp-bgt-content { display: none; }
    #rp-bgt-content.active { display: block; }
    #rp-bln-content { display: none; }
    #rp-bln-content.active { display: block; }
    #rp-bd-content { display: none; }
    #rp-bd-content.active { display: block; }

    #hp-perceel-info {
      background: #f1f5f9;
      border: 1px solid #e2e8f0;
      border-radius: 8px;
      padding: 10px 12px;
      margin-bottom: 12px;
    }
    .hp-info-label { font-size: 10px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }
    .hp-info-value { font-size: 13px; color: #1e293b; margin-bottom: 4px; }

    .hp-progress {
      font-size: 12px;
      color: #94a3b8;
      margin-top: 8px;
    }

    /* Timeline entries */
    .tl-entry {
      display: flex;
      align-items: stretch;
      gap: 10px;
      margin-bottom: 2px;
      position: relative;
    }

    .tl-year {
      width: 40px;
      flex-shrink: 0;
      font-weight: 700;
      font-size: 12px;
      color: #94a3b8;
      padding-top: 8px;
      text-align: right;
    }

    .tl-line {
      width: 20px;
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      position: relative;
    }
    .tl-dot {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      border: 2px solid #e2e8f0;
      flex-shrink: 0;
      margin-top: 9px;
      z-index: 1;
    }
    .tl-connector {
      width: 2px;
      flex: 1;
      background: #e2e8f0;
    }
    .tl-entry:last-child .tl-connector { display: none; }

    .tl-card {
      flex: 1;
      background: #f1f5f9;
      border: 1px solid #e2e8f0;
      border-radius: 6px;
      padding: 7px 10px;
      margin-bottom: 4px;
      transition: border-color 0.2s;
    }
    .tl-card:hover { border-color: #6366f1; }
    .tl-card.no-match {
      background: #f8fafc;
      border-style: dashed;
      opacity: 0.6;
    }

    .tl-gewas { font-size: 13px; font-weight: 600; color: #1e293b; }
    .tl-code { font-size: 11px; color: #64748b; }
    .tl-area { font-size: 11.5px; color: #059669; font-weight: 600; }
    .tl-match-info { font-size: 10px; color: #94a3b8; margin-top: 2px; }

    @media (max-width: 700px) {
      #sidebar { width: 100%; position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 2000; }
    }

    /* -- Map custom controls -- */
    .map-info-box {
      background: rgba(255,255,255,0.95);
      color: #475569;
      padding: 6px 10px;
      border-radius: 6px;
      font-size: 11px;
      border: 1px solid #e2e8f0;
    }
    /* Coördinatenbox: absoluut naast de zoomknoppen (top-left) */
    #coordDisplay {
      position: absolute;
      top: 10px;
      left: 46px;   /* zoom: 10px marge + 26px breed + 10px gap */
      z-index: 1000;
      pointer-events: none;
    }

    .feature-count-badge {
      display: inline-block;
      background: #059669;
      color: white;
      border-radius: 10px;
      padding: 2px 9px;
      font-size: 11.5px;
      font-weight: 600;
      margin-top: 5px;
    }

    .compare-badge {
      display: inline-block;
      background: #6366f1;
      color: white;
      border-radius: 10px;
      padding: 2px 9px;
      font-size: 11.5px;
      font-weight: 600;
      margin-left: 4px;
    }

    .nv24-label {
      background: rgba(255,255,255,0.82) !important;
      border: none !important;
      box-shadow: 0 1px 3px rgba(0,0,0,0.15) !important;
      font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
      font-weight: 600;
      font-size: 10px;
      color: #7a5000 !important;
      padding: 1px 5px !important;
      border-radius: 3px !important;
      pointer-events: none;
      white-space: nowrap;
      backdrop-filter: blur(3px);
      -webkit-backdrop-filter: blur(3px);
    }
    .prov-label, .gemeente-label, .landbouwgroep-label, .landbouwgebied-label, .woonplaats-label {
      background: none !important;
      border: none !important;
      box-shadow: none !important;
      font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
      font-weight: 600;
      font-size: 11px;
      padding: 2px 7px !important;
      border-radius: 4px !important;
      pointer-events: none;
      white-space: nowrap;
      letter-spacing: -0.01em;
      backdrop-filter: blur(3px);
      -webkit-backdrop-filter: blur(3px);
    }
    .prov-label {
      color: #3730a3 !important;
      background: rgba(224,231,255,0.88) !important;
      box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.02em;
    }
    .gemeente-label {
      color: #5b21b6 !important;
      background: rgba(237,233,254,0.85) !important;
      box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
      font-size: 12px;
    }
    .woonplaats-label {
      color: #c2410c !important;
      background: rgba(255,237,213,0.88) !important;
      box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
      font-size: 12px;
    }
    .landbouwgroep-label {
      color: #92400e !important;
      background: rgba(254,243,199,0.88) !important;
      box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
      font-size: 12px;
      font-weight: 700;
    }
    .landbouwgebied-label {
      color: #115e59 !important;
      background: rgba(204,251,241,0.85) !important;
      box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
      font-size: 12px;
    }

    /* Border percentage labels */
    .border-pct-label {
      background: transparent !important;
      border: none !important;
      box-shadow: none !important;
    }
    .border-pct-label span {
      background: rgba(239, 68, 68, 0.9);
      color: white;
      font-size: 15px;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 4px;
      white-space: nowrap;
      text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    }

    /* Perceel labels */
    .perceel-label {
      background: transparent !important;
      border: none !important;
      box-shadow: none !important;
      white-space: nowrap;
    }
    .gwh-count-label {
      background: transparent !important;
      border: none !important;
      box-shadow: none !important;
    }
    .gwh-count-label > span:not(.gwh-count-badge) {
      display: inline-block;
      background: rgba(255,255,255,0.88);
      color: #1e293b;
      font-size: 11px;
      font-weight: 600;
      line-height: 1.35;
      text-align: center;
      white-space: nowrap;
      padding: 2px 6px;
      border-radius: 4px;
      box-shadow: 0 1px 4px rgba(0,0,0,0.15), 0 0 0 0.5px rgba(0,0,0,0.06);
      text-shadow: none;
      transform: translate(-50%, -110%);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    }
    .gwh-count-label b { color: #6d28d9; }
    .gwh-count-badge {
      display: inline-block;
      background: #7c3aed !important;
      color: #fff !important;
      font-size: 16px;
      font-weight: 900;
      padding: 4px 11px;
      border-radius: 12px;
      margin-top: 3px;
      border: 2px solid #fff;
      box-shadow: 0 2px 6px rgba(0,0,0,0.5);
      text-shadow: 0 1px 2px rgba(0,0,0,0.3);
      letter-spacing: 0.5px;
      line-height: 1.2;
    }
    .perceel-label span {
      display: inline-block;
      background: rgba(255,255,255,0.88);
      color: #1e293b;
      font-size: var(--label-size, 11px);
      line-height: 1.4;
      padding: 3px 7px;
      border-radius: 5px;
      border: none;
      box-shadow: 0 1px 4px rgba(0,0,0,0.15), 0 0 0 0.5px rgba(0,0,0,0.06);
      text-align: center;
      pointer-events: none;
      text-shadow: none;
      max-width: 170px;
      white-space: normal;
      font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
      font-weight: 500;
      letter-spacing: -0.01em;
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
    }
    .perceel-label span b {
      color: #047857;
      font-weight: 700;
      font-size: var(--label-size, 11px);
      letter-spacing: 0;
    }

    /* Natura 2000 naam labels */
    .pie-chart-marker {
      background: none !important;
      border: none !important;
      box-shadow: none !important;
    }
    .n2k-name-label {
      background: none !important;
      border: none !important;
      box-shadow: none !important;
    }
    .n2k-name-label span {
      display: inline-block;
      font-size: 12px;
      font-weight: 600;
      color: #14532d;
      background: rgba(220,252,231,0.85);
      padding: 2px 6px;
      border-radius: 4px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.12);
      white-space: nowrap;
      pointer-events: none;
      font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
      letter-spacing: -0.01em;
      backdrop-filter: blur(3px);
      -webkit-backdrop-filter: blur(3px);
    }
    .n2k-name-label.n2k-vr span { color: #1e3a5f; background: rgba(219,234,254,0.88); }
    .n2k-name-label.n2k-vrhr span { color: #4c1d95; background: rgba(237,233,254,0.88); }
    .n2k-name-label .n2k-type-badge {
      font-size: 8px; font-weight: 700; opacity: 0.7; margin-left: 3px;
    }

    /* Waterschap naam labels */
    .waterschap-name-label {
      background: none !important;
      border: none !important;
      box-shadow: none !important;
    }
    .waterschap-name-label span {
      display: inline-block;
      font-size: 12px;
      font-weight: 600;
      color: #1e3a5f;
      background: rgba(219,234,254,0.85);
      padding: 2px 6px;
      border-radius: 4px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.12);
      white-space: nowrap;
      pointer-events: none;
      text-transform: capitalize;
      letter-spacing: 0.3px;
      font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
      backdrop-filter: blur(3px);
      -webkit-backdrop-filter: blur(3px);
    }

    /* -- Risicogewassen prioriteringspaneel -- */
    #riskPanel {
      display: none;
      position: fixed; top: 40px; left: 50%; transform: translateX(-50%);
      width: min(1100px, 96vw); height: min(85vh, 800px);
      background: #fff; border-radius: 10px;
      box-shadow: 0 20px 60px rgba(0,0,0,0.35);
      z-index: 9999; flex-direction: column; overflow: hidden;
      border: 1px solid #cbd5e1;
    }
    #riskPanel .rp-header {
      background: linear-gradient(90deg,#dc2626,#b91c1c);
      color: #fff; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
    }
    #riskPanel .rp-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
    #riskPanel .rp-close {
      background: rgba(255,255,255,0.2); color: #fff; border: none;
      width: 28px; height: 28px; border-radius: 4px; cursor: pointer; font-size: 16px;
    }
    #riskPanel .rp-close:hover { background: rgba(255,255,255,0.35); }
    #riskPanel .rp-body { display: flex; flex: 1; overflow: hidden; }
    #riskPanel .rp-controls {
      width: 280px; min-width: 280px; padding: 12px; background: #f8fafc;
      border-right: 1px solid #e2e8f0; overflow-y: auto;
    }
    #riskPanel .rp-controls label { font-size: 11px; font-weight: 600; color: #475569; display: block; margin: 8px 0 3px; }
    #riskPanel .rp-controls select, #riskPanel .rp-controls input { width: 100%; font-size: 12px; padding: 4px 6px; border: 1px solid #cbd5e1; border-radius: 4px; }
    #riskPanel #riskGewassen { height: 180px; }
    #riskPanel .rp-tiles-wrap { flex: 1; padding: 12px; overflow-y: auto; background: #f1f5f9; }
    #riskPanel .rp-progress { font-size: 12px; color: #475569; margin-bottom: 8px; min-height: 16px; }
    #riskPanel .risk-tile {
      background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; padding: 10px;
      margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    #riskPanel .risk-tile-title { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 6px; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px; }
    #riskPanel .risk-tile-summary { display: flex; gap: 14px; font-size: 11px; color: #475569; margin-bottom: 6px; flex-wrap: wrap; }
    #riskPanel .risk-tile-summary b { color: #dc2626; }
    #riskPanel .risk-tile-table { width: 100%; font-size: 11px; border-collapse: collapse; }
    #riskPanel .risk-tile-table th { background: #f8fafc; text-align: left; padding: 3px 6px; color: #475569; font-weight: 600; border-bottom: 1px solid #e2e8f0; }
    #riskPanel .risk-tile-table td { padding: 2px 6px; border-bottom: 1px solid #f1f5f9; }
    #riskPanel .risk-tile-table td:nth-child(2), #riskPanel .risk-tile-table td:nth-child(3), #riskPanel .risk-tile-table td:nth-child(4) { text-align: right; font-variant-numeric: tabular-nums; }
    #riskPanel .rp-tiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
    #riskPanel .rp-run-btn {
      width: 100%; background: #dc2626; color: #fff; border: none; padding: 8px; border-radius: 4px;
      font-weight: 700; cursor: pointer; margin-top: 12px; font-size: 13px;
    }
    #riskPanel .rp-run-btn:hover { background: #b91c1c; }

    /* -- Afstromingslijnen tab -- */
    .afst-badge { font-size:10px; padding:2px 7px; border-radius:10px; font-weight:600; }
    .afst-badge-hoog   { background:#fee2e2; color:#dc2626; }
    .afst-badge-midden { background:#ffedd5; color:#c2410c; }
    .afst-badge-laag   { background:#dcfce7; color:#15803d; }
    .afst-arrow-marker { font-size:15px; line-height:1; color:#0284c7; text-shadow:0 0 3px rgba(255,255,255,0.8); }
    #riskPanel input[type=range] {
      -webkit-appearance: none; appearance: none; background: transparent; height: 24px; pointer-events: auto;
    }
    #riskPanel input[type=range]::-webkit-slider-thumb {
      -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
      background: #dc2626; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); cursor: pointer; pointer-events: auto;
    }
    #riskPanel input[type=range]::-moz-range-thumb {
      width: 14px; height: 14px; border-radius: 50%; background: #dc2626; border: 2px solid #fff; cursor: pointer;
    }
    #riskPanel input[type=range]::-webkit-slider-runnable-track { height: 3px; background: #fecaca; border-radius: 2px; }
    #riskPanel .risk-tile-chart { margin-top: 6px; }
    #riskPanel .risk-tile-chart-header {
      display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 11px; color: #475569;
    }
    #riskPanel .risk-tile-chart-header select {
      flex: 1; font-size: 11px; padding: 2px 4px; border: 1px solid #cbd5e1; border-radius: 3px;
    }
    #riskPanel .risk-tile-chart svg { display: block; width: 100%; height: 80px; }
    #riskPanel .risk-tile-chart svg .bar { fill: #dc2626; }
    #riskPanel .risk-tile-chart svg .bar:hover { fill: #b91c1c; }
    #riskPanel .risk-tile-chart svg .axis { stroke: #cbd5e1; stroke-width: 1; }
    #riskPanel .risk-tile-chart svg text { font-size: 9px; fill: #64748b; }
    #riskPanel .risk-tile-chart svg .bar-label { fill: #1e293b; font-weight: 600; }

    /* Grondwaterbeschermingsgebied naam labels */
    .grondwater-name-label {
      background: none !important;
      border: none !important;
      box-shadow: none !important;
      display: flex !important;
      flex-direction: column !important;
      align-items: flex-start !important;
    }
    .grondwater-name-label .gw-label-name {
      display: block;
      font-size: 15px;
      font-weight: 700;
      color: #164e63;
      background: rgba(207,250,254,0.9);
      padding: 2px 6px 1px;
      border-radius: 4px 4px 0 0;
      white-space: nowrap;
      pointer-events: none;
      font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
      letter-spacing: -0.01em;
      backdrop-filter: blur(3px);
      -webkit-backdrop-filter: blur(3px);
      box-shadow: 0 -1px 3px rgba(0,0,0,0.08);
    }
    .grondwater-name-label .gw-label-sub {
      display: block;
      font-size: 12px;
      font-weight: 400;
      color: #475569;
      background: rgba(207,250,254,0.75);
      padding: 1px 6px 2px;
      border-radius: 0 0 4px 4px;
      white-space: nowrap;
      pointer-events: none;
      font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
      backdrop-filter: blur(3px);
      -webkit-backdrop-filter: blur(3px);
      box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }
    .grondwater-name-label .gw-label-name:only-child {
      border-radius: 4px;
      padding: 2px 6px;
      box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    }
    .gw-label-type {
      display: inline-block;
      font-size: 10px;
      font-weight: 500;
      color: #475569;
      background: rgba(226,232,240,0.80);
      padding: 1px 5px;
      border-radius: 4px;
      white-space: nowrap;
      pointer-events: none;
      font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
      letter-spacing: 0.01em;
      backdrop-filter: blur(3px);
      -webkit-backdrop-filter: blur(3px);
      box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    }

    /* Dual range slider for year selection */
    #yearRangeContainer input[type=range] {
      -webkit-appearance: none;
      appearance: none;
      background: transparent;
      height: 28px;
      margin: 0;
    }
    #yearRangeContainer input[type=range]::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 16px; height: 16px;
      border-radius: 50%;
      background: #0d6efd;
      border: none;
      box-shadow: 0 1px 4px rgba(0,0,0,0.3);
      cursor: pointer;
      pointer-events: auto;
      position: relative;
      z-index: 2;
    }
    #yearRangeContainer input[type=range]::-moz-range-thumb {
      width: 16px; height: 16px;
      border-radius: 50%;
      background: #0d6efd;
      border: none;
      box-shadow: 0 1px 4px rgba(0,0,0,0.3);
      cursor: pointer;
      pointer-events: auto;
    }
    #yearRangeContainer input[type=range]::-webkit-slider-runnable-track {
      height: 4px;
      background: #e2e8f0;
      border-radius: 2px;
    }
    #yearRangeContainer input[type=range]::-moz-range-track {
      height: 4px;
      background: #e2e8f0;
      border-radius: 2px;
    }

    /* Dual range slider for area year selection (blue variant) */
    #areaYearRangeContainer input[type=range] {
      -webkit-appearance: none; appearance: none;
      background: transparent; height: 28px; margin: 0;
    }
    #areaYearRangeContainer input[type=range]::-webkit-slider-thumb {
      -webkit-appearance: none; appearance: none;
      width: 16px; height: 16px; border-radius: 50%;
      background: #0d6efd; border: none;
      box-shadow: 0 1px 4px rgba(0,0,0,0.3);
      cursor: pointer; pointer-events: auto; position: relative; z-index: 2;
    }
    #areaYearRangeContainer input[type=range]::-moz-range-thumb {
      width: 16px; height: 16px; border-radius: 50%;
      background: #0d6efd; border: none;
      box-shadow: 0 1px 4px rgba(0,0,0,0.3);
      cursor: pointer; pointer-events: auto;
    }
    #areaYearRangeContainer input[type=range]::-webkit-slider-runnable-track {
      height: 4px; background: #e2e8f0; border-radius: 2px;
    }
    #areaYearRangeContainer input[type=range]::-moz-range-track {
      height: 4px; background: #e2e8f0; border-radius: 2px;
    }

    /* Hover tooltip bij cursor */
    .perceel-hover-tooltip {
      background: rgba(30,41,59,0.90);
      color: #f8fafc;
      font-size: 12px;
      line-height: 1.4;
      padding: 5px 9px;
      border-radius: 5px;
      border: none;
      box-shadow: 0 2px 8px rgba(0,0,0,0.25);
      white-space: nowrap;
      pointer-events: none;
      font-family: 'Segoe UI', Tahoma, sans-serif;
    }
    .perceel-hover-tooltip b {
      color: #34d399;
      font-weight: 700;
    }

  /* -- Mobile elementen verborgen op desktop -- */
  #mobile-sheet-handle { display: none; }
  #mobile-tab-strip    { display: none; }
  #mobile-panel-fab    { display: none; }

  /* ===============================================================
     MOBIELE LAYOUT — bottom sheet  (≤ 768px)
     =============================================================== */
  @media (max-width: 768px) {

    /* -- Top bar: compact, verberg tab-rijen -- */
    #top-bar { padding: 6px 12px; min-height: 46px; }
    #top-bar-tabs { display: none !important; }
    #top-bar-title .title-sub { display: none; }
    #top-bar-title { font-size: 13px; }
    #about-btn { font-size: 12px; padding: 3px 10px; }

    /* -- Main content: relatief positionerings-anker -- */
    #main-content { position: relative; flex: 1; overflow: hidden; }

    /* -- Map area: vult het hele scherm -- */
    #map-area {
      position: absolute !important;
      inset: 0;
      width: 100% !important;
      z-index: 1;
    }

    /* -- Sidebar → bottom sheet -- */
    #sidebar-resize-handle { display: none !important; }
    #sidebar {
      position: fixed !important;
      bottom: 0;
      left: 0;
      right: 0;
      top: auto !important;
      width: 100% !important;
      min-width: 0 !important;
      max-width: 100% !important;
      height: 88vh;
      border-radius: 16px 16px 0 0;
      box-shadow: 0 -4px 32px rgba(0,0,0,0.20);
      /* iOS home indicator: peek-balk boven de home indicator uitsteken */
      transform: translateY(calc(100% - 56px - env(safe-area-inset-bottom, 0px)));
      transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
      z-index: 2000;
      will-change: transform;
    }

    /* Sheet-staten (gezet via body-klasse door JS) */
    body.sheet-half #sidebar  { transform: translateY(45%); }
    body.sheet-full #sidebar  { transform: translateY(0);   }

    /* -- Mobiele handle bovenaan de sheet -- */
    #mobile-sheet-handle {
      display: flex !important;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      padding: 8px 16px 6px;
      cursor: pointer;
      flex-shrink: 0;
      background: #ffffff;
      border-radius: 16px 16px 0 0;
      user-select: none;
      -webkit-user-select: none;
    }
    #mobile-handle-bar {
      width: 36px;
      height: 4px;
      background: #cbd5e1;
      border-radius: 2px;
    }
    #mobile-sheet-header-row {
      display: flex;
      align-items: center;
      width: 100%;
      justify-content: space-between;
      margin-top: 2px;
    }
    #mobile-active-tab-name {
      font-size: 13px;
      font-weight: 700;
      color: #1e293b;
    }
    #mobile-sheet-close-btn {
      background: #f1f5f9;
      border: none;
      border-radius: 50%;
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: #64748b;
      font-size: 13px;
      line-height: 1;
      flex-shrink: 0;
    }

    /* -- Mobiele tab-strip (scrollbaar) -- */
    #mobile-tab-strip {
      display: flex !important;
      flex-direction: row;
      overflow-x: auto;
      gap: 6px;
      padding: 6px 12px 8px;
      background: #ffffff;
      border-bottom: 1px solid #e2e8f0;
      flex-shrink: 0;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    #mobile-tab-strip::-webkit-scrollbar { display: none; }

    .mobile-tab-btn {
      background: #f1f5f9;
      border: 1px solid #e2e8f0;
      color: #475569;
      font-size: 12px;
      font-weight: 600;
      padding: 6px 13px;
      border-radius: 20px;
      cursor: pointer;
      white-space: nowrap;
      transition: background 0.15s, color 0.15s;
      flex-shrink: 0;
    }
    .mobile-tab-btn.active {
      background: #059669;
      color: #ffffff;
      border-color: #059669;
    }

    /* -- Floating action button (kaart ↔ paneel) -- */
    #mobile-panel-fab {
      display: flex !important;
      position: absolute;
      /* iOS home indicator: FAB boven de home indicator plaatsen */
      bottom: max(72px, calc(56px + env(safe-area-inset-bottom, 0px)));
      right: max(16px, env(safe-area-inset-right, 16px));
      z-index: 1999;
      width: 52px;
      height: 52px;
      background: #059669;
      color: #ffffff;
      border: none;
      border-radius: 50%;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      box-shadow: 0 4px 16px rgba(0,0,0,0.28);
      cursor: pointer;
      transition: transform 0.18s, background 0.18s;
    }
    #mobile-panel-fab:active { transform: scale(0.90); background: #047857; }

    /* -- Sidebar-body & tab panels -- */
    #sidebar-body { overflow: hidden; }
    /* iOS home indicator: extra ruimte onder scrollinhoud in sheet-half / sheet-full */
    .tab-panel { padding-bottom: max(24px, calc(16px + env(safe-area-inset-bottom, 0px))); }

    /* -- Perceel-paneel & bp2-paneel: bottom sheet op mobiel -- */

    /* Backdrop: donkere laag achter het paneel, tikken sluit het paneel */
    #parcel-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.45);
      z-index: 2999;
      transition: opacity 0.25s;
    }
    #parcel-backdrop.visible { display: block; }

    /* Alle drie panelen altijd als flex renderen; transform stuurt zichtbaarheid */
    #parcel-panel,
    #bp2-parcel-panel,
    #history-panel {
      display: flex !important;
      position: fixed !important;
      top: auto !important;
      bottom: 0 !important;
      left: 0 !important;
      right: 0 !important;
      width: 100% !important;
      min-width: 0 !important;
      max-width: 100vw !important;
      height: 92vh !important;
      max-height: 92vh !important;
      border-left: none !important;
      border-radius: 16px 16px 0 0 !important;
      box-shadow: 0 -4px 32px rgba(0,0,0,0.22) !important;
      z-index: 3000 !important;
      transform: translateY(100%);
      transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
      will-change: transform;
    }

    /* Open-staat: schuif omhoog */
    #parcel-panel.open,
    #bp2-parcel-panel.open,
    #history-panel.open {
      transform: translateY(0);
    }

    /* Handle-balk bovenaan (wit pilletje in de gekleurde header) */
    #parcel-panel::before,
    #bp2-parcel-panel::before,
    #history-panel::before {
      content: '';
      position: absolute;
      top: 8px;
      left: 50%;
      transform: translateX(-50%);
      width: 36px;
      height: 4px;
      background: rgba(255,255,255,0.5);
      border-radius: 2px;
      z-index: 1;
      pointer-events: none;
    }

    /* Header: ruimte voor handle-balk + grotere sluitknop */
    #pp-header,
    .bp2-pp-header,
    #hp-header {
      padding-top: 20px !important;
      border-radius: 16px 16px 0 0 !important;
      flex-shrink: 0;
    }

    /* Sluitknop fors groter op mobiel */
    #pp-close,
    #bp2PpClose,
    #hp-close {
      width: 44px !important;
      height: 44px !important;
      font-size: 22px !important;
      border-radius: 8px !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      background: rgba(255,255,255,0.22) !important;
      flex-shrink: 0;
    }

    /* Body: touch-scroll inschakelen, geen horizontale overflow */
    #pp-body,
    .bp2-pp-body,
    #hp-body,
    #hp-settings {
      -webkit-overflow-scrolling: touch;
      overflow-x: hidden !important;
      /* iOS home indicator: scrollinhoud niet achter home indicator laten verdwijnen */
      padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }

    /* Centroïde-coördinaten: laat tekst op meerdere regels breken */
    #hp-centroid {
      overflow-wrap: break-word;
      word-break: break-all;
    }

    /* Settings rijen: wrap en overflow-safe op smal scherm */
    #hp-settings > div[style*="display:flex"] {
      flex-wrap: wrap !important;
    }
    #hp-settings > div[style*="display:flex"] > div {
      min-width: 0;
      flex-shrink: 1;
    }
    /* Timeline en perceel-info niet afkappen */
    #hp-body,
    #hp-settings { overflow-x: hidden !important; }
    #hp-timeline,
    #hp-perceel-info { max-width: 100%; overflow-x: hidden; }

    /* FAB verbergen als perceel-paneel open is */
    body.parcel-panel-open #mobile-panel-fab { display: none !important; }

    /* Hoofd bottom-sheet dimmen als perceel-paneel open is */
    body.parcel-panel-open #sidebar { opacity: 0.35; pointer-events: none; }

    /* -- Onderste panelen: hoogte beperken -- */
    #bottom-panel, #bp2-bottom-panel { max-height: 32vh; }

    /* -- Drag handles verbergen op mobiel -- */
    #map-drag-handle, #bp2-bottom-drag { display: none !important; }

    /* -- Status bar verbergen (ruimtebesparing) -- */
    #status-bar { display: none; }

    /* -- Grotere touch-targets -- */
    .leaflet-control a {
      width: 36px !important;
      height: 36px !important;
      line-height: 36px !important;
      font-size: 16px !important;
    }

    /* -- Instellingen-modus: full-screen sidebar -- */
    body.settings-mode #sidebar {
      transform: translateY(0) !important;
    }
    body.settings-mode #mobile-panel-fab { display: none !important; }
/* ========================================================
   LABELS — filter chips en label-kaarten
=========================================================== */
.caf-chip {
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.caf-chip:hover {
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  opacity: .9;
}
.caf-chip.caf-active {
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
  font-weight: 700;
}

/* Label-kaart in instellingen */
.label-card {
  transition: box-shadow .15s;
}
.label-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.lbl-assign-chip {
  user-select: none;
}
.lbl-gewas-opt:first-child { border-radius: 6px 6px 0 0; }
.lbl-gewas-opt:last-child  { border-radius: 0 0 6px 6px; border-bottom: none !important; }

/* Mobiel: chips wat groter voor touch */
@media (max-width: 600px) {
  .caf-chip {
    font-size: 11px !important;
    padding: 4px 10px !important;
  }
  .lbl-assign-chip {
    font-size: 11px !important;
  }
}

.sett-ov-labels {
  min-width: 60px;
}
.sett-ov-lbl-dropdown label:hover {
  background: #f0f9ff;
  border-radius: 4px;
}