
        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: var(--font);
            background: var(--map-water);
            color: var(--text);
            overflow: hidden;
        }

        /* ── Map ─────────────────────────────────────────────── */
        #map { width: 100vw; height: 100vh; background: var(--map-water); }

        /* ── Sidebar shell ───────────────────────────────────── */
        #sidebar {
            position: fixed;
            top: 0; left: 0;
            height: 100vh;
            width: 300px;
            z-index: 1001;
            transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        }

        #sidebar.collapsed { transform: translateX(-300px); }

        /* ── Sidebar inner (the visible panel) ───────────────── */
        #sidebar-inner {
            position: absolute;
            top: 0; left: 0;
            width: 300px; height: 100%;
            background: var(--panel-bg);
            border-right: 1px solid var(--panel-border);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        /* ── Header ──────────────────────────────────────────── */
        #sidebar-header {
            padding: 22px 22px 16px;
            border-bottom: 1px solid var(--panel-border);
            flex-shrink: 0;
        }

        .project-title {
            font-family: var(--font);
            font-size: 20px;
            font-weight: 700;
            color: var(--text-strong);
            line-height: 1.25;
            margin-bottom: 10px;
        }

        .status-row {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 10px;
            color: var(--text-muted);
            letter-spacing: 0.3px;
        }

        .status-dot {
            width: 5px; height: 5px;
            border-radius: 50%;
            background: var(--accent);
            flex-shrink: 0;
            animation: blink 2.4s ease-in-out infinite;
        }

        @keyframes blink {
            0%, 100% { opacity: 1; box-shadow: 0 0 5px var(--accent); }
            50%       { opacity: 0.35; box-shadow: none; }
        }

        /* ── Tab nav ─────────────────────────────────────────── */
        #tab-nav {
            display: flex;
            border-bottom: 1px solid var(--panel-border);
            flex-shrink: 0;
        }

        .tab-btn {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            padding: 11px 6px 9px;
            background: transparent;
            border: none;
            border-bottom: 2px solid transparent;
            margin-bottom: -1px;
            cursor: pointer;
            color: var(--text-muted);
            font-family: var(--font);
            font-size: 8.5px;
            font-weight: 600;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            transition: color 0.15s;
        }

        .tab-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
        .tab-btn:hover { color: var(--text-strong); }

        .tab-btn.active {
            color: var(--accent);
            border-bottom-color: var(--accent);
        }

        /* ── Tab content ─────────────────────────────────────── */
        #tab-content {
            flex: 1;
            overflow-y: auto;
            padding: 4px 0 24px;
        }

        #tab-content::-webkit-scrollbar { width: 4px; }
        #tab-content::-webkit-scrollbar-track { background: transparent; }
        #tab-content::-webkit-scrollbar-thumb {
            background: var(--accent-soft);
            border-radius: 2px;
        }

        /* ── Sidebar footer (link to the About / data-sources page) ─ */
        #sidebar-footer {
            flex-shrink: 0;
            padding: 10px 20px 12px;
            border-top: 1px solid var(--panel-border);
        }
        #sidebar-footer a {
            font-size: 10px;
            font-weight: 600;
            letter-spacing: 0.5px;
            color: var(--accent);
            text-decoration: none;
        }
        #sidebar-footer a:hover { text-decoration: underline; }

        .tab-panel { display: none; padding: 14px 20px 0; }
        .tab-panel.active { display: block; }

        /* ── Layer group headers ─────────────────────────────── */
        .group-header {
            display: flex;
            align-items: center;
            gap: 7px;
            font-size: 8px;
            font-weight: 600;
            letter-spacing: 2px;
            text-transform: uppercase;
            padding: 14px 0 6px;
            border-bottom: 1px solid var(--panel-border);
            margin-bottom: 2px;
        }

        .group-header::before {
            content: '';
            width: 5px; height: 5px;
            border-radius: 50%;
            background: currentColor;
            flex-shrink: 0;
        }

        .group-base      { color: var(--grp-base); }
        .group-exclusion { color: var(--grp-exclusion); }
        .group-condition { color: var(--grp-condition); }
        .group-ownership { color: var(--grp-ownership); }
        .group-equity    { color: var(--grp-equity); }
        .group-sites     { color: var(--lyr-waterbody); }

        /* ── Layer rows ──────────────────────────────────────── */
        .layer-row {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 5px 0;
            cursor: pointer;
            user-select: none;
        }

        .layer-row.disabled {
            opacity: 0.4;
            cursor: default;
            pointer-events: none;
        }

        .layer-row:not(.disabled):hover .cb-name { color: var(--text-strong); }

        .layer-row input[type="checkbox"] {
            position: absolute; opacity: 0; width: 0; height: 0;
        }

        .cb-box {
            width: 13px; height: 13px;
            border: 1.5px solid var(--cb-border);
            border-radius: 3px;
            flex-shrink: 0;
            position: relative;
            transition: border-color 0.15s, background 0.15s;
        }

        .layer-row input:checked + .cb-box {
            border-color: var(--accent);
            background: var(--accent-soft);
        }

        .layer-row input:checked + .cb-box::after {
            content: '';
            position: absolute;
            left: 3px; top: 0;
            width: 5px; height: 8px;
            border: 1.5px solid var(--accent);
            border-left: none; border-top: none;
            transform: rotate(45deg);
        }

        .swatch {
            width: 16px; height: 2.5px;
            border-radius: 2px;
            background: var(--c, var(--accent));
            opacity: var(--o, 1);
            flex-shrink: 0;
        }

        /* glow retained as a class hook but neutral on the light theme */
        .swatch.glow { box-shadow: none; }

        .cb-name {
            font-size: 11px;
            color: var(--text-muted);
            font-weight: 400;
            flex: 1;
            transition: color 0.12s;
        }

        .badge {
            font-size: 7.5px;
            font-weight: 600;
            letter-spacing: 0.5px;
            text-transform: uppercase;
            color: var(--text-faint);
            flex-shrink: 0;
        }

        /* ── Legend tab ──────────────────────────────────────── */
        .legend-group { margin-bottom: 20px; }

        .legend-group-title {
            font-size: 8px;
            font-weight: 600;
            letter-spacing: 2px;
            text-transform: uppercase;
            padding: 14px 0 8px;
            border-bottom: 1px solid var(--panel-border);
            margin-bottom: 10px;
            color: var(--accent);
        }

        .legend-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 5px 0;
        }

        .legend-sym {
            flex-shrink: 0;
            width: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .legend-line {
            width: 28px; height: 0;
            border-top: 2px solid var(--c);
        }

        /* glow retained as a class hook but neutral on the light theme */
        .legend-line.glow { filter: none; }

        .legend-fill {
            width: 20px; height: 12px;
            border-radius: 2px;
            background: var(--c);
            opacity: var(--o, 0.8);
            border: 1px solid var(--c);
        }

        .legend-dot {
            width: 8px; height: 8px;
            border-radius: 50%;
            background: var(--c);
        }

        .legend-label {
            font-size: 11px;
            color: var(--text-muted);
            font-weight: 400;
            flex: 1;
        }

        .legend-note {
            font-size: 10px;
            color: var(--text-faint);
            font-style: italic;
            padding: 4px 0 0;
        }

        /* ── About tab ───────────────────────────────────────── */
        .about-section { margin-bottom: 20px; }

        .about-heading {
            font-size: 8px;
            font-weight: 600;
            letter-spacing: 2px;
            text-transform: uppercase;
            color: var(--accent);
            padding: 14px 0 8px;
            border-bottom: 1px solid var(--panel-border);
            margin-bottom: 10px;
        }

        .about-text {
            font-size: 11.5px;
            font-weight: 400;
            color: var(--text);
            line-height: 1.7;
        }

        .about-text + .about-text { margin-top: 10px; }

        .source-item {
            padding: 6px 0;
            border-bottom: 1px solid var(--panel-border-soft);
        }

        .source-name {
            font-size: 10.5px;
            font-weight: 600;
            color: var(--text-strong);
        }

        .source-desc {
            font-size: 10px;
            font-weight: 400;
            color: var(--text-muted);
            margin-top: 1px;
        }

        /* ── Sidebar toggle handle ───────────────────────────── */
        #sidebar-toggle {
            position: absolute;
            left: 300px;
            top: 108px;
            width: 22px;
            height: 60px;
            background: var(--panel-bg);
            border: 1px solid var(--panel-border);
            border-left: none;
            border-radius: 0 8px 8px 0;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--accent);
            transition: background 0.15s;
        }

        #sidebar-toggle:hover { background: var(--panel-bg-alt); }

        /* Chevron drawn in CSS */
        .chevron {
            width: 6px; height: 6px;
            border-left:  2px solid currentColor;
            border-bottom: 2px solid currentColor;
            transform: rotate(45deg) translateX(1px);  /* points left → */
            transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
            flex-shrink: 0;
        }

        #sidebar.collapsed .chevron {
            transform: rotate(-135deg) translateX(1px);  /* points right ← */
        }

