:root {
    color-scheme: light;
    --canvas: #f5f7f1;
    --surface: #fff;
    --ink: #132820;
    --muted: #53665b;
    --line: #d8e1d6;
    --line-strong: #a8bbae;
    --green: #205e42;
    --green-dark: #103a2f;
    --green-tint: #eaf2e5;
    --lime: #dcf27e;
    --lime-hover: #cce764;
    --danger: #8a3832;
    --radius: 17px;
    font-family: Inter, "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.24; overflow-wrap: anywhere; }
h2 { font-size: 1.25rem; }
p { overflow-wrap: anywhere; }
a { color: var(--green); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #48765c; outline-offset: 3px; }
[id] { scroll-margin-top: 16px; }
code { overflow-wrap: anywhere; }

.wrap { width: min(1080px, calc(100% - 64px)); margin-inline: auto; }
.site-header { background: #fafbf7; border-bottom: 1px solid var(--line); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-size: 1.2rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.brand-mark { position: relative; display: inline-block; flex: 0 0 auto; width: 37px; height: 37px; border-radius: 10px; background: var(--lime); }
.brand-mark::before, .brand-mark::after { content: ""; display: block; position: absolute; }
.brand-mark::before { z-index: 1; width: 18px; height: 10px; left: 9px; bottom: 8px; border: 1.7px solid #184433; border-radius: 2px; background: var(--lime); }
.brand-mark::after { width: 10px; height: 13px; left: 14px; top: 7px; border: 1.7px solid #184433; border-radius: 2px; background: #fcfff4; transform: rotate(27deg); }
.header-link { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: .875rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.header-link span { color: var(--green); font-size: 1rem; }
.header-link:hover, .text-link:hover { text-decoration: underline; text-underline-offset: .2em; }
.voter-main, .admin-main { padding-block: 28px 56px; }

.ballot-hero { position: relative; isolation: isolate; overflow: hidden; min-height: 268px; display: flex; align-items: center; padding: 34px 43px; border-radius: 23px; background: var(--green-dark); color: #fbfdf6; }
.hero-background { position: absolute; inset: 0; background: #205742; clip-path: polygon(78% 0, 100% 0, 100% 100%, 57% 100%); }
.hero-art { position: absolute; z-index: 0; width: 400px; height: 288px; right: -6px; bottom: -45px; }
.hero-art > span { position: absolute; inset: 0; display: block; }
.box-top { background: #dcf478; clip-path: polygon(10% 50%, 56% 31%, 100% 48%, 53% 73%); }
.box-top::before { content: ""; position: absolute; inset: 0; background: #123d2b; clip-path: polygon(39% 52%, 71% 39%, 77% 42%, 45% 56%); }
.box-front { background: #b7d64f; clip-path: polygon(10% 50%, 53% 73%, 53% 100%, 10% 100%); }
.box-side { background: #83a634; clip-path: polygon(53% 73%, 100% 48%, 100% 100%, 53% 100%); }
.box-paper { z-index: 1; background: #f6f9ed; clip-path: polygon(43% 51%, 51% 13%, 73% 6%, 66% 42%); }
.hero-copy { position: relative; z-index: 1; width: min(100%, 630px); }
.ballot-hero h1 { margin-top: 13px; font-size: clamp(2rem, 4.4vw, 3.5rem); font-weight: 850; letter-spacing: .025em; }
.hero-description { margin-top: 10px; color: #eff7eb; font-size: 1.035rem; white-space: pre-line; }
.deadline { display: flex; align-items: center; gap: 8px; margin-top: 15px; color: #d6e8d9; font-size: .9rem; font-variant-numeric: tabular-nums; }
.clock-icon { position: relative; flex: 0 0 15px; height: 15px; border: 1.5px solid currentColor; border-radius: 50%; }
.clock-icon::after { content: ""; position: absolute; width: 4px; height: 5px; left: 5.5px; top: 2.5px; border-left: 1.5px solid; border-bottom: 1.5px solid; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; width: max-content; max-width: 100%; padding: 5px 10px; border-radius: 7px; color: #274a3b; background: #e8eee5; font-size: .8rem; font-weight: 750; white-space: nowrap; }
.status-pill > span { flex: 0 0 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill--open { color: #23462d; background: var(--lime); }
.status-pill--closed { color: #47584b; background: #e4e9e2; }

.voter-layout { margin-top: 21px; display: grid; grid-template-columns: minmax(0, .84fr) minmax(0, 1.16fr); align-items: start; gap: 21px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.padded { padding: 24px; }
.muted { color: var(--muted); font-size: .9rem; }
.rule-panel { display: flex; align-items: center; gap: 15px; padding: 19px 21px; background: #edf3e8; border-color: #d6e2d2; }
.rule-panel h2 { font-size: 1.08rem; }
.rule-panel p { margin-top: 5px; color: var(--muted); font-size: .88rem; }
.rule-icon { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border: 1px solid #cddcc9; border-radius: 10px; background: #f7faf3; color: var(--green); font-size: 1.05rem; font-weight: 850; }
.verification > .muted, .access-card > .muted { margin-top: 7px; }
.form-stack { display: grid; gap: 15px; margin-top: 18px; }
.form-stack > .btn { margin-top: 2px; }
.field { display: grid; align-content: start; min-width: 0; gap: 6px; }
.field > span { font-size: .89rem; font-weight: 700; }
.field > small, .field > span small { color: var(--muted); font-size: .78rem; font-weight: 500; }
.field > span small { margin-left: 5px; }
.field input, .field textarea, .field select {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fdfefa;
    color: var(--ink);
    padding: 10px 12px;
}
.field textarea { resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #68796e; }
.field input[type="file"] { padding: 6px; font-size: .9rem; }
.field input::file-selector-button { min-height: 32px; margin-right: 9px; padding: 4px 9px; border: 0; border-radius: 5px; background: var(--green-tint); color: var(--ink); cursor: pointer; }
.field-grid { display: grid; grid-template-columns: minmax(105px, .7fr) minmax(0, 1.3fr); gap: 12px; }
.narrow-field { max-width: 160px; }
.checkbox-field { display: flex; gap: 9px; align-items: center; min-height: 44px; font-size: .89rem; cursor: pointer; }
.checkbox-field input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-note { margin-top: 13px; color: var(--muted); font-size: .82rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 45px; padding: 8px 15px; border: 1px solid transparent; border-radius: 9px; color: var(--ink); font-size: .92rem; font-weight: 750; text-decoration: none; text-align: center; white-space: nowrap; }
.btn-wide { width: 100%; min-height: 49px; }
.btn-primary { background: var(--lime); color: #182b18; }
.btn-primary:hover:not(:disabled) { background: var(--lime-hover); }
.btn-outline { background: #fff; border-color: var(--line-strong); color: var(--green); }
.btn-outline:hover { border-color: #659277; background: #f0f6ed; }
.btn-danger { background: #fff8f7; border-color: #e9c9c5; color: var(--danger); }
.btn-danger:hover { background: #fcece9; }
.btn:disabled { border-color: #dfe6db; background: #eef1ea; color: #606e63; cursor: default; }
.text-link { display: inline-flex; align-items: center; background: transparent; border: 0; padding: 0; color: var(--green); font-size: .88rem; font-weight: 700; text-decoration: none; }
.text-danger { color: var(--danger); }
.compact { min-height: 44px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nowrap { white-space: nowrap; }

.vote-status .row-between:first-child { margin-top: -8px; }
.identity { margin-top: 2px; color: var(--muted); font-size: .87rem; }
.vote-progress-label { margin-block: 10px 8px; line-height: 1.3; font-size: .9rem; font-variant-numeric: tabular-nums; }
.vote-progress-label strong { font-size: 1.1rem; }
progress { appearance: none; display: block; width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 20px; background: #e3ebdf; color: var(--green); }
progress::-webkit-progress-bar { border-radius: 20px; background: #e3ebdf; }
progress::-webkit-progress-value { border-radius: 20px; background: var(--green); }
progress::-moz-progress-bar { border-radius: 20px; background: var(--green); }
.section-heading { margin-bottom: 12px; min-height: 30px; }
.option-list, .ranking-list, .checklist, .choice-list { list-style: none; padding: 0; }
.option-list, .details-list { display: grid; gap: 10px; }
.option-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 13px; }
.option-card--selected { border-color: #9bb6a2; background: #f7fbf5; }
.avatar { width: 52px; height: 52px; display: grid; flex-shrink: 0; place-items: center; border-radius: 11px; color: #2b5335; background: #e3eed8; font-size: 1.35rem; font-weight: 800; }
.avatar--1 { color: #704044; background: #f4e4e7; }
.avatar--2 { color: #355a70; background: #e1ecf7; }
.avatar--3 { color: #70522a; background: #f3ebd8; }
.option-copy h3 { font-size: 1.02rem; }
.option-copy p { margin-top: 4px; color: var(--muted); font-size: .83rem; line-height: 1.45; white-space: pre-line; }
.option-actions { display: grid; justify-items: end; align-items: center; gap: 5px; }
.option-actions .btn { min-width: 75px; padding-inline: 9px; }
.selected-label { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: .78rem; font-weight: 750; white-space: nowrap; }
.selected-label span { display: grid; width: 17px; height: 17px; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-size: .7rem; }
.notice { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid #cae0c8; border-radius: 10px; background: #eef7e9; color: #23513a; font-size: .88rem; overflow-wrap: anywhere; }
.notice--error { border-color: #edcbc6; background: #fff3f0; color: #7c352f; }
.notice-icon { display: grid; place-items: center; flex: 0 0 17px; height: 17px; border: 1px solid currentColor; border-radius: 50%; margin-top: 2px; font-size: .7rem; font-weight: 800; }
.empty-state { padding: 18px 14px; color: var(--muted); font-size: .89rem; }
.padded > .empty-state { padding-inline: 0; padding-bottom: 3px; }
.isolated { max-width: 510px; margin: min(8vh, 62px) auto 48px; }
.isolated h1 { margin: 12px 0 7px; font-size: clamp(1.55rem, 3vw, 2rem); }
.isolated .panel > .btn { margin-top: 14px; }
.access-card .notice { margin-top: 13px; }
.access-icon { width: 37px; height: 37px; }

.admin-main { padding-top: 32px; }
.admin-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-heading h1 { margin-top: 4px; font-size: clamp(1.75rem, 3.5vw, 2.75rem); }
.eyebrow { color: var(--muted); font-size: .9rem; }
.admin-heading-actions { display: flex; flex-shrink: 0; align-items: center; gap: 14px; }
.admin-tabs { display: flex; align-items: center; gap: 4px; margin-top: 18px; border-bottom: 1px solid var(--line); }
.admin-tabs a { min-height: 46px; display: grid; place-items: center; padding: 0 17px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 700; white-space: nowrap; }
.admin-tabs a:hover { background: #eef2e9; color: var(--ink); }
.admin-tabs a[aria-current] { border-bottom-color: var(--green); color: var(--green); }
.admin-content { margin-top: 22px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-items: start; gap: 17px; }
.admin-grid--wide-left { grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); }
.admin-aside { background: #fdfefa; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 17px; }
.metric { padding: 17px 18px; }
.metric dt { color: var(--muted); font-size: .87rem; }
.metric dd { margin-top: 2px; color: #194831; font-size: clamp(1.45rem, 3vw, 2.08rem); font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ranking-list { display: grid; gap: 15px; margin-top: 17px; }
.ranking-list li { display: flex; align-items: center; gap: 11px; }
.ranking-list .avatar, .managed-option .avatar { width: 40px; height: 40px; border-radius: 8px; font-size: 1.05rem; }
.ranking-main { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .88rem; }
.ranking-main progress { height: 7px; margin-top: 5px; }
.checklist { display: grid; gap: 7px; margin-block: 13px 18px; }
.checklist li { display: flex; gap: 9px; align-items: center; min-height: 34px; font-size: .9rem; }
.checklist li span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--green-tint); color: var(--green); font-weight: 750; }
.checklist a { text-underline-offset: 3px; }
.key-value { display: grid; gap: 11px; margin-block: 16px 20px; font-size: .89rem; }
.key-value div { display: flex; justify-content: space-between; align-items: start; gap: 9px; }
.key-value dt { color: var(--muted); }
.key-value dd { text-align: right; font-weight: 700; }
.separate-action { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.managed-option summary { list-style: none; min-height: 64px; display: flex; align-items: center; padding: 11px 15px; gap: 10px; cursor: pointer; }
.managed-option summary::-webkit-details-marker { display: none; }
.managed-option .manage-option-title { flex: 1; min-width: 0; font-weight: 750; overflow-wrap: anywhere; }
.summary-arrow { height: 8px; width: 8px; flex-shrink: 0; margin-left: 4px; border: solid var(--green); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg) translateY(-2px); }
.managed-option[open] .summary-arrow { transform: rotate(225deg) translateY(-2px); }
.managed-option-body { border-top: 1px solid var(--line); padding: 0 15px 16px; }
.import-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.import-panel p { margin-top: 7px; max-width: 375px; }
.import-panel .form-stack { margin-top: 0; gap: 7px; }
.roster-panel { margin-top: 16px; }
.roster-heading p { margin-top: 4px; }
.filter-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-block: 17px; }
.filter-form .field:first-of-type { width: min(100%, 268px); }
.roster-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .87rem; }
.roster-table :is(th, td) { vertical-align: middle; padding: 8px 9px; text-align: left; overflow-wrap: anywhere; }
.roster-table th { border-bottom: 1px solid var(--line); background: #f2f5ee; color: var(--muted); font-weight: 700; }
.roster-table th:nth-child(1) { width: 25%; }
.roster-table th:nth-child(2) { width: 12%; }
.roster-table th:nth-child(4) { width: 20%; }
.roster-table th:nth-child(5) { width: 59px; }
.roster-table tr + tr { border-top: 1px solid var(--line); }
.roster-person > * { display: block; }
.student-number { font-variant-numeric: tabular-nums; }
.choice-list { display: flex; flex-wrap: wrap; gap: 5px; }
.choice-list li { max-width: 100%; padding: 2px 7px; background: var(--green-tint); border-radius: 5px; color: #28533b; font-size: .8rem; }
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .88rem; }

@media (max-width: 920px) {
    .hero-copy { max-width: 70%; }
    .hero-art { right: -53px; width: 350px; height: 255px; }
    .padded { padding: 19px; }
}

@media (max-width: 680px) {
    .wrap { width: calc(100% - 32px); }
    .header-inner { min-height: 59px; }
    .brand { font-size: 1.07rem; gap: 8px; }
    .voter-main, .admin-main { padding-block: 14px 35px; }
    .ballot-hero { min-height: 192px; padding: 22px 18px; border-radius: 17px; }
    .ballot-hero h1 { font-size: clamp(1.75rem, 7.3vw, 2.3rem); margin-top: 11px; }
    .hero-copy { max-width: 81%; }
    .hero-background { clip-path: polygon(88% 0, 100% 0, 100% 100%, 58% 100%); }
    .hero-art { width: 200px; height: 155px; right: -61px; bottom: -29px; }
    .hero-description { font-size: .91rem; margin-top: 8px; }
    .deadline { font-size: .8rem; margin-top: 13px; }
    .status-pill { padding: 4px 8px; font-size: .76rem; }
    .voter-layout { grid-template-columns: minmax(0, 1fr); gap: 13px; margin-top: 13px; }
    .rule-panel { padding: 12px 14px; gap: 12px; }
    .rule-panel p { font-size: .8rem; }
    .padded { padding: 16px; }
    .form-stack { gap: 12px; margin-top: 14px; }
    .option-section { padding-top: 2px; }
    .option-card { padding: 10px; gap: 9px; }
    .avatar { width: 44px; height: 44px; font-size: 1.17rem; border-radius: 9px; }
    .option-copy p { font-size: .8rem; }
    .option-actions .btn { min-width: 63px; font-size: .84rem; }
    .admin-main { padding-top: 21px; }
    .admin-heading-actions { flex-wrap: wrap; justify-content: end; gap: 3px 8px; max-width: 47%; }
    .admin-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 13px; gap: 0; }
    .admin-tabs a { padding-inline: 2px; font-size: .84rem; }
    .admin-content { margin-top: 14px; }
    .admin-grid, .import-panel { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
    .metric { padding: 11px 12px; }
    .filter-form .field:first-of-type { width: 100%; }
    .roster-panel { margin-top: 12px; }
    .roster-heading h2 { font-size: 1.1rem; }
    .roster-heading .btn { padding-inline: 8px; font-size: .8rem; }
    .roster-table, .roster-table tbody { display: block; }
    .roster-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .roster-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding-block: 10px; }
    .roster-table td { display: block; padding: 3px 0; }
    .roster-table td[data-label] { grid-column: 1 / -1; display: flex; align-items: start; gap: 8px; }
    .roster-table td[data-label]::before { flex: 0 0 61px; content: attr(data-label); color: var(--muted); font-size: .8rem; }
    .roster-table .roster-action { grid-row: 1; grid-column: 2; padding: 0 0 0 10px; }
    .roster-static { display: none; }
}

@media (max-width: 370px) {
    .ballot-hero h1 { letter-spacing: 0; }
    .hero-art { right: -80px; }
    .field-grid { grid-template-columns: minmax(0, 1fr); }
    .roster-heading { align-items: start; flex-direction: column; }
}
