:root {
  /* Same palette and type as the RSVP page (css/rsvp.css) */
  --bg: #f8f6f1;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --text: #1b241f;
  --muted: #5c665f;
  --border: #e5e0d5;
  --brand: #1a4630;
  --brand-strong: #0f2c1e;
  --brand-contrast: #ffffff;
  --accent: #b71c2c;
  --gold: #8a6414;
  --danger: #b71c2c;
  --danger-bg: #fcecee;
  --ok: #1a5c3c;
  --ok-bg: #eaf3ed;
  --warn: #8a6414;
  --warn-bg: #fbf3dc;
  --info-bg: #ebf0fa;
  --focus: #2f5fd1;
  --shadow: 0 1px 2px rgb(15 44 30 / 5%), 0 12px 32px -12px rgb(15 44 30 / 18%);
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111814;
    --surface: #18221c;
    --surface-2: #1d2922;
    --text: #e8eee9;
    --muted: #a3ada6;
    --border: #2e3b33;
    --brand: #5fbf8f;
    --brand-strong: #7fd1a7;
    --brand-contrast: #0d1a13;
    --accent: #f08a80;
    --gold: #d9b45e;
    --danger: #f08a80;
    --danger-bg: #3a1d1b;
    --ok: #7fd1a7;
    --ok-bg: #173226;
    --warn: #f0c46a;
    --warn-bg: #352a12;
    --info-bg: #1a2836;
    --focus: #7ab4f5;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111814; --surface: #18221c; --surface-2: #1d2922; --text: #e8eee9; --muted: #a3ada6;
  --border: #2e3b33; --brand: #5fbf8f; --brand-strong: #7fd1a7; --brand-contrast: #0d1a13;
  --accent: #f08a80; --gold: #d9b45e; --danger: #f08a80; --danger-bg: #3a1d1b; --ok: #7fd1a7;
  --ok-bg: #173226; --warn: #f0c46a; --warn-bg: #352a12; --info-bg: #1a2836; --focus: #7ab4f5;
  --shadow: none; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1, h2, .display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 .75em; }
a { color: var(--brand); }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.container { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; }
.container.wide { max-width: 1200px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card > h2 { font-size: 1.15rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--brand); color: var(--brand-contrast);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--brand-strong); color: var(--brand-contrast); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: .875rem; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; text-decoration: underline; cursor: pointer; }

/* Forms */
.field { margin-bottom: 16px; }
.field > label, .field > .label, fieldset > legend {
  display: block; font-weight: 600; margin-bottom: 6px; padding: 0;
}
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .875rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 1px var(--danger); }
.field-error { color: var(--danger); font-size: .875rem; margin: 6px 0 0; }
.field-error:empty { display: none; }
fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 16px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); cursor: pointer; font-weight: 500;
}
.choice input { accent-color: var(--brand); width: 18px; height: 18px; margin: 0; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--ok-bg); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 520px) { .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

/* Notices */
.notice { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.notice.error { background: var(--danger-bg); color: var(--danger); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.info { background: var(--info-bg); }
.notice:empty { display: none; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.yes, .badge.paid, .badge.approved, .badge.sent { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.maybe, .badge.partial, .badge.pending { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.no, .badge.unpaid, .badge.failed, .badge.disabled, .badge.overpaid { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

dl.summary { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 16px; }
dl.summary dt { color: var(--muted); }
dl.summary dd { margin: 0; font-weight: 600; }

footer.site { padding: 24px 0 40px; text-align: center; color: var(--muted); font-size: .875rem; }

/* Staff pages: nav, sky strip and ribbon come from css/theme.css */
main.staff { padding: 28px 16px 48px; }
.stat .value { font-family: var(--font-display); }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 16px; scrollbar-width: thin; }
.tabs button {
  background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: .8rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.toolbar > * { flex: 0 1 auto; }
.toolbar input[type="search"] { flex: 1 1 220px; width: auto; }
.toolbar select { width: auto; }
.toolbar label.check { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { background: var(--surface-2); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
table.data th button { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 0; }
table.data th[aria-sort="ascending"] button::after { content: " ▲"; font-size: .7em; }
table.data th[aria-sort="descending"] button::after { content: " ▼"; font-size: .7em; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: var(--surface-2); }
table.data tr.deleted td { opacity: .55; text-decoration: line-through; }
table.data .num { text-align: right; }

dialog {
  width: min(760px, calc(100vw - 16px)); max-height: calc(100dvh - 32px);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text); padding: 0;
}
dialog::backdrop { background: rgb(0 0 0 / 45%); }
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 1; }
.dialog-head h2 { margin: 0; font-size: 1.2rem; flex: 1; }
.dialog-body { padding: 16px 20px 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

ol.history { list-style: none; margin: 0; padding: 0; }
ol.history > li { border-left: 3px solid var(--border); padding: 4px 0 12px 12px; }
ol.history > li .meta { color: var(--muted); font-size: .85rem; }
ol.history > li ul { margin: 4px 0 0; padding-left: 18px; font-size: .9rem; }

.signin { max-width: 480px; margin: 48px auto; }
.gsi-button { display: flex; justify-content: center; min-height: 44px; margin: 20px 0 4px; }
.dev-users { display: grid; gap: 8px; margin: 12px 0 16px; }
.dev-users button { justify-content: space-between; text-align: left; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.empty { padding: 24px; text-align: center; color: var(--muted); }

@media (max-width: 640px) {
  .card { padding: 16px; }
}

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  max-width: calc(100vw - 32px); box-shadow: var(--shadow); z-index: 10; margin: 0;
  border: 1px solid var(--border);
}
