:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #1c1c1c;
  --muted: #555;
  --accent: #1d4e89;
  --accent-text: #ffffff;
  --border: #cfcac0;
  --error: #b00020;
  --error-bg: #fdecee;
  --ok-bg: #e8f3ea;
  --focus: #f2a900;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.skip { position: absolute; left: -999px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { left: 16px; top: 16px; background: var(--card); padding: 8px 12px; z-index: 10; }

.hero { background: var(--accent); color: var(--accent-text); padding: 32px 16px 28px; text-align: center; }
.hero h1 { margin: 0 0 4px; font-size: 1.9rem; line-height: 1.2; }
.hero .lead { margin: 0; font-size: 1.15rem; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 1.35rem; color: var(--accent); }
.card.small { font-size: 0.95rem; color: var(--muted); }

.facts { margin: 0; }
.facts > div { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eee; }
.facts > div:last-child { border-bottom: 0; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }
.events { margin: 0; padding-left: 1.2em; }
.events li { margin-bottom: 6px; }
.nowrap { overflow-wrap: anywhere; }

a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.field { margin: 0 0 18px; border: 0; padding: 0; }
label, legend { display: block; font-weight: 600; margin-bottom: 6px; }
legend { padding: 0; }
.optional, .hint { font-weight: 400; color: var(--muted); font-size: 0.92rem; }
.hint { margin: 4px 0 0; }
input:not([type=radio]):not([type=checkbox]), select {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit;
  border: 2px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
}
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--error); }
.choice { display: flex; align-items: flex-start; gap: 12px; font-weight: 400; min-height: 48px; padding: 10px 0; cursor: pointer; }
.choice input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.error { color: var(--error); margin: 4px 0 0; font-size: 0.95rem; }
.error:empty { display: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.total { font-size: 1.1rem; font-weight: 600; }
.total:empty { display: none; }
.turnstile { margin: 8px 0 16px; min-height: 65px; }

.btn {
  display: inline-block; width: 100%; min-height: 52px; padding: 12px 20px; font: inherit; font-weight: 700;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px; cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); }

.alert { padding: 12px 14px; border-radius: 8px; background: var(--ok-bg); margin-bottom: 16px; }
.alert p { margin: 0 0 6px; }
.alert-error { background: var(--error-bg); color: var(--error); }

#success { background: var(--ok-bg); border-radius: 8px; padding: 16px; }
#success h3 { margin-top: 0; font-size: 1.3rem; }
.amount { font-size: 1.2rem; }
.code { font: 700 1.8rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.08em; background: #fff; border: 2px dashed var(--accent); border-radius: 8px; padding: 10px; text-align: center; user-select: all; }

@media (min-width: 700px) {
  .hero { padding: 48px 16px 40px; }
  .hero h1 { font-size: 2.4rem; }
  .card { padding: 24px; }
  .btn { width: auto; }
}

/* Admin */
.admin main { max-width: 1200px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.stat .n { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.stat .l { color: var(--muted); font-size: 0.9rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.toolbar input { max-width: 320px; }
.toolbar .btn { width: auto; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; vertical-align: top; white-space: nowrap; }
th { background: #faf9f6; position: sticky; top: 0; }
td.num, th.num { text-align: right; }
td input[type=checkbox] { width: 22px; height: 22px; }
td input.note { min-height: 36px; padding: 4px 8px; min-width: 160px; font-size: 0.9rem; }
tr.paid td { background: #f2f9f3; }
