/* HOA Board Election - styles. Colors are defined once here. */
:root {
  --paper: #F6F3EC; --surface: #FFFFFF; --ink: #16191D; --muted: #4A5058; --line: #D9D3C7;
  --green: #1D5C47; --green-dark: #123D2F; --green-tint: #E4EFE9; --on-green: #FFFFFF;
  --amber-tint: #FBF1DC; --amber-ink: #7A4F00; --red: #9B2C2C; --red-tint: #F7E4E2;
  --dark: #16191D; --on-dark: #FFFFFF;
  --focus: #1D5C47;
  --sans: 'Atkinson Hyperlegible', 'Segoe UI', Roboto, Arial, sans-serif;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}
html.hc {
  --paper: #000; --surface: #000; --ink: #FFF; --muted: #FFF; --line: #FFF;
  --green: #FFD60A; --green-dark: #FFE45C; --green-tint: #000; --on-green: #000;
  --amber-tint: #000; --amber-ink: #FFD60A; --red: #FF8A80; --red-tint: #000;
  --dark: #FFD60A; --on-dark: #000; --focus: #FFD60A;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html.ts-2 { font-size: 118%; }
html.ts-3 { font-size: 138%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.5; }
a { color: var(--green); }
a:hover { color: var(--green-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- buttons and forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 3rem; padding: .5rem 1.25rem;
  border: 2px solid var(--ink); border-radius: 12px; background: var(--surface); color: var(--ink);
  font: 700 1.05rem/1.2 var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--paper); color: var(--ink); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: var(--on-green); }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger.solid { background: var(--red); color: #fff; }
.btn.big { min-height: 4.25rem; font-size: 1.4rem; width: 100%; }
.btn.small { min-height: 2.5rem; padding: .25rem .8rem; font-size: .95rem; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
label { display: block; font-weight: 700; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=tel], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: .35rem; min-height: 3rem; padding: .5rem .8rem; border: 2px solid var(--ink); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: 400 1.05rem var(--sans); }
textarea { min-height: 5rem; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 1.35rem; height: 1.35rem; accent-color: var(--green); flex-shrink: 0; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin: .4rem 0; }
.hint { color: var(--muted); font-size: .95rem; font-weight: 400; }
.field { margin-bottom: 1rem; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; }
fieldset { border: 2px solid var(--line); border-radius: 12px; padding: 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }
fieldset.cosign { border-color: var(--amber-ink); background: var(--amber-tint); }

/* ---------- notices and pills ---------- */
.notice { padding: .9rem 1.1rem; border-radius: 12px; margin: 0 0 1rem; border: 2px solid transparent; }
.notice.good { background: var(--green-tint); border-color: var(--green); }
.notice.bad { background: var(--red-tint); border-color: var(--red); }
.notice.warn { background: var(--amber-tint); border-color: var(--amber-ink); }
.pill { display: inline-block; padding: .15rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.pill.green { background: var(--green); color: var(--on-green); }
.pill.amber { background: var(--amber-tint); color: var(--amber-ink); border: 1px solid var(--amber-ink); }
.pill.grey { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.pill.red { background: var(--red); color: #fff; }

/* ---------- voter pages ---------- */
body.voter { font-size: 1.15rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; padding: .6rem .8rem; background: var(--surface); border-bottom: 1px solid var(--line); justify-content: center; }
.tool { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 3rem; padding: .3rem .9rem; flex: 1 1 auto; max-width: 14rem;
  border: 2px solid var(--ink); border-radius: 10px; background: var(--surface); color: var(--ink); font: 700 1rem var(--sans); text-decoration: none; cursor: pointer; }
.tool[aria-pressed=true] { background: var(--dark); color: var(--on-dark); }
.vmain { max-width: 40rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.vhead .hoa { color: var(--muted); font-weight: 700; margin-bottom: .25rem; }
.vhead h1 { font-family: var(--serif); font-size: 2.1rem; }
.steps { display: flex; gap: .4rem; margin: 1rem 0 .5rem; }
.steps span { flex: 1; height: .5rem; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--green); }
.step { font-weight: 700; font-size: 1.15rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; margin: 1rem 0; }
.card.help { background: var(--amber-tint); border-color: transparent; }
html.hc .card.help { border-color: var(--line); }
.deadline { display: flex; gap: .75rem; align-items: center; background: var(--dark); color: var(--on-dark); border-radius: 12px; padding: .9rem 1rem; margin: 1rem 0; }
.deadline strong { display: block; font-size: 1.1rem; }
.deadline span { opacity: .9; font-size: 1rem; }
.code-input { font-size: 1.9rem !important; font-weight: 700 !important; letter-spacing: .3rem; text-align: center; text-transform: uppercase; min-height: 4.25rem !important; border-width: 3px !important; }
.error { color: var(--red); font-weight: 700; }
html.hc .error { color: #FF8A80; }

.counter { position: sticky; top: 0; z-index: 4; display: flex; justify-content: space-between; align-items: center; background: var(--dark); color: var(--on-dark); border-radius: 12px; padding: .8rem 1rem; margin: .5rem 0 1rem; }
.counter .big { font-size: 1.45rem; font-weight: 700; }
.cands { display: grid; gap: .75rem; }
@media (min-width: 900px) {
  body.voter.wide .vmain { max-width: 72rem; }
  body.voter.wide .cands { grid-template-columns: repeat(3, 1fr); }
}
.cand-row { position: relative; }
.cand { display: flex; align-items: center; gap: .9rem; min-height: 5.5rem; padding: .75rem 3.8rem .75rem .9rem; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; font-weight: 400; }
.cand input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cand .photo { width: 3.6rem; height: 3.6rem; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--line); }
.initials { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
.cand-text { flex: 1; display: flex; flex-direction: column; }
.cand-name { font-size: 1.3rem; font-weight: 700; }
.cand-loc { color: var(--muted); font-size: 1rem; }
.tick { width: 2.75rem; height: 2.75rem; flex-shrink: 0; border: 3px solid var(--green); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--on-green); }
.tick svg { opacity: 0; }
.cand:has(input:checked) { border: 3px solid var(--green); background: var(--green-tint); }
.cand:has(input:checked) .tick { background: var(--green); }
.cand:has(input:checked) .tick svg { opacity: 1; }
.cand.is-on { border: 3px solid var(--green); background: var(--green-tint); }
.cand.is-on .tick { background: var(--green); }
.cand.is-on .tick svg { opacity: 1; }
.cand:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.cand.is-full { opacity: .55; }
.cand-tools { display: flex; justify-content: flex-end; margin-top: .3rem; }
.cand-tools button { min-height: 2.75rem; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .7rem; font: 700 .95rem var(--sans); cursor: pointer; }
.actionbar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: .9rem 1rem 1.1rem; margin: 1.5rem -1rem 0; }
.chosen-list { display: grid; gap: .6rem; margin: 1rem 0; }
.chosen-list li { list-style: none; display: flex; gap: .8rem; align-items: center; background: var(--surface); border: 2px solid var(--green); border-radius: 12px; padding: .6rem .8rem; font-size: 1.25rem; font-weight: 700; }
.chosen-list { padding: 0; }
.center { text-align: center; }
.done-mark { width: 7rem; height: 7rem; margin: 2rem auto 1rem; border-radius: 50%; background: var(--green); color: var(--on-green); display: flex; align-items: center; justify-content: center; }
.done-mark.lock { background: var(--dark); color: var(--on-dark); }
.receipt { font-size: 1.9rem; font-weight: 700; letter-spacing: .2rem; }
.results-table { width: 100%; border-collapse: collapse; }
.results-table td, .results-table th { padding: .6rem .4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.bar { height: 1.1rem; background: var(--line); border-radius: 6px; overflow: hidden; min-width: 6rem; }
.bar i { display: block; height: 100%; background: var(--green); }
.bar i.tie { background: var(--amber-ink); }
.bar i.no { background: var(--muted); }

/* ---------- committee pages ---------- */
body.admin { font-size: 1rem; }
.ashell { display: flex; min-height: 100vh; }
.anav { width: 15rem; flex-shrink: 0; background: #16191D; color: #fff; padding: 1.5rem .75rem; display: flex; flex-direction: column; gap: .15rem; }
.anav-title { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; padding: 0 .6rem 1rem; margin: 0; }
.anav a { color: #D9D3C7; text-decoration: none; padding: .6rem .7rem; border-radius: 8px; }
.anav a:hover { background: #2A3038; color: #fff; }
.anav a.on { background: #2A3038; color: #fff; font-weight: 700; }
.anav a:focus-visible, .anav button:focus-visible { outline-color: #FFD60A; }
.anav-foot { margin-top: auto; padding: 1rem .7rem 0; font-size: .95rem; color: #D9D3C7; }
.anav-foot span { font-size: .85rem; }
.anav-foot .linkbtn { color: #fff; }
.amain { flex: 1; min-width: 0; padding: 2rem 2.5rem 4rem; max-width: 78rem; }
.amain h1 { font-family: var(--serif); font-size: 2rem; margin-bottom: 1.25rem; }
.amain h2 { font-size: 1.3rem; margin-top: .25rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.stat b { display: block; font-size: 1.75rem; }
.stat span { color: var(--muted); font-size: .95rem; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .97rem; }
.tbl th { text-align: left; color: var(--muted); font-size: .88rem; padding: .5rem; border-bottom: 2px solid var(--line); }
.tbl td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl .actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.inline { display: inline; }
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; }
.checklist li { padding: .35rem 0; display: flex; gap: .6rem; align-items: baseline; }
.checklist .ok { color: var(--green); font-weight: 700; }
.checklist .no { color: var(--red); font-weight: 700; }
.household { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; margin-bottom: .9rem; background: var(--surface); }
.household h3 { font-size: 1.1rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.toolbar-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.toolbar-row .field { margin: 0; flex: 1; min-width: 12rem; }
.pager { display: flex; gap: .5rem; margin-top: 1rem; }
.login-box { max-width: 26rem; margin: 4rem auto; }
@media (max-width: 860px) {
  .ashell { flex-direction: column; }
  .anav { width: auto; flex-direction: row; flex-wrap: wrap; padding: .75rem; }
  .anav-title { width: 100%; padding-bottom: .4rem; }
  .anav-foot { width: 100%; margin-top: .5rem; padding-top: .5rem; }
  .amain { padding: 1.25rem 1rem 3rem; }
}

/* ---------- printed code slips ---------- */
.slips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.slip { border: 1px dashed #777; padding: 1rem 1.1rem; break-inside: avoid; page-break-inside: avoid; background: #fff; color: #000; }
.slip .s-hoa { font-size: .85rem; margin: 0; }
.slip .s-title { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; margin: 0 0 .4rem; }
.slip .s-name { font-weight: 700; font-size: 1.1rem; margin: 0; }
.slip .s-code { font-size: 1.9rem; font-weight: 700; letter-spacing: .25rem; margin: .4rem 0; border: 2px solid #000; border-radius: 8px; text-align: center; padding: .2rem; }
.slip .s-help { font-size: .82rem; margin: 0; }
@media print {
  .anav, .noprint, .toolbar, .actionbar { display: none !important; }
  body, .panel, .amain { background: #fff !important; color: #000 !important; }
  .amain { padding: 0; max-width: none; }
  .panel { border: 0; padding: 0; }
}
