/* ================================================
   Tamil Nadu Elections 2026 – Global Stylesheet
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500;600;700;800&display=swap');

/* Mono typography for numbers and data cells */
.mono,
.kpi-value,
.val,
.const-row span,
.progress-label span:last-child,
/* Constituency card inline Elector / Candidate numbers */
#homeConstTable td:nth-child(1),
#homeConstTable td:nth-child(7),
#districtTable td:nth-child(n+2),
#resultsHistTable td:nth-child(1),
#resultsHistTable td:nth-child(n+3),
#cmpPartyResult td:nth-child(2),
#cmpPartyResult td:nth-child(3),
#cmpConstResult td:nth-child(2),
#cmpConstResult td:nth-child(3) {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* ── Design Tokens ─────────────────────────────── */
:root {
    --bg: #F7F6F3;
    --surface: #FFFFFF;
    --surface-alt: #F0EFEC;
    --border: #E0DED9;
    --text: #1A1A1A;
    --text-2: #555550;
    --text-3: #888884;
    --accent: #E53935;
    --accent-2: #1565C0;
    --accent-3: #2E7D32;
    --primary: var(--accent-2);
    --radius: 8px;
    --radius-lg: 14px;
    --shadow: 0 1px 4px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
    --font-mono: 'JetBrains Mono', monospace;

    /* Alliance colours */
    --spa: #E53935;
    --nda: #43A047;
    --tvk: #A67C00;
    --ntk: #b31818;
    --ind: #757575;

    --nav-w: 220px;
    --header-h: 60px;
    --secondary-nav-h: 46px;
}

/* ── Reset ──────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

img {
    max-width: 100%;
    display: block;
}

/* Utility classes for dynamic elements */
.clickable {
    cursor: pointer !important;
}

.hover-surface:hover {
    background: var(--surface-alt) !important;
}

.hover-primary-text:hover {
    color: var(--primary) !important;
}

.hover-alliance-card[style*="color"]:hover {
    background: var(--accent) !important;
    color: #fff !important;
}

/* ── Layout ─────────────────────────────────────── */
.global-header {
    min-height: var(--header-h);
    background: linear-gradient(135deg, #1A1A1A 0%, #3B1010 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    color: #fff;
    flex-shrink: 0;
}

.global-header .nav-item {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
}

.global-header .nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.global-header .btn-share {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.global-header .btn-share:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-1px);
}

/* Global Modal Base */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.modal-overlay.active,
.modal-overlay.open {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--surface);
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
}

.modal-header h3,
.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text);
    transform: rotate(90deg) scale(1.1);
}

/* Candidate specific Sidepane overrides */
#candModal {
    justify-content: flex-end;
    padding: 0;
}

#candModal .modal {
    height: 100vh;
    max-height: 100vh;
    width: 100%;
    max-width: 480px;
    margin: 0;
    border-radius: 0;
    border: none;
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#candModal.open .modal {
    transform: translateX(0);
}

/* Share Modal Styles */
.share-modal-content {
    padding: 1rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.share-row-primary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.share-row-secondary {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    transition: all 0.2s ease;
    width: 60px; /* Force consistent width for 5-across */
}

.share-option:hover {
    transform: translateY(-2px);
}

.share-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%; /* Circular social icons */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.share-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    opacity: 0.8;
}

.share-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-action-btn:hover {
    background: var(--border);
    border-color: var(--text-dim);
}

.icon-whatsapp { background: #25D366; }
.icon-x { background: #000; }
.icon-facebook { background: #1877F2; }
.icon-telegram { background: #0088CC; }
.icon-instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }

.copy-feedback {
    position: absolute;
    bottom: 4.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: #4CAF50;
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.copy-feedback.active { opacity: 1; }

.nav-group {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 200;
}

.layout {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Secondary Nav (former Sidebar Nav) */
.secondary-nav {
    width: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    height: var(--secondary-nav-h);
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    scroll-snap-type: x proximity;
}

.secondary-nav::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar for a cleaner look */
}

.nav-section {
    display: flex;
    padding: 0;
    align-items: center;
    flex-shrink: 0;
}

.nav-label {
    display: none;
}

.nav-item {
    display: inline-flex;
    align-items: center;
    gap: .625rem;
    padding: 0 1rem;
    height: 100%;
    font-size: .82rem;
    font-weight: 500;
    color: var(--text-2);
    transition: background .15s, color .15s;
    border-bottom: 3px solid transparent;
}

.nav-item:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.nav-item.active {
    color: var(--accent);
    background: transparent;
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.nav-item .ni {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

/* Main area */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    min-height: var(--header-h);
    padding: 0.5rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-breadcrumb {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-3);
    margin-bottom: .2rem;
}

.topbar-meta {
    font-size: .75rem;
    color: var(--text-3);
}

.election-badge {
    background: #FFF3E0;
    border: 1px solid #FFB74D;
    color: #E65100;
    font-size: .7rem;
    font-weight: 700;
    padding: .2rem .6rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.page-content {
    flex: 1;
    padding: 1.75rem 2.5rem;
    width: 100%;
    margin: 0 auto;
}

/* ── Page Header ─────────────────────────────────── */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.02em;
}

.page-header p {
    font-size: .875rem;
    color: var(--text-2);
    margin-top: .25rem;
}

/* ── Empty State ───────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6rem 2rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    margin: 1rem 0 3rem;
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.empty-state h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.empty-state p {
    color: var(--text-2);
    max-width: 450px;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ── KPI Cards ───────────────────────────────────── */
.kpi-section-title {
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-2);
    margin: 1.5rem 0 .75rem 0;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.kpi-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
    opacity: 0.5;
}

.kpi-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.25rem 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform .2s, box-shadow .2s;
    position: relative;
    overflow: hidden;
    flex: 1 1 200px; /* Base width of 200px, but can grow to fill space */
    min-width: 160px;
}

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

/* Color Variants using border-color and subtle tints */
.kpi.accent  { --kpi-color: #E53935; border-color: color-mix(in srgb, var(--kpi-color) 30%, var(--border)); background: color-mix(in srgb, var(--kpi-color) 4%, var(--surface)); }
.kpi.green   { --kpi-color: #43A047; border-color: color-mix(in srgb, var(--kpi-color) 30%, var(--border)); background: color-mix(in srgb, var(--kpi-color) 4%, var(--surface)); }
.kpi.purple  { --kpi-color: #8E24AA; border-color: color-mix(in srgb, var(--kpi-color) 30%, var(--border)); background: color-mix(in srgb, var(--kpi-color) 4%, var(--surface)); }
.kpi.orange  { --kpi-color: #FB8C00; border-color: color-mix(in srgb, var(--kpi-color) 30%, var(--border)); background: color-mix(in srgb, var(--kpi-color) 4%, var(--surface)); }
.kpi.neutral { --kpi-color: #546E7A; border-color: color-mix(in srgb, var(--kpi-color) 30%, var(--border)); background: color-mix(in srgb, var(--kpi-color) 4%, var(--surface)); }
/* Fallback for generic .kpi using inline --kpi-color */
.kpi[style*="--kpi-color"] { border-color: color-mix(in srgb, var(--kpi-color) 30%, var(--border)); background: color-mix(in srgb, var(--kpi-color) 4%, var(--surface)); }

.kpi.accent .kpi-label { color: #E53935; }
.kpi.green  .kpi-label { color: #43A047; }
.kpi.purple .kpi-label { color: #8E24AA; }
.kpi.orange .kpi-label { color: #FB8C00; }
.kpi.neutral .kpi-label { color: #546E7A; }
.kpi[style*="--kpi-color"] .kpi-label { color: var(--kpi-color); }

.kpi.clickable {
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s, border-color 0.25s, filter 0.25s;
}

.kpi.clickable:hover {
    transform: translateY(-2px);
    border-color: var(--kpi-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.kpi.clickable:active {
    transform: translateY(0);
    filter: brightness(0.96);
}

.kpi-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-3);
    margin-bottom: .5rem;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--text);
    line-height: 1;
}

.kpi-sub {
    font-size: .72rem;
    color: var(--text-3);
    margin-top: .35rem;
}



/* ── Cards / Panels ──────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-header h3 {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text);
}

.card-header .subtitle {
    font-size: .75rem;
    color: var(--text-3);
}

.card-body {
    padding: 1.25rem;
}

/* Home page 3-col top grid */
.home-top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* 2-col grid */
.two-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.three-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* Chart wrapper */
.chart-wrap {
    position: relative;
    height: 260px;
}

.chart-wrap canvas {
    width: 100% !important;
}

/* Standardized chart card */
.chart-card {
    display: flex;
    flex-direction: column;
    height: 380px;
}

.chart-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 1rem;
    overflow: hidden;
}

.chart-card .chart-wrap {
    flex: 1;
    width: 100%;
    position: relative;
    min-height: 0;
}

.chart-wrap > div {
    height: 100% !important;
}

/* Fix: Remove focus outline from SVG/ApexCharts on click */
.apexcharts-canvas, 
.apexcharts-canvas *,
svg, 
path, 
circle, 
rect {
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
}

/* ── Tables ──────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}

.data-table th,
.data-table td {
    padding: .65rem .9rem;
    text-align: left;
}

.data-table thead th {
    background: var(--surface-alt);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-3);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}

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

.data-table tbody tr:hover {
    background: var(--surface-alt);
}

    /* Responsive Table Adjustments - Desktop layout preserved for mobile */
@media (max-width: 768px) {
    /* We no longer hide headers, we let the table scroll horizontally */
    .data-table thead {
        display: table-header-group !important;
    }
    
    .data-table {
        display: table !important;
        width: 100% !important;
        min-width: 900px !important; /* Force desktop-like width for scrolling */
        border-collapse: collapse !important;
    }
    
    .data-table tbody {
        display: table-row-group !important;
    }
    
    .data-table tr {
        display: table-row;
    }
    
    .data-table td, .data-table th {
        display: table-cell !important;
        text-align: left !important;
        padding: 0.65rem 0.9rem !important;
        border-bottom: 1px solid var(--border) !important;
        white-space: nowrap !important; /* Crucial to prevent squishing */
    }
    
    .data-table th {
        background: var(--surface-alt) !important;
        vertical-align: bottom !important;
    }

    /* Specific override for schedule table to fit on screen */
    .schedule-table {
        min-width: 0 !important;
        width: 100% !important;
        table-layout: auto !important;
    }
    
    .schedule-table td, .schedule-table th {
        padding: 0.5rem 0.5rem !important;
        font-size: 0.75rem !important;
        white-space: normal !important; /* Allow wrapping of event names if needed */
    }

    .schedule-table td.mono {
        white-space: nowrap !important;
    }
    
    .data-table td::before {
        display: none !important;
    }

    /* Container should handle overflow */
    .card-body, div[style*="overflow-x:auto"], .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
    }
}

    /* Specific overrides for small tables that should stay as tables */
    .table-sm-stack-off thead { display: table-header-group; }
    .table-sm-stack-off tbody { display: table-row-group; }
    .table-sm-stack-off tr { display: table-row; border: none; margin: 0; padding: 0; }
    .table-sm-stack-off td { display: table-cell; text-align: left; border-bottom: 1px solid var(--border); }
    .table-sm-stack-off td::before { display: none; }




/* party chip */
.party-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .15rem .55rem;
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 700;
    white-space: nowrap;
}

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

/* status badge */
.badge {
    display: inline-block;
    padding: .12rem .5rem;
    border-radius: 20px;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-active {
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-upcoming {
    background: #E3F2FD;
    color: #1565C0;
}

.badge-done {
    background: #F3E5F5;
    color: #6A1B9A;
}

/* ── Filters ─────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}

.stats-filter-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.stats-filter-bar label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-3);
}

.stats-filter-bar select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    min-width: 160px;
}

.stats-filter-bar select:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.filter-bar input[type=text] {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .5rem .85rem;
    font-size: .82rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--accent-2);
    font-weight: 600;
    outline: none;
    transition: border-color .2s;
}

input::placeholder {
    color: var(--text-3) !important;
    opacity: 0.7;
}

input[type="text"] {
    color: var(--primary);
}

.filter-bar select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .5rem 2.5rem .5rem .85rem;
    font-size: .82rem;
    font-family: inherit;
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333333' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px 12px;
    color: var(--text);
    outline: none;
    transition: border-color .2s;
    min-width: 160px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-bar input[type=text]:focus,
.filter-bar select:focus {
    border-color: var(--accent);
}

.filter-bar input[type=text] {
    flex: 1;
    min-width: 200px;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    font-size: .82rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: all .2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: #C62828;
    border-color: #C62828;
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text-2);
}

.btn-outline:hover {
    border-color: var(--text-3);
    background: var(--surface-alt);
}

.btn-sm {
    padding: .3rem .7rem;
    font-size: .75rem;
}

/* ── Alliance Cards ──────────────────────────────── */
.alliance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.alliance-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform .2s, box-shadow .2s;
}

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

.alliance-name {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: .5rem;
}

.alliance-parties {
    font-size: .75rem;
    color: var(--text-2);
    margin-bottom: .9rem;
    line-height: 1.7;
}

.alliance-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: .5rem;
}

.a-stat {
    background: var(--surface-alt);
    border-radius: var(--radius);
    padding: .5rem;
    text-align: center;
}

.a-stat .val {
    font-size: 1.1rem;
    font-weight: 800;
}

.a-stat .lbl {
    font-size: .62rem;
    color: var(--text-3);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Candidate Cards ─────────────────────────────── */
.candidate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.cand-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform .2s;
    cursor: pointer;
}

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

.cand-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: .75rem;
    flex-shrink: 0;
}

.cand-name {
    font-size: .9rem;
    font-weight: 700;
    margin-bottom: .2rem;
}

.cand-meta {
    font-size: .76rem;
    color: var(--text-2);
    margin-bottom: .65rem;
}

.cand-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.cand-tag {
    font-size: .65rem;
    font-weight: 600;
    padding: .15rem .5rem;
    border-radius: 20px;
    background: var(--surface-alt);
    color: var(--text-2);
}

/* ── Highlights / Timeline ───────────────────────── */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tl-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}

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

.tl-date {
    font-size: .72rem;
    color: var(--text-3);
    width: 80px;
    flex-shrink: 0;
    font-weight: 600;
    padding-top: .1rem;
}

.tl-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: .4rem;
}

.tl-body {
    flex: 1;
}

.tl-title {
    font-size: .87rem;
    font-weight: 700;
    margin-bottom: .2rem;
}

.tl-desc {
    font-size: .78rem;
    color: var(--text-2);
    line-height: 1.5;
}

.tl-tag {
    display: inline-block;
    font-size: .62rem;
    font-weight: 700;
    padding: .1rem .45rem;
    border-radius: 20px;
    background: #E3F2FD;
    color: #1565C0;
    margin-top: .4rem;
}

/* ── Constituency mini-map grid ──────────────────── */
.const-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .85rem;
    margin-bottom: 1.25rem;
}

.const-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform .2s;
}

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

.const-name {
    font-size: .88rem;
    font-weight: 700;
    margin-bottom: .15rem;
}

.const-dist {
    font-size: .72rem;
    color: var(--text-3);
    margin-bottom: .65rem;
}

.const-row {
    display: flex;
    justify-content: space-between;
    font-size: .75rem;
    color: var(--text-2);
    padding: .15rem 0;
}

.const-row span {
    font-weight: 600;
    color: var(--text);
}

/* ── Compare panel ───────────────────────────────── */
.compare-panel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.compare-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--text-3);
    padding-top: 2.5rem;
}



/* ── Progress bars ───────────────────────────────── */
.progress-row {
    margin-bottom: .75rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: .78rem;
    margin-bottom: .3rem;
    font-weight: 600;
    color: var(--text-2);
}

.progress-bar {
    height: 8px;
    background: var(--surface-alt);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .6s ease;
}

/* ── Donut legend ────────────────────────────────── */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .85rem;
    margin-top: auto;
    justify-content: center;
    align-items: flex-end;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    color: var(--text-2);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Gender pill ──────────────────────────────────── */
.gender-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 700;
    padding: .15rem .5rem;
    border-radius: 20px;
}

.gender-m {
    background: #E3F2FD;
    color: #1565C0;
}

.gender-f {
    background: #FCE4EC;
    color: #C2185B;
}

.gender-o {
    background: #F3E5F5;
    color: #6A1B9A;
}

/* Combined with global modal base */

.modal-body {
    padding: 1.4rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: .83rem;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-3);
    font-weight: 600;
}

.detail-val {
    color: var(--text);
    font-weight: 600;
    text-align: right;
}

/* ── Responsive ──────────────────────────────────── */

/* Tablet landscape */
@media (max-width: 1200px) {
    .page-content {
        padding: 1.5rem 1.75rem;
    }
}

/* Tablet portrait */
@media (max-width: 900px) {

    .two-col,
    .three-col {
        grid-template-columns: 1fr;
    }

    .home-top-grid {
        grid-template-columns: 1fr 1fr;
    }

    .home-top-grid> :first-child {
        grid-column: 1 / -1;
    }

    .topbar {
        padding: 0.5rem 1rem;
    }

    .topbar-meta {
        display: none;
    }

    .page-content {
        padding: 1rem 1.25rem;
    }

    .compare-panel {
        grid-template-columns: 1fr;
    }

    .compare-vs {
        padding-top: 0;
    }

    .global-header {
        padding: 0 1rem;
    }

    .secondary-nav {
        padding: 0 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .kpi-value {
        font-size: 1.3rem;
    }

    .alliance-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .candidate-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .const-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .election-badge {
        display: none;
    }

    .global-header {
        min-height: 48px;
        padding: 0 0.75rem;
    }

    .global-header h1 {
        font-size: 0.9rem !important;
    }

    .desktop-title {
        display: none !important;
    }

    .mobile-title {
        display: inline !important;
    }

    #pollingCountdown {
        font-size: 0.70rem !important;
        padding: 0.2rem 0.4rem !important;
    }

    .secondary-nav {
        height: 44px;
        padding: 0 0.5rem;
        position: relative;
        overflow-x: auto;
        -ms-overflow-style: none; /* IE/Edge */
        -webkit-mask-image: linear-gradient(to right, black 92%, transparent 100%);
        mask-image: linear-gradient(to right, black 92%, transparent 100%);
    }

    .nav-section {
        gap: 0;
    }

    .nav-item {
        font-size: 0.78rem;
        padding: 0 0.75rem;
        flex-shrink: 0;
    }

    .page-content {
        padding: 0.75rem;
    }

    .page-header h2 {
        font-size: 1.15rem;
    }

    .page-header p {
        font-size: 0.8rem;
    }

    .kpi-grid {
        gap: 0.6rem;
    }
    .kpi {
        flex: 1 1 140px; /* Smaller base for mobile */
        min-width: 120px;
    }

    .kpi {
        padding: 0.85rem 0.9rem 0.7rem;
    }

    .kpi-value {
        font-size: 1.15rem;
    }

    .kpi-label {
        font-size: 0.6rem;
    }

    .kpi-sub {
        font-size: 0.62rem;
    }

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

    .home-top-grid {
        grid-template-columns: 1fr;
    }

    .home-top-grid> :first-child {
        grid-column: auto;
    }

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

    .const-grid {
        grid-template-columns: 1fr !important;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar input[type=text],
    .filter-bar select {
        width: 100%;
        min-width: unset;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    .card-header h3 {
        font-size: 0.82rem;
    }

    .card-body {
        padding: 0.85rem;
    }

    .topbar {
        padding: 0.4rem 0.75rem;
        min-height: 46px;
    }

    .topbar-breadcrumb {
        font-size: 0.7rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.45rem 0.5rem;
        font-size: 0.72rem;
    }

    .data-table thead th {
        font-size: 0.6rem;
    }

    .insight-list {
        grid-template-columns: 1fr;
    }

    .stats-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .stats-filter-bar select {
        width: 100%;
        min-width: unset;
    }
    .chart-wrap {
        height: 220px;
    }

    .tabs .tab {
        padding: 0.5rem 0.8rem;
        font-size: 0.72rem;
    }

    .manifesto-top-cards {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* Extra-small screens */
@media (max-width: 400px) {
    .kpi {
        flex: 1 1 100%; /* Force full width on very small screens */
    }

    .page-content {
        padding: 0.5rem;
    }

    .manifesto-top-cards {
        grid-template-columns: 1fr !important;
    }
}

/* ── Tabs ────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: .65rem 1.1rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-3);
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all .15s;
}

.tab:hover {
    color: var(--text);
}

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

/* ── Cand View Tabs ──────────────────────────────── */
.cand-view-btn {
    border-radius: 20px;
    padding: 0.6rem 1.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.cand-view-btn.active {
    background: var(--text);
    color: white;
    border-color: var(--text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cand-view-btn:not(.active):hover {
    background: var(--surface-alt);
    border-color: var(--border);
    transform: translateY(-1px);
}

/* ── Page visibility ─────────────────────────────── */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* ── Turnout bar ─────────────────────────────────── */
.turnout-indicator {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.turnout-bar {
    flex: 1;
    height: 12px;
    background: var(--surface-alt);
    border-radius: 6px;
    overflow: hidden;
}

.turnout-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--spa), #ff6b6b);
    border-radius: 6px;
}

/* ── Insight cards ───────────────────────────────── */
.insight-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .85rem;
}

.insight-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.2rem;
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    box-shadow: var(--shadow-sm);
}

.insight-rank {
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1;
    color: var(--border);
    width: 1.8rem;
    flex-shrink: 0;
}

.insight-body h4 {
    font-size: .87rem;
    font-weight: 700;
    margin-bottom: .2rem;
}

.insight-body p {
    font-size: .76rem;
    color: var(--text-2);
}

/* ── Footer ──────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 1rem;
    font-size: .72rem;
    color: var(--text-3);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* ── Mobile menu btn ─────────────────────────────── */
.menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .4rem .6rem;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text);
}

/* ── Sidebar View Drawer ────────────────────────── */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    padding: 1rem;
}

.sidebar-overlay.open {
    display: flex;
}

.sidebar-panel {
    background: var(--surface);
    width: 100%;
    max-width: 800px; /* Wider fit like standard modals */
    height: auto;
    max-height: 85vh; /* Standard modal safe zone */
    border-radius: var(--radius-lg); /* Rounded card shape overlay */
    box-shadow: 0 12px 50px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* curved corner clips properly */
    animation: modalScale .25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
    from { transform: scale(0.93); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--surface-alt);
}

.sidebar-pretitle {
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: .25rem;
}

.sidebar-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.sidebar-close {
    background: var(--surface);
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .9rem;
    color: var(--text-2);
    transition: all .2s;
}

.sidebar-close:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.mla-card {
    background: var(--surface-alt);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.mla-label {
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.mla-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.mla-header {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.mla-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
}

.mla-name {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0;
}

.mla-party {
    font-size: .85rem;
    font-weight: 700;
    margin-top: .1rem;
    color: var(--text-2);
}

.history-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.hist-year {
    font-weight: 800;
    font-size: .95rem;
    width: 50px;
}

.hist-info {
    flex: 1;
}

.hist-winner {
    font-size: .88rem;
    font-weight: 700;
    margin-bottom: .1rem;
}

.hist-party {
    font-size: .75rem;
    color: var(--text-3);
    font-weight: 600;
}

.hist-pct {
    text-align: right;
}

.hist-pct-val {
    font-weight: 800;
    font-size: .95rem;
    color: var(--accent);
}

.hist-pct-lbl {
    font-size: .6rem;
    text-transform: uppercase;
    color: var(--text-3);
    font-weight: 600;
}

/* ── Table Sorting Indicators ────────────────────── */
.data-table th {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem !important;
}

.data-table th:hover {
    background: var(--surface-alt);
}

.data-table th::after {
    content: '⇅';
    position: absolute;
    right: 0.5rem;
    opacity: 0.2;
    font-size: 0.8em;
}

.data-table th.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--accent);
}

.data-table th.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--accent);
}

/* ══════════════════════════════════════════════════
   DETAIL CARDS (constituency detail)
   ══════════════════════════════════════════════════ */
.glass-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    transition: box-shadow 0.2s;
}

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

/* ══════════════════════════════════════════════════
   CONSTITUENCY DETAIL VIEW (New Layout)
   ══════════════════════════════════════════════════ */
.cd-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 2.5rem;
    background: #FAFAFA;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

/* HEADER */
.cd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1.5rem;
}

.cd-header-left {
    flex: 1;
    min-width: 300px;
}

.cd-const-name {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.cd-const-meta {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-2);
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.cd-history-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #E53935;
    color: #fff;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    cursor: pointer;
    text-transform: uppercase;
    margin-top: 1rem;
}

.cd-header-right {
    background: #F4F4F4;
    border: 1px solid var(--border);
    padding: 1.5rem 1.75rem;
    border-radius: 8px;
    min-width: 320px;
    flex: 1;
    max-width: 500px;
}

.cd-snapshot-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-3);
    letter-spacing: 0.05em;
    margin-bottom: 1.2rem;
    text-align: left;
    text-transform: uppercase;
}

.cd-snapshot-stats {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.25rem;
}

.cd-stat-left {
    text-align: left;
}

.cd-stat-right {
    text-align: right;
}

.cd-snapshot-num {
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.02em;
}

.cd-snapshot-sub {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    margin-top: 0.3rem;
}

.cd-snapshot-cands-num {
    font-size: 1.8rem;
    font-weight: 600;
    color: #cc0000;
    line-height: 1;
    font-family: 'Inter', sans-serif;
}

.cd-snapshot-cands-sub {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    margin-top: 0.3rem;
}

.cd-gender-bar {
    display: flex;
    height: 8px;
    background: #E0E0E0;
    border-radius: 4px;
    overflow: hidden;
}

.cd-gender-fill {
    height: 100%;
}

/* BODY LAYOUT */
.cd-body {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.cd-left {
    flex: 2;
    min-width: 400px;
    background: #F4F4F4;
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.cd-right {
    flex: 1;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* LEFT: Candidate List */
.cd-section-hd {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.cd-cand-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.cd-cand-row {
    background: #FFFFFF;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid transparent;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.cd-cand-row.clickable {
    cursor: pointer;
}

.cd-cand-row.clickable:hover {
    border-color: #E0E0E0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.cd-cand-avatar {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #E5E5E5;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.cd-cand-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cd-cand-avatar svg {
    width: 24px;
    height: 24px;
}

.cd-cand-info {
    flex: 1;
    min-width: 0;
    margin-left: 0.5rem;
}

.cd-cand-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.cd-cand-party-lbl {
    font-size: 0.65rem;
    font-weight: 700;
    color: #C62828;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cd-alliance-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.3rem 0.6rem;
    border-radius: 2px;
    border: 1px solid currentColor;
    background: transparent !important;
    white-space: nowrap;
}

.cd-cand-chevron {
    color: var(--text-3);
    font-size: 1.25rem;
    padding-left: 0.5rem;
}

.cd-download-btn {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 1rem 0;
}

.cd-download-btn:hover {
    color: var(--text);
}

/* RIGHT: Cards */
.cd-mla-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.cd-mla-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

.cd-mla-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cd-mla-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.1rem;
}

.cd-mla-party {
    font-size: 0.75rem;
    font-weight: 700;
}

.cd-mla-avatar {
    width: 48px;
    height: 48px;
    border-radius: 6px; /* Boxy like image */
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
}

.cd-map-card {
    background: #EAEAEA;    /* Matching gray background from screenshot */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.cd-map-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text);
}

.cd-map-subtitle {
    font-size: 0.7rem;
    color: var(--text-2);
    margin-bottom: 1rem;
}

.cd-reels-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    overflow: hidden;
}



.cd-reels-embed {
    position: relative;
    padding-bottom: 177.77%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #222;
}

.cd-reels-open {
    display: none; /* Embed natively takes user to IG */
}

/* MOBILE RESPONSIVE FIXES */
@media (max-width: 900px) {
    .cd-body { 
        flex-direction: column; 
        gap: 1.5rem;
    }
    .cd-left, .cd-right { 
        width: 100%; 
        min-width: 0; 
        flex: none; 
    }
}

@media (max-width: 768px) {
    .cd-scroll {
        padding: 1.5rem;
    }
    .cd-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        margin-bottom: 1.5rem;
        padding-bottom: 1.25rem;
    }
    .cd-header-left, .cd-header-right {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
    .cd-const-name {
        font-size: 1.75rem;
    }
    .cd-snapshot-num {
        font-size: 1.75rem;
    }
    .cd-snapshot-cands-num {
        font-size: 1.5rem;
    }
    .sidebar-panel {
        max-height: 95vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    .cd-top-nav {
        padding: 0.75rem 1rem !important;
    }
}

@media (max-width: 480px) {
    .cd-scroll {
        padding: 1rem;
    }
    .cd-cand-row {
        padding: 0.85rem 1rem;
        gap: 0.75rem;
    }
    .cd-cand-avatar {
        width: 40px;
        height: 40px;
    }
    .cd-cand-name {
        font-size: 0.95rem;
    }
    .cd-cand-party-lbl {
        font-size: 0.6rem;
    }
    .cd-alliance-badge {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
}
/* CUSTOM TOOLTIP */
#custom-tooltip {
    position: fixed;
    background: #2D2D2D;
    color: #FFF;
    padding: 0.5rem 0.85rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateY(8px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.1);
    letter-spacing: 0.02em;
}
#custom-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hide tooltip on mobile/touch devices */
@media (max-width: 768px), (pointer: coarse) {
    #custom-tooltip {
        display: none !important;
    }
}

/* ── Announcement Box ── */
.announcement-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    opacity: 0;
    transition: opacity 0.4s ease;
    padding: 1.5rem;
}

.announcement-overlay.active {
    display: flex;
    opacity: 1;
}

.announcement-box {
    background: var(--surface);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 40px 80px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    text-align: center;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.announcement-overlay.active .announcement-box {
    transform: translateY(0) scale(1);
}

.announcement-icon-wrapper {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-2) 0%, #1e88e5 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    box-shadow: 0 10px 20px rgba(21, 101, 192, 0.25);
}

.announcement-title {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.announcement-msg {
    font-size: 1rem;
    color: var(--text-2);
    line-height: 1.7;
    margin-bottom: 2rem;
    font-weight: 500;
}

.announcement-btn {
    background: var(--text);
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    border-radius: 14px;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.announcement-btn:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

.announcement-btn:active {
    transform: translateY(0);
}
