* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
}

#map {
    height: 100vh;
    width: 100%;
    z-index: 1;
}

.welcome-popup {
    display: none;
    position: fixed;
    top: 165px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 51, 0.9);
    color: white;
    padding: 20px;
    border-radius: 8px;
    z-index: 1002;
    max-width: 80%;
    width: 400px;
    font-family: Arial, sans-serif;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
    font-size: 14px;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button:hover {
    opacity: 0.8;
}

/* Header Container - Google-style centered */
.header-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.8) 70%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.logo {
    max-width: 300px;
    height: auto;
    margin-bottom: 20px;
    pointer-events: auto;
}

.search-container {
    display: none; /* Hidden - replaced by search icon popup */
}

/* Search Icon Button - next to info icon */
.search-icon-btn {
    position: fixed;
    bottom: 20px;
    left: 132px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #667eea;
    transition: all 0.2s;
}

.search-icon-btn:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.search-icon-btn.active {
    background: #667eea;
    color: white;
}

/* Geolocation Icon Button - next to search icon */
.geo-icon-btn {
    position: fixed;
    bottom: 20px;
    left: 188px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #667eea;
    transition: all 0.2s;
}

.geo-icon-btn:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.geo-icon-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Voter Search Modal */
.vs-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 60px;
}
.vs-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
}
.vs-modal {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 600px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    overflow: hidden;
}
.vs-close {
    position: absolute;
    top: 10px; right: 14px;
    background: none; border: none;
    font-size: 24px; cursor: pointer; color: #999;
    z-index: 1;
}
.vs-close:hover { color: #333; }
.vs-header {
    text-align: center;
    padding: 18px 20px 10px;
    border-bottom: 1px solid #eee;
}
.vs-header-icon {
    font-size: 28px;
    color: #667eea;
    margin-bottom: 4px;
}
.vs-header h2 { margin: 0; font-size: 20px; color: #333; }
.vs-header p { margin: 4px 0 0; font-size: 13px; color: #888; }
.vs-search-bar {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
}
.vs-search-bar input {
    flex: 1;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
}
.vs-search-bar input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}
.vs-search-bar button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.vs-search-bar button:hover { opacity: 0.9; }
.vs-status {
    padding: 6px 20px;
    font-size: 12px;
    color: #888;
    min-height: 20px;
}
.vs-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px;
}
.vs-card {
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}
.vs-voter {
    padding: 12px 14px;
}
.vs-primary {
    background: #fafbff;
}
.vs-hh-member {
    background: #f8f8f8;
    border-top: 1px dashed #ddd;
}
.vs-voter-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.vs-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.vs-name {
    font-weight: 600;
    font-size: 14px;
    color: #222;
    flex: 1;
}
.vs-vuid {
    font-size: 10px;
    color: #aaa;
    font-family: monospace;
}
.vs-details {
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
}
.vs-history-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}
.vs-history {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}
.vs-pill {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    border: 1px solid #ccc;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    color: #444;
}
.vs-pill-party {
    color: white;
    font-weight: 700;
    font-size: 10px;
    padding: 2px 5px;
    margin-right: 4px;
}
.vs-pill span:last-child { padding-right: 6px; }
.vs-no-history {
    font-size: 11px;
    color: #bbb;
    font-style: italic;
    margin-bottom: 4px;
}
.vs-actions {
    margin-top: 4px;
}
.vs-zoom {
    font-size: 12px;
    color: #667eea;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}
.vs-zoom:hover { text-decoration: underline; }
.vs-no-coords {
    font-size: 11px;
    color: #c93;
}
.vs-household {
    border-top: 2px solid #e0e0e0;
}
.vs-household-title {
    padding: 8px 14px 4px;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    background: #f0f0f0;
}
@media (max-width: 640px) {
    .vs-overlay { padding-top: 20px; }
    .vs-modal { max-height: 92vh; }
}

/* Legacy search popup — no longer used */
.search-popup, .search-popup * { display: none !important; }

.search-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 24px;
    box-shadow: 0 1px 6px rgba(32,33,36,.28);
    padding: 5px 8px 5px 16px;
    transition: box-shadow 0.2s;
    max-width: 600px;
    width: 100%;
}

.search-wrapper:hover {
    box-shadow: 0 2px 8px rgba(32,33,36,.35);
}

#search-input {
    flex: 1;
    padding: 8px 12px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    outline: none;
    background: transparent;
    margin-right: 8px;
    height: 44px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.search-button {
    padding: 10px 24px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin-left: 8px;
    transition: background 0.2s;
}

.search-button:hover {
    background: #1765cc;
}

.geolocation-button {
    padding: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: 4px;
    transition: background 0.2s;
}

.geolocation-button:hover {
    background: rgba(0,0,0,0.05);
}

.geolocation-button svg {
    color: #5f6368;
}

/* Info Strip */
.info-strip {
    display: none; /* Hidden for now */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    text-align: center;
    font-size: 14px;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.info-strip a {
    color: #007bff;
    text-decoration: none;
}

.info-strip a:hover {
    text-decoration: underline;
}

/* Leaflet popup customization */
.leaflet-popup-content {
    margin: 15px;
    font-size: 14px;
}

.leaflet-popup-content strong {
    color: #333;
}

/* Custom marker icon */
.custom-div-icon {
    background: none;
    border: none;
}

.custom-div-icon i {
    font-size: 24px;
    color: #007bff;
}

/* Marker cluster customization */
.marker-cluster-small {
    background-color: rgba(181, 226, 140, 0.6);
}

.marker-cluster-small div {
    background-color: rgba(110, 204, 57, 0.6);
}

.marker-cluster-medium {
    background-color: rgba(241, 211, 87, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(240, 194, 12, 0.6);
}

.marker-cluster-large {
    background-color: rgba(253, 156, 115, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(241, 128, 23, 0.6);
}

/* Search results dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #ddd;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.search-result-item:hover {
    background: #f5f5f5;
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Loading indicator */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Map Loading Indicator */
.map-loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 30px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .logo {
        max-width: 200px;
        margin-bottom: 15px;
    }
    
    .search-container {
        width: 90%;
    }
    
    .search-wrapper {
        width: 100%;
    }
    
    #search-input {
        font-size: 14px;
    }
    
    .welcome-popup {
        width: 90%;
        font-size: 13px;
        padding: 15px 35px 15px 15px;
    }
}


/* Layer Control Styles */
.layer-control {
    position: absolute;
    top: 80px;
    right: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 250px;
    max-width: 300px;
}

.layer-control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px 8px 0 0;
}

.layer-control-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.layer-control-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: transform 0.3s;
}

.layer-control-toggle:hover {
    transform: scale(1.1);
}

.layer-control.expanded .layer-control-toggle {
    transform: rotate(180deg);
}

.layer-control-content {
    max-height: 400px;
    overflow-y: auto;
}

.layer-control-loading,
.layer-control-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.layer-list {
    padding: 10px;
}

.layer-item {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.layer-item:last-child {
    border-bottom: none;
}

.layer-year-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.layer-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.layer-count {
    font-size: 13px;
    color: #666;
}

.layer-datasets {
    margin-left: 10px;
}

.layer-dataset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 4px 0;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.layer-dataset-item:hover {
    background-color: #e3f2fd;
    border-color: #007bff;
    transform: translateX(4px);
}

.dataset-voter-count {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.layer-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex: 1;
}

.layer-checkbox input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.layer-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.layer-count {
    font-size: 13px;
    color: #666;
    background: #f0f0f0;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.layer-actions {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.layer-btn {
    flex: 1;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    transition: all 0.2s;
}

.layer-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.layer-btn:active {
    transform: scale(0.98);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .layer-control {
        top: 70px;
        right: 5px;
        min-width: 200px;
        max-width: 250px;
    }
    
    .layer-control-header h3 {
        font-size: 14px;
    }
    
    .layer-label {
        font-size: 14px;
    }
    
    .layer-count {
        font-size: 12px;
    }
}

/* Leaflet circle marker popup styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.info-box {
    font-size: 14px;
    line-height: 1.6;
}

.info-box strong {
    color: #667eea;
}


/* ============================================================================
   PARTY AFFILIATION VISUALIZATION STYLES
   ============================================================================ */

/* Time Filter Control */
.time-filter-control {
    position: absolute;
    top: 20px;
    right: 280px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    padding: 12px 15px;
    min-width: 250px;
}

.time-filter-header label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.time-filter-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.time-filter-select:hover {
    border-color: #667eea;
}

.time-filter-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Layer Control Panel - HIDDEN (replaced by Election Years panel) */
.layer-control-panel {
    display: none; /* Hide the old Map Layers panel */
    position: absolute;
    top: 80px;
    right: 270px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 220px;
}

.layer-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px 8px 0 0;
}

.layer-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.layer-panel-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
}

.layer-panel-content {
    padding: 10px;
}

.layer-panel-item {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.layer-panel-item:last-child {
    border-bottom: none;
}

.layer-panel-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.layer-panel-item input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Color Legend - Info Icon + Popup */
.legend-info-btn {
    position: fixed;
    bottom: 20px;
    left: 76px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #667eea;
    transition: all 0.2s;
}

.legend-info-btn:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.legend-info-btn.active {
    background: #667eea;
    color: white;
}

.legend-popup {
    position: fixed;
    bottom: 78px;
    left: 76px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    z-index: 1000;
    width: 220px;
    padding: 12px;
    display: none;
}

.legend-popup.open {
    display: block;
}

.legend-popup-content .legend-section {
    margin-bottom: 10px;
}

.legend-popup-content .legend-section:last-child {
    margin-bottom: 0;
}

.legend-popup-content .legend-section h4 {
    font-size: 11px;
    font-weight: 600;
    color: #667eea;
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-popup-content .legend-item {
    display: flex;
    align-items: center;
    padding: 3px 0;
    font-size: 12px;
    color: #333;
}

.legend-section {
    margin-bottom: 15px;
}

.legend-section:last-child {
    margin-bottom: 0;
}

.legend-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    color: #333;
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.legend-marker.filled {
    opacity: 0.8;
}

.legend-marker.hollow {
    background: transparent !important;
    border-width: 2px;
    border-style: solid;
}

.legend-marker.filled.red {
    background-color: #DC143C;
}

.legend-marker.filled.blue {
    background-color: #1E90FF;
}

.legend-marker.filled.purple {
    background-color: #6A1B9A;
}

.legend-marker.filled.maroon {
    background-color: #C62828;
}

.legend-marker.filled.green {
    background-color: #32CD32;
}

.legend-marker.hollow.red {
    border-color: #DC143C;
}

.legend-marker.hollow.blue {
    border-color: #1E90FF;
}

.legend-marker.hollow.gray {
    border-color: #808080;
}

.legend-marker.hollow.black {
    border-color: #000000;
}

/* Marker Badge Styles */
.marker-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 1px solid white;
    z-index: 10;
}

/* Star marker for new voters */
.star-marker {
    background: none !important;
    border: none !important;
}

/* Household Popup Styles */
.household-popup {
    min-width: 250px;
}

.household-popup h4 {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 16px;
}

.household-popup .address {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 13px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.voter-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.voter-item {
    display: flex;
    align-items: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 5px;
}

.voter-marker-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.voter-info {
    flex: 1;
}

.voter-info strong {
    display: block;
    color: #333;
    font-size: 14px;
    margin-bottom: 2px;
}

.voter-info small {
    color: #666;
    font-size: 12px;
}

/* Precinct Popup Styles */
.precinct-popup h4 {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 16px;
}

.precinct-popup p {
    margin: 5px 0;
    font-size: 14px;
}

/* Polling Place Popup Styles */
.polling-place-popup h4 {
    margin: 0 0 10px 0;
    color: #4A90E2;
    font-size: 16px;
}

.polling-place-popup p {
    margin: 5px 0;
    font-size: 14px;
}

/* Polling Place Icon */
.polling-place-icon {
    background: none;
    border: none;
}

.polling-place-icon svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Precinct Label Styles */
.precinct-label {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    font-weight: 800;
    color: rgba(60, 60, 60, 0.35);
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 
        0 0 4px rgba(255, 255, 255, 0.9),
        0 0 8px rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .time-filter-control {
        top: 70px;
        right: 10px;
        min-width: 200px;
    }
    
    .legend-info-btn {
        bottom: 16px;
        left: 12px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .legend-popup {
        bottom: 68px;
        left: 12px;
        width: 200px;
    }
    
    .search-icon-btn {
        bottom: 16px;
        left: 116px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .geo-icon-btn {
        bottom: 16px;
        left: 168px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .search-popup {
        bottom: 68px;
        left: 12px;
        width: calc(100vw - 24px);
        max-width: 380px;
    }
    
    .household-popup {
        min-width: 200px;
    }
}

/* Smooth transitions */
.leaflet-marker-icon,
.leaflet-popup {
    transition: opacity 0.2s ease-in-out;
}

/* Performance optimization - reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================================
   DATASET SELECTOR STYLES
   ============================================================================ */

/* Dataset Selector Control - HIDDEN (moved to Data Options panel) */
/* All styles removed - control is hidden */
.dataset-selector-control,
.dataset-selector-control * {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Party Filter Control - HIDDEN (moved to Data Options panel) */
/* All styles removed - control is hidden */
.party-filter-control,
.party-filter-control * {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

/* ============================================================================
   PARTY FILTER STYLES
   ============================================================================ */

/* Party Filter Control - HIDDEN (moved to Data Options panel) */
/* All styles removed - control is hidden */


/* Heatmap Mode Control - Standalone below search */
.heatmap-mode-control {
    position: fixed;
    top: 160px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 1px 6px rgba(32,33,36,.28);
}

.heatmap-label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-right: 4px;
}

.heatmap-separator {
    color: #ddd;
    font-weight: 300;
    margin: 0 4px;
}

.heatmap-toggle-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    color: #555;
}

.heatmap-toggle-btn:hover {
    background: #f5f5f5;
}

.heatmap-toggle-btn.active {
    background: #1a73e8;
    color: white;
}

/* Right Sidebar Panels - Dynamic Bottom-Right Stacking */
/* JavaScript calculates positions to stack panels without overlap */

/* Right-side Panel Icon Buttons */
.panel-icon-btn {
    position: fixed;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #667eea;
    transition: all 0.2s;
}

.panel-icon-btn:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.panel-icon-btn.active {
    background: #667eea;
    color: white;
}

.data-icon-btn {
    bottom: 20px;
    right: 20px;
}

.map-icon-btn {
    bottom: 20px;
    right: 76px;
}

.newspaper-icon-btn {
    bottom: 20px;
    right: 132px;
    color: #8B4513;
}
.newspaper-icon-btn:hover {
    color: #5C2D00;
}

.campaigns-icon-btn {
    bottom: 20px;
    right: 188px;
    color: #4A148C;
}
.campaigns-icon-btn:hover {
    color: #311B92;
}
.campaigns-icon-btn.active {
    background: #4A148C;
    color: white;
}

.account-icon-btn {
    bottom: 20px;
    left: 20px;
}

/* Account Modal */
.account-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.account-modal {
    background: white;
    border-radius: 12px;
    min-width: 300px;
    max-width: 360px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.account-modal-close {
    position: absolute;
    top: 8px; right: 12px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #999;
}

/* Panel Popups */
.panel-popup {
    position: fixed;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    z-index: 1001;
    width: 280px;
    display: none;
    max-height: 70vh;
    overflow-y: auto;
}

.panel-popup.open {
    display: block;
}

.map-options-popup {
    bottom: 78px;
}

.data-options-popup {
    bottom: 78px;
}

.panel-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.panel-popup-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.panel-popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.panel-popup-close:hover {
    opacity: 0.8;
}

.panel-popup-content {
    padding: 15px;
}

.data-option-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.data-option-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.party-filter-section {
    margin-top: 0;
}

.party-filter-btn-inline {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    text-align: center !important;
    transition: all 0.2s ease;
    background: white !important;
    border: 2px solid #ddd !important;
    color: #333 !important;
    font-weight: 500 !important;
}

.party-filter-btn-inline:hover {
    border-color: #667eea !important;
    background: #f8f9ff !important;
    transform: translateX(2px);
}

.party-filter-btn-inline.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    font-weight: 600 !important;
}

.party-filter-btn-inline.active:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%) !important;
    transform: translateX(2px);
}

/* Flipped Voters Buttons */
.flipped-voters-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    text-align: center !important;
    transition: all 0.2s ease;
    background: white !important;
    border: 2px solid #ddd !important;
    color: #333 !important;
    font-weight: 500 !important;
}

.flipped-voters-btn:hover {
    border-color: #667eea !important;
    background: #f8f9ff !important;
    transform: translateX(2px);
}

.flipped-voters-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    font-weight: 600 !important;
}

.flipped-voters-btn.active:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%) !important;
    transform: translateX(2px);
}

/* New Voters Button */
.new-voters-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    text-align: center !important;
    transition: all 0.2s ease;
    background: white !important;
    border: 2px solid #ddd !important;
    color: #333 !important;
    font-weight: 500 !important;
}

.new-voters-btn:hover {
    border-color: #DAA520 !important;
    background: #fffbf0 !important;
    transform: translateX(2px);
}

.new-voters-btn.active {
    background: linear-gradient(135deg, #DAA520 0%, #B8860B 100%) !important;
    color: white !important;
    border-color: #DAA520 !important;
    font-weight: 600 !important;
}

.new-voters-btn.active:hover {
    background: linear-gradient(135deg, #C49619 0%, #A0750A 100%) !important;
    transform: translateX(2px);
}

/* Gender Filter Buttons */
.gender-filter-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    text-align: center !important;
    transition: all 0.2s ease;
    background: white !important;
    border: 2px solid #ddd !important;
    color: #333 !important;
    font-weight: 500 !important;
}

.gender-filter-btn:hover {
    border-color: #667eea !important;
    background: #f8f9ff !important;
    transform: translateX(2px);
}

.gender-filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    font-weight: 600 !important;
}

.gender-filter-btn.active:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%) !important;
    transform: translateX(2px);
}

/* Age Filter Buttons */
.age-filter-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    text-align: center !important;
    transition: all 0.2s ease;
    background: white !important;
    border: 2px solid #ddd !important;
    color: #333 !important;
    font-weight: 500 !important;
}

.age-filter-btn:hover {
    border-color: #667eea !important;
    background: #f8f9ff !important;
    transform: translateX(2px);
}

.age-filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    font-weight: 600 !important;
}

.age-filter-btn.active:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%) !important;
    transform: translateX(2px);
}

/* (Old panel styles removed - now using icon + popup approach) */

.map-option-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.map-option-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.map-option-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.map-option-buttons {
    display: flex;
    gap: 8px;
}

.map-option-btn {
    flex: 1;
    padding: 8px 12px;
    background: white !important;
    border: 2px solid #ddd !important;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555 !important;
    transition: all 0.2s;
    text-align: center;
}

.map-option-btn:hover {
    border-color: #667eea !important;
    background: #f8f9ff !important;
}

.map-option-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
}

.map-option-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.map-option-checkbox input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.map-option-checkbox span {
    user-select: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .panel-icon-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .data-icon-btn {
        bottom: 16px;
        right: 12px;
    }
    
    .map-icon-btn {
        bottom: 16px;
        right: 64px;
    }
    
    .newspaper-icon-btn {
        bottom: 16px;
        right: 120px;
    }
    
    .campaigns-icon-btn {
        bottom: 16px;
        right: 168px;
    }
    
    .account-icon-btn {
        bottom: 16px;
        left: 64px;
    }
    
    .panel-popup {
        right: 12px;
        width: calc(100vw - 24px);
        max-width: 300px;
    }
    
    .map-options-popup {
        bottom: 68px;
    }
    
    .data-options-popup {
        bottom: 68px;
    }
    
    .panel-popup-header h3 {
        font-size: 14px;
    }
    
    .map-option-label {
        font-size: 12px;
    }
    
    .map-option-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .map-option-checkbox {
        font-size: 13px;
    }
}


/* Overlay Image (Logo) */
.overlay-image {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 25vw;
    max-width: 300px;
    min-width: 200px;
    opacity: 0.85;
    z-index: 1000;
    pointer-events: none;
}

/* Dataset Stats Box - below logo */
.dataset-stats-box {
    position: fixed;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border-radius: 8px;
    padding: 8px 16px;
    z-index: 999;
    font-size: 12px;
    color: #333;
    text-align: center;
    box-shadow: 0 1px 6px rgba(0,0,0,0.15);
    max-width: 340px;
    min-width: 200px;
    line-height: 1.5;
    pointer-events: none;
}

.dataset-stats-box .stats-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    color: #222;
}

.dataset-stats-box .stats-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.dataset-stats-box .stat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.dataset-stats-box .stat-value {
    font-weight: 700;
}

.dataset-stats-box .stat-dem {
    color: #1E90FF;
}

.dataset-stats-box .stat-rep {
    color: #DC143C;
}

/* Header Background Fade */
.header-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 300px;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 255, 255, 0.98) 5%,
        rgba(255, 255, 255, 0.95) 10%,
        rgba(255, 255, 255, 0.9) 15%,
        rgba(255, 255, 255, 0.85) 20%,
        rgba(255, 255, 255, 0.78) 25%,
        rgba(255, 255, 255, 0.7) 30%,
        rgba(255, 255, 255, 0.6) 35%,
        rgba(255, 255, 255, 0.5) 40%,
        rgba(255, 255, 255, 0.4) 45%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.22) 55%,
        rgba(255, 255, 255, 0.15) 60%,
        rgba(255, 255, 255, 0.1) 65%,
        rgba(255, 255, 255, 0.06) 70%,
        rgba(255, 255, 255, 0.03) 75%,
        rgba(255, 255, 255, 0.01) 80%,
        rgba(255, 255, 255, 0) 85%);
    z-index: 999;
    pointer-events: none;
}

.fade-out {
    opacity: 0;
    transition: opacity 2s ease;
}


/* ============================================================
   GAZETTE — Clean data brief
   ============================================================ */
.gazette-overlay {
    position: fixed; inset: 0;
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.gazette-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}
.gazette {
    position: relative;
    width: 94vw; max-width: 560px;
    max-height: 92vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 0;
    transform: scale(0.9); opacity: 0;
    animation: gazetteIn 0.3s ease-out forwards;
}
@keyframes gazetteIn {
    to { transform: scale(1); opacity: 1; }
}
.gazette-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none;
    font-size: 24px; color: #999; cursor: pointer;
    line-height: 1; z-index: 2;
    transition: color 0.15s;
}
.gazette-close:hover { color: #333; }
.gazette-inner {
    padding: 24px 28px 20px;
}

/* ---- Header ---- */
.gazette-header {
    text-align: center;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 2px solid #e5e5e5;
}
.gazette-logo {
    height: 48px;
    width: auto;
    margin-bottom: 6px;
}
.gazette-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: #111;
    line-height: 1.1;
    margin-bottom: 4px;
}
.gazette-meta {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px;
    color: #888;
}

/* ---- Body ---- */
.gazette-body {
    font-family: 'Inter', system-ui, sans-serif;
    color: #222;
    font-size: 13px;
    line-height: 1.55;
}
.gazette-loading {
    text-align: center;
    color: #aaa;
    padding: 40px 0;
}

/* ---- KPI row ---- */
.gz-kpi-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.gz-kpi {
    flex: 1;
    text-align: center;
    padding: 12px 6px;
    border-radius: 8px;
    background: #f7f7f7;
}
.gz-kpi-value {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.1;
    color: #111;
}
.gz-kpi-label {
    font-size: 10px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}
.gz-kpi.dem { border-bottom: 3px solid #1976D2; }
.gz-kpi.rep { border-bottom: 3px solid #D32F2F; }
.gz-kpi.neutral { border-bottom: 3px solid #666; }
.gz-kpi.dem .gz-kpi-value { color: #1565C0; }
.gz-kpi.rep .gz-kpi-value { color: #C62828; }
.gz-kpi.gold { border-bottom: 3px solid #DAA520; background: #FFFDF5; }
.gz-kpi.gold .gz-kpi-value { color: #B8860B; }

/* ---- Section ---- */
.gz-section {
    margin-bottom: 14px;
}
.gz-section-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 0;
    padding: 8px 0 6px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.gz-section-title:hover { color: #555; }
.gz-section-title::after {
    content: '▾';
    font-size: 12px;
    transition: transform 0.2s;
}
.gz-section.collapsed .gz-section-title::after {
    transform: rotate(-90deg);
}
.gz-section-title.gold {
    color: #B8860B;
    border-bottom-color: #F0E68C;
}
.gz-section-title.gold:hover { color: #8B6914; }
.gz-section-body {
    overflow: hidden;
    max-height: 600px;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.2s ease;
    opacity: 1;
    margin-top: 6px;
}
.gz-section.collapsed .gz-section-body {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}
.gz-text {
    font-size: 13px;
    line-height: 1.55;
    color: #333;
    margin: 0 0 6px;
}
.gz-dem { color: #1565C0; font-weight: 700; }
.gz-rep { color: #C62828; font-weight: 700; }
.gz-gold { color: #B8860B; font-weight: 700; }
.gz-big { font-size: 16px; font-weight: 800; }

/* ---- Inline bar ---- */
.gz-bar {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin: 6px 0;
}
.gz-bar-dem { background: #1976D2; }
.gz-bar-rep { background: #D32F2F; }
.gz-bar-gold { background: #DAA520; }
.gz-bar-gold-light { background: #F0E68C; }
.gz-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
}

/* ---- Tables ---- */
.gz-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin: 6px 0;
}
.gz-table th {
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    padding: 4px 6px;
    border-bottom: 2px solid #ddd;
}
.gz-table td {
    padding: 3px 6px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}
.gz-table tr:last-child td {
    border-bottom: 2px solid #ddd;
    font-weight: 700;
    color: #111;
}
.gz-table .r { text-align: right; }
.gz-table .dem-val { color: #1565C0; font-weight: 600; }
.gz-table .rep-val { color: #C62828; font-weight: 600; }

/* ---- Footer ---- */
.gz-footer {
    text-align: center;
    font-size: 10px;
    color: #bbb;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* ---- Share buttons ---- */
.gz-share-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}
.gz-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}
.gz-share-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}
.gz-share-btn:active {
    transform: translateY(0);
}
.gz-share-fb { background: #1877F2; }
.gz-share-ig { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.gz-share-x { background: #000; }

@media (max-width: 480px) {
    .gazette-inner { padding: 16px 16px 14px; }
    .gazette-title { font-size: 22px; }
    .gz-kpi-value { font-size: 20px; }
    .gz-kpi-row { flex-wrap: wrap; }
    .gz-kpi { min-width: calc(50% - 4px); }
}


/* ============================================================
   CAMPAIGN DISTRICTS OVERLAY
   ============================================================ */
.campaign-overlay {
    position: fixed; inset: 0;
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.campaign-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
}

/* ── Selector Modal ── */
.campaign-selector {
    position: relative;
    width: 90vw; max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.3);
    padding: 0;
    animation: campaignSlideUp 0.3s ease-out;
}
@keyframes campaignSlideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.campaign-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none;
    font-size: 24px; color: #999; cursor: pointer; z-index: 2;
}
.campaign-close:hover { color: #333; }

.campaign-selector-header {
    text-align: center;
    padding: 28px 24px 16px;
    background: linear-gradient(135deg, #4A148C 0%, #7B1FA2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}
.campaign-selector-icon { font-size: 36px; margin-bottom: 8px; }
.campaign-selector-header h2 {
    margin: 0; font-size: 22px; font-weight: 700;
}
.campaign-selector-header p {
    margin: 6px 0 0; font-size: 13px; opacity: 0.85;
}

/* Tab bar for district type selection */
.campaign-tab-bar {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    background: #fafafa;
}
.campaign-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #888;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.campaign-tab:hover {
    color: #4A148C;
    background: #f3e5f5;
}
.campaign-tab.active {
    color: #4A148C;
    border-bottom-color: #7B1FA2;
    background: white;
}

.campaign-district-list { padding: 16px; max-height: 50vh; overflow-y: auto; }

.campaign-district-card {
    display: flex; align-items: center;
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}
.campaign-district-card:hover {
    border-color: #7B1FA2;
    background: #f9f0ff;
    transform: translateX(4px);
}
.campaign-district-card.active {
    border-color: #4A148C;
    background: #ede7f6;
}
.campaign-card-color {
    width: 8px; height: 48px;
    border-radius: 4px;
    margin-right: 14px;
    flex-shrink: 0;
}
.campaign-card-body { flex: 1; }
.campaign-card-title {
    font-size: 15px; font-weight: 700; color: #1a1a1a;
    margin-bottom: 2px;
}
.campaign-card-rep {
    font-size: 13px; color: #555;
}
.campaign-card-type {
    font-size: 11px; color: #999;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-top: 2px;
}
.campaign-card-arrow {
    font-size: 20px; color: #bbb;
    margin-left: 8px;
}
.campaign-district-card:hover .campaign-card-arrow { color: #7B1FA2; }

.campaign-clear-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 0 16px 16px;
    padding: 10px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    text-align: center;
    transition: all 0.2s;
}
.campaign-clear-btn:hover {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
}

/* ── Stats Modal ── */
.campaign-stats-modal {
    position: relative;
    width: 92vw; max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.3);
    animation: campaignSlideUp 0.3s ease-out;
}
.campaign-stats-header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px 10px;
}
.campaign-stats-badge {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.campaign-stats-level {
    font-size: 10px; font-weight: 700;
    letter-spacing: 1.5px;
    color: #999;
    text-transform: uppercase;
}
.campaign-stats-title {
    margin: 2px 0; font-size: 18px; font-weight: 800; color: #1a1a1a;
}
.campaign-stats-rep {
    font-size: 13px; color: #555;
}

.campaign-stats-body { padding: 0 20px 12px; }

.campaign-stats-loading {
    text-align: center; padding: 40px 0;
}
.campaign-stats-loading p {
    margin-top: 12px; color: #888; font-size: 14px;
}

/* Party bar */
.campaign-party-bar {
    display: flex; height: 12px;
    border-radius: 6px; overflow: hidden;
    margin-bottom: 4px;
}
.campaign-party-bar-dem { background: #1E90FF; }
.campaign-party-bar-rep { background: #DC143C; }
.campaign-party-labels {
    display: flex; justify-content: space-between;
    font-size: 12px; font-weight: 700;
    margin-bottom: 10px;
}
.campaign-dem-label { color: #1E90FF; }
.campaign-rep-label { color: #DC143C; }

/* Metrics grid */
.campaign-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}
.campaign-metric {
    text-align: center;
    padding: 6px 2px;
    background: #f8f9fa;
    border-radius: 8px;
}
.campaign-metric-value {
    font-size: 17px; font-weight: 800; color: #1a1a1a;
}
.campaign-metric-label {
    font-size: 9px; color: #888;
    text-transform: uppercase; letter-spacing: 0.3px;
    margin-top: 1px;
}

/* Shift banner */
.campaign-shift-banner {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 12px; color: #333;
}
.campaign-shift-arrow { font-size: 16px; font-weight: 800; }

/* Sections */
.campaign-section {
    margin-bottom: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}
.campaign-section h4 {
    margin: 0 0 6px; font-size: 13px; font-weight: 700; color: #333;
}

/* Flips */
.campaign-flip-row {
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap;
}
.campaign-flip-item {
    display: flex; align-items: center; gap: 4px;
    font-size: 13px; color: #333;
}
.campaign-flip-dot {
    width: 10px; height: 10px; border-radius: 50%;
}
.campaign-flip-net {
    font-weight: 800; font-size: 13px;
    margin-left: auto;
}

/* New voters bar */
.campaign-new-bar {
    display: flex; height: 8px;
    border-radius: 4px; overflow: hidden;
    margin: 6px 0 4px;
}
.campaign-new-bar-dem { background: #1E90FF; }
.campaign-new-bar-rep { background: #DC143C; }
.campaign-gender-grid {
    display: flex; gap: 20px; justify-content: center; margin: 8px 0;
}
.campaign-gender-col {
    text-align: center; flex: 1;
}
.campaign-gender-icon {
    font-size: 24px; margin-bottom: 2px;
}
.campaign-gender-party {
    font-size: 11px; margin-top: 2px; color: #666;
}
.campaign-gender-bar {
    display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 6px 0 2px;
}
.campaign-gender-bar-f { background: #E91E63; }
.campaign-gender-bar-m { background: #1565C0; }
.campaign-metric-inline {
    font-size: 14px; color: #333;
}
.campaign-metric-big {
    font-size: 18px; font-weight: 800; color: #DAA520;
}

/* Comparison table */
.campaign-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.campaign-table th {
    text-align: right; padding: 3px 6px;
    font-size: 10px; color: #999;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 2px solid #eee;
}
.campaign-table th:first-child { text-align: left; }
.campaign-table td {
    text-align: right; padding: 3px 6px;
    border-bottom: 1px solid #f0f0f0;
}
.campaign-table td:first-child {
    text-align: left; font-weight: 600;
}

/* County tabs within campaign stats modal */
.campaign-county-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e0e0e0;
    margin: 0 -12px 10px;
    padding: 0 12px;
    overflow-x: auto;
}
.campaign-county-tab {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.campaign-county-tab:hover {
    color: #4A148C;
    background: #f3e5f5;
}
.campaign-county-tab.active {
    color: #4A148C;
    border-bottom-color: #7B1FA2;
}

/* Footer */
.campaign-stats-footer {
    display: flex; gap: 10px;
    padding: 8px 20px 14px;
    border-top: 1px solid #eee;
}
.campaign-btn-secondary {
    flex: 1; padding: 10px;
    background: white; border: 2px solid #ddd;
    border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 600; color: #555;
    transition: all 0.2s;
}
.campaign-btn-secondary:hover {
    border-color: #7B1FA2; color: #7B1FA2;
}
.campaign-btn-primary {
    flex: 1; padding: 10px;
    background: linear-gradient(135deg, #4A148C, #7B1FA2);
    border: none; border-radius: 8px; cursor: pointer;
    font-size: 13px; font-weight: 600; color: white;
    transition: all 0.2s;
}
.campaign-btn-primary:hover {
    background: linear-gradient(135deg, #38006b, #6a1b9a);
}

/* Mobile */
@media (max-width: 600px) {
    .campaign-selector { max-width: 95vw; }
    .campaign-stats-modal { max-width: 95vw; }
    .campaign-metrics { grid-template-columns: repeat(2, 1fr); }
    .campaign-stats-title { font-size: 16px; }
    .campaign-metric-value { font-size: 18px; }
}
