/* ============================================================
   Election Results Component — results.css
   A standalone, opinionated stylesheet for the front-end
   results page. Designed to look great in any Joomla template
   while inheriting the template's base font and colours.

   Load order: your template CSS → electionresults.css → results.css
   results.css adds richer visual treatment on top of the base.
   ============================================================ */

/* ── Page wrapper ─────────────────────────────────────────── */
.er-results-page {
    max-width: var(--er-results-max-width, none);
    margin: 0 auto;
    padding: 0 1em 3em;
    background: var(--er-page-bg, #ffffff);
}
/* .er-wrap is the actual rendered outer div — apply width constraint here too */
.er-wrap {
    max-width: var(--er-results-max-width, none);
    margin-left: auto;
    margin-right: auto;
    background: var(--er-page-bg, #ffffff);
}

/* ── Election header card ─────────────────────────────────── */
.er-header-card {
    background: linear-gradient(135deg, var(--er-primary, #1a56db) 0%, #0e3fa0 100%);
    color: #ffffff;
    border-radius: .75em;
    padding: 1.5em 1.75em;
    margin-bottom: 1.5em;
    box-shadow: 0 4px 20px rgba(26, 86, 219, .25);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1em;
}

.er-header-card__title {
    font-size: 1.5em;
    font-weight: 700;
    margin: 0 0 .3em;
    color: #ffffff;
    line-height: 1.25;
}

.er-header-card__date {
    font-size: 1em;
    opacity: .8;
    margin-bottom: .5em;
}

.er-header-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: .4em;
    margin-top: .4em;
}

/* Counting badge — inside header (white on primary) */
.er-header-card .er-counting-badge {
    background: rgba(255, 255, 255, .18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, .35);
}

.er-header-card .er-counting-dot {
    background: #fbbf24;
}

/* Certified badge — inside header */
.er-header-card .er-certified-badge {
    background: rgba(255, 255, 255, .18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, .35);
}

/* Enter Votes button inside header */
.er-header-card .er-btn--primary {
    background: rgba(255, 255, 255, .2);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, .5);
    padding: .45em 1.1em;
    border-radius: .4em;
    font-size: 1em;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s;
}

.er-header-card .er-btn--primary:hover {
    background: rgba(255, 255, 255, .32);
    color: #ffffff;
    text-decoration: none;
}

/* ── Stats row ────────────────────────────────────────────── */
.er-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: .75em;
    margin-bottom: 1.4em;
}

.er-stat-card {
    background: var(--er-surface, #f9fafb);
    border: 1px solid var(--er-border, rgba(0,0,0,.1));
    border-radius: .6em;
    padding: .75em 1em;
    text-align: center;
}

.er-stat-card__value {
    font-size: 1.6em;
    font-weight: 700;
    line-height: 1;
    color: var(--er-primary, #1a56db);
    margin-bottom: .2em;
}

.er-stat-card__label {
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: .06em;
    opacity: .6;
}

/* ── Legend / anchor nav ──────────────────────────────────── */
.er-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35em .5em;
    background: var(--er-surface, #f9fafb);
    border: 1px solid var(--er-border, rgba(0,0,0,.1));
    border-radius: .5em;
    padding: .6em .9em;
    margin-bottom: 1.4em;
    font-size: 1em;
}

.er-legend__label {
    font-size: .7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    opacity: .55;
    margin-right: .25em;
    flex-shrink: 0;
}

.er-legend__link {
    display: inline-flex;
    align-items: center;
    gap: .3em;
    padding: .25em .8em;
    border-radius: 999px;
    border: 1.5px solid var(--er-primary, #1a56db);
    color: var(--er-primary, #1a56db) !important;
    font-weight: 600;
    font-size: 1em;
    text-decoration: none !important;
    transition: all .14s;
    white-space: nowrap;
}

.er-legend__link:hover,
.er-legend__link:focus {
    background: var(--er-jumpto-hover, var(--er-primary, #1a56db));
    border-color: var(--er-jumpto-hover, var(--er-primary, #1a56db));
    color: #ffffff !important;
    text-decoration: none !important;
}

.er-legend__arrow {
    font-size: .7em;
    opacity: .7;
    transition: transform .14s;
}

.er-legend__link:hover .er-legend__arrow {
    transform: translateY(2px);
    opacity: 1;
}

/* ── Office section ───────────────────────────────────────── */
.er-office {
    background: var(--er-bg, transparent);
    border: 1px solid var(--er-border, rgba(0,0,0,.1));
    border-radius: .7em;
    margin-bottom: 1.4em;
    overflow: hidden;
    scroll-margin-top: 5em;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.er-office__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .5em;
    padding: .85em 1.1em;
    background: var(--er-surface, #f9fafb);
    border-bottom: 1px solid var(--er-border, rgba(0,0,0,.1));
}

.er-office__title {
    font-size: var(--er-office-title-size, 1em);
    font-weight: 700;
    color: var(--er-office-title-color, var(--er-primary, #1a56db));
    margin: 0;
}

.er-office__header-right {
    display: flex;
    align-items: center;
    gap: .6em;
    flex-wrap: wrap;
}

.er-office__total {
    font-size: 1em;
    opacity: .6;
}

.er-office__precinct-count {
    font-size: 1em;
    font-weight: 600;
    padding: .2em .65em;
    border-radius: 999px;
    background: var(--er-primary, #1a56db);
    color: #ffffff;
    opacity: .85;
}

/* ── Candidate rows ───────────────────────────────────────── */
.er-candidates {
    padding: .6em .8em;
    display: flex;
    flex-direction: column;
    gap: .5em;
}

.er-candidate {
    border-radius: .5em;
    border: 1.5px solid var(--er-border, rgba(0,0,0,.1));
    overflow: hidden;
    transition: box-shadow .15s;
    background: var(--er-candidate-bg, #ffffff);
    color: var(--er-candidate-text, inherit);
}

.er-candidate:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.er-candidate--leading {
    background: var(--er-leading-row-bg, #92400e);
    border-color: var(--er-leading-row-bg, #92400e);
}

.er-candidate--winner {
    background: var(--er-winner-row-bg, #065f46);
    border-color: var(--er-winner-row-bg, #065f46);
}

.er-candidate__summary {
    display: flex;
    align-items: center;
    gap: .85em;
    padding: .7em .9em;
    flex-wrap: wrap;
    align-self: flex-start;
    flex: 0 0 400px;    /* fixed — ensures bar is same width for every candidate */
    max-width: 400px;
    min-width: 220px;
    box-sizing: border-box;
}

/* Avatar */
.er-candidate__photo {
    width: 2.2em;
    height: 2.2em;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(0,0,0,.1);
}

.er-candidate__avatar {
    width: 2.2em;
    height: 2.2em;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.25);
}

/* Name + party */
.er-candidate__identity {
    flex: 1;
    min-width: 0;
}

.er-candidate__name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35em;
}

.er-candidate__name {
    font-weight: 700;
    font-size: 1em;
    color: var(--er-text, inherit);
}

.er-candidate--leading .er-candidate__name,
.er-candidate--winner  .er-candidate__name {
    color: var(--er-leading-row-text, #ffffff);
}

.er-candidate--winner .er-candidate__name {
    color: var(--er-winner-row-text, #ffffff);
}

.er-candidate__party {
    font-size: 1em;
    opacity: .7;
    padding-left: .4em;
    border-left: 2.5px solid currentColor;
    margin-top: .15em;
    display: block;
}

.er-candidate--leading .er-candidate__party,
.er-candidate--winner  .er-candidate__party {
    opacity: .65;
    color: rgba(255,255,255,.85);
}

/* Badges */
.er-badge {
    display: inline-flex;
    align-items: center;
    gap: .25em;
    padding: .2em .65em;
    border-radius: 999px;
    font-size: 1em;
    font-weight: 700;
    white-space: nowrap;
}

.er-badge--leading {
    background: var(--er-leading-badge-bg, #fef3c7);
    color: var(--er-leading-badge-text, #92400e);
    font-size: var(--er-leading-badge-size, 85%);
}

.er-badge--winner {
    background: rgba(255,255,255,.2);
    color: #ffffff;
    font-size: var(--er-winner-badge-size, 85%);
}

/* Pulse dot */
.er-pulse-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fbbf24;
    animation: er-pulse 1.3s ease-in-out infinite;
}

.er-candidate--leading .er-pulse-dot { background: rgba(255,255,255,.9); }

@keyframes er-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .3; transform: scale(.65); }
}

.er-candidate__badge-row {
    display: flex;
    align-items: center;
}

/* Progress bar */
.er-candidate__results {
    flex: 2;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: .35em;
    justify-content: center;
}

.er-progress-bar {
    height: .45em;
    background: rgba(0,0,0,.08);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: .3em;
}

.er-candidate--leading .er-progress-bar,
.er-candidate--winner  .er-progress-bar {
    background: rgba(255,255,255,.2);
}

.er-progress-bar__fill {
    height: 100%;
    border-radius: 999px;
    transition: width .4s ease;
}

.er-candidate__vote-info {
    display: flex;
    justify-content: space-between;
    font-size: 1em;
}

.er-candidate__votes { opacity: .7; }

.er-candidate__pct {
    font-weight: 700;
    font-size: 1em;
}

.er-candidate--leading .er-candidate__votes,
.er-candidate--leading .er-candidate__pct,
.er-candidate--winner  .er-candidate__votes,
.er-candidate--winner  .er-candidate__pct {
    color: rgba(255,255,255,.9);
}

/* ── Precinct breakdown table ─────────────────────────────── */
.er-precinct-breakdown {
    margin: 0;
    padding: .5em .9em .75em;
    border-top: 1px dashed var(--er-border, rgba(0,0,0,.12));
    background: var(--er-surface, #f9fafb);
    overflow-x: auto;
    flex: 1 1 0;         /* fills remaining space equally for all candidates */
    min-width: 0;
    align-self: stretch;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.er-candidate--leading .er-precinct-breakdown,
.er-candidate--winner  .er-precinct-breakdown {
    background: rgba(0, 0, 0, .1);
    border-top-color: rgba(255, 255, 255, .2);
}

.er-precinct-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--er-table-font-size, 85%);
    min-width: 280px;
}

.er-precinct-table__head {
    padding: .3em .7em;
    text-align: center;
    font-size: .68em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: var(--er-table-head-bg, var(--er-surface, #f9fafb));
    border: 1px solid var(--er-border, rgba(0,0,0,.1));
    color: var(--er-table-head-text, var(--er-text-muted, rgba(0,0,0,.5)));
    white-space: nowrap;
}

.er-precinct-table__head.er-precinct-table__total {
    background: var(--er-border, rgba(0,0,0,.1));
    color: var(--er-text, inherit);
}

.er-precinct-table__cell {
    padding: .35em .7em;
    text-align: center;
    border: 1px solid var(--er-border, rgba(0,0,0,.1));
    font-variant-numeric: tabular-nums;
    background: var(--er-bg, transparent);
}

.er-precinct-table__cell--empty {
    color: var(--er-text-muted, rgba(0,0,0,.4));
    font-style: italic;
}
/* ── Out-of-scope precinct cell (office has ED restriction) ─── */
.er-precinct-table__cell--na {
    background: var(--er-table-na-bg, #e0e0e0);
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,
        rgba(0,0,0,.07) 4px,
        rgba(0,0,0,.07) 8px
    );
    color: var(--er-table-na-text, #bbb);
    cursor: default;
    user-select: none;
    pointer-events: none;
}
/* NA cell dark rule moved to after the regular cell rule below */


.er-precinct-table__total-cell {
    font-weight: 700;
    background: var(--er-surface, #f9fafb);
    border-left: 2px solid var(--er-border, rgba(0,0,0,.15));
}

/* Precinct table on coloured rows */
/* ── Winner row — precinct table ───────────────────────────── */
.er-candidate--winner .er-precinct-table__head,
.er-candidate--winner .er-precinct-table__cell {
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.15);
    color: rgba(255,255,255,.85);
}
.er-candidate--winner .er-precinct-table__head.er-precinct-table__total,
.er-candidate--winner .er-precinct-table__total-cell {
    background: rgba(255,255,255,.18);
    color: #ffffff;
}
.er-candidate--winner .er-precinct-table__cell--empty {
    color: rgba(255,255,255,.35);
}
.er-candidate--winner .er-precinct-table__cell--na {
    background: var(--er-table-na-bg, #e0e0e0);
    background-image: repeating-linear-gradient(
        -45deg, transparent, transparent 4px,
        rgba(0,0,0,.07) 4px, rgba(0,0,0,.07) 8px);
    color: var(--er-table-na-text, #bbb);
    pointer-events: none;
}

/* ── Leading row — configurable via Options > Colours ─────── */
.er-candidate--leading .er-precinct-table__head {
    background: var(--er-leading-precinct-head-bg, #78350f) !important;
    color: var(--er-leading-precinct-head-text, #ffffff) !important;
    border-color: rgba(0,0,0,.1);
}
.er-candidate--leading .er-precinct-table__cell {
    background: var(--er-leading-precinct-cell-bg, #fef3c7) !important;
    color: var(--er-leading-precinct-cell-text, #1a1a1a) !important;
    border-color: rgba(0,0,0,.08);
}
.er-candidate--leading .er-precinct-table__head.er-precinct-table__total {
    background: var(--er-leading-precinct-head-bg, #78350f) !important;
    color: var(--er-leading-precinct-head-text, #ffffff) !important;
    opacity: .85;
}
.er-candidate--leading .er-precinct-table__total-cell {
    background: var(--er-leading-precinct-cell-bg, #fef3c7) !important;
    color: var(--er-leading-precinct-cell-text, #1a1a1a) !important;
    opacity: .85;
    font-weight: 700;
}
.er-candidate--leading .er-precinct-table__cell--empty {
    color: var(--er-text-muted);
}
.er-candidate--leading .er-precinct-table__cell--na {
    background: var(--er-table-na-bg, #e0e0e0) !important;
    background-image: repeating-linear-gradient(
        -45deg, transparent, transparent 4px,
        rgba(0,0,0,.07) 4px, rgba(0,0,0,.07) 8px) !important;
    color: var(--er-table-na-text, #bbb) !important;
    pointer-events: none;
}

/* ── Recent submissions table ─────────────────────────────── */
.er-recent-submissions {
    margin-top: 1.5em;
    border: 1px solid var(--er-border, rgba(0,0,0,.1));
    border-radius: .6em;
    overflow: hidden;
}

.er-recent-submissions__title {
    font-size: 1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: .65em 1em;
    background: var(--er-surface, #f9fafb);
    border-bottom: 1px solid var(--er-border, rgba(0,0,0,.1));
    margin: 0;
    opacity: .65;
}

.er-submissions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
}

.er-submissions-table th {
    padding: .5em .8em;
    text-align: left;
    font-size: .7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    opacity: .55;
    border-bottom: 1px solid var(--er-border, rgba(0,0,0,.1));
    background: var(--er-surface, #f9fafb);
}

.er-submissions-table td {
    padding: .5em .8em;
    border-bottom: 1px solid var(--er-border, rgba(0,0,0,.06));
}

.er-submissions-table tr:last-child td {
    border-bottom: none;
}

.er-submissions-table tr:hover td {
    background: var(--er-surface, #f9fafb);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .er-header-card {
        padding: 1.1em 1em;
    }
    .er-header-card__title {
        font-size: 1.2em;
    }
    .er-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    /* On mobile: release fixed width so summary fills full card width */
    .er-candidate__summary {
        flex: 0 0 100%;
        max-width: 100%;
        min-width: 0;
        gap: .5em;
        padding: 0;
    }
    .er-precinct-breakdown {
        flex: 0 0 100%;
        width: 100%;
        align-self: auto;
    }
    .er-candidate__results {
        flex: 1 0 100%;
    }
}

@media (max-width: 400px) {
    .er-stats {
        grid-template-columns: 1fr;
    }
}


/* ── Seats badge in office header ─────────────────────────── */
.er-office__seats-badge {
    display: inline-flex;
    align-items: center;
    padding: .2em .65em;
    background: var(--er-primary, #1a56db);
    color: #fff;
    border-radius: 999px;
    font-size: .72em;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ── Rank badges — 1st/2nd/3rd/Nth ───────────────────────── */
.er-badge--rank {
    font-weight: 700;
    letter-spacing: .03em;
}

/* ── Dark theme override ──────────────────────────────────── */
.er-theme-dark .er-header-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f1f33 100%);
    box-shadow: 0 4px 20px rgba(0,0,0,.4);
}

.er-theme-dark .er-office {
    background: #1f2937;
    border-color: #374151;
}

.er-theme-dark .er-office__header {
    background: #111827;
    border-color: #374151;
}

.er-theme-dark .er-candidate {
    border-color: #374151;
}

.er-theme-dark .er-progress-bar {
    background: rgba(255,255,255,.12);
}

.er-theme-dark .er-precinct-breakdown {
    background: #111827;
    border-top-color: #374151;
}

/* Dark theme: head uses configurable vars (with dark fallback) */
.er-theme-dark .er-precinct-table__head {
    background: var(--er-table-head-bg, #1f2937);
    color: var(--er-table-head-text, #d1d5db);
    border-color: #374151;
}
.er-theme-dark .er-precinct-table__cell {
    background: var(--er-surface, #1f2937);
    border-color: #374151;
    color: #d1d5db;
}
/* NA cell must come AFTER regular cell rule — same specificity, last wins */
.er-theme-dark .er-precinct-table__cell--na {
    background: var(--er-table-na-bg, #1a1a2e) !important;
    color: var(--er-table-na-text, #555) !important;
}

.er-theme-dark .er-precinct-table__head.er-precinct-table__total,
.er-theme-dark .er-precinct-table__total-cell {
    background: #374151;
    color: #f9fafb;
}

.er-theme-dark .er-stat-card {
    background: #1f2937;
    border-color: #374151;
}

.er-theme-dark .er-stat-card__value {
    color: #60a5fa;
}

.er-theme-dark .er-legend {
    background: #1f2937;
    border-color: #374151;
}

/* ── Incumbent asterisk ───────────────────────────────────────────── */
.er-incumbent-badge {
    display: inline-flex;
    align-items: center;
    background: var(--er-incumbent-bg, #e65c00);
    color: var(--er-incumbent-color, #ffffff);
    font-size: var(--er-incumbent-badge-size, 80%);
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: .15em .5em;
    border-radius: 3px;
    margin-left: .4em;
    vertical-align: middle;
    line-height: 1.5;
    cursor: default;
    white-space: nowrap;
}

/* Group header row (parent district spanning sub-district columns) */
.er-precinct-table__group {
    text-align: center;
    font-size: .7em;
    font-weight: 800;
    letter-spacing: .04em;
    background: var(--er-primary, #1a56db);
    color: #fff;
    border-color: var(--er-primary, #1a56db);
    padding: .25em .5em;
}
.er-precinct-table__group--solo {
    background: transparent;
    border-color: transparent;
}
.er-candidate--leading .er-precinct-table__group,
.er-candidate--winner  .er-precinct-table__group {
    background: rgba(255,255,255,.25);
    border-color: rgba(255,255,255,.2);
}

.er-results__badge-row {
    display: block !important;
    width: 100% !important;
    text-align: center;
    margin-top: .25em;
}

/* Enter Votes button — centred block below the title area */
.er-results__header .er-btn {
    display: inline-block;
    margin-top: .75em;
}

/* ── Precinct table header — tooltip (ℹ) + map popup ─────────────────── */
.er-prec-th {
    position: relative;
}
.er-prec-th__info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: .3em;
    font-size: .75em;
    background: var(--er-primary, #1a56db);
    color: #fff;
    border-radius: 50%;
    cursor: help;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1;
}
/* CSS tooltip on the ℹ — shown via title attribute, styled by browser default */
/* For a custom CSS tooltip, use the data-tip approach below */
.er-prec-th__name--map {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}

/* Map popup via JS (added dynamically) */
.er-map-popup {
    position: fixed;
    z-index: 9999;
    background: #fff;
    border: 2px solid var(--er-primary, #1a56db);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    padding: 6px;
    pointer-events: none;
    display: none;
    max-width: 340px;
    max-height: 280px;
}
.er-map-popup img {
    display: block;
    max-width: 100%;
    max-height: 260px;
    border-radius: 3px;
}
.er-map-popup__label {
    font-size: .75em;
    font-weight: 600;
    color: var(--er-primary, #1a56db);
    text-align: center;
    margin-top: 4px;
}

/* ── Table bottom note ────────────────────────────────────────────────── */
.er-precinct-table__note-foot .er-precinct-table__note {
    font-size: .8em;
    color: var(--er-text-muted);
    padding: .4em .6em;
    text-align: left;
    font-style: italic;
    background: transparent;
    border: none;
    border-top: 1px dashed var(--er-border, rgba(0,0,0,.1));
}
.er-theme-dark .er-precinct-table__note-foot .er-precinct-table__note {
    color: var(--er-text-muted);
    border-top-color: var(--er-border);
}

/* ── Judge Retention / YES-NO Table ─────────────────────────────────────── */
/* Retention tables container — flex so multiple tables sit side by side */
.er-retention-tables-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
    justify-content: center;
    margin-top: 1em;
}
.er-retention-wrap {
    margin-top: 0;
    max-width: 680px;
    width: 100%;
    flex: 1 1 480px;
}
/* ── Retained badge (certified + YES wins) ─────────────────── */
.er-retention-retained-badge,
.er-retention-not-retained-badge {
    display: inline-flex;
    align-items: center;
    font-size: .78em;
    font-weight: 700;
    letter-spacing: .06em;
    padding: .3em .8em;
    border-radius: 2em;
    margin-bottom: .6em;
    text-transform: uppercase;
    gap: .25em;
}
.er-retention-retained-badge {
    background: var(--er-retained-bg, #065f46);
    color: var(--er-retained-text, #ffffff);
}
.er-retention-not-retained-badge {
    background: var(--er-not-retained-bg, #9b1c1c);
    color: var(--er-not-retained-text, #ffffff);
}

.er-retention-question {
    font-weight: 700;
    font-size: .88em;
    text-align: center;
    padding: .6em 1em;
    background: var(--er-surface, #f9fafb);
    border: 1px solid var(--er-border, rgba(0,0,0,.1));
    border-bottom: none;
    letter-spacing: .01em;
}
.er-retention-breakdown {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.er-retention-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--er-table-font-size, .85em);
    min-width: 480px;
}
.er-retention-table__th {
    background: var(--er-table-head-bg, #1a3a6b);
    color: var(--er-table-head-text, #ffffff);
    text-align: center;
    font-weight: 700;
    font-size: .8em;
    padding: 7px 10px;
    border: 1px solid rgba(255,255,255,.15);
    letter-spacing: .03em;
    vertical-align: middle;
    white-space: nowrap;
}
.er-retention-table__th.er-retention-table__district {
    text-align: left;
    width: 28%;
}
.er-retention-table__td {
    padding: 5px 10px;
    text-align: center;
    border: 1px solid var(--er-border, rgba(0,0,0,.1));
    vertical-align: middle;
}
.er-retention-table__td--district {
    text-align: left;
    font-weight: 600;
    padding-left: 14px;
    background: inherit;
}
.er-retention-table__td--total {
    background: var(--er-surface, #f9fafb);
}
.er-retention-table__td--pct {
    font-weight: 600;
}
.er-retention-table__td--dash {
    color: var(--er-text-muted);
    letter-spacing: .05em;
}
.er-retention-table tbody tr:nth-child(odd) td {
    background: var(--er-bg, #fff);
}
.er-retention-table tbody tr:nth-child(even) td {
    background: var(--er-surface, #f9fafb);
}
.er-retention-table__total-row td {
    background: var(--er-surface, #e8edf5) !important;
    font-weight: 700;
    border-top: 2px solid var(--er-primary, #1a3a6b);
}
.er-retention-table__td--label {
    text-align: center;
    font-size: .82em;
    letter-spacing: .03em;
}
.er-retention-table__td--grand-yes {
    color: var(--er-secondary, #e02424);
    font-weight: 700;
}

/* Dark theme */
.er-theme-dark .er-retention-question {
    background: var(--er-surface);
    color: var(--er-text);
    border-color: var(--er-border);
}
.er-theme-dark .er-retention-table__total-row td {
    background: var(--er-surface) !important;
    border-top-color: var(--er-primary);
}
