:root {
  --bg: #faf6f1; --card: #fff; --ink: #2e2a27; --muted: #766e67; --line: #e6dfd6;
  --accent: #8a5a44; --accent-ink: #fff; --seat: #9a5b00; --ok: #3c7a52; --bad: #a14444; --warn: #a2761f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1917; --card: #262220; --ink: #f1ebe4; --muted: #a39a90; --line: #3a3430;
    --accent: #d09a7e; --accent-ink: #1c1917; --seat: #f2c14e; --ok: #6fbf8b; --bad: #e08a8a; --warn: #e0b565;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 Georgia, 'Times New Roman', serif; }
h1, h2, h3 { font-weight: normal; margin: 0 0 .5rem; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 560px; margin: 0 auto; padding: 32px 16px 64px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .15em; font-size: .75rem; color: var(--muted); }
.couple { font-size: 2.4rem; margin: .25rem 0 .75rem; }
.muted { color: var(--muted); }
.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 10px 18px;
  border-radius: 8px; cursor: pointer; font-size: 1rem; }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* guest page */
.choices { display: flex; gap: 12px; margin: 20px 0; }
.choice { flex: 1; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; text-align: center; padding: 14px 8px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
label.field { display: block; margin: 16px 0 6px; }
select, input[type=text], input[type=number], input[type=email], textarea {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
textarea { min-height: 80px; resize: vertical; }
.msg { margin-top: 14px; min-height: 1.4em; }
.msg.err { color: var(--bad); } .msg.ok { color: var(--ok); }
.hidden { display: none !important; }

/* admin */
.admin { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
.admin h1 { font-size: 1.8rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.8rem; font-weight: normal; line-height: 1.1; }
.stat small { color: var(--muted); }
.stat.ok b { color: var(--ok); } .stat.bad b { color: var(--bad); } .stat.warn b { color: var(--warn); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1 1 200px; }
.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: normal; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: .8rem; border: 1px solid currentColor; }
.pill.attending { color: var(--ok); } .pill.declined { color: var(--bad); } .pill.pending { color: var(--warn); }
a { color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
td.name { min-width: 130px; font-weight: bold; }
td.msg-cell { min-width: 160px; max-width: 240px; overflow-wrap: break-word; }
td.diet-cell { min-width: 120px; overflow-wrap: break-word; max-width: 200px; }
td.contact { overflow-wrap: anywhere; min-width: 140px; }
td.actions { width: 230px; min-width: 230px; }
.actions-box { display: flex; flex-wrap: wrap; gap: 4px; }
a.btn { display: inline-block; text-decoration: none; }
.pill.late { color: var(--warn); font-size: .7rem; margin-left: 2px; }
.pill.printed { color: var(--muted); font-size: .7rem; font-weight: normal; margin-left: 2px; }
.banner { padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: .9rem; }
.banner.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); border: 1px solid var(--bad); }
.qr-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); width: min(440px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; }

/* guest page: highlighted seat count and small helper text */
.seats { display: inline-block; margin: 0 .1em; padding: .02em .5em; border-radius: 10px; font-size: 1.45em; font-weight: 700;
  line-height: 1.35; white-space: nowrap; letter-spacing: .01em; color: var(--seat);
  background: color-mix(in srgb, var(--seat) 16%, transparent); border: 2px solid color-mix(in srgb, var(--seat) 60%, transparent); }
.hint { font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* guest page: meal counts */
.field-label { margin: 16px 0 6px; }
.meal-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; }
.meal-row label { flex: 1; }
.meal-row select { width: 5.5em; flex: none; }
.hint.ok { color: var(--ok); }
.hint.err { color: var(--bad); }
