:root {
    color-scheme: light;
    --ink: #15271c;
    --body: #374b3e;
    --muted: #4e6456;
    --green: #186533;
    --green-dark: #104a25;
    --line: #dce7dc;
    --soft: #f2f8f1;
    --page: #f8faf6;
    --white: #fff;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--green); text-underline-offset: .18em; }
a:hover { color: var(--green-dark); }
:focus-visible { outline: 3px solid #267842; outline-offset: 3px; }

.shell { width: min(100% - 3rem, 77rem); margin-inline: auto; }
.skip-link {
    position: absolute;
    z-index: 10;
    top: .5rem;
    left: .5rem;
    transform: translateY(-160%);
    padding: .75rem 1rem;
    background: var(--white);
}
.skip-link:focus { transform: translateY(0); }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.site-header-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 4.65rem; }
.brand { display: block; flex-shrink: 0; }
.brand img { display: block; width: 8.7rem; height: auto; }
.finder {
    display: inline-flex;
    align-items: center;
    min-height: 2.65rem;
    padding: .5rem .95rem;
    border: 1px solid #b8d3bf;
    border-radius: .55rem;
    color: var(--green);
    font-size: .875rem;
    font-weight: 700;
    text-decoration: none;
}
.finder:hover { background: var(--soft); }

.intro { padding: 2.95rem 0 2.65rem; background: #eaf4e8; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 .75rem; color: var(--green); font-size: .86rem; font-weight: 750; letter-spacing: .05em; }
h1 { margin: 0; font-size: clamp(2.15rem, 5vw, 3.65rem); font-weight: 760; line-height: 1.04; letter-spacing: -.045em; }
.intro-copy { margin: .85rem 0 0; color: var(--body); font-size: clamp(1rem, 2vw, 1.15rem); line-height: 1.5; }

.directory { padding-block: 1.5rem 3rem; scroll-margin-top: .75rem; }
.office-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    padding: .25rem;
    margin-bottom: 1rem;
}
.office-nav a {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-height: 2.7rem;
    padding: .55rem .75rem;
    border: 1px solid var(--line);
    border-radius: .6rem;
    background: var(--white);
    color: var(--body);
    font-size: .88rem;
    font-weight: 670;
    text-decoration: none;
}
.office-nav a:hover { background: var(--soft); }
.office-nav a[aria-current] { background: var(--green); color: var(--white); border-color: var(--green); }
.office-count {
    padding: .1rem .37rem;
    border-radius: .35rem;
    background: #eaf3e9;
    color: var(--green-dark);
    font-size: .78rem;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

.controls, .table-frame, .message { background: var(--white); border: 1px solid var(--line); border-radius: .85rem; }
.controls { padding: 1.15rem; }
.filter-grid { display: grid; grid-template-columns: minmax(12rem, 1.35fr) repeat(4, minmax(0, 1fr)); gap: .7rem; }
.field { display: grid; align-content: start; gap: .35rem; min-width: 0; }
.field label { color: var(--body); font-size: .875rem; font-weight: 680; }
.field input, .field select {
    width: 100%;
    min-width: 0;
    min-height: 2.75rem;
    border: 1px solid #c9d7cb;
    border-radius: .48rem;
    padding: .56rem .64rem;
    background-color: var(--white);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
}
.field input::placeholder { color: var(--muted); opacity: 1; }
.field select {
    appearance: none;
    padding-inline-end: 1.9rem;
    text-overflow: ellipsis;
    background: linear-gradient(45deg, transparent 50%, #49614f 50%) calc(100% - 16px) 50% / 5px 5px no-repeat,
                linear-gradient(135deg, #49614f 50%, transparent 50%) calc(100% - 11px) 50% / 5px 5px no-repeat,
                var(--white);
}
.search-input { position: relative; }
.search-input::before {
    content: "";
    position: absolute;
    left: .7rem;
    top: .86rem;
    width: .72rem;
    height: .72rem;
    border: 1.5px solid var(--muted);
    border-radius: 50%;
    pointer-events: none;
}
.search-input::after {
    content: "";
    position: absolute;
    left: 1.29rem;
    top: 1.49rem;
    width: .35rem;
    height: 1.5px;
    background: var(--muted);
    transform: rotate(45deg);
    pointer-events: none;
}
.search-input input { padding-inline-start: 1.95rem; }

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem 1rem;
    border-top: 1px solid var(--line);
    margin-top: .9rem;
    padding-top: .9rem;
}
.select-inline { display: flex; align-items: center; gap: .5rem; }
.select-inline label { white-space: nowrap; }
.select-inline select { min-height: 2.5rem; }
.apply-actions { display: flex; align-items: center; gap: .95rem; margin-inline-start: auto; }
.apply-actions button {
    min-height: 2.7rem;
    padding: .5rem 1rem;
    border: 1px solid var(--green);
    border-radius: .48rem;
    background: var(--green);
    color: var(--white);
    cursor: pointer;
    font: inherit;
    font-size: .9rem;
    font-weight: 720;
}
.apply-actions button:hover { background: var(--green-dark); }
.reset { font-size: .9rem; font-weight: 650; }

.results { margin-top: 1.7rem; scroll-margin-top: 1rem; }
.results-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem .75rem; margin-bottom: .65rem; }
.results-heading h2 { margin: 0; font-size: clamp(1.3rem, 2.5vw, 1.65rem); letter-spacing: -.025em; }
.results-heading p, .pagination p { margin: 0; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.result-tools, .quick-pages { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; }
.quick-pages a { padding: .35rem .15rem; font-size: .875rem; font-weight: 700; }
.table-frame { overflow: hidden; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
thead { background: var(--soft); color: var(--green-dark); }
th, td { padding: .75rem .85rem; overflow-wrap: anywhere; }
th { font-size: .875rem; font-weight: 700; }
td { color: var(--body); font-size: .9rem; line-height: 1.4; }
thead th:nth-child(1) { width: 29%; }
thead th:nth-child(2) { width: 10%; }
thead th:nth-child(3) { width: 20%; }
thead th:nth-child(4) { width: 23%; }
thead th:nth-child(5) { width: 8%; }
thead th:nth-child(6) { width: 10%; }
tbody tr { border-top: 1px solid var(--line); }
tbody tr:hover, tbody tr:focus-within { background: #f5f9f3; }
.candidate-name { font-size: .98rem; font-weight: 720; line-height: 1.35; }
.party { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; }
.party img {
    flex: 0 0 auto;
    display: block;
    border: 1px solid var(--line);
    border-radius: 50%;
    object-fit: contain;
    background: var(--white);
}
.secondary, .unknown, .mobile-meta { color: var(--muted); font-size: .82rem; font-weight: 500; }
.secondary { display: block; margin-top: .12rem; }
.mobile-only { display: none; }

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    margin-top: 1rem;
}
.pagination ul { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; padding: 0; list-style: none; }
.pagination li > * {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: .25rem .55rem;
    border: 1px solid var(--line);
    border-radius: .45rem;
    background: var(--white);
    font-size: .875rem;
    font-weight: 650;
    text-decoration: none;
}
.pagination a:hover { background: var(--soft); }
.pagination .disabled { background: transparent; color: var(--muted); }
.pagination .current { background: var(--green); border-color: var(--green); color: var(--white); }
.pagination .ellipsis { background: transparent; border-color: transparent; min-width: 1.5rem; padding-inline: .2rem; }

.message { padding: 1.5rem; }
.message h3 { margin: 0; font-size: 1.05rem; }
.message p { margin: .45rem 0 0; color: var(--body); }
.site-footer { padding: 1.1rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.site-footer span { margin-inline: .25rem; }

@media (max-width: 58rem) {
    .filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .search-field { grid-column: 1 / -1; }
    thead th:nth-child(2) { width: 13%; }
    thead th:nth-child(3) { width: 17%; }
}
@media (max-width: 44rem) {
    .desktop-cell { display: none; }
    .mobile-only { display: inline; }
    .mobile-meta, .mobile-only.secondary { display: block; margin-top: .2rem; line-height: 1.4; }
    th, td { padding: .68rem .6rem; }
    thead th:nth-child(1) { width: 54%; }
    thead th:nth-child(2) { width: 21%; }
    thead th:nth-child(5) { width: 25%; }
    .party { flex-wrap: wrap; }
}
@media (max-width: 34rem) {
    .shell { width: calc(100% - 1.25rem); }
    .site-header-inner { min-height: 4rem; }
    .brand img { width: 7rem; }
    .finder { min-height: 2.35rem; padding-inline: .6rem; font-size: .81rem; }
    .intro { padding-block: 1.55rem; }
    .directory { padding-top: .9rem; }
    .office-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: .15rem;
        gap: .35rem;
        margin-bottom: .8rem;
    }
    .office-nav a { justify-content: space-between; min-height: 2.5rem; padding-inline: .53rem; font-size: .8rem; }
    .controls { padding: .78rem; }
    .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-actions { justify-content: space-between; gap: .7rem; }
    .select-inline { flex: 1; flex-direction: column; align-items: stretch; }
    .select-inline:first-child { flex: 2; }
    .apply-actions { flex: 0 0 100%; justify-content: flex-end; }
    .apply-actions button { min-width: 8rem; }
    .pagination .page-number { display: none; }
}
