:root {
    --bg:       #f5f6f8;
    --card:     #ffffff;
    --card-2:   #fafbfc;
    --text:     #1a2332;
    --muted:    #6b7280;
    --line:     #e3e6ea;
    --line-2:   #eef0f3;
    --accent:   #1b4f8b;
    --accent-2: #15406f;
    --accent-soft: #e9eff7;

    --with:      #1b8a3a;
    --against:   #c0392b;
    --undecided: #d68910;
    --unknown:   #7f8c8d;

    --ok:     #1b8a3a;
    --warn:   #d68910;
    --danger: #c0392b;

    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    --radius: 8px;
}

[data-theme="dark"] {
    --bg:       #0d1117;
    --card:     #161b22;
    --card-2:   #1c222b;
    --text:     #e6e9ef;
    --muted:    #8b95a3;
    --line:     #262d38;
    --line-2:   #1f262f;
    --accent:   #6aa3e5;
    --accent-2: #87b8ef;
    --accent-soft: #1b2738;

    --with:      #4ac76f;
    --against:   #e57367;
    --undecided: #e6b04a;
    --unknown:   #7d8794;

    --ok:     #4ac76f;
    --warn:   #e6b04a;
    --danger: #e57367;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                  "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    /* Safety net: a wide table or other intrinsic-content element should
       scroll internally (see the mobile table rule below), never force the
       whole page to scroll sideways. */
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 10px 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand a {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: var(--text);
}
.topbar nav { display: flex; gap: 2px; flex: 1; }
.topbar nav a {
    padding: 7px 12px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}
.topbar nav a:hover { background: var(--line-2); color: var(--text); text-decoration: none; }
.topbar nav a.active { background: var(--accent-soft); color: var(--accent); }

/* ------- Campaign bar ------- */
.campaign-bar {
    background: var(--card-2);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 49px;
    z-index: 9;
}
.campaign-bar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 6px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}
.campaign-bar-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 600;
}
.campaign-bar-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.campaign-switch-form select {
    width: auto;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 600;
    border-color: var(--line);
}
.campaign-manage-link { margin-left: auto; color: var(--accent); }

.theme-btn {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 6px;
    width: 34px; height: 34px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.theme-btn:hover { color: var(--text); background: var(--line-2); }
.theme-btn .i-moon { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: none; }
[data-theme="dark"] .theme-btn .i-moon { display: block; }

.container { max-width: 1240px; margin: 0 auto; padding: 24px; }

h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 16px; }
h2 {
    font-size: 14px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--muted); margin: 0 0 12px;
}
.muted, .small-text { color: var(--muted); }
.small-text { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 20px;
}
.quick { display: flex; gap: 8px; flex-wrap: wrap; }

.flashes { margin-bottom: 16px; }
.flash {
    padding: 10px 14px; border-radius: 6px; margin-bottom: 6px;
    font-size: 14px; border: 1px solid transparent;
}
.flash-ok    { background: color-mix(in srgb, var(--ok) 12%, var(--card)); color: var(--ok);
               border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-error { background: color-mix(in srgb, var(--danger) 12%, var(--card)); color: var(--danger);
               border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px; margin-bottom: 16px;
}
.kpi {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px;
    box-shadow: var(--shadow);
}
.kpi-label {
    font-size: 12px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
}
.kpi-num {
    font-size: 28px; font-weight: 600;
    margin: 4px 0 2px; letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.kpi-unit { font-size: 16px; color: var(--muted); margin-left: 2px; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.neu { color: var(--muted); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col > * { min-width: 0; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

.bar {
    display: flex; height: 12px;
    border-radius: 6px; overflow: hidden;
    background: var(--line-2); margin-bottom: 12px;
}
.seg { height: 100%; }
.seg-with      { background: var(--with); }
.seg-against   { background: var(--against); }
.seg-undecided { background: var(--undecided); }
.seg-unknown   { background: var(--unknown); }

.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.legend li a { color: var(--text); flex: 1; display: flex; align-items: center; gap: 8px; }
.legend li a:hover { color: var(--accent); text-decoration: none; }
.legend li strong { font-variant-numeric: tabular-nums; }

.dot {
    display: inline-block; width: 10px; height: 10px;
    border-radius: 50%; flex-shrink: 0;
}
.dot-with      { background: var(--with); }
.dot-against   { background: var(--against); }
.dot-undecided { background: var(--undecided); }
.dot-unknown   { background: var(--unknown); }

.mini-bar {
    display: inline-block; width: 80px; height: 6px;
    background: var(--line-2); border-radius: 3px; overflow: hidden;
    vertical-align: middle; margin-right: 6px;
}
.mini-fill { height: 100%; background: var(--accent); }

.headline {
    display: flex; align-items: center;
    gap: 24px; padding: 24px;
}
.headline-num {
    font-size: 48px; font-weight: 700;
    letter-spacing: -0.03em; line-height: 1;
    font-variant-numeric: tabular-nums;
}
.headline-text { font-size: 15px; line-height: 1.5; }

table {
    width: 100%; border-collapse: collapse;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
    margin-bottom: 16px; box-shadow: var(--shadow);
}
.card > table { box-shadow: none; border: none; margin-bottom: 0; }
th, td {
    padding: 10px 12px; text-align: left;
    border-bottom: 1px solid var(--line-2); font-size: 14px;
}
thead th {
    background: var(--card-2); font-weight: 600;
    font-size: 12px; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1px solid var(--line);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--line-2); }
table.compact th, table.compact td { padding: 7px 10px; font-size: 13px; }

.voter-table .cb { width: 32px; }
.thumb {
    width: 36px; height: 36px;
    border-radius: 4px; object-fit: cover; display: block;
}
.thumb-empty {
    background: var(--line-2); color: var(--muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-row input[type="search"] { flex: 1 1 220px; }
.filter-row select, .filter-row input { padding: 7px 10px; font-size: 14px; }

input[type="text"], input[type="search"], input[type="file"],
input[type="number"], input[type="password"], input[type="email"],
input[type="tel"], input[type="date"], select, textarea {
    font: inherit; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--card); color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
label { display: block; margin-bottom: 12px; font-size: 12px;
        color: var(--muted); font-weight: 500; }
label input, label select, label textarea {
    margin-top: 4px; color: var(--text); font-size: 14px;
}
label.checkbox {
    display: flex; align-items: center; gap: 8px;
    color: var(--text); font-size: 14px;
}
label.checkbox input { width: auto; margin-top: 0; }
textarea { resize: vertical; min-height: 70px; font-family: inherit; }

.stacked { display: block; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .row-2 { grid-template-columns: 1fr; } }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 7px 14px;
    background: var(--accent); color: white;
    border: 1px solid var(--accent); border-radius: 6px;
    font: inherit; font-size: 14px; font-weight: 500;
    cursor: pointer; text-decoration: none; line-height: 1.4;
}
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); text-decoration: none; }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-2); border-color: var(--line); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 80%, black); }
.btn-big { padding: 10px 22px; font-size: 15px; }
button.small {
    padding: 4px 10px; font-size: 12px;
    background: var(--card); color: var(--text);
    border: 1px solid var(--line); border-radius: 4px; cursor: pointer;
}
button.small.danger { color: var(--danger); }
button.small:hover { background: var(--line-2); }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
form.inline { display: inline; }

.detail-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.detail-grid > * { min-width: 0; }
.detail-grid > .card.full { grid-column: 1 / -1; }
.detail-grid > .card.right { grid-column: 2; }
@media (max-width: 800px) {
    .detail-grid { grid-template-columns: 1fr; }
    .detail-grid > .card.right { grid-column: 1; }
}

.photo-wrap { text-align: center; margin-bottom: 12px; }
.photo-big {
    width: 100%; max-width: 240px;
    aspect-ratio: 1 / 1; object-fit: cover;
    border-radius: 6px; border: 1px solid var(--line);
}
.photo-empty {
    display: flex; align-items: center; justify-content: center;
    background: var(--line-2); color: var(--muted); font-size: 14px;
}
.photo-upload { display: flex; flex-direction: column; gap: 8px; }

.pledge-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.pledge-btn {
    --c: var(--accent);
    padding: 8px 14px;
    border: 1px solid var(--line);
    background: var(--card); color: var(--text);
    border-radius: 6px; cursor: pointer;
    font: inherit; font-size: 14px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 8px;
}
.pledge-btn::before {
    content: ''; width: 8px; height: 8px;
    border-radius: 50%; background: var(--c);
}
.pledge-btn:hover { background: var(--line-2); }
.pledge-btn.active {
    background: var(--c); color: white; border-color: var(--c);
}
.pledge-btn.active::before { background: white; }
.pledge-btn-with      { --c: var(--with); }
.pledge-btn-against   { --c: var(--against); }
.pledge-btn-undecided { --c: var(--undecided); }
.pledge-btn-unknown   { --c: var(--unknown); }

/* ------- Big / block buttons (member door-to-door mode) ------- */
.btn-block { display: flex; width: 100%; justify-content: center; }
form.inline.block { display: block; margin-bottom: 8px; }
form.inline.block:last-child { margin-bottom: 0; }

.quick-actions { border-width: 2px; border-color: var(--accent); }
.quick-actions h2 { font-size: 15px; }
.quick-actions .voted-row { margin-bottom: 20px; }
.quick-actions .voted-row:last-child { margin-bottom: 0; }

.pledge-buttons-big { flex-direction: column; gap: 8px; margin-bottom: 20px; }
.pledge-btn-big {
    justify-content: center;
    padding: 16px;
    font-size: 16px;
    width: 100%;
}

/* ------- Member (door-to-door) simplified voter view ------- */
.member-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 480px;
}
.member-photo-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.member-photo-facts {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.member-photo-facts .btn { width: fit-content; }
.photo-round {
    width: 64px; height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--line-2);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    text-align: center;
}
.member-view .photo-upload { flex: 0 0 100%; }
@media (max-width: 480px) {
    .member-photo-facts .btn { width: 100%; }
}

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500;
    background: var(--line-2); color: var(--text);
}
.pill::before {
    content: ''; width: 7px; height: 7px;
    border-radius: 50%; background: var(--c, var(--muted));
}
.pill-with      { --c: var(--with); }
.pill-against   { --c: var(--against); }
.pill-undecided { --c: var(--undecided); }
.pill-unknown   { --c: var(--unknown); }

.badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-ok      { background: color-mix(in srgb, var(--ok) 15%, var(--card)); color: var(--ok); }
.badge-pending { background: var(--line-2); color: var(--muted); }
.badge-win     { background: color-mix(in srgb, var(--with) 15%, var(--card)); color: var(--with); }
.badge-loss    { background: color-mix(in srgb, var(--against) 15%, var(--card)); color: var(--against); }
.badge-tie     { background: color-mix(in srgb, var(--undecided) 15%, var(--card)); color: var(--undecided); }
.badge.big { font-size: 13px; padding: 5px 12px; }

.voted-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }

.activity { list-style: none; padding: 0; margin: 0; }
.activity li {
    padding: 7px 0; border-bottom: 1px solid var(--line-2);
    font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline;
}
.activity li:last-child { border-bottom: none; }
.activity .ts { color: var(--muted); min-width: 90px; }
.activity .act {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--muted); font-weight: 600;
}

.bulk-row {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); margin-bottom: 16px;
}
.bulk-row select { width: auto; flex: 0 0 200px; }

.select-all-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--muted);
    margin-bottom: 10px; cursor: pointer; user-select: none;
    width: fit-content;
}
.select-all-row input { margin: 0; }
.select-all-row:hover { color: var(--text); }

/* Floating bulk-assign bar, shared by table + grid views */
.bulk-bar {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translate(-50%, 24px);
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
    max-width: calc(100vw - 32px);
}
.bulk-bar.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}
.bulk-bar .bulk-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.bulk-bar select { width: auto; flex: 0 0 160px; }
@media (max-width: 600px) {
    .bulk-bar { flex-wrap: wrap; justify-content: center; border-radius: var(--radius); left: 16px; right: 16px; transform: translateY(24px); max-width: none; }
    .bulk-bar.visible { transform: translateY(0); }
    .bulk-bar select { flex: 1 1 auto; }
}

.pager {
    display: flex; gap: 16px; align-items: center; justify-content: center;
    padding: 8px; font-size: 14px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
.grid-2 > * { min-width: 0; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.empty { text-align: center; padding: 40px; }
.empty-state { text-align: center; padding: 40px 24px; }
.empty-state .actions {
    display: flex; gap: 8px; justify-content: center;
    margin: 16px 0 8px; flex-wrap: wrap;
}
.danger-zone {
    margin-top: 16px; padding-top: 12px;
    border-top: 1px dashed var(--line);
}
.danger-block {
    border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
    background: color-mix(in srgb, var(--danger) 4%, var(--card));
}

/* ------- Card transitions / hover ------- */
.card, .kpi { transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.kpi:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }

/* ------- Flash slide-in ------- */
@keyframes flashIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.flash { animation: flashIn .18s ease-out; }

/* ------- Custom file input ------- */
input[type="file"] {
    padding: 0;
    background: transparent;
    border: 1px dashed var(--line);
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    color: var(--muted);
    transition: border-color .15s ease, background .15s ease;
}
input[type="file"]:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text);
}
input[type="file"]::file-selector-button {
    font: inherit;
    padding: 8px 14px;
    margin-right: 10px;
    background: var(--card);
    color: var(--text);
    border: none;
    border-right: 1px solid var(--line);
    border-radius: 6px 0 0 6px;
    cursor: pointer;
    font-weight: 500;
}
input[type="file"]::file-selector-button:hover { background: var(--line-2); }

/* ------- View toggle (table / grid) ------- */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    background: var(--card);
    margin-right: 4px;
}
.view-toggle a {
    padding: 7px 10px;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    border-right: 1px solid var(--line);
}
.view-toggle a:last-child { border-right: none; }
.view-toggle a:hover { background: var(--line-2); color: var(--text); text-decoration: none; }
.view-toggle a.active { background: var(--accent-soft); color: var(--accent); }

/* ------- Voter card grid ------- */
.voter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.voter-card-wrap {
    display: flex;
    align-items: stretch;
    gap: 8px;
}
.voter-card-wrap .card-cb {
    flex: 0 0 auto;
    width: 28px;
    align-self: center;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
}
.voter-card {
    flex: 1;
    min-width: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
    display: flex;
    gap: 12px;
    padding: 12px;
    align-items: center;
    transition: border-color .15s ease, transform .12s ease;
}
.voter-card:hover {
    text-decoration: none;
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
    transform: translateY(-1px);
}
.voter-card-wrap:has(.card-cb:checked) .voter-card {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.voter-card-photo {
    width: 64px; height: 64px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--line-2);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.voter-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.voter-card-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.voter-card-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--muted);
}
.voter-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 2px;
}

/* ------- Mobile topbar ------- */
.nav-toggle { display: none; }
.nav-end { margin-left: auto; }

@media (max-width: 780px) {
    .topbar { gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
    .nav-toggle {
        display: inline-flex;
        background: transparent;
        border: 1px solid var(--line);
        color: var(--text);
        border-radius: 6px;
        width: 36px; height: 34px;
        align-items: center; justify-content: center;
        cursor: pointer;
        margin-left: auto;
    }
    .topbar nav {
        order: 99;
        flex-basis: 100%;
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height .2s ease;
    }
    .topbar nav.open { max-height: 480px; overflow-y: auto; }
    .topbar nav a {
        padding: 12px 8px;
        border-radius: 0;
        border-bottom: 1px solid var(--line-2);
    }
    .topbar nav a:last-child { border-bottom: none; }
    .topbar nav a.nav-end { margin-left: 0; }
    .container { padding: 16px; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .filter-row { gap: 6px; }
    .filter-row select, .filter-row input { font-size: 14px; }
    .headline { flex-direction: column; gap: 12px; padding: 18px; text-align: center; }
    .headline-num { font-size: 40px; }
    .voter-card-photo { width: 56px; height: 56px; }

    /* Wide tables (Team, Campaigns, leaderboards, etc.) would otherwise
       force the whole page wider than the screen. Let the table itself
       scroll horizontally instead of blowing out the layout. */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    .campaign-bar-inner { padding: 6px 16px; }
    .grid-2 { gap: 12px; }
    .bulk-row { flex-wrap: wrap; }
}

/* ------- Section head with inline clear/reset action ------- */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.section-head h2 { margin: 0 0 12px; }
.link-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 12px;
    padding: 0;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
}
.link-btn:hover { color: var(--danger); text-decoration: underline; }

/* ------- Quick-facts sidebar on voter detail ------- */
.quick-facts {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line-2);
}
.quick-facts p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.4;
}
.quick-facts p:last-child { margin-bottom: 0; }

/* ------- Party pill ------- */
.pill-party {
    --c: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}
.pill-party::before { background: var(--accent); }

/* ------- Login page ------- */
.login-wrap {
    max-width: 400px;
    margin: 60px auto 0;
}
.login-card { padding: 24px; }
.login-card .btn { width: 100%; margin-top: 8px; }
details summary { cursor: pointer; color: var(--accent); }
