*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--font-body);
  min-height: 100vh; display: flex; flex-direction: column;
}
h1, h2, h3 { font-family: var(--font-display); color: var(--brand-deep); line-height: 1.12; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* Top bar */
.topbar { background: var(--brand-deep); color: #fff; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; }
.brand { display: flex; align-items: baseline; gap: .75rem; color: #fff; text-decoration: none; flex-wrap: wrap; }
.brand img { height: 34px; width: auto; display: block; }
.brand-mark { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; letter-spacing: -0.01em; }
.brand-event { opacity: .8; font-size: .95rem; }
.who { display: flex; align-items: center; gap: .9rem; font-size: .95rem; }
.who form { margin: 0; }
.link-btn { background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 999px;
  padding: .3rem .9rem; font: inherit; cursor: pointer; }
.link-btn:hover { background: rgba(255,255,255,.12); }

main.wrap { flex: 1; padding: 2.5rem 0 3rem; }
.foot { color: var(--muted); font-size: .88rem; padding: 1.5rem 0 2rem; border-top: 1px solid var(--line); }

/* Flash */
.flash { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; border-left: 4px solid var(--brand); background: var(--brand-tint); }
.flash.error { border-color: var(--danger); background: #FBEAE8; color: #5c1511; }

/* Buttons & fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font: 600 1.05rem var(--font-body); padding: .85rem 1.6rem;
  border-radius: 999px; text-decoration: none; }
.btn:hover { background: var(--brand-deep); }
.btn:disabled { background: #9DB3AA; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.ghost:hover { background: var(--brand-tint); }
label.field { display: block; font-weight: 600; margin-bottom: 1rem; }
.input { display: block; width: 100%; margin-top: .35rem; padding: .8rem .95rem; font: inherit; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-tint); }

/* Login */
.login { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; min-height: 60vh; }
.login-copy h1 { max-width: 14ch; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2rem; }
.login-card .btn { width: 100%; margin-top: .5rem; }

/* Category page */
.ballot { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2.5rem; align-items: start; }
.brief { position: sticky; top: 1.5rem; }
.brief .lede { font-size: 1.15rem; }
.criteria { list-style: none; padding: 0; margin: 1.25rem 0 0; border-top: 1px solid var(--line); }
.criteria li { padding: .7rem 0 .7rem 2rem; border-bottom: 1px solid var(--line); position: relative; }
.criteria li::before { content: ""; position: absolute; left: .35rem; top: 1.05rem; width: .7rem; height: .7rem;
  border-radius: 50%; background: var(--accent); }
.deadline { margin-top: 1.25rem; font-size: .95rem; color: var(--muted); }

.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.5rem; }
.sheet-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sheet-head h2 { margin: 0; }
.search { max-width: 260px; margin: 0; }
.nominees { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem; margin: 0; padding: 0; border: 0; }
.nominee { position: relative; }
.nominee input { position: absolute; opacity: 0; pointer-events: none; }
.nominee label { display: flex; gap: .75rem; align-items: center; padding: .75rem .85rem; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); min-height: 64px; }
.nominee label:hover { border-color: var(--brand); }
.initials { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper); color: var(--brand-deep); font: 700 .95rem var(--font-display); }
.nominee .name { font-weight: 600; line-height: 1.25; display: block; }
.nominee .dept { color: var(--muted); font-size: .85rem; display: block; }
.nominee input:checked + label { border-color: var(--brand); background: var(--brand-tint); box-shadow: inset 0 0 0 1px var(--brand); }
.nominee input:checked + label .initials { background: var(--accent); color: var(--brand-deep); }
.nominee input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.empty-filter { display: none; color: var(--muted); padding: 1rem 0; }

.cast { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px dashed var(--line); }
.choice-line { font-size: 1.05rem; margin-bottom: .75rem; min-height: 1.6em; }
.choice-line strong { color: var(--brand-deep); }
.confirm { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: 1rem; font-size: .98rem; }
.confirm input { width: 1.15rem; height: 1.15rem; margin-top: .2rem; accent-color: var(--brand); }

/* Done / seal */
.done { text-align: center; padding: 2rem 0; }
.done p { margin-inline: auto; }
.seal { width: 168px; height: 168px; margin: 0 auto 1.75rem; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 50%, var(--accent) 0 56%, var(--accent-tint) 57% 100%);
  border: 3px dashed var(--accent); color: var(--brand-deep); font: 800 1.15rem/1.1 var(--font-display); text-align: center; }
.seal span { display: block; padding: 0 1rem; }
@media (prefers-reduced-motion: no-preference) {
  .seal.animate { animation: stamp .55s cubic-bezier(.2, 1.4, .4, 1) both; }
  @keyframes stamp { from { transform: scale(1.6) rotate(-14deg); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Index list */
.cat-list { display: grid; gap: .8rem; margin-top: 1.5rem; }
.cat-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.1rem 1.25rem; }
.cat-row h3 { margin: 0 0 .2rem; }
.cat-row p { margin: 0; color: var(--muted); font-size: .95rem; }
.pill { display: inline-block; padding: .25rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--brand-tint); color: var(--brand-deep); }

/* Admin */
.admin-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.admin-head h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0; }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; }
.tabs a { padding: .45rem 1rem; border-radius: 999px; text-decoration: none; border: 1.5px solid var(--line); color: var(--ink); font-weight: 600; font-size: .95rem; }
.tabs a.on { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 2rem; }
.fact { background: var(--surface); padding: 1rem 1.2rem; }
.fact b { display: block; font: 800 1.9rem/1.1 var(--font-display); color: var(--brand-deep); }
.fact span { color: var(--muted); font-size: .92rem; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; }
.result-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.turnout { height: 10px; border-radius: 999px; background: var(--paper); overflow: hidden; margin: .5rem 0 1.25rem; }
.turnout i { display: block; height: 100%; background: var(--brand); }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 2rem minmax(0, 1fr) 4.5rem; gap: .75rem; align-items: center; padding: .55rem 0; border-top: 1px solid var(--line); }
.rank .pos { font: 700 1rem var(--font-display); color: var(--muted); }
.rank .who-col .nm { font-weight: 600; }
.bar { height: 8px; border-radius: 999px; background: var(--paper); margin-top: .35rem; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.rank li.lead .bar i { background: var(--accent); }
.rank li.lead .pos { color: var(--accent); }
.rank .count { text-align: right; font-variant-numeric: tabular-nums; }
.rank .count b { display: block; font-size: 1.05rem; }
.rank .count span { color: var(--muted); font-size: .82rem; }
.notice { background: var(--accent-tint); border-radius: var(--radius-sm); padding: .6rem .9rem; font-size: .95rem; margin-bottom: 1rem; }
.days { display: flex; align-items: flex-end; gap: .4rem; height: 120px; padding-top: .5rem; }
.days div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 26px; }
.days i { display: block; width: 100%; max-width: 38px; background: var(--brand); border-radius: 6px 6px 0 0; }
.days small { font-size: .75rem; color: var(--muted); margin-top: .3rem; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
table.part { width: 100%; border-collapse: collapse; background: var(--surface); }
table.part th, table.part td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
table.part th { font-size: .9rem; color: var(--muted); font-weight: 600; }
.yes { color: var(--brand); font-weight: 700; }
.no { color: var(--muted); }

@media (max-width: 860px) {
  .login, .ballot { grid-template-columns: 1fr; gap: 1.75rem; }
  .brief { position: static; }
  .search { max-width: none; width: 100%; }
  .cat-row { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 600px) {
  .who > span, .brand-event { display: none; }
  .link-btn { white-space: nowrap; }
  .facts { grid-template-columns: 1fr 1fr; }
  main.wrap { padding-top: 1.75rem; }
}

/* Deadline */
.deadline-box { margin: 0 0 1.75rem; padding: 1rem 1.15rem; border-radius: var(--radius-sm); background: var(--accent-tint);
  border-left: 4px solid var(--accent); display: grid; gap: .15rem; }
.deadline-box strong { font-family: var(--font-display); color: var(--brand-deep); font-size: 1.1rem; }
.deadline-box .left { font-weight: 600; color: var(--brand-deep); }
.cat-when { margin-top: .35rem !important; font-size: .92rem; color: var(--muted); }
.cat-when strong { color: var(--brand-deep); }
.pill { background: var(--paper); color: var(--muted); }
