.fte-map-widget{
            --ink-950: #0c1b31;
            --ink-900: #132844;
            --white: #ffffff;
            --nation-fill: #012C56;
            --nation-hover: #00B857;
            --nation-stroke: transparent;
            --state-fill: #012C56;
            --state-hover: #00B857;
            --state-active: #00B857;
            --state-stroke: rgba(255,255,255,0.36);
            --congress-fill: var(--state-active);
            --congress-hover: #b9dfc8;
            --congress-active: #009245;
            --congress-stroke: rgba(255,255,255,0.58);
            --underlayer-fill: #012C56;
            --underlayer-stroke: rgba(255,255,255,0.36);
            --tab-bg: #B9DFC8;
            --tab-active-bg: #00B857;
            --tab-active-text: #ffffff;
            --tab-text: #36567b;
            --stats-border: #dee7f2;
            --stats-icon-bg: #e7f1e6;
            --stats-icon-ink: #3b9c32;
        }

        .fte-map-widget *{ box-sizing: border-box; }

        .fte-map-widget {
            margin: 0;
            padding: 0;
            min-height: 100%;
            background: #f3fbf7;
            color: var(--ink-950);
            font-family: 'IBM Plex Sans', sans-serif;
        }

        .fte-map-widget .page{
            max-width: 1150px;
            margin: 22px auto;
            padding: 0 14px 20px;
        }

        .fte-map-widget .hero{
            background: linear-gradient(125deg, var(--ink-900) 0%, #183961 48%, #245285 100%);
            color: var(--white);
            border-radius: 18px;
            padding: 22px 24px;
            box-shadow: 0 18px 34px rgba(22, 45, 75, 0.26);
        }

        .fte-map-widget .hero h1{
            margin: 0;
            font-family: 'Sora', sans-serif;
            font-size: clamp(1.32rem, 2.1vw, 1.9rem);
        }

        .fte-map-widget .hero p{
            margin: 10px 0 0;
            font-size: 0.95rem;
            color: rgba(255,255,255,0.9);
            max-width: 760px;
        }

        .fte-map-widget .workspace{ margin-top: 14px; }

        .fte-map-widget .map-card{
            background: var(--white);
            border: 1px solid #dbe6f4;
            border-radius: 16px;
            overflow: hidden;
            box-shadow: 0 12px 24px rgba(24, 45, 74, 0.09);
        }

        .fte-map-widget .tab-bar{
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            border-bottom: 1px solid #dde7f3;
            background: var(--tab-bg);
        }

        .fte-map-widget .tab-btn{
            border: none;
            background: transparent;
            color: var(--tab-text);
            padding: 11px 8px;
            font-family: 'IBM Plex Sans', sans-serif;
            font-size: 0.86rem;
            font-weight: 700;
            letter-spacing: 0.01em;
            cursor: pointer;
            transition: background 0.15s ease, color 0.15s ease;
        }

        .fte-map-widget .tab-btn.active{
            background: var(--tab-active-bg);
            color: var(--tab-active-text);
        }

        .fte-map-widget .tab-btn.disabled{
            opacity: 0.55;
            cursor: not-allowed;
            position: relative;
        }

        /* Tooltip for disabled Congressional Districts tab — below the tab
           (above is clipped by .map-card overflow:hidden) */
        .fte-map-widget .tab-btn.disabled[data-tooltip]:hover::after{
            content: attr(data-tooltip);
            position: absolute;
            top: calc(100% + 6px);
            left: 50%;
            transform: translateX(-50%);
            background: var(--ink-950, #0c1b31);
            color: #fff;
            padding: 6px 12px;
            border-radius: 6px;
            font-size: 0.78rem;
            font-weight: 400;
            white-space: nowrap;
            z-index: 10;
            pointer-events: none;
            box-shadow: 0 2px 8px rgba(0,0,0,0.18);
        }

        .fte-map-widget .tab-btn.disabled[data-tooltip]:hover::before{
            content: '';
            position: absolute;
            top: calc(100% + 2px);
            left: 50%;
            transform: translateX(-50%);
            border: 5px solid transparent;
            border-bottom-color: var(--ink-950, #0c1b31);
            z-index: 10;
            pointer-events: none;
        }

        .fte-map-widget #map-container{
            width: 100%;
            aspect-ratio: 960 / 600;
            position: relative;
            background: linear-gradient(180deg, #f0f0f0 0%, #e8e8e8 100%);
        }

        .fte-map-widget #map-container svg{
            width: 100%;
            height: 100%;
        }

        .fte-map-widget .map-stats-row{
            display: grid;
            grid-template-columns: minmax(0, 1fr) 285px;
            border-top: 1px solid #e4edf8;
        }

        .fte-map-widget .stats-panel{
            background: var(--white);
            border-left: 1px solid var(--stats-border);
            padding: 18px;
            display: flex;
            flex-direction: column;
        }

        .fte-map-widget .stats-panel h3{
            margin: 0 0 12px 0;
            line-height: 1.2;
        }

        .fte-map-widget .stat-region-name{
            display: block;
            color: inherit;
        }

        .fte-map-widget .stat-report-name{
            display: block;
            font-style: normal;
            color: #012C56;
            justify-content: center;
            gap: 10px;
        }

        .fte-map-widget .stat-row{
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 8px 0;
            border-bottom: 1px solid #edf2f7;
        }

        .fte-map-widget .stat-row:last-child{ border-bottom: none; }
        body .fte-map-widget .stats-panel .stat-row.hidden{ display: none; }

        .fte-map-widget .stat-icon{
            width: 40px;
            height: 40px;
            border-radius: 9px;
            background: var(--stats-icon-bg);
            display: grid;
            place-items: center;
            color: var(--stats-icon-ink);
            flex-shrink: 0;
        }

        .fte-map-widget .stat-icon svg{
            width: 21px;
            height: 21px;
            fill: currentColor;
        }

        .fte-map-widget .stat-info{
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .fte-map-widget .stat-number{
            color: #0f2b4f;
            font-size: 1.04rem;
            font-weight: 800;
            letter-spacing: -0.01em;
        }

        .fte-map-widget .stat-label{
            color: #6c7f99;
            font-size: 0.76rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            font-weight: 700;
        }

        .fte-map-widget .download-row{
            border-top: 1px solid #dfe9f5;
            padding: 14px 16px;
            display: flex;
            justify-content: flex-end;
            background: #fbfdff;
        }

        .fte-map-widget .btn-download{
            border: none;
            border-radius: 9px;
            background: linear-gradient(180deg, #3ea739 0%, #2d8d2b 100%);
            color: var(--white);
            display: inline-flex;
            align-items: center;
            gap: 8px;
            font-size: 0.9rem;
            font-weight: 700;
            padding: 8px 14px;
            cursor: pointer;
            transition: filter 0.15s ease;
        }

        .fte-map-widget .btn-download:hover{ filter: brightness(1.05); }
        .fte-map-widget .btn-download.disabled{
            opacity: 0.55;
            pointer-events: none;
            filter: none;
        }
        .fte-map-widget .btn-download.is-loading{
            cursor: progress;
        }

        .fte-map-widget .btn-download svg{
            width: 14px;
            height: 14px;
            stroke: currentColor;
            fill: none;
        }

        .fte-map-widget #background-layer .background-feature{
            fill: var(--underlayer-fill);
            stroke: var(--underlayer-stroke);
            stroke-width: 1;
        }

        .fte-map-widget #map-container.mode-nation #layer-2-features .feature{
            fill: var(--nation-fill);
            stroke: var(--nation-stroke);
            stroke-width: 1;
            stroke-linejoin: round;
            stroke-linecap: round;
            stroke-miterlimit: 2;
            shape-rendering: geometricPrecision;
            cursor: pointer;
        }

        .fte-map-widget #map-container.mode-nation #layer-2-features .feature:hover{
            fill: var(--nation-hover);
            stroke: var(--nation-hover);
        }

        .fte-map-widget #map-container.mode-nation .state-label{
            opacity: 0;
            pointer-events: none;
        }

        .fte-map-widget #map-container.mode-states #layer-2-features .feature{
            fill: var(--state-fill);
            stroke: var(--state-stroke);
            stroke-width: 1;
            stroke-linejoin: round;
            stroke-linecap: round;
            stroke-miterlimit: 2;
            shape-rendering: geometricPrecision;
            cursor: pointer;
            transition: fill 0.15s ease, stroke 0.15s ease, stroke-width 0.15s ease;
        }

        .fte-map-widget #map-container.mode-states #layer-2-features .feature:hover{ fill: var(--state-hover); }
        .fte-map-widget #map-container.mode-states #layer-2-features .feature.active{ fill: var(--state-active); }
        .fte-map-widget #map-container.mode-states #layer-3-features .feature{
            fill: var(--congress-fill);
            stroke: var(--congress-stroke);
            stroke-width: 1;
            opacity: 1;
            pointer-events: auto;
            transition: fill 0.15s ease, stroke 0.15s ease;
        }
        .fte-map-widget #map-container.mode-states #layer-3-features .feature:hover{ fill: var(--congress-hover); }
        .fte-map-widget #map-container.mode-states #layer-3-features .feature.active{ fill: var(--congress-active); }

        .fte-map-widget #map-container.mode-states .state-label{
            cursor: default;
            pointer-events: none;
        }
        .fte-map-widget #map-container.mode-states .state-label[data-label-position]:not([data-label-position="A"]){
            cursor: pointer;
            pointer-events: auto;
        }
        .fte-map-widget #map-container.mode-states .state-label circle{ fill: #012C56; opacity: 0.88; }
        .fte-map-widget #map-container.mode-states .state-label text{
            fill: #f6f9fe;
            font-family: 'Sora', sans-serif;
            font-weight: 700;
        }
        .fte-map-widget #map-container.mode-states .state-label.active circle{ fill: #00B857; }

        .fte-map-widget #map-container.mode-congress #layer-2-features .feature{
            fill: var(--state-fill);
            stroke: rgba(255,255,255,0.16);
            stroke-width: 1;
            opacity: 0.48;
            cursor: pointer;
        }

        #map-container.mode-congress #layer-2-features .feature:hover,
        .fte-map-widget #map-container.mode-congress #layer-2-features .feature.active{
            opacity: 0.86;
            stroke: rgba(255,255,255,0.32);
        }

        .fte-map-widget #map-container.mode-congress #layer-3-features .feature{
            fill: var(--congress-fill);
            stroke: var(--congress-stroke);
            stroke-width: 1;
            stroke-linejoin: round;
            stroke-linecap: round;
            cursor: pointer;
            transition: fill 0.15s ease, stroke 0.15s ease;
        }

        .fte-map-widget #map-container.mode-congress #layer-3-features .feature:hover{ fill: var(--congress-hover); }
        .fte-map-widget #map-container.mode-congress #layer-3-features .feature.active{ fill: var(--congress-active); }
        .fte-map-widget #map-container.mode-congress .state-label{ opacity: 0; pointer-events: none; }

        .fte-map-widget #hover-outline-path{
            fill: none;
            stroke: #ffffff;
            stroke-width: 1;
            stroke-linejoin: round;
            stroke-linecap: round;
            vector-effect: non-scaling-stroke;
        }

        .fte-map-widget .loading{
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            color: #355474;
            font-size: 0.9rem;
            background: rgba(236, 243, 252, 0.86);
            z-index: 5;
        }

        .fte-map-widget .loading.hidden{ display: none; }

        .fte-map-widget .dot{
            width: 11px;
            height: 11px;
            border-radius: 50%;
            background: #2fb170;
            animation: pulse 0.85s ease-in-out infinite;
        }

        @keyframes pulse {
            0%, 100% { transform: scale(0.8); opacity: 0.6; }
            50% { transform: scale(1); opacity: 1; }
        }

        .fte-map-widget .report-popup{
            position: absolute;
            left: 50%;
            top: 18px;
            transform: translateX(-50%) translateY(-8px);
            min-width: 260px;
            max-width: min(88%, 520px);
            background: rgba(12, 32, 56, 0.96);
            color: #ffffff;
            border: 1px solid rgba(255,255,255,0.16);
            border-radius: 12px;
            box-shadow: 0 14px 30px rgba(9, 22, 40, 0.35);
            padding: 12px 14px;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity 0.2s ease, transform 0.2s ease;
            z-index: 7;
        }

        .fte-map-widget .report-popup.visible{
            opacity: 1;
            visibility: visible;
            transform: translateX(-50%) translateY(0);
            pointer-events: auto;
        }

        .fte-map-widget .report-popup.success{
            background: rgba(25, 88, 45, 0.96);
            border-color: rgba(177, 235, 190, 0.45);
        }

        .fte-map-widget .report-popup.error{
            background: rgba(109, 30, 30, 0.97);
            border-color: rgba(251, 189, 189, 0.4);
        }

        .fte-map-widget .report-popup-title{
            font-size: 0.78rem;
            font-weight: 800;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            opacity: 0.9;
            margin-bottom: 4px;
        }

        .fte-map-widget .report-popup-text{
            font-size: 0.9rem;
            line-height: 1.35;
            font-weight: 600;
            word-break: break-word;
        }

        .fte-map-widget .report-popup-close{
            margin-top: 8px;
            border: none;
            border-radius: 8px;
            background: rgba(255,255,255,0.18);
            color: #fff;
            font-size: 0.74rem;
            font-weight: 700;
            padding: 5px 10px;
            cursor: pointer;
        }

        .fte-map-widget .report-popup-close:hover{ background: rgba(255,255,255,0.28); }

        .fte-map-widget .report-popup-close.hidden{ display: none; }

        .fte-map-widget .map-lens-btn{
            position: absolute;
            right: 14px;
            bottom: 14px;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            border: 1px solid rgba(255,255,255,0.34);
            background: rgba(15, 41, 70, 0.92);
            color: #ffffff;
            display: grid;
            place-items: center;
            cursor: pointer;
            box-shadow: 0 8px 18px rgba(9, 22, 40, 0.34);
            transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
            z-index: 6;
        }

        .fte-map-widget .map-lens-btn:hover{ background: rgba(24, 59, 100, 0.96); }
        .fte-map-widget .map-lens-btn:active{ transform: translateY(1px); }
        .fte-map-widget .map-lens-btn svg{
            width: 20px;
            height: 20px;
            fill: none;
            stroke: currentColor;
            stroke-width: 1.9;
            stroke-linecap: round;
            stroke-linejoin: round;
        }
        .fte-map-widget .map-lens-btn.hidden{
            visibility: hidden;
            pointer-events: none;
            opacity: 0;
        }
        .fte-map-widget .map-lens-btn.disabled{
            pointer-events: none;
            opacity: 0.55;
        }

        .d3map-tooltip, .fte-map-widget .d3map-tooltip{
            background: #122847;
            color: #fff;
            padding: 6px 10px;
            border-radius: 8px;
            box-shadow: 0 10px 18px rgba(12, 24, 43, 0.3);
            font-size: 0.78rem;
            pointer-events: none;
            font-family: 'IBM Plex Sans', sans-serif;
            z-index: 9999;
        }

        @media (max-width: 960px) {
            .fte-map-widget .map-stats-row{ grid-template-columns: 1fr; }
            .fte-map-widget .stats-panel{
                border-left: none;
                border-top: 1px solid var(--stats-border);
            }
            .fte-map-widget .btn{ width: 100%; }
        }
