﻿
    /* =========================
           Map container
        ========================== */
    #map {
        height: 72vh;
        min-height: 520px;
        border-radius: 18px;
        overflow: hidden;
        border: 1px solid rgba(0,0,0,.08);
    }

    .map-hero,
    .table-card,
    .explain-card,
    .rank-card {
        border-radius: 18px;
        border: 1px solid rgba(0,0,0,.08);
        background: #fff;
    }
        /* =========================
           Explanation cards
        ========================== */
        .explain-card .icon {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            display: grid;
            place-items: center;
            background: rgba(25,135,84,.10);
            border: 1px solid rgba(25,135,84,.18);
            color: #198754;
            font-size: 1.2rem;
            flex: 0 0 auto;
        }
    /* =========================
           Ranking strip
        ========================== */
    .rank-list {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 6px;
        scroll-snap-type: x mandatory;
    }

    .rank-pill {
        scroll-snap-align: start;
        border: 1px solid rgba(0,0,0,.10);
        border-radius: 14px;
        padding: 10px 12px;
        min-width: 220px;
        background: #fff;
        box-shadow: 0 8px 18px rgba(0,0,0,.06);
        cursor: pointer;
        user-select: none;
    }

        .rank-pill:hover {
            border-color: rgba(25,135,84,.35);
        }

        .rank-pill .name {
            font-weight: 800;
        }

        .rank-pill .sub {
            color: #6c757d;
            font-size: .85rem;
        }

        .rank-pill .pay {
            font-weight: 900;
            color: #198754;
        }
    /* =========================
           Badge + Tooltip
        ========================== */
    .badge-soft {
        background: rgba(25,135,84,.10);
        color: #198754;
        border: 1px solid rgba(25,135,84,.25);
        font-weight: 700;
    }

    .region-tooltip {
        background: rgba(255,255,255,.95);
        border: 1px solid rgba(0,0,0,.10);
        border-radius: 10px;
        box-shadow: 0 8px 18px rgba(0,0,0,.10);
        padding: 6px 10px;
        font-weight: 700;
    }
    /* =========================
           Leaflet legend/key (desktop default)
        ========================== */
    .legend {
        background: rgba(255,255,255,.95);
        border: 1px solid rgba(0,0,0,.10);
        border-radius: 14px;
        box-shadow: 0 10px 25px rgba(0,0,0,.10);
        padding: 10px;
        max-width: 180px;
    }

        .legend .title {
            font-size: 14px;
            margin-bottom: 8px;
            font-weight: 800;
        }

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

        .legend i {
            width: 12px;
            height: 12px;
            border-radius: 4px;
        }

        .legend span {
            font-size: 12px;
            white-space: nowrap;
        }
    /* Collapsible key UI */
    .legend-toggle {
        display: none; /* mobile only */
        width: 100%;
        border: 1px solid rgba(0,0,0,.10);
        background: rgba(255,255,255,.92);
        border-radius: 12px;
        padding: 6px 8px;
        font-weight: 800;
        font-size: 11px;
        text-align: center;
        cursor: pointer;
    }

    .legend-body {
        margin-top: 6px;
    }
    /* Collapsed state hides rows */
    .legend.is-collapsed .legend-body {
        display: none;
    }
    /* =========================
           Remove focus/outline after click
        ========================== */
    .leaflet-container:focus {
        outline: none !important;
    }

    .leaflet-interactive:focus {
        outline: none !important;
    }

    svg path:focus {
        outline: none !important;
    }
    /* =========================
           Hero controls (prevent overflow)
        ========================== */
    .hero-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-end;
        align-items: center;
    }
    /* =========================
           MOBILE (single source of truth)
        ========================== */
    @media (max-width: 768px) {

        #map {
            height: 64vh;
            min-height: 420px;
        }
        /* Key becomes a tiny "Key" chip by default */
        .legend {
            max-width: 78px;
            padding: 6px;
            border-radius: 12px;
            opacity: 0.86;
            box-shadow: 0 6px 14px rgba(0,0,0,.10);
        }

            .legend .title {
                display: none;
            }
        /* remove title on mobile */
        .legend-toggle {
            display: block;
        }
        /* show Key button */
        /* Expanded state */
        .legend.is-expanded {
            max-width: 140px;
            opacity: 0.96;
        }

            .legend.is-expanded .legend-body {
                margin-top: 8px;
            }

        .legend .row {
            margin: 3px 0;
            gap: 6px;
        }

        .legend i {
            width: 9px;
            height: 9px;
            border-radius: 3px;
        }

        .legend span {
            font-size: 10px;
            letter-spacing: -0.1px;
        }
        /* Hero controls stack */
        .hero-controls {
            justify-content: stretch;
        }

            .hero-controls > * {
                width: 100%;
            }

        .hero-switch {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

            .hero-switch label {
                white-space: normal;
                line-height: 1.2;
                flex: 1 1 auto;
            }

            .hero-switch input {
                flex: 0 0 auto;
            }
        /* Ranking strip cards */
        .rank-pill {
            min-width: 190px;
        }
    }
    /* Expanded workforce rows (collapse details) */
    .workforce-row td {
        padding-top: .35rem !important;
        padding-bottom: .65rem !important;
        border-top: 0 !important;
    }

    .workforce-panel {
        background: rgba(25,135,84,.07);
        border: 1px solid rgba(25,135,84,.18);
        border-left: 5px solid rgba(25,135,84,.45);
        border-radius: 12px;
        padding: 10px 12px;
        display: flex;
        flex-wrap: wrap;
        gap: 14px;
        align-items: center;
    }

        .workforce-panel .k {
            color: #6c757d;
            font-size: .85rem;
            font-weight: 700;
        }

        .workforce-panel .v {
            color: #212529;
            font-weight: 900;
        }
    /* Make it tighter on mobile */
    @media (max-width: 768px) {
        .workforce-panel {
            padding: 8px 10px;
            gap: 10px;
        }

            .workforce-panel .k {
                font-size: .8rem;
            }
    }

    .workforce-toggle {
        padding: 4px 10px;
        font-size: 0.8rem;
        border-radius: 999px;
    }

    @media (max-width: 576px) {
        .workforce-toggle {
            font-size: 0.75rem;
            padding: 4px 8px;
        }
    }
    /* Clickable table rows */
    .region-row {
        cursor: pointer;
    }

        .region-row:hover {
            background: rgba(25,135,84,.06);
        }
    /* Quick insights: prevent messy wrap */
    .insights-note {
        white-space: nowrap;
    }

    @media (max-width: 576px) {
        .insights-note {
            white-space: normal; /* allow wrap */
            margin-top: 2px;
        }
    }
    /* Clamp the dynamic value text so long strings don’t wreck the card */
    .insight-value {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .insight-value {
        font-weight: 700;
    }

        .insight-value span {
            color: #6c757d;
            font-weight: 500;
        }

