:root {
  color-scheme: light;
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #111b17;
  background: #f8fbfa;
  --green: #08633f;
  --deep: #03452a;
  --mint: #e0f8eb;
  --line: #e0e9e4;
  --muted: #55645e;
  --surface: #fff;
  --shadow: 0 8px 28px rgb(18 65 48 / 7%);
  --radius: 20px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
a { color: var(--green); }
button, input { font: inherit; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.35rem, 7vw, 3.5rem); letter-spacing: -.055em; line-height: 1.15; }
h2, legend, summary { font-size: 1.18rem; font-weight: 750; }
p { line-height: 1.55; }

.page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  padding-top: env(safe-area-inset-top);
}

.page::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: clamp(195px, 29vw, 330px);
  background: linear-gradient(145deg, #ecfcf5 25%, #adf0d3 100%);
  clip-path: ellipse(88% 97% at 100% 0);
  opacity: .65;
  mask-image: linear-gradient(#000 15%, transparent 100%);
  pointer-events: none;
}

.shell { width: min(940px, calc(100% - 32px)); margin-inline: auto; }
.narrow { max-width: 488px; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 24px 8px; }
.brand img { display: block; width: min(205px, 63%); height: auto; }
.vote-page .brand { justify-content: flex-start; padding-top: 26px; }
.brand button { min-height: 37px; flex-shrink: 0; font-size: .82rem; }
main { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
.hero { padding-block: 23px 22px; }
.vote-page .brand, .vote-page .hero { padding-inline: 8px; }
.eyebrow { color: var(--muted); font-size: .84rem; font-weight: 700; margin-bottom: 7px; }
.round-line, .section-heading, .actions { display: flex; align-items: center; gap: 10px; }
.round-line { margin-top: 14px; flex-wrap: wrap; overflow-wrap: anywhere; }
.pill, .round-line #doctor {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: .91rem;
  line-height: 1.35;
}
.pill { background: var(--mint); color: var(--deep); font-weight: 750; white-space: nowrap; }
.vote-page .pill, .pill[data-phase="open"] { background: #bdf4d8; }
.pill[data-phase="closed"], .pill[data-phase="finished"] { color: var(--muted); background: #eef3f0; }
.round-line #doctor { border: 1px solid #ceeadd; background: #f8fbfab3; max-width: 100%; }
.round-line #doctor:empty { display: none; }
.round-line:has(#doctor:empty) { margin-top: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(15px, 4vw, 24px);
  box-shadow: var(--shadow);
}
.muted { color: var(--muted); font-size: .91rem; margin-top: 6px; }
.banner { padding: 11px 14px; margin-bottom: 12px; border-radius: 12px; color: var(--deep); background: var(--mint); }
.warning { color: #714814; background: #fff1d9; }
.vote-page #notice { margin: 12px 0 0; }
footer { text-align: center; color: var(--muted); font-size: .78rem; line-height: 1.55; padding: 16px 4px 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; font-size: clamp(1.12rem, 5vw, 1.5rem); letter-spacing: -.025em; }
.ballot { position: relative; isolation: isolate; overflow: hidden; }
.ballot::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto 0 0 auto;
  width: 60%;
  height: 135px;
  background: radial-gradient(ellipse at top right, #d4f7e6, transparent 68%);
  clip-path: ellipse(89% 99% at 100% 100%);
  pointer-events: none;
}
.criteria { display: grid; gap: 7px; margin-block: 15px 19px; }
.criterion {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 46px;
  padding: 9px 12px;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.criterion:has(input:checked) { background: linear-gradient(110deg, #e7f9ef, #d7f7e6); border-color: #d7f4e5; }
.criterion span { font-weight: 650; }
.criterion input { appearance: none; width: 21px; height: 21px; margin: 0; border: 1.5px solid #8f9d96; border-radius: 5px; background: #fff; cursor: pointer; }
.criterion input:checked { position: relative; background: var(--deep); border-color: var(--deep); }
.criterion input:checked::after { content: ""; position: absolute; width: 9px; height: 5px; top: 5px; left: 4px; border: solid white; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.criterion small { color: var(--muted); white-space: nowrap; }
.criterion:has(input:checked) small { color: var(--deep); }
.score-bar { display: grid; gap: 13px; border-top: 1px solid var(--line); padding-top: 12px; }
.score-bar > div { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.score-label { color: var(--muted); font-size: .88rem; }
#score { color: var(--deep); font-size: 2.45rem; font-weight: 800; margin-left: 6px; line-height: 1.2; font-variant-numeric: tabular-nums; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 43px;
  border-radius: 100px;
  padding: 8px 15px;
  border: 1px solid #cfdfd7;
  background: #f8fbf9;
  color: var(--deep);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--mint); }
.primary { background: linear-gradient(115deg, var(--green), var(--deep)); color: #fff; border-color: transparent; }
.primary:hover { background: var(--deep); }
.score-bar .primary { min-height: 49px; font-size: 1.04rem; }
.submit-arrow { font-size: 1.35em; line-height: 1; }
.wide { width: 100%; margin-top: 14px; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.confirmation {
  width: min(400px, calc(100% - 36px));
  max-width: none;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 54px rgb(9 51 34 / 20%);
  background: white;
  color: inherit;
}
.confirmation h2:focus { outline: none; }
.confirmation::backdrop { background: rgb(9 29 22 / 47%); }
.confirmation p { white-space: pre-line; }
.confirmation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 19px; }
.confirmation-actions button { min-height: 44px; }

input:not([type="checkbox"]) {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cddbd4;
  border-radius: 11px;
  padding: 8px 11px;
  background: white;
  color: inherit;
  font-size: 16px;
}
input:disabled { background: #f4f7f5; opacity: .78; }
.login input { margin-top: 8px; }
.login { max-width: 430px; }
#dashboard, .dashboard-main, .dashboard-side { display: grid; gap: 12px; min-width: 0; }
.section-heading { justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 15px 0; }
.metrics > div { display: grid; gap: 4px; padding: 12px 14px; border-radius: 15px; background: linear-gradient(135deg, #e2f8ed, #f3faf6); }
.metrics span { color: var(--muted); font-size: .85rem; }
.metrics strong { color: var(--deep); font-size: clamp(1.6rem, 5vw, 2.6rem); line-height: 1.1; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.actions { flex-wrap: wrap; }
.actions .muted { flex-basis: 100%; margin-top: 0; }
#audience-url { flex: 1 1 215px; min-width: 0; }
#qr img { display: block; max-width: 100%; height: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; }
summary { cursor: pointer; }
details[open] summary { margin-bottom: 14px; }
details .actions, details p + a { margin-top: 9px; }
#audience-entry label, #config label { font-size: .9rem; }
#config-doctor { margin-top: 5px; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 10px 12px; margin-top: 10px; }
.config-grid label { display: grid; gap: 5px; }
#config button { margin-top: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
td, th { padding: 9px; border-bottom: 1px solid var(--line); }
th { font-size: .83rem; color: var(--muted); white-space: nowrap; }
td:nth-child(2) { overflow-wrap: anywhere; }
td:not(:nth-child(2)) { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (min-width: 760px) {
  #dashboard { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
}

@media (forced-colors: active) {
  .criterion input { appearance: auto; }
  .criterion input:checked::after { display: none; }
}
