/* PollingSource Styles */

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

:root {
    /* ============================================
       PHASE 1: CSS CUSTOM PROPERTIES FOUNDATION
       Created: October 27, 2025
       Purpose: Dynamic CSS migration - all variables in one place
       ============================================ */

    /* === BRAND COLORS === */
    --brand-primary: #002349;      /* Dark Royal Blue - header background */
    --brand-secondary: #1D63FF;    /* Prussian Blue - links, accents */
    --brand-accent: #957C3D;       /* Gold - borders, highlights */
    --brand-light-blue: #B8D4FF;   /* Very light Prussian blue - countdown timer */

    /* === ELECTORAL MAP COLORS === */
    /* Democrat shades (blue) */
    --dem-strong: #1a4c8b;         /* Safe Democratic */
    --dem-medium: #3d7ac7;         /* Likely Democratic */
    --dem-light: #6fa3e3;          /* Lean Democratic */
    --dem-tilt: #a5c9f5;           /* Tilt Democratic */

    /* Republican shades (red) */
    --rep-strong: #b91c1c;         /* Safe Republican */
    --rep-medium: #dc2626;         /* Likely Republican */
    --rep-light: #f87171;          /* Lean Republican */
    --rep-tilt: #fca5a5;           /* Tilt Republican */

    /* Neutral */
    --tossup: #E8A020;             /* Toss-up gold — matches the spectrum bar (Jim 20260705; was grey #9ca3af) */

    /* === BACKGROUND COLORS === */
    --bg-primary: #ffffff;         /* Primary background (white) */
    --bg-secondary: #F8F9FA;       /* Secondary background (light gray) */
    --bg-light: #F8F9FA;           /* Alias for bg-secondary (backward compat) */
    --bg-white: #ffffff;           /* Alias for bg-primary (backward compat) */
    --bg-hover: #f1f5f9;           /* Hover state background */
    --bg-dark: #1a1a1a;            /* Dark backgrounds (future use) */

    /* === TEXT COLORS === */
    --text-primary: #1a1a1a;       /* Primary text (near black) */
    --text-secondary: #5a5a5a;     /* Secondary text (medium gray) */
    --text-tertiary: #9ca3af;      /* Tertiary text (light gray) */
    --text-dark: #1a1a1a;          /* Alias for text-primary (backward compat) */
    --text-gray: #5a5a5a;          /* Alias for text-secondary (backward compat) */
    --text-light: #ffffff;         /* Light text on dark backgrounds */
    --text-link: var(--brand-secondary); /* Link color */
    --text-link-hover: var(--brand-primary); /* Link hover color */

    /* === BORDER COLORS === */
    --border-color: #E0E4E8;       /* Default border color */
    --border: #E0E4E8;             /* Alias (backward compat) */
    --border-light: #f1f5f9;       /* Light borders */
    --border-dark: #cbd5e1;        /* Darker borders */

    /* === SPACING SCALE (8px grid system) === */
    --space-xs: 0.5rem;    /* 8px */
    --space-sm: 1rem;      /* 16px */
    --space-md: 1.5rem;    /* 24px */
    --space-lg: 2rem;      /* 32px */
    --space-xl: 3rem;      /* 48px */
    --space-2xl: 4rem;     /* 64px */
    --space-3xl: 6rem;     /* 96px */

    /* NOTE: Starting with 8px grid. May migrate to 4px grid (0.25rem increments)
       if finer control needed for page requirements. See DYNAMIC_CSS_MIGRATION_PLAN.md */

    /* === TYPOGRAPHY SCALE (Fluid) === */
    /* These use clamp() for responsive sizing */
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);      /* 12px - 14px */
    --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);        /* 14px - 16px */
    --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);        /* 16px - 18px */
    --text-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);       /* 18px - 20px */
    --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);        /* 20px - 24px */
    --text-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);             /* 24px - 32px */
    --text-3xl: clamp(2rem, 1.7rem + 1.5vw, 2.5rem);           /* 32px - 40px */

    /* === BREAKPOINTS (for reference - not actual @media queries) === */
    /* These are documented for consistency, actual @media uses px values */
    --bp-mobile: 480px;     /* Small phones */
    --bp-tablet: 768px;     /* Tablets and large phones */
    --bp-desktop: 1024px;   /* Desktop */
    --bp-wide: 1440px;      /* Large desktop */

    /* NOTE: Breakpoints can be revisited during implementation if needed.
       See DYNAMIC_CSS_MIGRATION_PLAN.md */

    /* === CONTAINER MAX-WIDTHS === */
    --container-sm: 640px;   /* Small container */
    --container-md: 768px;   /* Medium container */
    --container-lg: 1024px;  /* Large container */
    --container-xl: 1280px;  /* Extra large container */

    /* === TRANSITIONS === */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* === SHADOWS === */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-base: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.2);

    /* === BORDER RADIUS === */
    --radius-sm: 4px;
    --radius-base: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;  /* For pills/circles */

    /* === Z-INDEX SCALE === */
    --z-dropdown: 1000;
    --z-sticky: 1010;
    --z-fixed: 1020;
    --z-modal-backdrop: 1030;
    --z-modal: 1040;
    --z-popover: 1050;
    --z-tooltip: 1060;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--bg-light);
}

/* ============================================
   CONTAINER SYSTEM - Responsive Containers
   ============================================ */

.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

/* Responsive container max-widths */
@media (min-width: 640px) {
    .container {
        max-width: var(--container-sm);
    }
}

@media (min-width: 768px) {
    .container {
        max-width: var(--container-md);
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: var(--container-lg);
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: var(--container-xl);
    }
}

/* Container size variations (for future use) */
.container-sm {
    max-width: var(--container-sm);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

.container-md {
    max-width: var(--container-md);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

.container-lg {
    max-width: var(--container-lg);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

.container-xl {
    max-width: var(--container-xl);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
}

/* Header */
/* ============================================
   PHASE 2: RESPONSIVE HEADER & NAVIGATION
   ============================================ */

.site-header {
    background: var(--brand-primary);  /* Dark royal blue */
    border-bottom: 3px solid var(--brand-accent);  /* Gold border */
    padding: clamp(1rem, 2vw, 1.5rem) 0;  /* Fluid padding: smaller mobile, larger desktop */
    margin-bottom: 0;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;  /* For hamburger positioning */
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Home link wrapper - preserves visual appearance while being clickable */
.site-home-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}

.site-home-link:hover,
.site-home-link:visited,
.site-home-link:active {
    text-decoration: none;
    color: inherit;
}

.site-logo {
    width: clamp(60px, 10vw, 80px);  /* Fluid logo: 60-80px */
    height: clamp(60px, 10vw, 80px);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;  /* Prevent squishing */
}

.title-wrapper {
    flex: 1;
}

.site-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);  /* Fluid title size */
    font-weight: 800;
    color: var(--bg-white);  /* White on dark blue */
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.site-tagline {
    color: #B8C5D6;  /* Light blue-gray */
    font-size: clamp(0.9rem, 2vw, 1.1rem);  /* Fluid tagline */
    margin-bottom: 0;
}

/* Header Banner Box - Hidden on mobile/tablet, visible on desktop */
.header-banner {
    margin-left: auto;
    border: 2px solid var(--brand-accent);  /* Gold border */
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-white);
    box-shadow: 0 2px 4px rgba(149, 124, 61, 0.2);  /* Gold glow */
    display: none;  /* Hidden by default (mobile/tablet) */
}

.header-banner-image {
    display: block;
    height: 60px;
    width: auto;
    object-fit: contain;
}

/* Show banner on desktop (>1024px) */
@media (min-width: 1024px) {
    .header-banner {
        display: block;
    }

    .site-tagline {
        display: block;
    }

    .nav-divider {
        display: block;
    }
}

/* Hamburger Menu Button - Mobile/Tablet only */
.hamburger-btn {
    display: none;  /* Hidden by default (desktop) */
    position: absolute;
    top: 0;
    right: 0;
    background: var(--brand-secondary);  /* Prussian blue */
    border: 2px solid var(--brand-accent);  /* Gold border */
    border-radius: 8px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    z-index: 100;
    transition: var(--transition-base);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
}

.hamburger-btn:hover {
    background: var(--brand-accent);
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--bg-white);
    border-radius: 2px;
    transition: var(--transition-base);
}

/* Hamburger animation when open */
.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Navigation - Desktop (visible by default) */
.main-nav {
    display: flex;
    gap: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 1rem;
    transition: var(--transition-base);
}

.main-nav a {
    text-decoration: none;
    color: var(--bg-white);  /* White links */
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: var(--transition-base);
}

.main-nav a:hover {
    background: var(--brand-accent);  /* Gold hover */
    color: var(--brand-primary);
}

.main-nav a.active {
    background: var(--brand-secondary);  /* Prussian blue */
    color: var(--bg-white);
}

.main-nav a.disabled {
    color: #6B8CAE;
    cursor: not-allowed;
    opacity: 0.6;
}

.main-nav a.disabled:hover {
    background: transparent;
    color: #6B8CAE;
}

/* Nav divider and login link */
.nav-divider {
    display: none;  /* Hidden on mobile */
    width: 1px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 0.5rem;
}

.nav-login {
    background: var(--brand-accent) !important;
    color: var(--brand-primary) !important;
}

.nav-login:hover {
    background: var(--bg-white) !important;
    color: var(--brand-primary) !important;
}

/* Nav Donate Button - same style as Login, pushed to far right */
.nav-donate {
    background: var(--brand-accent) !important;
    color: var(--brand-primary) !important;
    margin-left: auto;
}

.nav-donate:hover {
    background: var(--bg-white) !important;
    color: var(--brand-primary) !important;
}

/* Subscribe CTA Banner */
.subscribe-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    margin: 1rem auto;
    max-width: 600px;
    font-size: 0.95rem;
}

.subscribe-cta span {
    flex: 1;
}

.subscribe-btn {
    background: var(--brand-accent);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.subscribe-btn:hover {
    background: #7a6531;
}

@media (max-width: 600px) {
    .subscribe-cta {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .subscribe-btn {
        width: 100%;
        text-align: center;
    }
}

/* Mobile/Tablet Navigation (≤768px) */
@media (max-width: 768px) {
    /* Hide tagline on mobile/tablet */
    .site-tagline {
        display: none;
    }

    /* Show hamburger button */
    .hamburger-btn {
        display: flex;
    }

    /* Hide navigation by default */
    .main-nav {
        display: none;
        flex-direction: column;
        gap: 0;
        border-top: none;
        padding-top: 0;
        margin-top: 1rem;
        background: var(--brand-primary);
        border-radius: 8px;
        overflow: hidden;
    }

    /* Show navigation when active */
    .main-nav.active {
        display: flex;
    }

    /* Dropdown menu styling */
    .main-nav a {
        padding: 1rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .main-nav a:last-child {
        border-bottom: none;
    }
}

/* Electoral Counter */
.electoral-counter {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.counter-bar {
    display: flex;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.democrat-bar {
    background: linear-gradient(135deg, var(--dem-strong) 0%, var(--dem-medium) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.republican-bar {
    background: linear-gradient(135deg, var(--rep-medium) 0%, var(--rep-strong) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.tossup-bar {
    background: var(--tossup);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.counter-note {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.95rem;
}

/* States Grid */
.states-section {
    margin-bottom: 3rem;
}

.states-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

.states-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.state-card {
    background: var(--bg-white);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
    border: 2px solid var(--brand-secondary);  /* Prussian blue border */
    border-left: 4px solid var(--tossup);  /* Rating color on left */
}

.state-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

/* State Rating Colors */
.state-card.safe-dem { border-left-color: var(--dem-strong); }
.state-card.likely-dem { border-left-color: var(--dem-medium); }
.state-card.lean-dem { border-left-color: var(--dem-light); }
.state-card.tilt-dem { border-left-color: var(--dem-tilt); }
.state-card.safe-rep { border-left-color: var(--rep-strong); }
.state-card.likely-rep { border-left-color: var(--rep-medium); }
.state-card.lean-rep { border-left-color: var(--rep-light); }
.state-card.tilt-rep { border-left-color: var(--rep-tilt); }
.state-card.tossup { border-left-color: var(--tossup); }

.state-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.state-header h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
}

.electoral-votes {
    background: var(--bg-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-gray);
}

.state-data {
    margin-bottom: 1rem;
}

.poll-results {
    margin-bottom: 0.75rem;
}

.result-bar {
    display: flex;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.dem-bar {
    background: var(--dem-medium);
}

.rep-bar {
    background: var(--rep-medium);
}

.result-numbers {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
}

.result-numbers .dem { color: var(--dem-strong); }
.result-numbers .rep { color: var(--rep-strong); }
.result-numbers .separator { color: var(--text-gray); }

.state-rating {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rating-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    background: var(--bg-light);
    color: var(--text-dark);
}

.poll-count {
    font-size: 0.85rem;
    color: var(--text-gray);
}

.no-polls {
    text-align: center;
    padding: 1rem 0;
}

.no-data {
    color: var(--text-gray);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.state-link {
    display: block;
    text-align: center;
    padding: 0.5rem;
    color: var(--dem-medium);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
    padding-top: 1rem;
    transition: color 0.2s;
}

.state-link:hover {
    color: var(--dem-strong);
}

/* Methodology */
.methodology {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.methodology h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.methodology p {
    color: var(--text-gray);
    margin-bottom: 1rem;
}

.methodology a {
    color: var(--dem-medium);
    text-decoration: none;
    font-weight: 600;
}

.methodology a:hover {
    text-decoration: underline;
}

/* Sticky Footer Donation Banner */
.donation-footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.donation-footer-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.donation-footer-text strong {
    font-size: 1rem;
    color: var(--text-dark);
}

.donation-footer-text span {
    font-size: 0.875rem;
    color: var(--text-gray);
}

.donation-footer-button {
    background: var(--brand-accent);  /* Gold */
    color: var(--brand-primary);  /* Dark blue text */
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}

.donation-footer-button:hover {
    background: #B59556;  /* Lighter gold */
}

.donation-footer-button svg {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .donation-footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .donation-footer-text span {
        font-size: 0.8rem;
    }

    .donation-footer-button {
        width: 100%;
        justify-content: center;
    }
}

/* Footer */
.site-footer {
    background: var(--brand-primary);  /* Dark royal blue */
    color: var(--bg-white);
    padding: 2rem 0;
    margin-top: 0;
    text-align: center;
    border-top: 3px solid var(--brand-accent);  /* Gold accent */
}

.site-footer p {
    margin: 0.5rem 0;
    opacity: 0.9;
}

.site-footer a {
    color: var(--brand-accent);  /* Gold links */
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: #B59556;  /* Lighter gold */
    text-decoration: underline;
}

/* State Detail Page */
.breadcrumb {
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--dem-medium);
    text-decoration: none;
    font-weight: 600;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.state-header-section {
    margin-bottom: 2rem;
}

.state-header-section h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.state-meta {
    display: flex;
    gap: 2rem;
    color: var(--text-gray);
    font-size: 1.1rem;
}

.current-average-box {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    border-left: 6px solid var(--tossup);
}

.current-average-box.safe-dem { border-left-color: var(--dem-strong); }
.current-average-box.likely-dem { border-left-color: var(--dem-medium); }
.current-average-box.lean-dem { border-left-color: var(--dem-light); }
.current-average-box.safe-rep { border-left-color: var(--rep-strong); }
.current-average-box.likely-rep { border-left-color: var(--rep-medium); }
.current-average-box.lean-rep { border-left-color: var(--rep-light); }

.current-average-box h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.current-average-box.no-data {
    text-align: center;
    padding: 3rem 2rem;
}

.average-bars {
    margin-bottom: 1.5rem;
}

.candidate-bar {
    margin-bottom: 1.5rem;
    position: relative;
}

.candidate-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.candidate-label .percentage {
    font-size: 2rem;
    font-weight: 800;
}

.dem-bar .candidate-label { color: #1a202c; }
.rep-bar .candidate-label { color: #1a202c; }

.candidate-bar .bar-fill {
    height: 40px;
    border-radius: 8px;
    transition: width 0.3s ease;
    background: var(--bg-light);
    position: relative;
    overflow: visible;
}

.dem-bar .bar-fill {
    background: linear-gradient(90deg, #2c5282 0%, #2d5a8d 100%);
    box-shadow: 0 2px 4px rgba(26, 76, 139, 0.3);
}

.rep-bar .bar-fill {
    background: linear-gradient(90deg, #a81c1c 0%, #b01f1f 100%);
    box-shadow: 0 2px 4px rgba(185, 28, 28, 0.3);
}

.average-details {
    display: flex;
    gap: 2rem;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
    flex-wrap: wrap;
}

.average-details > div {
    flex: 1;
    min-width: 150px;
}

.rating-display, .margin-display {
    font-size: 1.1rem;
}

.rating-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.margin-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.margin-value.dem { color: var(--dem-strong); }
.margin-value.rep { color: var(--rep-strong); }

/* Polls Table */
.polls-section {
    margin-bottom: 3rem;
}

.polls-section h2 {
    margin-bottom: 1.5rem;
}

.polls-table {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--brand-secondary);  /* Prussian blue border */
    overflow: hidden;
}

.polls-table table {
    width: 100%;
    border-collapse: collapse;
}

.polls-table th {
    background: var(--bg-light);
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
}

.polls-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.polls-table tbody tr:last-child td {
    border-bottom: none;
}

.polls-table tbody tr:hover {
    background: var(--bg-light);
}

.pollster-cell {
    min-width: 150px;
}

.pollster-cell small {
    color: var(--text-gray);
}

.date-cell {
    min-width: 100px;
}

.date-cell small {
    color: var(--text-gray);
    font-size: 0.85rem;
}

.sample-cell {
    text-align: center;
}

.sample-cell small {
    color: var(--text-gray);
}

.dem-cell {
    color: var(--dem-strong);
    text-align: center;
    font-size: 1.1rem;
}

.rep-cell {
    color: var(--rep-strong);
    text-align: center;
    font-size: 1.1rem;
}

.margin-cell {
    text-align: center;
    font-size: 1.1rem;
}

.margin-cell.dem-margin {
    color: var(--dem-strong);
}

.margin-cell.rep-margin {
    color: var(--rep-strong);
}

/* Historical Results */
.historical-section {
    margin-bottom: 3rem;
}

.historical-section h2 {
    margin-bottom: 1.5rem;
}

.historical-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.historical-card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.historical-card h3 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
}

.result-row.dem {
    background: var(--dem-light);
    color: white;
}

.result-row.rep {
    background: var(--rep-light);
    color: white;
}

.result-row .percentage {
    font-weight: 700;
}

.winner {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-gray);
}

/* Responsive - Mobile Optimizations */
@media (max-width: 768px) {
    .logo-title {
        gap: 1rem;
    }

    .site-logo {
        width: 60px;
        height: 60px;
    }

    .site-title {
        font-size: 1.75rem;
    }

    .site-tagline {
        font-size: 0.9rem;
    }

    .header-banner {
        display: none;
    }

    .states-grid {
        grid-template-columns: 1fr;
    }

    .counter-bar {
        height: 60px;
        font-size: 0.9rem;
    }

    .main-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
        font-size: 0.9rem;
    }

    .main-nav a {
        padding: 0.4rem 0.8rem;
    }

    .polls-table {
        overflow-x: auto;
    }

    .polls-table table {
        min-width: 600px;
    }

    .average-details {
        flex-direction: column;
        gap: 1rem;
    }

    .state-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Countdown Timer - Mobile already optimized by desktop base styles */
    .election-countdown {
        margin: 8px auto;
        padding: 6px;
        max-width: 100%;
    }

    .countdown-display {
        font-size: 0.9rem;
        letter-spacing: 0.5px;
        margin-bottom: 3px;
    }

    .countdown-label {
        font-size: 0.4rem;
    }

    /* Electoral Map - MOBILE ONLY - Very Small to Show Full Map */
    .electoral-map-container {
        padding: 0.5rem 0;
        overflow: hidden;
        margin: 0 auto;
        max-width: 100%;
        width: 100%;
    }

    .map-svg-wrapper {
        width: 300px !important;
        min-width: 300px !important;
        max-width: 300px !important;
        padding: 0;
        margin: 0 auto;
        overflow: hidden;
        display: block;
    }

    .map-svg-wrapper svg {
        width: 300px !important;
        height: auto !important;
        max-width: 300px !important;
        display: block;
        margin: 0 auto;
    }

    /* Sticky Footer Donation - MOBILE ONLY - Very Compact */
    .ad-banner-bottom {
        position: relative;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        max-height: none;
        margin-top: 2rem;
        background: var(--bg-light);
    }

    .donation-footer-content {
        flex-direction: column;
        gap: 0.2rem;
        text-align: center;
        padding: 0;
    }

    .donation-footer-text {
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
        margin-bottom: 0.2rem;
    }

    .donation-footer-text strong {
        font-size: 0.75rem;
        display: block;
        font-weight: 600;
        margin-bottom: 0.05rem;
    }

    .donation-footer-text span {
        font-size: 0.6rem;
        line-height: 1.15;
        display: block;
    }

    .donation-footer-button {
        width: auto;
        max-width: 150px;
        padding: 0.35rem 0.65rem;
        font-size: 0.7rem;
        margin: 0 auto;
        display: block;
    }

    /* Site Footer - Adjust spacing on mobile */
    .site-footer {
        padding: 2.5rem 1rem;
        margin-top: 1rem;
    }

    .site-footer p {
        font-size: 0.875rem;
        line-height: 1.6;
        margin-bottom: 0.75rem;
    }

    .footer-links {
        margin-top: 1rem;
    }

    /* Container padding adjustment */
    .container {
        padding: 0 15px;
    }

    /* Main content - add bottom padding for footer clearance */
    main.container {
        padding-bottom: 3rem;
        margin-bottom: 0;
    }

    /* Electoral vote bars - stack better on mobile */
    .electoral-votes-container {
        margin: 1rem 0;
    }

    /* Methodology section - better spacing */
    .methodology {
        margin-top: 2.5rem;
        padding: 1.5rem 1rem;
    }

    /* Electoral Vote Bar - Smaller text on mobile */
    .electoral-counter {
        margin: 1.5rem 0;
    }

    .counter-label {
        font-size: 0.85rem;
    }

    .counter-label strong {
        font-size: 1.1rem;
    }

    .counter-note {
        font-size: 0.85rem;
    }
}

/* Ad Banners */
.ad-banner-top {
    text-align: center;
    margin: 0 auto 2rem;
    max-width: 728px;
}

.ad-banner-top > * {
    margin: 0 auto;
}

/* Affiliate Disclosure */
.affiliate-disclosure {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-top: 1rem;
    font-style: italic;
}

/* Electoral Map */
.electoral-map-container {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.electoral-map-container h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.map-subtitle {
    text-align: center;
    color: var(--text-gray);
    margin-bottom: 2rem;
}

.map-svg-wrapper {
    width: 100%;
    max-width: 1020px;
    margin: 0 auto;
}

.map-svg-wrapper svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Only apply to path elements with state class, not groups */
.map-svg-wrapper path.state {
    cursor: pointer;
    transition: all 0.2s;
    stroke: #fff;
    stroke-width: 1.5;
    fill: var(--tossup) !important;
}

/* Ensure group containers don't get fills */
.map-svg-wrapper g.state {
    fill: none;
}

.map-svg-wrapper path.state:hover {
    stroke: #fff;
    stroke-width: 2.5;
}

.map-svg-wrapper path.state.safe-dem { fill: var(--dem-strong) !important; }
.map-svg-wrapper path.state.likely-dem { fill: var(--dem-medium) !important; }
.map-svg-wrapper path.state.lean-dem { fill: var(--dem-light) !important; }
.map-svg-wrapper path.state.tilt-dem { fill: var(--dem-tilt) !important; }
.map-svg-wrapper path.state.safe-rep { fill: var(--rep-strong) !important; }
.map-svg-wrapper path.state.likely-rep { fill: var(--rep-medium) !important; }
.map-svg-wrapper path.state.lean-rep { fill: var(--rep-light) !important; }
.map-svg-wrapper path.state.tilt-rep { fill: var(--rep-tilt) !important; }
.map-svg-wrapper path.state.tossup { fill: var(--tossup) !important; }

/* Election Countdown Timer */
.election-countdown {
    text-align: center;
    margin: 10px auto;
    padding: 8px;
    max-width: 250px;
    background: var(--brand-light-blue);  /* Solid light Prussian blue */
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.countdown-display {
    font-size: 1rem;
    font-weight: bold;
    color: #111827;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.countdown-number {
    display: inline-block;
    min-width: 18px;
    text-align: center;
}

.countdown-label {
    color: #374151;
    font-size: 0.45rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* Congressional District Circles (ME-2, NE-2) */
.map-svg-wrapper circle[id^="ME-"],
.map-svg-wrapper circle[id^="NE-"] {
    cursor: pointer;
    transition: all 0.2s;
    stroke: #fff;
    stroke-width: 2;
}

/* District colors - match state colors */
.map-svg-wrapper circle.safe-dem { fill: var(--dem-strong) !important; }
.map-svg-wrapper circle.likely-dem { fill: var(--dem-medium) !important; }
.map-svg-wrapper circle.lean-dem { fill: var(--dem-light) !important; }
.map-svg-wrapper circle.tilt-dem { fill: var(--dem-tilt) !important; }
.map-svg-wrapper circle.safe-rep { fill: var(--rep-strong) !important; }
.map-svg-wrapper circle.likely-rep { fill: var(--rep-medium) !important; }
.map-svg-wrapper circle.lean-rep { fill: var(--rep-light) !important; }
.map-svg-wrapper circle.tilt-rep { fill: var(--rep-tilt) !important; }
.map-svg-wrapper circle.tossup { fill: var(--tossup) !important; }

.map-svg-wrapper circle[id^="ME-"]:hover,
.map-svg-wrapper circle[id^="NE-"]:hover {
    stroke: #fff;
    stroke-width: 3;
    opacity: 0.8;
}

.map-svg-wrapper text {
    fill: white;
    font-weight: 700;
    pointer-events: none;
    text-shadow: 0 0 3px rgba(0,0,0,0.7);
}

.map-tooltip {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    visibility: hidden; /* Extra safety - hide when not in use */
}

.map-tooltip[style*="display: block"] {
    visibility: visible; /* Only show when JavaScript sets display: block */
}

.map-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.legend-color {
    width: 24px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
}

.legend-color.safe-dem { background: var(--dem-strong); }
.legend-color.likely-dem { background: var(--dem-medium); }
.legend-color.lean-dem { background: var(--dem-light); }
.legend-color.tilt-dem { background: var(--dem-tilt); }
.legend-color.tossup { background: var(--tossup); }
.legend-color.tilt-rep { background: var(--rep-tilt); }
.legend-color.lean-rep { background: var(--rep-light); }
.legend-color.likely-rep { background: var(--rep-medium); }
.legend-color.safe-rep { background: var(--rep-strong); }

/* State Page Layout - 70/30 split with sidebar */
.state-page-layout {
    display: grid;
    grid-template-columns: 70% 30%;
    gap: 2rem;
    margin-top: 2rem;
}

.state-main-content {
    min-width: 0; /* Prevent grid overflow */
}

.state-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-ad-box {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-ad-box img {
    max-width: 100%;
    height: auto;
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .state-page-layout {
        grid-template-columns: 1fr;
    }

    .state-sidebar {
        order: 2;
    }
}

/* Bottom Banner Ad (Sticky Footer Ad) */
.ad-banner-bottom {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-top: 2px solid var(--border);
    padding: 0.75rem 0;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    max-height: 120px;
    overflow: hidden;
}

.ad-banner-bottom img {
    max-width: 100%;
    max-height: 90px;
    height: auto;
}

/* PayPal Donation Placeholder Styles */
.donation-placeholder {
    background: linear-gradient(135deg, #6FA3FF 0%, #B8D4FF 100%);  /* Gradient of new blues */
    border: 2px solid var(--brand-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.donation-placeholder:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.donation-content h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    color: var(--text-dark);
    font-weight: 600;
}

.donation-content p {
    margin: 0 0 1rem 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.donation-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--brand-accent);  /* Gold */
    color: var(--brand-primary);  /* Dark blue text */
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.donation-button:hover {
    background: #B59556;  /* Lighter gold */
    transform: scale(1.05);
}

.paypal-icon {
    width: 20px;
    height: 20px;
}

.donation-note {
    margin: 0.75rem 0 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Donation Banner (top_banner) */
.donation-banner {
    max-height: 120px;
    padding: 1rem 2rem;
}

.donation-banner .donation-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.donation-banner .donation-content p {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.donation-banner .donation-button {
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
}

/* Donation Sidebar (sidebar_box_1, sidebar_box_2) */
.donation-sidebar {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Donation Footer (bottom_banner) */
.donation-footer {
    max-height: 100px;
    padding: 1rem 2rem;
}

.donation-footer .donation-content h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.donation-footer .donation-content p {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.donation-footer .donation-button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Responsive: Simplify on mobile */
@media (max-width: 768px) {
    .donation-banner,
    .donation-footer {
        padding: 1rem;
    }

    .donation-content h3 {
        font-size: 1rem;
    }

    .donation-content p {
        font-size: 0.85rem;
    }

    .donation-button {
        font-size: 0.9rem;
        padding: 0.65rem 1.25rem;
    }
}


/* Legal Pages (Privacy, Terms, About) */
.legal-page {
    background: var(--bg-white);
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 900px;
    margin: 2rem auto;
}

.legal-page h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.legal-page .last-updated {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.legal-page section {
    margin-bottom: 2.5rem;
}

.legal-page h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    margin-top: 2rem;
}

.legal-page h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
    color: var(--text-dark);
}

.legal-page p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.legal-page ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.legal-page li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.legal-page a {
    color: var(--dem-medium);
    text-decoration: none;
}

.legal-page a:hover {
    text-decoration: underline;
}

.legal-page strong {
    color: var(--text-dark);
    font-weight: 600;
}

.footer-links {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.footer-links a {
    color: #e5e7eb;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .legal-page {
        padding: 1.5rem;
        margin: 1rem;
    }

    .legal-page h1 {
        font-size: 2rem;
    }

    .legal-page h2 {
        font-size: 1.5rem;
    }
}

/* Social Media Links */
.social-media-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 0;
    margin: 1rem 0;
}

.social-media-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 2px solid var(--border);
    color: var(--text-gray);
    font-size: 1.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-media-links a:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.social-media-links a:hover .fa-facebook {
    color: #1877f2;
}

.social-media-links a:hover .fa-twitter {
    color: #1da1f2;
}

.social-media-links a:hover .fa-instagram {
    color: #e4405f;
}

.social-media-links a:hover .fa-youtube {
    color: #ff0000;
}

.social-media-links a:hover .fa-linkedin {
    color: #0077b5;
}

.social-media-links a:hover .fa-x-twitter {
    color: #000000;
}

/* Social Media Icon Images (Truth Social, GETTR) */
.social-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

@media (max-width: 768px) {
    .social-media-links {
        gap: 1rem;
        padding: 1.5rem 0;
    }

    .social-media-links a {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .social-icon-img {
        width: 24px;
        height: 24px;
    }
}

/* ============================================
   SENATE PAGE STYLES
   Created: December 2025
   ============================================ */

.page-title {
    font-size: var(--text-2xl);
    color: var(--brand-primary);
    margin-bottom: 0.2rem;
    text-align: center;
    letter-spacing: -0.01em;
}

.page-subtitle {
    font-size: var(--text-base);
    color: var(--brand-accent);
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--space-md);
    letter-spacing: 0.03em;
}

/* Senate Balance Bar */
.senate-balance {
    background: var(--bg-white);
    border: 2px solid var(--brand-secondary);
    border-radius: 8px;
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.senate-balance h3 {
    font-size: var(--text-xl);
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--space-sm);
}

.balance-bar {
    display: flex;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.balance-bar .dem-seats {
    background: var(--dem-strong);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: var(--space-sm);
}

.balance-bar .rep-seats {
    background: var(--rep-strong);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: var(--space-sm);
}

.balance-bar .seat-count {
    color: white;
    font-weight: bold;
    font-size: var(--text-lg);
}

.balance-labels {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-xs);
    font-size: var(--text-sm);
}

.balance-labels .dem-label {
    color: var(--dem-strong);
    font-weight: 600;
}

.balance-labels .rep-label {
    color: var(--rep-strong);
    font-weight: 600;
}

.balance-labels .majority-marker {
    color: var(--text-secondary);
    font-style: italic;
}

/* Senate Races Section */
.senate-races {
    margin-bottom: var(--space-xl);
}

.senate-races h3 {
    font-size: var(--text-2xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-md);
}

.rating-group {
    margin-bottom: var(--space-lg);
}

.rating-header {
    font-size: var(--text-lg);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 4px;
    margin-bottom: var(--space-sm);
    color: white;
}

.rating-header.tossup {
    background: var(--tossup);
}

.rating-header.lean-d {
    background: var(--dem-light);
}

.rating-header.lean-r {
    background: var(--rep-light);
}

.rating-header.safe-d {
    background: var(--dem-strong);
}

.rating-header.safe-r {
    background: var(--rep-strong);
}

/* Race Cards */
.race-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
}

.race-cards.compact {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-sm);
}

.race-card {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: var(--space-md);
    transition: var(--transition-base);
    border-left-width: 4px;
    /* Clickable link styles */
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.race-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--brand-secondary);
}

.race-card.tossup {
    border-left-color: var(--tossup);
}

.race-card.lean-d, .race-card.tilt-d {
    border-left-color: var(--dem-light);
}

.race-card.likely-d {
    border-left-color: var(--dem-medium);
}

.race-card.safe-d {
    border-left-color: var(--dem-strong);
}

.race-card.lean-r, .race-card.tilt-r {
    border-left-color: var(--rep-light);
}

.race-card.likely-r {
    border-left-color: var(--rep-medium);
}

.race-card.safe-r {
    border-left-color: var(--rep-strong);
}

.race-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.race-header .state-code {
    font-weight: bold;
    font-size: var(--text-xl);
    color: var(--brand-primary);
}

.race-header .state-name {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.race-header .special-badge {
    background: var(--brand-accent);
    color: white;
    font-size: var(--text-xs);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

.race-details {
    margin-bottom: var(--space-sm);
}

.race-details .incumbent {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-base);
}

.race-details .incumbent.d .party-badge {
    background: var(--dem-strong);
}

.race-details .incumbent.r .party-badge {
    background: var(--rep-strong);
}

.party-badge {
    color: white;
    font-size: var(--text-xs);
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
}

.race-details .challenger {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

.race-rating {
    display: flex;
    justify-content: flex-end;
}

/* Multi-Source Ratings */
.rating-multi-source {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.source-indicator {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: var(--text-xs);
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-light);
    color: var(--text-gray);
}

.source-indicator i {
    font-size: 0.7rem;
}

.source-indicator.sources-agree {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.source-indicator.sources-vary {
    background: rgba(234, 179, 8, 0.15);
    color: #ca8a04;
}

/* Rating Pills (for showing all sources) */
.rating-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: var(--space-xs);
}

.rating-pill {
    font-size: var(--text-xs);
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--bg-light);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rating-pill .source-abbrev {
    font-weight: 600;
    color: var(--text-dark);
}

.rating-pill.changed {
    border: 1px solid var(--brand-accent);
}

/* Compact Race Cards (for Safe seats) */
.race-card-compact {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    border-left-width: 3px;
    /* Clickable link styles */
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: var(--transition-base);
}

.race-card-compact:hover {
    background: var(--bg-light);
    border-color: var(--brand-secondary);
}

.race-card-compact .state-code {
    font-weight: bold;
    color: var(--brand-primary);
}

.race-card-compact .state-name {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.race-card-compact .incumbent-name {
    margin-left: auto;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Retirements Section */
.retirements {
    margin-bottom: var(--space-xl);
}

.retirements h3 {
    font-size: var(--text-2xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-md);
}

.retirement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.retirement-card {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: var(--space-md);
}

.retirement-card.dem {
    border-left: 4px solid var(--dem-strong);
}

.retirement-card.rep {
    border-left: 4px solid var(--rep-strong);
}

.retirement-card h4 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-sm);
}

.retirement-card.dem h4 {
    color: var(--dem-strong);
}

.retirement-card.rep h4 {
    color: var(--rep-strong);
}

.retirement-card ul {
    list-style: none;
    padding: 0;
}

.retirement-card li {
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border-light);
    font-size: var(--text-sm);
}

.retirement-card li:last-child {
    border-bottom: none;
}

/* Senate Map Section */
.senate-map-section {
    margin-bottom: var(--space-lg);
}

.senate-map-container {
    margin-bottom: var(--space-lg);
}

.senate-map-container .map-svg-wrapper {
    max-width: 100%;
    margin: 0 auto;
}

.senate-map-container .map-svg-wrapper svg {
    width: 100%;
    height: auto;
}

/* States without Senate/Governor races - very light grey with light border
   (light enough to stay distinct from the darker Toss-up grey).
   Needs higher specificity than ".map-svg-wrapper path.state { fill: var(--tossup) }"
   or no-race states render grey (same as Toss-up). */
.no-senate-race,
.map-svg-wrapper path.state.no-senate-race {
    fill: #E8E8E8 !important;
    stroke: #d1d5db;
    stroke-width: 0.5;
}

/* Legend color for no race */
.legend-color.no-race {
    background-color: #E8E8E8;
    border: 1px solid #d1d5db;
}

/* ═══ Primary Map Colors ═══ */
.map-svg-wrapper path.state.primary-results { fill: #16a34a !important; stroke: #15803d; stroke-width: 1; }
.map-svg-wrapper path.state.primary-soon { fill: var(--brand-accent, #957C3D) !important; stroke: #7a6430; stroke-width: 1; }
.map-svg-wrapper path.state.primary-upcoming { fill: #5b9bd5 !important; stroke: #4a7fb5; stroke-width: 0.5; }
.map-svg-wrapper path.state.primary-later { fill: #a8c8e8 !important; stroke: #8bb0d4; stroke-width: 0.5; }
.map-svg-wrapper path.state.primary-completed { fill: #94a3b8 !important; stroke: #78899a; stroke-width: 0.5; }
.map-svg-wrapper path.state.no-primary-data { fill: #e5e7eb !important; stroke: #9ca3af; stroke-width: 0.5; }
/* Primary map legend colors */
.legend-color.primary-results-legend { background: #16a34a; }
.legend-color.primary-soon-legend { background: var(--brand-accent, #957C3D); }
.legend-color.primary-upcoming-legend { background: #5b9bd5; }
.legend-color.primary-later-legend { background: #a8c8e8; }
.legend-color.primary-completed-legend { background: #94a3b8; }

/* ═══ State Primary Page ═══ */
.primary-state-header {
    margin-bottom: var(--space-lg, 2rem);
}
.primary-state-header h1 {
    color: var(--brand-primary, #002349);
    margin-bottom: var(--space-sm, 0.75rem);
}
.primary-date-box {
    display: flex;
    align-items: center;
    gap: var(--space-md, 1.5rem);
    padding: var(--space-md, 1.5rem);
    background: #f0f4f8;
    border-left: 4px solid var(--brand-accent, #957C3D);
    border-radius: 6px;
    margin-bottom: var(--space-sm, 0.75rem);
}
.primary-date-main {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.primary-date-day {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-primary, #002349);
}
.primary-date-year {
    font-size: 0.85rem;
    color: #64748b;
}
.primary-date-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.primary-status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.primary-status-badge.completed { background: #94a3b8; color: #fff; }
.primary-status-badge.upcoming { background: var(--brand-accent, #957C3D); color: #fff; }
.primary-type-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.primary-type-badge.open { background: #dbeafe; color: #1e40af; }
.primary-type-badge.closed { background: #f1f5f9; color: #64748b; }
.primary-key-dates {
    display: flex;
    gap: var(--space-md, 1.5rem);
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #475569;
}
.primary-runoff-note {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: var(--space-lg, 2rem);
    font-size: 0.9rem;
}
/* Office-scoped split calendar (LA 2026: senate primary May 16, house jungle Nov 3) */
.primary-split-calendar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md, 1.5rem);
    margin-bottom: var(--space-sm, 0.75rem);
}
.primary-date-box.office-scoped {
    flex: 1 1 300px;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0;
}
.primary-office-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--brand-primary, #002349);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.office-runoff-line { font-size: 0.85rem; color: #475569; }
.office-primary-note { font-size: 0.8rem; color: #64748b; max-width: 52ch; }
.fundraising-note {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.5rem;
    font-style: italic;
}
/* Generic-ballot 30-day average panel + ALL/RV/LV toggle */
.gb-average-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--brand-accent, #957C3D);
    border-radius: 8px;
    padding: var(--space-md, 1.5rem);
    margin-bottom: var(--space-md, 1.5rem);
}
.gb-pop-toggle { display: flex; gap: 0.5rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.gb-pop-btn {
    padding: 6px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
}
.gb-pop-btn.active {
    background: var(--brand-primary, #002349);
    border-color: var(--brand-primary, #002349);
    color: #ffffff;
}
.gb-pop-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.gb-average-display {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 1.15rem;
}
.gb-avg-side strong { font-size: 1.6rem; }
.gb-avg-side.dem strong { color: #1d4ed8; }
.gb-avg-side.rep strong { color: #b91c1c; }
.gb-avg-sep { color: #94a3b8; }
.gb-avg-lead {
    font-size: 0.9rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: #e2e8f0;
    color: #334155;
}
.gb-avg-lead.dem { background: #dbeafe; color: #1e40af; }
.gb-avg-lead.rep { background: #fee2e2; color: #991b1b; }
.gb-avg-note { font-size: 0.85rem; color: #64748b; margin-top: 0.5rem; }
.primary-race-section {
    margin-bottom: var(--space-xl, 2.5rem);
    padding: var(--space-md, 1.5rem);
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.primary-section-title {
    font-size: 1.3rem;
    color: var(--brand-primary, #002349);
    margin-bottom: var(--space-md, 1.5rem);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.section-icon { color: var(--brand-accent, #957C3D); }
.race-count {
    font-size: 0.85rem;
    font-weight: 400;
    color: #64748b;
    margin-left: auto;
}
.primary-race-info { margin-bottom: var(--space-md, 1.5rem); }
.primary-candidates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md, 1.5rem);
}
.party-column {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}
.party-header {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}
.party-header.r { background: var(--rep-strong, #c62828); }
.party-header.d { background: var(--dem-strong, #1a4c8b); }
.party-header.i { background: #6b7280; }
.candidate-row {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.candidate-row:last-child { border-bottom: none; }
.candidate-row.incumbent { background: #f8fafc; }
.candidate-row.primary-winner { background: #f0fdf4; }
.candidate-name { font-weight: 500; }
.incumbent-badge, .winner-badge, .open-seat-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.incumbent-badge { background: #e2e8f0; color: #475569; }
.winner-badge { background: #bbf7d0; color: #166534; }
.open-seat-badge { background: #fef3c7; color: #92400e; }
.open-seat-badge.small { font-size: 0.65rem; padding: 1px 6px; }
.fundraising { font-size: 0.8rem; color: #64748b; margin-left: auto; }
.race-link { margin-top: var(--space-sm, 0.75rem); }
.race-link a {
    color: var(--brand-secondary, #1D63FF);
    font-weight: 500;
    text-decoration: none;
}
.race-link a:hover { text-decoration: underline; }
.no-data {
    color: #94a3b8;
    font-style: italic;
    padding: var(--space-sm, 0.75rem) 0;
}

/* House districts list on state primary page */
.house-districts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.house-district-row {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fafbfc;
}
.district-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}
.district-label {
    font-weight: 700;
    color: var(--brand-primary, #002349);
    min-width: 50px;
}
.district-name {
    color: #64748b;
    font-size: 0.85rem;
}
.district-incumbent {
    margin-left: auto;
    font-size: 0.85rem;
}
.district-candidates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.5rem 0;
}
.candidate-chip {
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 15px;
    background: #f1f5f9;
    color: #475569;
}
.candidate-chip.r { background: #fee2e2; color: #991b1b; }
.candidate-chip.d { background: #dbeafe; color: #1e3a5f; }
.candidate-chip.winner { font-weight: 600; }
.district-detail-link {
    font-size: 0.8rem;
    color: var(--brand-secondary, #1D63FF);
    text-decoration: none;
}
.district-detail-link:hover { text-decoration: underline; }
.rating-badge.inline { font-size: 0.75rem; padding: 2px 10px; vertical-align: middle; }
.rating-badge.small { font-size: 0.7rem; padding: 2px 8px; }
/* Source of the resolved rating (poll-derived vs editorial) — quiet, transparent. */
.rating-source { font-size: 0.68rem; color: var(--text-muted, #6b7280); text-transform: uppercase; letter-spacing: 0.03em; margin-left: 6px; white-space: nowrap; cursor: help; }

/* ── Hero poll-rating card: OUR signal leads; experts are the comparison. ── */
.race-rating-hero { border-radius: 12px; padding: 1.25rem 1.5rem; margin: .25rem 0 1.25rem; color: #fff; box-shadow: 0 3px 14px rgba(0,0,0,.10); }
.race-rating-hero.safe-dem, .race-rating-hero.likely-dem, .race-rating-hero.lean-dem, .race-rating-hero.tilt-dem { background: linear-gradient(135deg, #1D63FF, #123a8f); }
.race-rating-hero.safe-rep, .race-rating-hero.likely-rep, .race-rating-hero.lean-rep, .race-rating-hero.tilt-rep { background: linear-gradient(135deg, #d42a2a, #8f1414); }
.race-rating-hero.tossup { background: linear-gradient(135deg, #5b6472, #3a414d); }
.race-rating-hero .hero-main { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.race-rating-hero .hero-rating { font-size: 2.3rem; font-weight: 800; line-height: 1; }
.race-rating-hero .hero-meta { font-size: 1rem; opacity: .95; }
.race-rating-hero .hero-tag { text-transform: uppercase; letter-spacing: .04em; font-size: .7rem; background: rgba(255,255,255,.22); padding: 3px 9px; border-radius: 20px; margin-right: .5rem; vertical-align: middle; }
.race-rating-hero .hero-diverge { margin-top: .7rem; font-size: .92rem; background: rgba(255,255,255,.16); padding: .45rem .75rem; border-radius: 8px; display: inline-block; }
.party-badge.small { font-size: 0.7rem; padding: 1px 6px; }
.back-link {
    margin: var(--space-lg, 2rem) 0;
    padding-top: var(--space-md, 1.5rem);
    border-top: 1px solid #e2e8f0;
}
.back-link a {
    color: var(--brand-secondary, #1D63FF);
    text-decoration: none;
    font-weight: 500;
}
.back-link a:hover { text-decoration: underline; }

/* ═══ Primary Results Display ═══ */
.primary-results-section {
    margin-top: var(--space-md, 1.5rem);
    padding-top: var(--space-md, 1.5rem);
    border-top: 2px solid #e2e8f0;
}
.results-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-primary, #002349);
    margin-bottom: var(--space-sm, 0.75rem);
}
.results-party-block {
    margin-bottom: var(--space-md, 1.5rem);
}
.results-party-label {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: inline-block;
}
.results-party-label.republican { background: #fee2e2; color: #991b1b; }
.results-party-label.democratic, .results-party-label.democrat { background: #dbeafe; color: #1e3a5f; }
.results-party-label.open { background: #f3e8ff; color: #6b21a8; }
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.results-table th {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
}
.results-table th.num { text-align: right; }
.results-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
}
.results-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.results-table tr.result-winner {
    background: #f0fdf4;
    font-weight: 600;
}
.winner-check {
    color: #16a34a;
    font-weight: 700;
    margin-left: 4px;
}
.result-bar-wrapper {
    width: 80px;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}
.result-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.result-bar.republican { background: #ef4444; }
.result-bar.democratic { background: #3b82f6; }
.result-bar.open { background: #8b5cf6; }
.precincts-reporting {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 6px;
    font-style: italic;
}

/* House district results (compact) */
.district-results {
    margin: 0.5rem 0;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-radius: 4px;
    border-left: 3px solid #e2e8f0;
}
.district-results-party {
    margin-bottom: 0.25rem;
}
.mini-party-label {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    margin-right: 4px;
}
.mini-party-label.republican { background: #fee2e2; color: #991b1b; }
.mini-party-label.democratic { background: #dbeafe; color: #1e3a5f; }
.district-result-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    padding: 2px 0;
    margin-right: 12px;
}
.district-result-row.winner { font-weight: 600; }
.result-votes { color: #64748b; font-size: 0.75rem; }
.result-pct { color: #475569; font-weight: 500; }

@media (max-width: 768px) {
    .primary-date-box { flex-direction: column; align-items: flex-start; }
    .primary-key-dates { flex-direction: column; gap: 0.25rem; }
    .primary-candidates-grid { grid-template-columns: 1fr; }
    .district-header { flex-direction: column; align-items: flex-start; }
    .district-incumbent { margin-left: 0; }
    .result-bar-wrapper { width: 50px; }
    .district-result-row { display: flex; }
}

/* Responsive adjustments for Senate page */
@media (max-width: 768px) {
    .page-title {
        font-size: var(--text-xl);
    }

    .balance-bar {
        height: 32px;
    }

    .balance-labels {
        flex-direction: column;
        align-items: center;
        gap: var(--space-xs);
    }

    .race-cards {
        grid-template-columns: 1fr;
    }

    .race-cards.compact {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   HOUSE PAGE STYLES
   Created: December 2025
   ============================================ */

.house-balance {
    background: var(--bg-white);
    border: 2px solid var(--brand-secondary);
    border-radius: 8px;
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.house-balance h3 {
    font-size: var(--text-xl);
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--space-sm);
}

.house-races {
    margin-bottom: var(--space-xl);
}

.house-races h3 {
    font-size: var(--text-2xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-xs);
}

.section-note {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-md);
}

/* District code styling (for House races) */
.district-code {
    font-weight: bold;
    font-size: var(--text-xl);
    color: var(--brand-primary);
}

/* 2024 margin display */
.margin-2024 {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
    font-style: italic;
}

/* Likely rating headers */
.rating-header.likely-d {
    background: var(--dem-medium);
}

.rating-header.likely-r {
    background: var(--rep-medium);
}

/* Browse States Section */
.browse-states {
    margin-bottom: var(--space-xl);
}

.browse-states h3 {
    font-size: var(--text-2xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-xs);
}

.state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.state-link-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm);
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    transition: var(--transition-base);
}

.state-link-box:hover {
    border-color: var(--brand-secondary);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.state-link-box .state-code {
    font-weight: bold;
    font-size: var(--text-lg);
    color: var(--brand-primary);
}

.state-link-box .district-count {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* House Map Section */
.house-map-section {
    margin-bottom: var(--space-lg);
}

/* Responsive adjustments for House page */
@media (max-width: 768px) {
    .state-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: var(--space-xs);
    }

    .state-link-box {
        padding: var(--space-xs);
    }
}

/* ============================================
   PHASE 1: HOMEPAGE REDESIGN — NAV, MAP TOGGLE,
   SCOREBOARD, RACES TO WATCH, STATE TABLE, STUBS
   ============================================ */

/* --- Subscribe Button (replaces Donate) --- */
.nav-subscribe {
    background: #C9A84C !important;
    color: var(--brand-primary) !important;
    font-weight: 700 !important;
    margin-left: auto;
}

.nav-subscribe:hover {
    background: var(--bg-white) !important;
    color: var(--brand-primary) !important;
}

/* --- Nav adjustments for 7+ items (768-1024px) --- */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-nav {
        gap: 0.5rem;
    }
    .main-nav a {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
}

/* --- Map Toggle Tabs --- */
.map-toggle-container {
    margin-bottom: var(--space-sm);
}

.map-toggle-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
}

.map-tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-base);
    margin-bottom: -2px;
}

.map-tab:hover {
    color: var(--brand-primary);
    background: var(--bg-hover);
}

.map-tab.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-accent);
}

.map-panels {
    margin-bottom: var(--space-lg);
}

.map-panel {
    min-height: 200px;
    overflow: hidden;
}

.map-panel svg {
    max-width: 100%;
    height: auto;
}

/* --- Scoreboard Row --- */
.scoreboard {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border-color);
}

.scoreboard-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.scoreboard-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.scoreboard-seats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-xl);
    font-weight: 800;
}

.seats-rep { color: var(--rep-strong); }
.seats-dem { color: var(--dem-strong); }
.seats-divider { color: var(--text-tertiary); font-weight: 400; }

.scoreboard-days {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.scoreboard-days .countdown-number {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--brand-primary);
}

.scoreboard-days .countdown-unit {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

@media (max-width: 480px) {
    .scoreboard {
        gap: var(--space-sm);
        padding: var(--space-xs) var(--space-sm);
    }
    .scoreboard-seats {
        font-size: var(--text-lg);
    }
}

/* --- Races to Watch --- */
.races-to-watch {
    margin-bottom: var(--space-lg);
}

.races-to-watch h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.watch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-sm);
}

.watch-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: var(--space-sm);
    background: var(--bg-white);
    border-radius: var(--radius-base);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--tossup);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition-base);
}

.watch-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.watch-card.safe-dem { border-left-color: var(--dem-strong); }
.watch-card.likely-dem { border-left-color: var(--dem-medium); }
.watch-card.lean-dem { border-left-color: var(--dem-light); }
.watch-card.tilt-dem { border-left-color: var(--dem-tilt); }
.watch-card.safe-rep { border-left-color: var(--rep-strong); }
.watch-card.likely-rep { border-left-color: var(--rep-medium); }
.watch-card.lean-rep { border-left-color: var(--rep-light); }
.watch-card.tilt-rep { border-left-color: var(--rep-tilt); }
.watch-card.tossup { border-left-color: var(--tossup); }

.watch-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.watch-label {
    font-weight: 700;
    font-size: var(--text-base);
}

.watch-card-body {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.watch-card-footer {
    margin-top: auto;
}

/* Party badges */
.party-badge {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.party-badge.d, .party-badge.D { background: var(--dem-medium); }
.party-badge.r, .party-badge.R { background: var(--rep-medium); }
.party-badge.i, .party-badge.I { background: var(--tossup); }

.party-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.party-dot.d, .party-dot.D { background: var(--dem-medium); }
.party-dot.r, .party-dot.R { background: var(--rep-medium); }
.party-dot.i, .party-dot.I { background: var(--tossup); }

.special-badge {
    background: var(--brand-accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Condensed State Table --- */
.states-table-section {
    margin-bottom: var(--space-lg);
}

.states-table-section h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.states-table-wrapper {
    background: var(--bg-white);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.states-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.states-table thead th {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
}

.states-table tbody td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.states-table tbody tr:hover {
    background: var(--bg-hover);
}

.states-table a {
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.states-table a:hover {
    color: var(--brand-secondary);
}

.states-table .text-center {
    text-align: center;
}

.states-table .text-muted {
    color: var(--text-tertiary);
}

.senate-race-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Sortable table headers */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem !important;
}

.sortable::after {
    content: '\2195'; /* up-down arrow */
    position: absolute;
    right: 0.5rem;
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.sortable.sort-asc::after { content: '\25B2'; color: var(--brand-primary); }
.sortable.sort-desc::after { content: '\25BC'; color: var(--brand-primary); }

.rating-badge.small {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
}

/* --- Coming Soon Pages --- */
.coming-soon-page {
    text-align: center;
    padding: var(--space-3xl) var(--space-md);
    max-width: 600px;
    margin: 0 auto;
}

.coming-soon-page h1 {
    font-size: var(--text-3xl);
    color: var(--brand-primary);
    margin-bottom: var(--space-xs);
}

.coming-soon-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-lg);
    margin-bottom: var(--space-md);
}

.coming-soon-badge {
    display: inline-block;
    background: var(--brand-accent);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: var(--text-base);
    margin-bottom: var(--space-md);
}

.coming-soon-page p {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--space-md);
}

.btn-back {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    background: var(--brand-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-base);
    font-weight: 600;
    transition: var(--transition-base);
}

.btn-back:hover {
    background: var(--brand-secondary);
}

/* --- Freshness Timestamps --- */
.freshness-timestamp {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-style: italic;
}

/* ============================================
   PHASE 2: ECHARTS — CHART CONTAINERS & PAYWALL
   ============================================ */

.chart-section {
    margin-bottom: var(--space-lg);
}

.chart-section h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.spectrum-section {
    margin-bottom: var(--space-md);
}

.ps-chart {
    width: 100%;
    min-height: 100px;
    border-radius: var(--radius-base);
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e8ebf0;
    box-shadow: 0 1px 6px rgba(0, 35, 73, 0.05);
}

/* Main poll-trend chart: generous height, breathing room inside the card */
.ps-chart--trend {
    height: 440px;
    padding: var(--space-sm) var(--space-xs);
}

@media (max-width: 640px) {
    .ps-chart--trend {
        height: 340px;
    }
}

/* Small muted caption under a chart (methodology/freshness note) */
.chart-caption {
    margin-top: var(--space-xs);
    font-size: 0.8rem;
    color: #6b7280;
}

/* Embed-code disclosure under charts (AEO P5) */
.chart-embed {
    margin-top: var(--space-xs);
    font-size: 0.85rem;
}

.chart-embed summary {
    cursor: pointer;
    color: #6b7280;
}

.chart-embed textarea {
    width: 100%;
    margin-top: var(--space-xs);
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-primary);
    background: #f8f9fa;
    border: 1px solid #e8ebf0;
    border-radius: var(--radius-base);
    padding: var(--space-xs);
    resize: vertical;
}

/* ============================================
   RACE Q&A (AEO conversational answers)
   ============================================ */

.race-qa {
    margin-bottom: var(--space-lg);
}

.race-qa h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.qa-item {
    background: #ffffff;
    border: 1px solid #e8ebf0;
    border-radius: var(--radius-base);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
}

.qa-question {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin: 0 0 0.35rem;
}

.qa-answer {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.55;
}

.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    background: #ffffff;
    color: #6b7280;
    font-size: var(--text-sm);
    border-radius: var(--radius-base);
}

.chart-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    background: #ffffff;
    color: #C0392B;
    font-size: var(--text-sm);
    border-radius: var(--radius-base);
}

/* Paywall overlay for tier-gated charts */
.chart-paywalled {
    position: relative;
}

.chart-paywall-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 27, 42, 0.85);
    backdrop-filter: blur(6px);
    border-radius: var(--radius-base);
    z-index: 10;
}

.chart-paywall-content {
    text-align: center;
    color: #E8EDF2;
    padding: var(--space-lg);
}

.chart-paywall-content i {
    font-size: 2rem;
    color: var(--brand-accent);
    margin-bottom: var(--space-sm);
    display: block;
}

.chart-paywall-content p {
    margin-bottom: var(--space-sm);
    font-size: var(--text-base);
}

.chart-paywall-btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: #C9A84C;
    color: var(--brand-primary);
    text-decoration: none;
    border-radius: var(--radius-base);
    font-weight: 700;
    transition: var(--transition-base);
}

.chart-paywall-btn:hover {
    background: #ddbf6a;
}

/* ============================================
   PHASE 4: HOMEPAGE GRID + SIDEBAR COMPONENTS
   ============================================ */

/* --- Homepage Grid Layout --- */
.homepage-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-lg);
    align-items: start;
    margin-bottom: var(--space-lg);
}

.homepage-main {
    min-width: 0; /* prevent grid blowout */
    overflow: hidden;
}

.homepage-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

@media (max-width: 768px) {
    .homepage-grid {
        grid-template-columns: 1fr 240px;
    }
}

@media (max-width: 600px) {
    .homepage-grid {
        grid-template-columns: 1fr 200px;
    }
}

@media (max-width: 480px) {
    .homepage-grid {
        grid-template-columns: 1fr;
    }
    .homepage-sidebar {
        order: 2;
    }
    .sidebar-card {
        padding: var(--space-xs);
    }
    .sidebar-card-title {
        font-size: var(--text-sm);
    }
}

/* --- Sidebar Card Base --- */
.sidebar-card {
    background: var(--bg-white);
    border-radius: var(--radius-base);
    border: 1px solid var(--border-color);
    padding: var(--space-sm) var(--space-md);
    box-shadow: var(--shadow-sm);
}

.sidebar-card-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: var(--space-sm);
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--brand-accent);
}

/* --- Sidebar Links --- */
.sidebar-link {
    display: block;
    margin-top: var(--space-sm);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--brand-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.sidebar-link:hover {
    color: var(--brand-primary);
}

/* --- Sidebar Lists --- */
.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: var(--text-sm);
}

.sidebar-list li:last-child {
    border-bottom: none;
}

.sidebar-empty {
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    font-style: italic;
}

/* --- Senate Scoreboard Sidebar --- */
.sidebar-composition {
    margin-bottom: var(--space-xs);
}

.sidebar-comp-bar {
    display: flex;
    height: 28px;
    border-radius: var(--radius-base);
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.comp-dem {
    background: var(--dem-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease;
}

.comp-dem span {
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

.comp-rep {
    background: var(--rep-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease;
}

.comp-rep span {
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

.sidebar-comp-note {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
}

.sidebar-rating-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: var(--space-xs);
    margin-bottom: var(--space-xs);
}

/* --- Races in News Sidebar --- */
.sidebar-news-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-news-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-news-item:last-child {
    border-bottom: none;
}

.sidebar-news-item a {
    display: block;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.sidebar-news-item a:hover {
    color: var(--brand-secondary);
}

.sidebar-news-race {
    font-weight: 600;
    font-size: var(--text-sm);
    margin-bottom: 0.2rem;
}

.sidebar-news-change {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.sidebar-news-arrow {
    color: var(--text-tertiary);
}

/* --- Latest Polls Sidebar --- */
.sidebar-polls-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.sidebar-poll-race {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.sidebar-poll-pollster {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.sidebar-poll-margin {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--brand-primary);
}

/* --- Primary Calendar Sidebar --- */
.sidebar-date {
    font-weight: 700;
    font-size: var(--text-xs);
    color: var(--brand-accent);
    white-space: nowrap;
    min-width: 45px;
}

.sidebar-primary-label {
    font-size: var(--text-sm);
    color: var(--text-primary);
}

/* --- Subscribe CTA Sidebar --- */
.sidebar-cta {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    text-align: center;
}

.sidebar-cta p {
    color: #C8D6E5;
    font-size: var(--text-sm);
    margin: 0 0 var(--space-sm);
    line-height: 1.5;
}

.sidebar-cta-btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: var(--brand-accent);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-base);
    font-weight: 700;
    font-size: var(--text-sm);
    transition: var(--transition-base);
}

.sidebar-cta-btn:hover {
    background: #ddbf6a;
    color: white;
}

/* ============================================
   PHASE 3: RACE DETAIL TEMPLATE
   ============================================ */

/* --- Race Detail Header --- */
.race-detail-header {
    background: var(--brand-primary);
    color: white;
    padding: var(--space-md) 0;
    margin-bottom: var(--space-lg);
}

.race-detail-header .container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.race-detail-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.race-detail-title h1 {
    margin: 0;
    font-size: var(--text-2xl);
}

.race-detail-meta {
    opacity: 0.8;
    margin-top: 0.2rem;
    font-size: var(--text-sm);
}

/* --- Back Link & Breadcrumb --- */
.race-back-link {
    color: var(--brand-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: var(--space-sm);
    font-size: var(--text-sm);
    font-weight: 600;
}

.race-back-link:hover {
    text-decoration: underline;
}

.race-breadcrumb {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    font-size: var(--text-sm);
}

.race-breadcrumb a {
    color: var(--brand-secondary);
}

.race-breadcrumb .current {
    color: var(--text-secondary);
}

/* --- Race Info Box --- */
.race-info-box {
    background: var(--bg-white);
    border-radius: var(--radius-base);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.race-info-box h3 {
    margin: 0 0 var(--space-sm) 0;
    color: var(--brand-primary);
    font-size: var(--text-lg);
}

.race-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-sm);
}

.race-info-item {
    padding: var(--space-xs) 0;
}

.race-info-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.race-info-value {
    font-weight: 700;
    color: var(--text-primary);
}

.race-info-value.dem-color { color: var(--dem-medium); }
.race-info-value.rep-color { color: var(--rep-medium); }

/* --- Race Ratings Grid --- */
.race-ratings-section {
    margin-bottom: var(--space-lg);
}

.race-ratings-section h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.race-ratings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.race-rating-card {
    background: var(--bg-white);
    border-radius: var(--radius-base);
    padding: var(--space-md);
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.race-rating-card h4 {
    margin: 0 0 var(--space-sm) 0;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 600;
}

.race-rating-value {
    font-size: var(--text-xl);
    font-weight: 700;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-base);
    display: inline-block;
    color: white;
}

.race-rating-value.safe-dem { background: var(--dem-strong); }
.race-rating-value.likely-dem { background: var(--dem-medium); }
.race-rating-value.lean-dem { background: var(--dem-light); }
.race-rating-value.tossup { background: var(--tossup); }
.race-rating-value.lean-rep { background: var(--rep-light); }
.race-rating-value.likely-rep { background: var(--rep-medium); }
.race-rating-value.safe-rep { background: var(--rep-strong); }

.race-rating-change {
    font-size: var(--text-xs);
    margin-top: var(--space-xs);
    color: var(--text-secondary);
}

.race-muted-note {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-style: italic;
}

/* --- Candidate Cards --- */
.race-candidates-section {
    margin-bottom: var(--space-lg);
}

.race-candidates-section h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.race-candidates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.race-candidate-card {
    background: var(--bg-white);
    border-radius: var(--radius-base);
    padding: var(--space-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: var(--space-md);
}

.race-candidate-card.democrat { border-left: 4px solid var(--dem-medium); }
.race-candidate-card.republican { border-left: 4px solid var(--rep-medium); }
.race-candidate-card.independent { border-left: 4px solid var(--tossup); }

.race-candidate-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.race-candidate-photo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.race-candidate-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: var(--text-base);
}

.race-party-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-base);
    font-size: var(--text-xs);
    font-weight: 700;
    color: white;
}

.race-party-label.d { background: var(--dem-medium); }
.race-party-label.r { background: var(--rep-medium); }
.race-party-label.i { background: var(--tossup); }

.race-incumbent-badge {
    background: var(--brand-accent);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-base);
    font-size: var(--text-xs);
    font-weight: 700;
    margin-left: 0.5rem;
}

.race-candidate-stats {
    margin-top: var(--space-xs);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.race-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

/* --- Polling Section --- */
.race-polling-section {
    margin-bottom: var(--space-lg);
}

.race-polling-section h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

/* --- Notes & Placeholders --- */
.race-notes-section,
.race-placeholder-section {
    margin-bottom: var(--space-lg);
}

.race-notes-section h2,
.race-placeholder-section h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

/* --- No Race / District Not Found --- */
.race-not-found {
    text-align: center;
    padding: var(--space-xl);
    background: var(--bg-white);
    border-radius: var(--radius-base);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.race-not-found h2 {
    margin-bottom: var(--space-sm);
}

.race-not-found a {
    color: var(--brand-secondary);
}

/* --- PVI Badge (House districts) --- */
.pvi-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-base);
    font-weight: 700;
    font-size: var(--text-sm);
    color: white;
}

.pvi-badge.dem { background: var(--dem-light); }
.pvi-badge.rep { background: var(--rep-light); }
.pvi-badge.even { background: var(--tossup); }

/* --- Responsive --- */
@media (max-width: 768px) {
    .race-detail-header .container {
        gap: var(--space-sm);
    }
    .race-detail-icon {
        font-size: 1.75rem;
    }
    .race-detail-title h1 {
        font-size: var(--text-xl);
    }
    .race-ratings-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    .race-candidates-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   PHASE 5: PRIMARY ELECTIONS CALENDAR
   ============================================ */

.primary-month {
    margin-bottom: var(--space-lg);
}

.primary-month-past {
    opacity: 0.6;
}

.primary-month-header {
    font-size: var(--text-xl);
    color: var(--brand-primary);
    padding-bottom: 0.4rem;
    border-bottom: 3px solid var(--brand-accent);
    margin-bottom: var(--space-md);
}

.primary-month-grid {
    display: grid;
    gap: var(--space-sm);
}

.primary-card {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-white);
    border-radius: var(--radius-base);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--brand-secondary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.primary-card:hover {
    box-shadow: var(--shadow-md);
}

.primary-card.primary-completed {
    border-left-color: var(--text-tertiary);
    opacity: 0.65;
}

.primary-card.primary-has-senate {
    border-left-color: var(--brand-accent);
}

.primary-card-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    flex-shrink: 0;
}

.primary-day {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--brand-primary);
    line-height: 1;
}

.primary-dow {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

.primary-card-body {
    flex: 1;
    min-width: 0;
}

.primary-card-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
}

.primary-card-header strong {
    font-size: var(--text-base);
    color: var(--text-primary);
}

.primary-type-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.primary-type-badge.runoff { background: #FEF3C7; color: #92400E; }
.primary-type-badge.caucus { background: #EDE9FE; color: #5B21B6; }
.primary-type-badge.open { background: #D1FAE5; color: #065F46; }
.primary-type-badge.completed { background: var(--bg-secondary); color: var(--text-tertiary); }

.primary-card-offices {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
}

.primary-office-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: var(--radius-base);
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.primary-office-tag.senate { background: var(--brand-primary); color: white; }
.primary-office-tag.governor { background: #7C3AED; color: white; }

.primary-card-detail {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.primary-detail-label {
    font-weight: 600;
}

.primary-card-note {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 0.2rem;
}

@media (max-width: 480px) {
    .primary-card {
        gap: var(--space-sm);
    }
    .primary-card-date {
        min-width: 40px;
    }
}

/* ============================================================
   Phase 7: News Module + Race News
   ============================================================ */

/* Homepage news grid */
.news-module h3 {
    font-size: 1.4rem;
    margin-bottom: var(--space-md);
    color: var(--text-primary, #fff);
}
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}
.news-card {
    display: block;
    background: #f8fafc;
    border: 1px solid #d1d9e0;
    border-radius: 8px;
    padding: var(--space-md);
    transition: border-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}
.news-card:hover {
    border-color: var(--brand-accent, #957C3D);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.news-type-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-accent, #957C3D);
    margin-bottom: 0.4rem;
}
.news-headline {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 0.5rem 0;
    color: var(--brand-primary, #002349);
}
.news-race-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #4a6580;
    background: #e2e8f0;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.4rem;
}
.news-meta {
    font-size: 0.75rem;
    color: #6b7d8e;
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}
.news-empty {
    color: var(--text-muted, #8899aa);
    font-style: italic;
    padding: var(--space-md) 0;
}

@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .news-grid {
        grid-template-columns: 1fr;
    }
}

/* Race detail page news */
.race-news-section h3 {
    font-size: 1.2rem;
    margin-bottom: var(--space-sm);
    color: var(--text-primary, #fff);
}
.race-news-section h3 i {
    margin-right: 0.4rem;
    color: var(--brand-accent, #957C3D);
}
.race-news-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.race-news-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color, #2a3a4a);
}
.race-news-item:last-child {
    border-bottom: none;
}
.race-news-headline a {
    color: var(--text-primary, #fff);
    text-decoration: none;
    font-weight: 500;
    line-height: 1.35;
}
.race-news-headline a:hover {
    color: var(--brand-accent, #957C3D);
}
.race-news-meta {
    font-size: 0.75rem;
    color: var(--text-muted, #8899aa);
    display: flex;
    gap: 0.6rem;
    margin-top: 0.3rem;
    align-items: center;
}
.news-type-badge.small {
    font-size: 0.6rem;
    padding: 0.1rem 0.4rem;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════ */
/* News Detail Page                                           */
/* ═══════════════════════════════════════════════════════════ */
.news-detail-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    padding-top: var(--space-lg);
    padding-bottom: var(--space-xl);
}
.news-detail-breadcrumb {
    font-size: 0.8rem;
    color: #6b7d8e;
    margin-bottom: var(--space-md);
}
.news-detail-breadcrumb a {
    color: var(--brand-secondary, #1D63FF);
    text-decoration: none;
}
.news-detail-breadcrumb a:hover {
    text-decoration: underline;
}
.breadcrumb-sep {
    margin: 0 0.4rem;
    color: #aab;
}
.news-detail-header {
    margin-bottom: var(--space-lg);
}
.news-type-badge-lg {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-accent, #957C3D);
    margin-bottom: 0.5rem;
    margin-right: 0.5rem;
}
.news-importance-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #dc2626;
    background: #fef2f2;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}
.news-detail-headline {
    font-size: 1.8rem;
    line-height: 1.25;
    color: var(--brand-primary, #002349);
    margin: 0.5rem 0 1rem;
}
.news-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: #6b7d8e;
    align-items: center;
}
.news-detail-source strong {
    color: var(--text-primary, #1a1a1a);
}
.news-detail-race-link {
    color: var(--brand-secondary, #1D63FF);
    text-decoration: none;
    font-weight: 500;
}
.news-detail-race-link:hover {
    text-decoration: underline;
}
.news-detail-summary {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #2d3748;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid #e2e8f0;
}
.news-detail-keypoints {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid #e2e8f0;
}
.news-detail-keypoints h3 {
    font-size: 1.1rem;
    color: var(--brand-primary, #002349);
    margin-bottom: 0.75rem;
}
.news-detail-keypoints ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.news-detail-keypoints li {
    padding: 0.4rem 0 0.4rem 1.2rem;
    position: relative;
    color: #374151;
    line-height: 1.5;
}
.news-detail-keypoints li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.75rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand-accent, #957C3D);
}
.news-detail-cta {
    margin-bottom: var(--space-lg);
}
.btn-read-full {
    display: inline-block;
    background: var(--brand-primary, #002349);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.btn-read-full:hover {
    background: var(--brand-secondary, #1D63FF);
    color: #fff;
}
.news-detail-related {
    margin-bottom: var(--space-lg);
}
.news-detail-related h3 {
    font-size: 1.1rem;
    color: var(--brand-primary, #002349);
    margin-bottom: 0.75rem;
}
.news-detail-race-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f0f5ff;
    border: 1px solid #c7d7f0;
    border-radius: 6px;
    text-decoration: none;
    transition: border-color 0.2s;
}
.news-detail-race-card:hover {
    border-color: var(--brand-secondary, #1D63FF);
}
.race-card-label {
    font-weight: 600;
    color: var(--brand-primary, #002349);
}
.race-card-arrow {
    font-size: 0.85rem;
    color: var(--brand-secondary, #1D63FF);
}

/* News detail sidebar */
.news-detail-sidebar h3 {
    font-size: 1.1rem;
    color: var(--brand-primary, #002349);
    margin-bottom: var(--space-md);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--brand-accent, #957C3D);
}
.sidebar-news-item {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
    text-decoration: none;
    transition: background 0.15s;
}
.sidebar-news-item:hover {
    background: #f8fafc;
}
.sidebar-news-headline {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 0.25rem;
}
.sidebar-news-item:hover .sidebar-news-headline {
    color: var(--brand-secondary, #1D63FF);
}
.sidebar-news-meta {
    display: block;
    font-size: 0.72rem;
    color: #6b7d8e;
}

@media (max-width: 900px) {
    .news-detail-container {
        grid-template-columns: 1fr;
    }
    .news-detail-headline {
        font-size: 1.4rem;
    }
}

/* ── Data Freshness Indicators ── */
.freshness-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 500;
}
.freshness-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.freshness-fresh { color: #166534; background: #f0fdf4; }
.freshness-fresh::before { background: #22c55e; }
.freshness-stale { color: #92400e; background: #fffbeb; }
.freshness-stale::before { background: #f59e0b; }
.freshness-old { color: #6b7280; background: #f9fafb; }
.freshness-old::before { background: #9ca3af; }

.section-freshness {
    float: right;
    margin-top: -2px;
}

/* ── IE Spending Section ── */
.ie-spending-section { margin-top: var(--space-lg, 2rem); }
.ie-spending-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm, 0.75rem);
    margin-bottom: var(--space-md, 1.5rem);
}
.ie-stat {
    text-align: center;
    padding: var(--space-sm, 0.75rem);
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.ie-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--brand-primary, #002349);
}
.ie-stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    margin-top: 0.25rem;
}
.ie-committee-list { list-style: none; padding: 0; }
.ie-committee-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}
.ie-committee-item:last-child { border-bottom: none; }
.ie-committee-name { color: #334155; flex: 1; }
.ie-committee-amount {
    font-weight: 600;
    color: var(--brand-primary, #002349);
    white-space: nowrap;
    margin-left: var(--space-sm, 0.75rem);
}
@media (max-width: 600px) {
    .ie-spending-summary { grid-template-columns: 1fr; }
}

/* =========================================================================
   Data Hub — Tabs, Tables, Tier Gates, Summary Stats (Phase 9)
   ========================================================================= */

/* Tab Navigation */
.data-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border, #e2e8f0);
    margin-bottom: var(--space-lg, 2rem);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.data-tabs::-webkit-scrollbar { display: none; }

.data-tab {
    padding: 0.75rem 1.25rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.data-tab:hover {
    color: var(--brand-primary, #002349);
}
.data-tab.active {
    color: var(--brand-primary, #002349);
    border-bottom-color: var(--brand-secondary, #1D63FF);
}
.data-tab i { margin-right: 0.4rem; }

.data-tab-panel {
    display: none;
    animation: fadeInPanel 0.25s ease;
}
.data-tab-panel.active { display: block; }

@keyframes fadeInPanel {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Sub-tabs (Senate | House within a tab) */
.data-subtabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: var(--space-md, 1.5rem);
}
.data-subtab {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--bg-white, #fff);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: all 0.2s;
}
.data-subtab:hover {
    border-color: var(--brand-secondary, #1D63FF);
    color: var(--brand-primary, #002349);
}
.data-subtab.active {
    background: var(--brand-secondary, #1D63FF);
    color: #fff;
    border-color: var(--brand-secondary, #1D63FF);
}

/* Summary Stats Row */
.data-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-sm, 0.75rem);
    margin-bottom: var(--space-lg, 2rem);
}
.data-stat-card {
    background: var(--bg-white, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: var(--space-md, 1.5rem);
    text-align: center;
}
.data-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-primary, #002349);
    line-height: 1.2;
}
.data-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    margin-top: 0.25rem;
}

/* Data Tables */
.data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    margin-bottom: var(--space-md, 1.5rem);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.data-table th,
.data-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border, #e2e8f0);
    white-space: nowrap;
}
.data-table th {
    background: var(--bg-light, #f8fafc);
    font-weight: 700;
    color: var(--brand-primary, #002349);
    position: sticky;
    top: 0;
    z-index: 1;
    cursor: pointer;
    user-select: none;
}
.data-table th:hover { background: #edf2f7; }
.data-table th .sort-icon {
    font-size: 0.65rem;
    margin-left: 0.3rem;
    opacity: 0.4;
}
.data-table th.sorted .sort-icon { opacity: 1; }
.data-table tbody tr:hover {
    background: var(--bg-hover, #f1f5f9);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.dem-color { color: #1565C0; font-weight: 600; }
.data-table td.rep-color { color: #C62828; font-weight: 600; }
.data-table .race-link {
    color: var(--brand-secondary, #1D63FF);
    text-decoration: none;
    font-weight: 600;
}
.data-table .race-link:hover { text-decoration: underline; }

/* Compact party label inside tables */
.party-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.3rem;
    vertical-align: middle;
}
.party-dot.d { background: #1565C0; }
.party-dot.r { background: #C62828; }
.party-dot.i { background: #6B7280; }

/* Tier Gate */
.tier-gate {
    border-radius: 8px;
    text-align: center;
}
.tier-gate-overlay {
    background: linear-gradient(to bottom, rgba(248,250,252,0.6), rgba(248,250,252,0.98));
    backdrop-filter: blur(4px);
    padding: 3rem 2rem;
    border: 1px solid var(--border, #e2e8f0);
}
.tier-gate-inline {
    background: var(--bg-light, #f8fafc);
    border: 2px dashed var(--border, #e2e8f0);
    padding: 2rem 1.5rem;
}
.tier-gate-content { max-width: 400px; margin: 0 auto; }
.tier-gate-icon {
    font-size: 2rem;
    color: var(--brand-accent, #957C3D);
    margin-bottom: 0.75rem;
}
.tier-gate-message {
    color: var(--text-secondary, #64748b);
    margin-bottom: 1rem;
    line-height: 1.5;
}
.tier-gate-btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: var(--brand-secondary, #1D63FF);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.tier-gate-btn:hover { background: var(--brand-primary, #002349); color: #fff; }

/* Data Hub Page Header */
.data-hub-header {
    margin-bottom: var(--space-lg, 2rem);
}
.data-hub-header h1 {
    margin-bottom: 0.25rem;
}
.data-hub-freshness {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary, #64748b);
}

/* Loading Spinner */
.data-loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary, #64748b);
}
.data-loading i { margin-right: 0.5rem; }
.data-error {
    text-align: center;
    padding: 2rem;
    color: #dc2626;
}

/* Table filter row */
.data-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: var(--space-md, 1.5rem);
    flex-wrap: wrap;
    align-items: center;
}
.data-filters select,
.data-filters input {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--bg-white, #fff);
}

/* Small Multiples Chart Grid */
.small-multiples-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md, 1.5rem);
}
.small-multiple-item {
    background: var(--bg-white, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
}
.small-multiple-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--brand-primary, #002349);
    margin-bottom: 0.25rem;
}
.small-multiple-chart {
    width: 100%;
    height: 150px;
}

/* Pagination */
.data-pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: var(--space-md, 1.5rem);
}
.data-pagination button {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border, #e2e8f0);
    background: var(--bg-white, #fff);
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}
.data-pagination button:hover { border-color: var(--brand-secondary, #1D63FF); }
.data-pagination button:disabled { opacity: 0.4; cursor: default; }

/* Responsive */
@media (max-width: 768px) {
    .data-tabs { gap: 0; }
    .data-tab { padding: 0.6rem 0.75rem; font-size: 0.8rem; }
    .data-stats-row { grid-template-columns: repeat(2, 1fr); }
    .small-multiples-grid { grid-template-columns: repeat(2, 1fr); }
    .data-table { font-size: 0.78rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.5rem; }
}
@media (max-width: 480px) {
    .data-stats-row { grid-template-columns: 1fr; }
    .small-multiples-grid { grid-template-columns: 1fr; }
    .data-tab { padding: 0.5rem 0.5rem; font-size: 0.75rem; }
    .data-tab i { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   CANDIDATE PROFILE PAGE
   ═══════════════════════════════════════════════════════════ */

/* Layout: main content + sidebar */
.candidate-profile-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-lg, 2rem);
    padding: var(--space-lg, 2rem) 0;
}

/* Breadcrumb */
.candidate-breadcrumb {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: var(--space-md, 1.5rem);
    grid-column: 1 / -1;
}
.candidate-breadcrumb a { color: var(--brand-secondary, #1D63FF); text-decoration: none; }
.candidate-breadcrumb a:hover { text-decoration: underline; }
.candidate-breadcrumb .breadcrumb-sep { margin: 0 0.4rem; color: #94a3b8; }

/* Header */
.candidate-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md, 1.5rem);
    margin-bottom: var(--space-lg, 2rem);
    padding-bottom: var(--space-md, 1.5rem);
    border-bottom: 2px solid #e2e8f0;
}
.candidate-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 3px solid #e2e8f0;
}
.candidate-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.candidate-photo .fa-user {
    font-size: 3rem;
    color: #94a3b8;
}
.candidate-header-info { flex: 1; }
.candidate-header-info h1 {
    font-size: 1.8rem;
    color: var(--brand-primary, #002349);
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}
.candidate-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.candidate-party-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
}
.candidate-party-badge.democrat { background: var(--dem-strong, #1a4c8b); }
.candidate-party-badge.republican { background: var(--rep-strong, #c62828); }
.candidate-party-badge.independent { background: #6b7280; }
.candidate-party-badge.libertarian { background: #f59e0b; color: #000; }
.candidate-party-badge.green { background: #16a34a; }
.candidate-office-label {
    font-size: 0.95rem;
    color: #475569;
}

/* Section containers */
.candidate-section {
    margin-bottom: var(--space-lg, 2rem);
    padding-bottom: var(--space-md, 1.5rem);
    border-bottom: 1px solid #f1f5f9;
}
.candidate-section:last-child { border-bottom: none; }
.candidate-section h2 {
    font-size: 1.2rem;
    color: var(--brand-primary, #002349);
    margin: 0 0 var(--space-sm, 0.75rem) 0;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--brand-accent, #957C3D);
    display: inline-block;
}

/* Bio */
.candidate-bio p {
    color: #334155;
    line-height: 1.7;
    margin: 0 0 0.5rem 0;
}
.candidate-bio .wiki-attribution {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}
.candidate-bio .wiki-attribution a { color: var(--brand-secondary, #1D63FF); }

/* Favorability (P3.3) */
.candidate-favorability .favorability-summary {
    color: #334155;
    margin: 0 0 var(--space-sm, 0.75rem) 0;
}
.candidate-favorability .data-attribution {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}
.candidate-favorability .data-attribution a { color: var(--brand-secondary, #1D63FF); }

/* Campaign Links */
.candidate-links {
    display: flex;
    gap: var(--space-sm, 0.75rem);
    flex-wrap: wrap;
}
.candidate-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--brand-secondary, #1D63FF);
    text-decoration: none;
    transition: border-color 0.2s;
}
.candidate-links a:hover { border-color: var(--brand-secondary, #1D63FF); }

/* FEC Financials */
.candidate-financials .fec-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm, 0.75rem);
    margin-bottom: var(--space-sm, 0.75rem);
}
.fec-summary-stat {
    text-align: center;
    padding: var(--space-sm, 0.75rem);
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}
.fec-summary-stat .stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--brand-primary, #002349);
}
.fec-summary-stat .stat-label {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 0.15rem;
}
.fec-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem var(--space-md, 1.5rem);
}
.fec-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
}
.fec-detail-row .fec-label { color: #64748b; }
.fec-detail-row .fec-value { font-weight: 600; color: #1e293b; }
.fec-link {
    margin-top: 0.5rem;
    font-size: 0.8rem;
}
.fec-link a { color: var(--brand-secondary, #1D63FF); text-decoration: none; }
.fec-link a:hover { text-decoration: underline; }

/* Primary Results */
.candidate-primary-results table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.candidate-primary-results th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
}
.candidate-primary-results th.num { text-align: right; }
.candidate-primary-results td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}
.candidate-primary-results td.num { text-align: right; }
.candidate-primary-results tr.current-candidate { background: #eff6ff; font-weight: 600; }
.candidate-primary-results tr.result-winner td:first-child::after {
    content: ' \2713';
    color: #16a34a;
    font-weight: 700;
}
.primary-results-meta {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.35rem;
}

/* IE Spending */
.candidate-ie-spending .ie-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm, 0.75rem);
    margin-bottom: var(--space-sm, 0.75rem);
}
.candidate-ie-spending .ie-total-stat {
    text-align: center;
    padding: var(--space-sm, 0.75rem);
    background: #f8fafc;
    border-radius: 6px;
}
.candidate-ie-spending .ie-total-stat .stat-value { font-size: 1.1rem; font-weight: 700; }
.candidate-ie-spending .ie-total-stat .stat-label { font-size: 0.78rem; color: #64748b; }
.candidate-ie-spending .ie-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
}
.candidate-ie-spending .ie-committee { flex: 1; color: #334155; }
.candidate-ie-spending .ie-type {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin: 0 0.5rem;
}
.candidate-ie-spending .ie-type.support { background: #dcfce7; color: #166534; }
.candidate-ie-spending .ie-type.oppose { background: #fee2e2; color: #991b1b; }
.candidate-ie-spending .ie-amount { font-weight: 600; white-space: nowrap; }

/* News Mentions */
.candidate-news .news-mention-item {
    display: block;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.candidate-news .news-mention-item:hover { background: #f8fafc; }
.candidate-news .news-mention-headline {
    font-weight: 500;
    color: var(--brand-primary, #002349);
    font-size: 0.92rem;
}
.candidate-news .news-mention-meta {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}

/* Tier gate notice */
.candidate-tier-gate {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: var(--space-sm, 0.75rem) var(--space-md, 1.5rem);
    text-align: center;
    color: #64748b;
    font-size: 0.88rem;
}
.candidate-tier-gate .fa-lock { margin-right: 0.3rem; font-size: 0.75rem; }
.candidate-tier-gate a { color: var(--brand-secondary, #1D63FF); font-weight: 600; }

/* Sidebar */
.candidate-sidebar {
    position: sticky;
    top: var(--space-md, 1.5rem);
    align-self: start;
}
.candidate-sidebar-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: var(--space-md, 1.5rem);
    margin-bottom: var(--space-md, 1.5rem);
}
.candidate-sidebar-section h3 {
    font-size: 1rem;
    color: var(--brand-primary, #002349);
    margin: 0 0 var(--space-sm, 0.75rem) 0;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid #e2e8f0;
}

/* Race context in sidebar */
.sidebar-race-link {
    display: block;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: var(--brand-primary, #002349);
    font-weight: 500;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}
.sidebar-race-link:hover { border-color: var(--brand-secondary, #1D63FF); }
.sidebar-race-rating {
    font-size: 0.78rem;
    margin-top: 0.2rem;
    color: #64748b;
}

/* Other candidates in sidebar */
.sidebar-candidate {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    font-size: 0.88rem;
}
.sidebar-candidate:last-child { border-bottom: none; }
.sidebar-candidate:hover { color: var(--brand-secondary, #1D63FF); }
.sidebar-candidate .party-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sidebar-candidate .party-dot.d { background: var(--dem-strong, #1a4c8b); }
.sidebar-candidate .party-dot.r { background: var(--rep-strong, #c62828); }
.sidebar-candidate .party-dot.i { background: #6b7280; }

/* Responsive */
@media (max-width: 900px) {
    .candidate-profile-container {
        grid-template-columns: 1fr;
    }
    .candidate-sidebar {
        position: static;
    }
}
@media (max-width: 600px) {
    .candidate-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .candidate-badges { justify-content: center; }
    .candidate-financials .fec-summary-grid {
        grid-template-columns: 1fr;
    }
    .fec-detail-grid {
        grid-template-columns: 1fr;
    }
    .candidate-ie-spending .ie-totals {
        grid-template-columns: 1fr;
    }
    .candidate-header-info h1 { font-size: 1.4rem; }
}

/* =============================================================================
   TODAY'S SOURCING — Digest Teaser (homepage card)
   ============================================================================= */

.digest-teaser {
    background: var(--bg-secondary, #f8f9fa);
    border-left: 4px solid var(--brand-accent, #957C3D);
    border-radius: 8px;
    padding: var(--space-md, 1.5rem);
    margin: var(--space-md, 1.5rem) 0;
}

.digest-teaser-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.digest-teaser h3 {
    color: var(--brand-primary, #002349);
    font-size: 1.1rem;
    margin: 0;
}

.digest-teaser-date {
    font-size: 0.8rem;
    color: #888;
}

.digest-teaser-polls,
.digest-teaser-money,
.digest-teaser-news {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

.digest-teaser-poll-result {
    padding: 3px 0;
    line-height: 1.5;
}

.digest-teaser-cta {
    display: inline-block;
    margin-top: 0.75rem;
    color: var(--brand-secondary, #1D63FF);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
}

.digest-teaser-cta:hover {
    text-decoration: underline;
}

.digest-teaser-empty {
    color: #999;
    font-style: italic;
    font-size: 0.875rem;
}

/* =============================================================================
   TODAY'S SOURCING — /today Briefing Page
   ============================================================================= */

.digest-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 0.75rem;
    margin-bottom: var(--space-md, 1.5rem);
    border-bottom: 2px solid var(--brand-primary, #002349);
}

.digest-header h1 {
    flex: 1;
    color: var(--brand-primary, #002349);
    margin: 0;
}

.digest-nav-arrow {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--brand-primary, #002349);
    text-decoration: none;
    white-space: nowrap;
}

.digest-nav-arrow:hover {
    background: #e8eaed;
    text-decoration: none;
}

.digest-summary {
    border-left: 3px solid var(--brand-accent, #957C3D);
    background: var(--bg-secondary, #f8f9fa);
    padding: 14px var(--space-md, 1.5rem);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: var(--space-md, 1.5rem);
    border-radius: 0 6px 6px 0;
}

.digest-summary p {
    margin: 0 0 16px 0;
}

.digest-summary p:last-child {
    margin-bottom: 0;
}

.digest-summary strong {
    color: var(--brand-accent, #957C3D);
}

.digest-section {
    padding: 20px 0;
    border-bottom: 1px solid #e0e0e0;
}

.digest-section:last-of-type {
    border-bottom: none;
}

.digest-section h3 {
    color: var(--brand-primary, #002349);
    font-size: 16px;
    margin-bottom: 12px;
}

/* v2 digest: override email inline styles for web rendering */
.digest-v2 h4 {
    margin: 20px 0 8px 0 !important;
    font-size: 16px !important;
    font-weight: bold !important;
    color: var(--brand-primary, #002349) !important;
    font-family: Georgia, 'Times New Roman', serif !important;
}

.digest-v2 h4:first-child {
    margin-top: 0 !important;
}

.digest-v2 p {
    margin: 0 0 12px 0 !important;
    font-size: 15px !important;
    line-height: 1.7 !important;
    color: #333 !important;
    font-family: Georgia, 'Times New Roman', serif !important;
}

.digest-v2 p:last-child {
    margin-bottom: 0 !important;
}

.digest-v2 strong {
    color: inherit !important;
}

.digest-poll-card {
    background: var(--bg-secondary, #f8f9fa);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 14px;
}

.digest-poll-card .dem {
    color: var(--brand-secondary, #1D63FF);
    font-weight: 600;
}

.digest-poll-card .rep {
    color: #c62828;
    font-weight: 600;
}

.digest-poll-card .pollster {
    color: #666;
    font-size: 13px;
    margin-top: 4px;
}

.digest-poll-card .moe {
    color: #666;
    font-size: 12px;
}

.digest-sparkline {
    height: 60px;
    margin-top: 10px;
}

.digest-money-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.digest-money-card {
    background: var(--bg-secondary, #f8f9fa);
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
}

.digest-money-card .amount {
    font-size: 16px;
    font-weight: 600;
    color: var(--brand-primary, #002349);
    display: block;
    margin-bottom: 2px;
}

.digest-ie-callout {
    border-left: 3px solid var(--brand-accent, #957C3D);
    background: #fff8f0;
    padding: 10px var(--space-md, 1.5rem);
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.digest-ie-elevated {
    padding: 16px var(--space-md, 1.5rem);
    font-size: 15px;
    border-left-width: 4px;
}

.digest-news-list {
    list-style: none;
    padding: 0;
    margin: 0;
    line-height: 1.8;
}

.digest-news-list a {
    color: var(--brand-secondary, #1D63FF);
    text-decoration: none;
    font-size: 14px;
}

.digest-news-list a:hover {
    text-decoration: underline;
}

.digest-news-list .source {
    color: #999;
    font-size: 12px;
    margin-left: 4px;
}

.digest-ratings {
    background: #fafafa;
    padding: 16px;
    border-radius: 6px;
    margin-top: 20px;
}

.digest-ratings h3 {
    color: #666;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.digest-ratings p {
    font-size: 13px;
    color: #555;
    margin: 0;
}

/* =============================================================================
   TODAY'S SOURCING — Email Signup CTA
   ============================================================================= */

.digest-email-cta {
    background: var(--brand-primary, #002349);
    padding: 20px;
    text-align: center;
    margin-top: 24px;
    border-radius: 8px;
}

.digest-email-cta p {
    color: #fff;
    margin-bottom: 8px;
}

.digest-email-cta .btn {
    display: inline-block;
    padding: 8px 24px;
    background: var(--brand-accent, #957C3D);
    color: #fff;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
}

.digest-email-cta .btn:hover {
    opacity: 0.9;
    text-decoration: none;
}

/* =============================================================================
   TODAY'S SOURCING — Feedback Widget
   ============================================================================= */

.digest-feedback {
    padding: 20px 0;
    border-top: 1px solid #e0e0e0;
    margin-top: 20px;
}

.digest-feedback h4 {
    color: var(--brand-primary, #002349);
    font-size: 14px;
    margin-bottom: 12px;
}

.digest-feedback-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.digest-feedback-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.digest-feedback-btn:hover {
    background: var(--bg-secondary, #f8f9fa);
}

.digest-feedback-btn.selected {
    background: var(--brand-secondary, #1D63FF);
    color: #fff;
    border-color: var(--brand-secondary, #1D63FF);
}

.digest-feedback-text {
    margin-top: 12px;
    display: none;
}

.digest-feedback-text input {
    width: 100%;
    max-width: 400px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.digest-feedback-thanks {
    color: var(--brand-accent, #957C3D);
    font-weight: 600;
    display: none;
    font-size: 14px;
    margin-top: 8px;
}

/* =============================================================================
   TODAY'S SOURCING — Tier Gate
   ============================================================================= */

.digest-tier-gate {
    background: #f0f4ff;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
    text-align: center;
}

.digest-tier-gate a {
    color: var(--brand-secondary, #1D63FF);
    font-weight: 600;
    text-decoration: none;
}

.digest-tier-gate a:hover {
    text-decoration: underline;
}

/* =============================================================================
   TODAY'S SOURCING — Responsive
   ============================================================================= */

@media (max-width: 768px) {
    .digest-money-grid {
        grid-template-columns: 1fr;
    }

    .digest-feedback-buttons {
        flex-wrap: wrap;
    }

    .digest-nav-arrow {
        padding: 3px 8px;
        font-size: 0.75rem;
    }
}

@media (max-width: 640px) {
    .digest-teaser {
        padding: 1rem;
    }

    .digest-signup-row {
        flex-direction: column;
    }

    .digest-signup-btn {
        width: 100%;
    }
}

/* =============================================================================
   TODAY'S SOURCING — Inline Email Signup Form
   ============================================================================= */

.digest-signup-form { margin-top: 12px; }
.digest-signup-row { display: flex; gap: 8px; justify-content: center; max-width: 450px; margin: 0 auto; }
.digest-signup-input { flex: 1; padding: 10px 14px; border: 2px solid rgba(255,255,255,0.3); border-radius: 4px; font-size: 14px; background: rgba(255,255,255,0.1); color: #fff; }
.digest-signup-input::placeholder { color: rgba(255,255,255,0.6); }
.digest-signup-input:focus { outline: none; border-color: var(--brand-accent); background: rgba(255,255,255,0.15); }
.digest-signup-btn { padding: 10px 24px; background: var(--brand-accent); color: #fff; border: none; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.digest-signup-btn:hover { opacity: 0.9; }
.digest-signup-message { margin-top: 12px; font-size: 14px; }
.digest-signup-message.success { color: var(--brand-accent); }
.digest-signup-message.error { color: #ff6b6b; }
.digest-signup-note { margin-top: 8px; font-size: 12px; color: rgba(255,255,255,0.6); }

/* Feedback toast */
.digest-toast {
    background: #d4edda;
    color: #155724;
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 500;
    animation: digestToastFade 4s ease-in-out forwards;
}
@keyframes digestToastFade {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================
   PREDICTION MAP STYLES
   ============================================ */

/* --- Prediction Progress Bar --- */
.prediction-bar {
    margin-bottom: var(--space-md);
}

.prediction-bar-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
    font-weight: 700;
    font-size: var(--text-base);
}

.prediction-bar-dem-count {
    color: var(--dem-strong);
}

.prediction-bar-rep-count {
    color: var(--rep-strong);
}

.prediction-bar-label {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 400;
}

.prediction-bar-track {
    display: flex;
    height: 28px;
    border-radius: var(--radius-base);
    overflow: hidden;
    background: var(--bg-muted);
}

.prediction-bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s ease;
    min-width: 0;
}

.prediction-bar-segment.locked-dem {
    background: var(--dem-strong);
}

.prediction-bar-segment.dem {
    background: var(--dem-medium);
}

.prediction-bar-segment.tossup {
    background: var(--tossup);
}

/* Toss-up segment doubles as a link to /tossups */
a.prediction-bar-segment.tossup {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.prediction-bar-segment.tossup:hover {
    filter: brightness(0.85);
}

.prediction-bar-segment.unrated {
    background: #d1d5db;
}

.prediction-bar-segment.rep {
    background: var(--rep-medium);
}

.prediction-bar-segment.locked-rep {
    background: var(--rep-strong);
}

.prediction-bar-tossup-count,
.prediction-bar-unrated-count {
    font-size: var(--text-xs);
    color: white;
    font-weight: 600;
}

/* --- Prediction Mode Toggle --- */
.prediction-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.prediction-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.5rem;
    background: var(--brand-accent);
    color: var(--brand-primary);
    border: none;
    border-radius: var(--radius-base);
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
}

.prediction-toggle-btn:hover {
    background: #b8993e;
}

.prediction-toggle-btn.active {
    background: var(--brand-primary);
    color: white;
}

/* --- Save & Share Button --- */
.prediction-save-btn {
    display: none;
    padding: 0.5rem 1.5rem;
    background: var(--brand-accent);
    color: var(--brand-primary);
    border: none;
    border-radius: var(--radius-base);
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
}

.prediction-save-btn:hover {
    background: #b8993e;
}

/* --- Selected State Highlight --- */
.map-svg-wrapper path.state.prediction-selected {
    stroke: var(--brand-accent) !important;
    stroke-width: 3 !important;
    filter: drop-shadow(0 0 4px rgba(149, 124, 61, 0.6));
}

/* --- Rating Label on State (Desktop) --- */
.state-rating-label {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
}

/* --- Mobile Pill Bar --- */
.prediction-pill-bar {
    background: var(--bg-white);
    border-top: 2px solid var(--border-color);
    padding: var(--space-xs) var(--space-sm);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.pill-bar-state-label {
    text-align: center;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--brand-primary);
    margin-bottom: 0.3rem;
}

.pill-bar-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.pill {
    padding: 4px 8px;
    border: 2px solid transparent;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: white;
    transition: var(--transition-fast);
}

.pill.safe-dem { background: var(--dem-strong); }
.pill.likely-dem { background: var(--dem-medium); }
.pill.lean-dem { background: var(--dem-light); }
.pill.tilt-dem { background: var(--dem-tilt); color: var(--brand-primary); }
.pill.tossup { background: var(--tossup); }
.pill.tilt-rep { background: var(--rep-tilt); color: var(--brand-primary); }
.pill.lean-rep { background: var(--rep-light); }
.pill.likely-rep { background: var(--rep-medium); }
.pill.safe-rep { background: var(--rep-strong); }
.pill.pill-clear {
    background: var(--bg-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.pill:hover, .pill.active {
    border-color: var(--brand-primary);
    transform: scale(1.1);
}

/* Hide pill bar on desktop */
@media (min-width: 481px) {
    .prediction-pill-bar {
        display: none !important;
    }
}

/* --- Share Modal --- */
.prediction-share-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.prediction-share-modal.visible {
    display: flex;
}

.prediction-share-content {
    background: var(--bg-white);
    border-radius: var(--radius-base);
    padding: var(--space-lg);
    max-width: 480px;
    width: 90%;
    text-align: center;
}

.prediction-share-url {
    display: flex;
    gap: 0.5rem;
    margin-top: var(--space-md);
}

.prediction-share-url input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    font-size: var(--text-sm);
}

.prediction-share-url button {
    padding: 0.5rem 1rem;
    background: var(--brand-primary);
    color: white;
    border: none;
    border-radius: var(--radius-base);
    cursor: pointer;
    font-weight: 600;
}

/* --- Social Share Buttons --- */
.prediction-share-social {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-md);
}

.share-social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-base);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    color: white;
    transition: var(--transition-fast);
}

.share-social-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.share-x { background: #000; }
.share-facebook { background: #1877f2; }
.share-linkedin { background: #0a66c2; }
.share-truth { background: #5448ee; }
.share-gettr { background: #e50914; }

/* =========================================================================
   Election Night Live
   ========================================================================= */

/* Banner */
.election-alert-strip {
    background: linear-gradient(135deg, #1a4b7a 0%, #2563a8 50%, #1a4b7a 100%);
    color: #fff;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    position: relative;
    z-index: 100;
    border-top: 1px solid rgba(255,255,255,0.15);
    border-bottom: 3px solid var(--brand-accent, #957C3D);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.election-alert-strip a {
    color: var(--brand-accent, #957C3D);
    text-decoration: none;
    font-weight: 700;
    margin-left: 0.5rem;
}
.election-alert-strip a:hover { text-decoration: underline; }
.election-alert-strip .alert-live-tag {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-right: 0.4rem;
    vertical-align: middle;
}
.election-alert-strip .alert-dismiss {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
}
.election-alert-strip .alert-dismiss:hover { color: #fff; }

/* Gold pulsing border for states voting today (all map tabs) */
.map-svg-wrapper path.state.primary-today {
    stroke: var(--brand-accent, #957C3D) !important;
    stroke-width: 2.5 !important;
    animation: pulse-gold 2s ease-in-out infinite;
    filter: drop-shadow(0 0 3px rgba(149,124,61,0.4));
}
@keyframes pulse-gold {
    0%, 100% { stroke-width: 2.5; filter: drop-shadow(0 0 3px rgba(149,124,61,0.3)); }
    50% { stroke-width: 3; filter: drop-shadow(0 0 6px rgba(149,124,61,0.6)); }
}
@media (prefers-reduced-motion: reduce) {
    .map-svg-wrapper path.state.primary-today { animation: none; }
}

/* Live indicator badge */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.live-indicator .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: live-pulse 1.5s ease-in-out infinite;
}
.live-indicator.status-live .live-dot { background: #dc2626; }
.live-indicator.status-live .live-label { color: #dc2626; }
.live-indicator.status-reporting .live-dot { background: var(--brand-accent, #957C3D); }
.live-indicator.status-reporting .live-label { color: var(--brand-accent, #957C3D); }
.live-indicator.status-called .live-dot { display: none; }
.live-indicator.status-called .live-label { color: #16a34a; }
@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}
@media (prefers-reduced-motion: reduce) {
    .live-indicator .live-dot { animation: none; }
}

.live-updated {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 400;
    margin-left: 0.5rem;
}

/* Result bar animation for live updates */
.result-bar {
    transition: width 0.6s ease-out;
}

/* Primary Night Hub */
.primary-night-hub { max-width: 1100px; margin: 0 auto; }
.primary-night-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--brand-accent, #957C3D);
}
.primary-night-header h1 { color: var(--brand-primary, #002349); margin-bottom: 0.25rem; }
.primary-night-header .night-subtitle { color: #6b7280; font-size: 1.1rem; }

.state-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}
.state-card {
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-base, 8px);
    padding: 1.25rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}
.state-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.state-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.state-card-header h2 {
    font-size: 1.15rem;
    color: var(--brand-primary, #002349);
    margin: 0;
}
.state-card-race {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}
.state-card-race:last-of-type { border-bottom: none; }
.state-card-race-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.4rem;
}
.state-card .race-link {
    display: block;
    text-align: right;
    font-size: 0.85rem;
    color: var(--brand-secondary, #1D63FF);
    text-decoration: none;
    margin-top: 0.5rem;
}
.state-card .race-link:hover { text-decoration: underline; }

/* Live state page header */
.live-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.live-page-header h1 { margin: 0; }
.live-status-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Race result rows for live mode */
.live-race-section { margin-bottom: 2rem; }
.live-race-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.live-race-header h3 { margin: 0; font-size: 1.05rem; }

/* Candidate result row in live mode */
.live-candidate-row {
    display: grid;
    grid-template-columns: 1fr 90px 60px 150px;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f3f4f6;
    gap: 0.5rem;
}
.live-candidate-row.winner { background: rgba(22,163,74,0.05); }
.live-candidate-name { font-weight: 500; }
.live-candidate-name .winner-check { color: #16a34a; margin-left: 0.3rem; }
.live-candidate-votes { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.live-candidate-pct { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.live-bar-cell { position: relative; }
.live-bar-cell .result-bar {
    height: 20px;
    border-radius: 2px;
    min-width: 2px;
}
.live-bar-cell .result-bar.republican, .live-bar-cell .result-bar.r { background: #ef4444; }
.live-bar-cell .result-bar.democratic, .live-bar-cell .result-bar.d { background: #3b82f6; }
.live-bar-cell .result-bar.libertarian, .live-bar-cell .result-bar.l { background: #f59e0b; }
.live-bar-cell .result-bar.open, .live-bar-cell .result-bar.i { background: #8b5cf6; }
.live-bar-cell .result-bar.zero-bar {
    width: 4px !important;
    min-width: 4px;
    opacity: 0.5;
}

.live-precincts {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
}
.results-pending-note {
    color: #9ca3af;
    font-size: 0.85rem;
    margin: 0.5rem 0;
    font-style: italic;
}
.incumbent-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    margin-left: 0.3rem;
    vertical-align: middle;
}

/* ═══ Race Result Cards Grid ═══ */
.race-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.race-result-card {
    display: block;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, border-color 0.15s;
    cursor: pointer;
}
.race-result-card:hover {
    border-color: var(--brand-secondary, #1D63FF);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.race-result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}
.race-result-card-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--brand-primary, #002349);
}
.race-result-card-incumbent {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.race-result-card-incumbent .party-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.race-result-card-incumbent .party-dot.d { background: #3b82f6; }
.race-result-card-incumbent .party-dot.r { background: #ef4444; }
.race-result-card-results {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.race-result-card-party-tag {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    color: #fff;
}
.race-result-card-party-tag.republican, .race-result-card-party-tag.r { background: #ef4444; }
.race-result-card-party-tag.democratic, .race-result-card-party-tag.democrat, .race-result-card-party-tag.d { background: #3b82f6; }
.race-result-card-row {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}
.race-result-card-name-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.15rem;
}
.race-result-card-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.race-result-card-name .winner-check { color: #16a34a; }
.race-result-card-votes {
    font-size: 0.75rem;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    margin-left: 0.5rem;
}
.race-result-card-bar-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.race-result-card-pct {
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 38px;
    text-align: right;
}
.race-result-card-bar {
    flex: 1;
    height: 24px;
    background: #f3f4f6;
    border-radius: 3px;
    overflow: hidden;
}
.race-result-card-bar-fill {
    height: 100%;
    border-radius: 3px;
    min-width: 3px;
    transition: width 0.6s ease;
}
.race-result-card-bar-fill.republican, .race-result-card-bar-fill.r { background: #ef4444; }
.race-result-card-bar-fill.democratic, .race-result-card-bar-fill.democrat, .race-result-card-bar-fill.d { background: #3b82f6; }
.race-result-card-bar-fill.libertarian, .race-result-card-bar-fill.l { background: #f59e0b; }
.race-result-card-bar-fill.open, .race-result-card-bar-fill.i { background: #8b5cf6; }
.race-result-card-precincts {
    font-size: 0.75rem;
    color: #9ca3af;
    text-align: right;
    margin-top: 0.3rem;
    padding-top: 0.3rem;
    border-top: 1px solid #f3f4f6;
}

@media (max-width: 768px) {
    .state-cards-grid { grid-template-columns: 1fr; }
    .race-cards-grid { grid-template-columns: 1fr; }
    .live-candidate-row { grid-template-columns: 1fr 70px 50px 80px; font-size: 0.85rem; }
    .live-page-header { flex-direction: column; align-items: flex-start; }
    .election-alert-strip { font-size: 0.85rem; padding: 0.5rem 2.5rem 0.5rem 0.5rem; }
}

/* ── Server-rendered poll table + paywall teaser (AEO Phase 1) ── */
.poll-table { width: 100%; border-collapse: collapse; margin: var(--space-sm) 0; }
.poll-table th, .poll-table td { padding: .5rem .6rem; border-bottom: 1px solid #e6e8ec; text-align: left; font-size: .95rem; }
.poll-table th { color: var(--brand-primary); font-weight: 600; }
.poll-window-note { font-size: .85rem; color: #5a6472; margin: .25rem 0 .5rem; }
.poll-empty { color: #5a6472; font-style: italic; }
.poll-teaser { position: relative; margin-top: -1px; }
.poll-teaser-blur { filter: blur(4px); pointer-events: none; user-select: none; opacity: .55; }
.poll-teaser-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.poll-teaser-cta { box-shadow: 0 2px 10px rgba(0,0,0,.18); }

/* Pollster track records (P4.1): /pollsters table + poll-row badges */
.pollster-records-table { width: 100%; border-collapse: collapse; margin: var(--space-sm) 0; }
.pollster-records-table th, .pollster-records-table td { padding: .5rem .6rem; border-bottom: 1px solid #e6e8ec; text-align: left; font-size: .95rem; white-space: nowrap; }
.pollster-records-table th { color: var(--brand-primary); font-weight: 600; user-select: none; }
.pollster-records-table td:first-child { white-space: normal; }
.partisan-tag { display: inline-block; padding: 0 .35em; border-radius: 3px; background: #f2e9d8; color: #6b5320; font-size: .72rem; font-weight: 600; vertical-align: 1px; letter-spacing: .02em; }
.pollster-record-badge { display: inline-block; padding: 0 .3em; border-radius: 3px; background: #eef2f8; color: #3d5375; font-size: .72rem; font-weight: 600; vertical-align: 1px; text-decoration: none; }
.pollster-record-badge:hover { background: var(--brand-secondary); color: #fff; }
.pollster-cycle-nav { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .95rem; }
.pollster-cycle-nav a, .pollster-cycle-nav strong { padding: .1rem .4rem; border-radius: 4px; }
.pollster-cycle-nav strong { background: var(--brand-primary); color: #fff; }
.pollster-cycle-nav a { background: #eef2f8; text-decoration: none; }
.pollster-cycle-nav a:hover { background: var(--brand-secondary); color: #fff; }
/* Scroll box so the header row stays pinned while the table scrolls */
.pollster-table-scroll { max-height: 78vh; overflow: auto; }
.pollster-table-scroll thead th { position: sticky; top: 0; background: #fff; box-shadow: 0 1px 0 #e6e8ec; z-index: 2; }

/* ═══════════════════════════════════════════
   P2 Dual-Audience Homepage (20260705)
   Movers strip, movement deltas, sparsity pills, rating divergence
   ═══════════════════════════════════════════ */

.movers-strip {
    margin: var(--space-lg) 0;
}

.movers-strip h2 .section-note-inline {
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.movers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.mover-card {
    display: block;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color, #e8ebf0);
    border-radius: var(--radius-base);
    background: var(--bg-primary);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.mover-card:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.mover-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.mover-label {
    font-weight: 700;
    font-size: var(--text-sm);
}

.mover-delta {
    font-weight: 700;
    font-size: var(--text-sm);
    white-space: nowrap;
}

.mover-delta.small {
    font-size: var(--text-xs);
}

.mover-delta.toward-d { color: var(--dem-strong); }
.mover-delta.toward-r { color: var(--rep-strong); }

/* Arrow = margin widened/tightened; kept visually distinct from the
   partisan-colored delta text on the same line */
.mover-delta .mover-arrow {
    color: var(--text-secondary);
    margin-right: 0.15rem;
}

.mover-margins {
    margin-top: 0.35rem;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.sparsity-pill {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 10px;
    background: var(--bg-muted, #f1f3f5);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.rating-source.rating-divergence {
    color: var(--brand-accent);
}

.states-table td.margin-cell {
    font-weight: 600;
    white-space: nowrap;
}

.states-table td .table-updated {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.sidebar-news-headline {
    display: block;
    font-size: var(--text-sm);
    line-height: 1.35;
    margin-bottom: 0.2rem;
}

/* ── Today's Source: grouped compact poll list (20260706) ─────────────── */
.poll-group {
    margin-bottom: 1.1rem;
    border: 1px solid #e3e6ea;
    border-radius: 8px;
    overflow: hidden;
}

.poll-group-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.85rem;
    background: var(--brand-primary);
}

.poll-group-head a {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.poll-group-head a:hover {
    text-decoration: underline;
}

.poll-group-count {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
    white-space: nowrap;
}

.poll-row {
    display: grid;
    grid-template-columns: 95px minmax(150px, 1.1fr) 2fr 62px;
    gap: 0.35rem 0.85rem;
    align-items: baseline;
    padding: 0.42rem 0.85rem;
    border-top: 1px solid #eef1f4;
    font-size: 0.9rem;
}

.poll-row:nth-child(even) {
    background: #f8f9fb;
}

.pg-date {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
}

.pg-pollster {
    color: var(--text-secondary);
}

.pg-meta {
    color: #8a94a0;
    font-size: 0.75rem;
    white-space: nowrap;
}

.poll-row .dem {
    color: var(--brand-secondary);
    font-weight: 600;
}

.poll-row .rep {
    color: #c62828;
    font-weight: 600;
}

.pg-sep {
    color: var(--text-secondary);
    padding: 0 0.15rem;
}

.pg-untested {
    color: #8a94a0;
    font-size: 0.8rem;
    font-style: italic;
}

.pg-margin {
    font-size: 0.8rem;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.pg-margin.dem-lead { color: var(--brand-secondary); }
.pg-margin.rep-lead { color: #c62828; }
.pg-margin.even { color: var(--text-secondary); }

@media (max-width: 640px) {
    .poll-row {
        grid-template-columns: 1fr auto;
    }

    .pg-pollster,
    .pg-result {
        grid-column: 1 / -1;
    }
}

.archive-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: -0.25rem 0 0.75rem;
}

.poll-archive .pg-pollster a {
    font-weight: 600;
    text-decoration: none;
}

.poll-archive .pg-pollster a:hover {
    text-decoration: underline;
}
