:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --ink: #1c2833;
  --muted: #66737f;
  --line: #dde3e1;
  --accent: #2c5d63;
  --accent-ink: #ffffff;
  --chip: #e8f0ee;
  --danger: #a3362f;
  --yes: #2f7a4d;
  --no: #a3362f;
  --pending: #8a6d1d;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12181d;
    --surface: #1a2229;
    --ink: #e6ecef;
    --muted: #93a1ac;
    --line: #2b3640;
    --accent: #6fb3ba;
    --accent-ink: #0f1a1d;
    --chip: #24323a;
    --danger: #e0766e;
    --yes: #66c08a;
    --no: #e0766e;
    --pending: #d9b756;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 80px; }
header h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  margin: 0 0 4px;
  letter-spacing: 0.2px;
}
header p { margin: 0; color: var(--muted); }

.totals {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin: 22px 0 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.totals div { min-width: 70px; }
.totals strong { display: block; font-family: var(--serif); font-size: 26px; font-weight: 600; }
.totals span { color: var(--muted); font-size: 13px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=search], input[type=text], select, textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
}
textarea { resize: vertical; min-height: 70px; }
.toolbar input[type=search] { flex: 1 1 200px; width: auto; }
.toolbar select { width: auto; }
button, a.btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, a.btn:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.link { border: none; background: none; padding: 4px 6px; color: var(--muted); }
button.link:hover { color: var(--accent); }
button.link.danger:hover { color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.invite {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.invite-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.invite-head h2 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 0; }
.count { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
select.rsvp { width: auto; font-size: 13px; font-weight: 600; padding: 4px 8px; }
select.rsvp.Yes { color: var(--yes); }
select.rsvp.No { color: var(--no); }
select.rsvp.Pending { color: var(--pending); }
.meta { color: var(--muted); font-size: 13px; margin-top: 2px; white-space: pre-line; }
.guests { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.chip {
  background: var(--chip);
  border-radius: 999px;
  padding: 3px 4px 3px 12px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.chip button { border: none; background: none; padding: 0 8px; color: var(--muted); font-size: 16px; line-height: 1; }
.chip button:hover { color: var(--danger); }
.add-guest { display: flex; gap: 8px; }
.add-guest input { flex: 1; }
.actions { display: flex; gap: 4px; margin-top: 8px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  width: min(480px, calc(100vw - 24px));
  padding: 20px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h3 { font-family: var(--serif); margin: 0 0 14px; font-size: 20px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.note { color: var(--muted); font-size: 12px; margin-top: 24px; }
#status { color: var(--muted); font-size: 13px; margin: 8px 0; min-height: 18px; }
#status.error { color: var(--danger); }

/* sign-in screen and header */
.login { max-width: 360px; margin: 14vh auto 0; }
.login h1 { font-family: var(--serif); font-weight: 600; font-size: 28px; margin: 0 0 4px; }
.login p { color: var(--muted); margin: 0 0 18px; }
.login button.primary { width: 100%; margin-top: 18px; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; }
.topbar { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.topbar .grow { flex: 1 1 260px; }
.topbar .who { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }

/* users and account dialog */
.user-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: none; }
.user-row .name { flex: 1; }
.user-row .you { color: var(--muted); font-size: 12px; }
dialog h4 { font-family: var(--serif); font-size: 16px; margin: 22px 0 4px; }
dialog h4:first-of-type { margin-top: 0; }
dialog .hint { color: var(--muted); font-size: 12px; margin: 2px 0 0; }
[hidden] { display: none !important; }
.error.ok { color: var(--yes); }
