/* the D3 bar chart (2026-early-voting.js, drawPercentBarChart) computes its own left/top
   margins from the actual rendered label widths, so this container needs no extra padding
   of its own (unlike the old Highcharts chart it replaced - see highcharts-backup/). */
div.sumchart-chart svg {
    display: block;
}


/**
 * STATE SUMMARY HEADER - topline stat tiles + last-updated/source caption
 */

.viz-root {
    color-scheme: light;
    --surface-1:       #fcfcfb;
    --text-primary:    #0b0b0b;
    --text-secondary:  #52514e;
    --text-muted:      #898781;
    --border-hairline: rgba(11, 11, 11, 0.10);
    --accent-total:     #0c6b46; /* green  - Total early votes */
    --accent-inperson:  #eb6834; /* orange - In-person early votes */
    --accent-returned:  #2a78d6; /* blue   - Mail ballots returned (skews mail = skews Democratic) */
    --accent-requested: #eda100; /* yellow - Mail ballots requested (not yet realized) */
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .viz-root {
        color-scheme: dark;
        --surface-1:       #1a1a19;
        --text-primary:    #ffffff;
        --text-secondary:  #c3c2b7;
        --text-muted:      #898781;
        --border-hairline: rgba(255, 255, 255, 0.10);
        --accent-total:     #1fa070;
        --accent-inperson:  #d95926;
        --accent-returned:  #3987e5;
        --accent-requested: #c98500;
    }
}
:root[data-theme="dark"] .viz-root {
    color-scheme: dark;
    --surface-1:       #1a1a19;
    --text-primary:    #ffffff;
    --text-secondary:  #c3c2b7;
    --text-muted:      #898781;
    --border-hairline: rgba(255, 255, 255, 0.10);
    --accent-total:     #1fa070;
    --accent-inperson:  #d95926;
    --accent-returned:  #3987e5;
    --accent-requested: #c98500;
}

.statgrid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1.25rem 0 0.75rem;
}

.stat-tile {
    flex: 1 1 180px;
    max-width: 280px;
    background: var(--surface-1);
    border: 1px solid var(--border-hairline);
    border-top: 4px solid var(--accent, var(--accent-total));
    border-radius: 6px;
    padding: 0.85rem 1.1rem 1.05rem;
}

.stat-tile[data-accent="total"]     { --accent: var(--accent-total); }
.stat-tile[data-accent="inperson"]  { --accent: var(--accent-inperson); }
.stat-tile[data-accent="returned"]  { --accent: var(--accent-returned); }
.stat-tile[data-accent="requested"] { --accent: var(--accent-requested); }

.stat-tile-label {
    margin: 0 0 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-tile-value {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: proportional-nums;
}

.stat-meta-block {
    margin: 0 0 1.5rem;
}

.stat-meta {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-meta-item a {
    color: var(--text-secondary);
}

.stat-meta-sep {
    margin: 0 0.6em;
    color: var(--text-muted);
}

.stat-meta-notes {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-secondary);
}

/* tab bar - same accent language as the stat tiles above them */
.viz-root .nav-tabs .nav-link {
    border-top: 3px solid transparent;
}
.viz-root .nav-tabs .nav-link.active,
.viz-root .nav-tabs .nav-link:hover {
    border-top-color: var(--accent, var(--accent-total));
}
.viz-root .nav-tabs .nav-link.active {
    font-weight: 600;
}
.viz-root .nav-tabs .nav-link[data-accent="total"]     { --accent: var(--accent-total); }
.viz-root .nav-tabs .nav-link[data-accent="inperson"]  { --accent: var(--accent-inperson); }
.viz-root .nav-tabs .nav-link[data-accent="returned"]  { --accent: var(--accent-returned); }

/* geography level selector (Locality / Congress / State House / State Senate) - a
   secondary, smaller tab row used only when a state publishes more than one geography
   file; most states show just the one table with no selector at all. */
.geography-level-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 0.75rem;
}
.geography-level-tab {
    padding: 0.3rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-hairline);
    border-radius: 999px;
    cursor: pointer;
}
.geography-level-tab:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}
.geography-level-tab.active {
    color: #fff;
    background: var(--accent-returned);
    border-color: var(--accent-returned);
}

/* sortable geography table */
/* the geography/party name column (th[scope="row"], both the header cell and every row's
   first cell, geography rows and party sub-rows alike) - browsers center a bare <th> by
   default, which every other column in this table overrides with .text-end for its numbers,
   but the name column never got an explicit alignment of its own to override that default with. */
table.sumtable-sortable th[scope="row"],
table.sumtable-sortable thead th[data-sort-key]:not(.text-end) {
    text-align: left;
}
table.sumtable-sortable thead th[data-sort-key] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
table.sumtable-sortable thead th[data-sort-key]:hover,
table.sumtable-sortable thead th[data-sort-key]:focus-visible {
    background: rgba(11, 11, 11, 0.05);
}
table.sumtable-sortable thead th[data-sort-key]:focus-visible {
    outline: 2px solid var(--accent-returned);
    outline-offset: -2px;
}
table.sumtable-sortable .sumtable-sort-indicator {
    display: inline-block;
    width: 1em;
    margin-left: 0.3em;
    font-size: 0.75em;
    color: var(--text-muted);
    opacity: 0.6;
}
table.sumtable-sortable .sumtable-sort-indicator-active {
    color: var(--text-secondary);
    opacity: 1;
}

/* Explicit stripe on alternate geography rows (see the $table comment in createSortableTable()
   for why this isn't .table-striped) - same tint Bootstrap's own striping would have given
   these rows, just keyed to a stable index instead of DOM position. */
table.sumtable-sortable tbody tr.sumtable-row-alt > * {
    background: rgba(11, 11, 11, 0.03);
}

/* per-row party-breakdown expand toggle (createSortableTable()'s _party rows) */
table.sumtable-sortable thead .sumtable-expand-col {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}
table.sumtable-sortable .sumtable-expand-col {
    width: 1.75em;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}
table.sumtable-sortable .sumtable-expand-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85em;
    line-height: 1;
}
table.sumtable-sortable .sumtable-expand-toggle:hover,
table.sumtable-sortable .sumtable-expand-toggle:focus-visible {
    color: var(--text-primary);
}
table.sumtable-sortable .sumtable-expand-toggle:focus-visible {
    outline: 2px solid var(--accent-returned);
    outline-offset: 1px;
}
/* party-breakdown sub-rows (createSortableTable()'s appendPartyDetailRows()) - real <tr>s
   sharing the parent table's own column grid (see appendRow()), not a separate nested table,
   so each party's Accepted/Requested/Percent Returned lands directly under the matching
   geography-row header. Deliberately a different (darker) tint than .sumtable-row-alt's, not
   the same value - the row being expanded can itself be alt-striped, and matching tints there
   made its sub-rows visually merge into it with no separation at all. */
table.sumtable-sortable tr.sumtable-party-row th,
table.sumtable-sortable tr.sumtable-party-row td {
    background: rgba(11, 11, 11, 0.07);
    color: var(--text-secondary);
    font-weight: 400;
}
table.sumtable-sortable tr.sumtable-party-row th {
    padding-left: 1.5rem;
}
.sumtable-party-swatch {
    display: inline-block;
    width: 0.65em;
    height: 0.65em;
    border-radius: 2px;
}
