/* TXTFIRE GEB 2026 — RSVP design system
   Surfaces: public = ceremonial form, admin = operations console. */

:root {
  color-scheme: dark;
  --bg: #0f0a15;
  --surface: #1a1124;
  --surface-2: #221631;
  --surface-3: #2b1d3b;
  --line: #352444;
  --line-2: #4a3359;
  --ink: #f7f1fb;
  --ink-2: #d2c4e0;
  --muted: #ab99b8;
  --gold: #e8cb84;
  --gold-2: #f8e6b6;
  --gold-dim: #a58e58;
  --ok: #85d6a9;
  --warn: #f0bb74;
  --bad: #e9918d;
  --r: 14px;
  --r-sm: 9px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --shadow: 0 18px 50px -24px rgba(0, 0, 0, .9);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* the hidden attribute must win over display rules set for layout */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 50% -260px, rgba(232, 203, 132, .10), transparent 70%),
    linear-gradient(180deg, #130d1b 0%, var(--bg) 42%);
  background-repeat: no-repeat;
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-2); }
img { max-width: 100%; height: auto; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- layout ---------- */
.shell { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 20px; }
.shell.wide { max-width: 1180px; }

.site-head { padding: 34px 0 0; }
.site-foot {
  border-top: 1px solid var(--line);
  margin-top: 44px;
  padding: 20px 0 40px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}

/* ---------- top bar (admin) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(15, 10, 21, .86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  display: flex; align-items: center; gap: 22px;
  min-height: 60px;
}
.topnav { flex: 1 1 auto; }
.topbar-side { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); font-weight: 750; letter-spacing: .1em;
  font-size: 13px; text-transform: uppercase; white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand .spark {
  width: 9px; height: 9px; border-radius: 2px;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 203, 132, .16);
  transform: rotate(45deg);
}
.brand-sub { color: var(--muted); font-weight: 600; letter-spacing: .14em; }
.topnav {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: nowrap; min-width: 0;
  overflow-x: auto; scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav > a, .topnav button {
  color: var(--ink-2); font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 999px; border: 1px solid transparent;
}
.topnav > a:hover { color: var(--ink); background: var(--surface-2); }
.topnav > a[aria-current="page"] { color: var(--gold); background: rgba(232, 203, 132, .1); }

.brand-plate {
  display: inline-flex; align-items: center; justify-content: center;
  background: #ffffff; border-radius: 7px; padding: 4px 9px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  line-height: 0; flex: 0 0 auto;
}
.brand-plate img { display: block; height: 17px; width: auto; }
.brand-plate.lg { padding: 9px 15px; border-radius: 11px; }
.brand-plate.lg img { height: 27px; }

/* ---------- page head ---------- */
.page-head { padding: 34px 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(1.5rem, 3.2vw, 2rem); }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 6px; }

/* ---------- KPI strip ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent);
  overflow: hidden;
}
.kpi { padding: 15px 17px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi .k {
  display: block; color: var(--muted); font-size: 10.5px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
}
.kpi .v {
  display: block; margin-top: 5px;
  font-size: 22px; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.kpi .v small { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-left: 5px; letter-spacing: 0; }
.kpi.accent .v { color: var(--gold); }

.progress-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 12.5px; }
.progress-row progress { flex: 0 1 220px; }
.progress-row span { white-space: nowrap; font-variant-numeric: tabular-nums; }
progress {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border: 0; border-radius: 999px;
  background: var(--surface-3); overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--gold); border-radius: 999px; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  margin: 22px 0 0;
}
.toolbar .field { margin: 0; flex: 1 1 260px; max-width: 380px; }
.toolbar .field.narrow { flex: 0 0 148px; max-width: none; }
.toolbar .spacer { flex: 1 1 0; }

/* ---------- fields ---------- */
.field { display: block; margin: 18px 0 0; }
.field > .label, .label {
  display: block; margin-bottom: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-2);
}
.hint { display: block; margin-top: 7px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
input, select, textarea, button { font: inherit; color: inherit; }
input:where(:not([type="hidden"]):not([type="radio"]):not([type="checkbox"]):not([type="submit"]):not([type="button"]):not([type="file"])),
select, textarea {
  width: 100%; padding: 11px 13px;
  background: #1c1428;
  border: 1px solid #59406c;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 15px;
  transition: border-color .15s ease, background .15s ease;
}
input::placeholder { color: #6f6280; }
input:hover, select:hover, textarea:hover { border-color: #5d4370; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); background: #180f24;
  box-shadow: 0 0 0 3px rgba(232, 203, 132, .14);
}
textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
input[readonly] { color: var(--ink-2); background: #120c1b; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 9px 16px;
  border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--ink);
  font-size: 13.5px; font-weight: 650; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--surface-3); border-color: #5f4573; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: #b99a58; color: #2a1c08;
}
.btn.primary:hover { background: var(--gold-2); border-color: var(--gold-2); color: #241705; }
.btn.ghost { border-color: var(--line-2); color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); }
.btn.danger { color: var(--bad); border-color: rgba(233, 145, 141, .38); }
.btn.danger:hover { background: rgba(233, 145, 141, .1); border-color: var(--bad); color: var(--bad); }
.btn.quiet { border-color: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); background: var(--surface-2); }
.btn.sm { min-height: 32px; padding: 6px 12px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px 10px; margin-top: 12px; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line-2);
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap;
  color: var(--ink-2); background: rgba(255, 255, 255, .03);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.pending { color: var(--muted); }
.chip.attending { color: var(--ok); border-color: rgba(133, 214, 169, .34); background: rgba(133, 214, 169, .08); }
.chip.declined { color: var(--bad); border-color: rgba(233, 145, 141, .34); background: rgba(233, 145, 141, .08); }
.chip.sent { color: var(--gold); border-color: rgba(232, 203, 132, .34); background: rgba(232, 203, 132, .08); }
.chip.unsent { color: var(--muted); }
.chip.plain::before { display: none; }

/* ---------- table ---------- */
.tablewrap {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}
table.grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.grid thead th {
  padding: 11px 14px;
  background: #1e1329;
  border-bottom: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  text-align: left; white-space: nowrap;
}
table.grid th.num, table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid .w-seats { width: 82px; }
table.grid .w-responses { width: 122px; }
table.grid .w-confirmed { width: 112px; }
table.grid .w-extras { width: 116px; }
table.grid .w-invite { width: 118px; }
table.grid td { padding: 0 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr.brow td { height: 54px; }
table.grid tr.trayrow > td { height: auto; }
tr.brow:last-of-type td { border-bottom: 0; }
tr.brow { cursor: pointer; transition: background .12s ease; }
tr.brow:hover { background: var(--surface-2); }
tr.brow.is-open { background: var(--surface-2); }
tr.brow.is-open td { border-bottom-color: transparent; }
tr.brow td.c-name { padding: 0; }

.rowtoggle {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 9px 14px;
  background: none; border: 0; text-align: left; cursor: pointer; color: inherit;
}
.rowtoggle .chev {
  flex: 0 0 auto; margin-left: auto; color: var(--muted);
  transition: transform .18s ease;
}
tr.brow.is-open .rowtoggle .chev { transform: rotate(90deg); color: var(--gold); }
.bname { font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.bmeta { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.cellnum { font-variant-numeric: tabular-nums; font-size: 14px; }
.cellnum.zero { color: var(--muted); }
.extras small { display: block; color: var(--muted); font-size: 11px; }

/* ---------- tray ---------- */
tr.trayrow > td { padding: 0; border-bottom: 1px solid var(--line-2); background: #1b1229; }
.tray {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr) minmax(0, .9fr);
  gap: 26px;
  padding: 22px 20px 24px;
  border-top: 1px solid rgba(232, 203, 132, .22);
}
.tray h4 {
  font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 9px;
}
.tray h4 + p.hint { margin-top: -3px; }
.tray .msg {
  font-size: 13px; line-height: 1.55; min-height: 132px;
  background: #120c1b; color: var(--ink-2);
}
.tray .statline { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.tray .statline:last-of-type { border-bottom: 0; }
.tray .statline span { color: var(--muted); }
.tray .statline b { font-variant-numeric: tabular-nums; }
.tray .sentbox {
  padding: 11px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: #140d1e;
  font-size: 12.5px; color: var(--ink-2);
}
.tray .sentbox strong { color: var(--gold); }

.steps { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 2px 0 18px 42px;
  color: var(--ink-2); font-size: 14px; line-height: 1.55; text-wrap: pretty;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(232, 203, 132, .45);
  background: rgba(232, 203, 132, .08);
  color: var(--gold); font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.steps li strong { display: block; color: var(--ink); font-weight: 650; }
.steps li:last-child { padding-bottom: 0; }
.steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 13.5px; top: 30px; bottom: 4px;
  width: 1px; background: linear-gradient(180deg, rgba(232,203,132,.28), rgba(232,203,132,.04));
}
.deadline-line { margin-top: 20px; }
.card > h2 + .hint { margin-top: 8px; }

.slogan {
  margin: 34px 0 -14px;
  text-align: center;
  color: var(--gold);
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  letter-spacing: .06em;
}
.site-foot .slogan { margin: 0; font-size: 15px; }

/* ---------- guest invitee form ---------- */
.check { display: flex; gap: 11px; align-items: flex-start; margin: 18px 0 0; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: #d8b877; flex: 0 0 auto; }
.check .hint { margin-top: 3px; }
.check > span { display: block; }
.notice.error { border-color: rgba(236, 143, 139, .55); background: rgba(236, 143, 139, .10); color: #ffd9d7; }
.stats3 .v.accent { color: var(--gold); }

/* ---------- cards / sections ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 17px; }
.card h2 + .hint { margin-top: 6px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 22px 0; }

/* ---------- public invitation page ---------- */
.invite { padding: 40px 0 0; }
.invite-brand { display: flex; align-items: center; gap: 10px; color: var(--gold); font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.invite-brand .spark { width: 8px; height: 8px; background: var(--gold); transform: rotate(45deg); border-radius: 2px; }
.invite h1 {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.75rem, 6vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -.005em;
  line-height: 1.18;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.invite .event-meta {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  margin-top: 14px; color: var(--ink-2); font-size: 13.5px;
}
.invite .event-meta span { display: inline-flex; align-items: center; gap: 7px; }
.invite .event-meta span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--gold-dim); }

.stats3 {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 26px 0 0;
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; background: rgba(255, 255, 255, .02);
}
.stats3 > div { padding: 15px 16px; border-right: 1px solid var(--line); }
.stats3 > div:last-child { border-right: 0; }
.stats3 .k { display: block; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.stats3 .v { display: block; margin-top: 6px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats3 .v small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 4px; letter-spacing: 0; }
.stats3 .v.gold { color: var(--gold); }

.policy {
  margin: 18px 0 0;
  padding: 16px 18px;
  border: 1px solid rgba(232, 203, 132, .3);
  border-radius: var(--r);
  background: rgba(232, 203, 132, .055);
}
.policy h2 {
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 7px;
}
.policy p { font-size: 13.5px; line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }
.policy strong { color: var(--gold-2); font-weight: 700; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 18px; padding: 13px 15px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(133, 214, 169, .34);
  background: rgba(133, 214, 169, .08);
  color: #cdeedb; font-size: 13.5px;
}
.notice.closed { border-color: rgba(240, 187, 116, .36); background: rgba(240, 187, 116, .08); color: #f6dcb6; }
.notice .mark { flex: 0 0 auto; font-weight: 800; color: var(--ok); }
.notice.closed .mark { color: var(--warn); }

/* segmented response control */
.seg { border: 0; padding: 0; margin: 22px 0 0; }
.seg legend { padding: 0; margin-bottom: 9px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.seg .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg label {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 52px; padding: 10px 14px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: #140d1e; color: var(--ink-2);
  font-size: 14px; font-weight: 600; text-align: center;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.seg label::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--line-2); flex: 0 0 auto;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.seg input { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer; }
.seg label:hover { border-color: #5d4370; color: var(--ink); }
.seg label:has(input:checked) { border-color: var(--gold); background: rgba(232, 203, 132, .09); color: var(--gold-2); }
.seg label:has(input:checked)::before { border-color: var(--gold); box-shadow: inset 0 0 0 3.5px var(--gold); background: #140d1e; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 3px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.form-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line);
}
.form-actions .btn { min-height: 46px; padding: 12px 26px; font-size: 14.5px; }
.form-note { color: var(--muted); font-size: 12px; max-width: 34ch; line-height: 1.5; }

/* full record page */
.record-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.record-actions { display: flex; flex-direction: column; gap: 12px; }
.audit { margin-top: 18px; }
.audit ol { list-style: none; margin: 0; padding: 0; }
.audit li {
  display: grid; grid-template-columns: 170px 90px 1fr; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2);
}
.audit li:last-child { border-bottom: 0; }
.audit .at { color: var(--muted); font-variant-numeric: tabular-nums; }
.audit .who { color: var(--gold); text-transform: uppercase; font-size: 11px; letter-spacing: .08em; font-weight: 700; }
.audit pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; color: var(--ink-2); }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; }
.auth .card { width: 100%; max-width: 390px; padding: 30px 28px; }
.auth h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.auth .sub { color: var(--muted); font-size: 13px; margin-top: 7px; }
.auth .field { margin-top: 20px; }
.auth .btn { margin-top: 20px; min-height: 46px; }
.auth .err {
  margin-top: 16px; padding: 10px 13px; border-radius: var(--r-sm);
  border: 1px solid rgba(233, 145, 141, .4); background: rgba(233, 145, 141, .1);
  color: #f4b7b4; font-size: 13px;
}
.auth .back { display: block; margin-top: 18px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* flash + toast */
.flashstack { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
.flash {
  padding: 11px 16px; border-radius: 999px;
  border: 1px solid rgba(232, 203, 132, .38);
  background: #241a13; color: var(--gold-2);
  font-size: 13px; text-align: center;
  box-shadow: var(--shadow);
}
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 70;
  transform: translate(-50%, 16px);
  padding: 11px 20px; border-radius: 999px;
  background: #efe0bd; color: #241705;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .8);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.copy-sink { position: fixed; top: -1000px; left: -1000px; opacity: 0; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 6px; font-size: 15px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .tray { grid-template-columns: 1fr 1fr; }
  .record-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .shell { padding: 0 16px; }
  .topbar-in { min-height: 56px; gap: 12px; }
  .brand-sub { display: none; }
  .topnav { gap: 2px; }
  .topnav > a, .topnav button { padding: 7px 9px; font-size: 12px; }
  .page-head { padding: 26px 0 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi { border-bottom: 1px solid var(--line); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }

  .stats3 { grid-template-columns: 1fr; }
  .stats3 > div { border-right: 0; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px; }
  .stats3 > div:last-child { border-bottom: 0; }
  .stats3 .v { margin-top: 0; font-size: 20px; }

  /* table -> stacked records */
  table.grid thead { display: none; }
  table.grid, table.grid tbody, table.grid tr, table.grid td { display: block; width: 100%; }
  .tablewrap { border: 0; background: none; overflow: visible; }
  tr.brow {
    position: relative;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    padding: 4px 0;
  }
  tr.brow.is-open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; margin-bottom: 0; }
  tr.brow td { height: auto; padding: 0 14px; border-bottom: 0; }
  tr.brow td.c-name { padding: 0; }
  tr.brow td:not(.c-name):not(.c-toggle) {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
    padding: 6px 14px 6px 44px;
  }
  tr.brow td:not(.c-name):not(.c-toggle)::before {
    content: attr(data-label);
    color: var(--muted); font-size: 10.5px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
  }
  tr.brow td.c-toggle { display: none; }
  .rowtoggle { padding: 10px 14px 8px; }
  .bname { font-size: 15px; }
  tr.trayrow { margin: 0 0 10px; }
  tr.trayrow > td { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); background: #1b1229; }
  .tray { grid-template-columns: 1fr; gap: 20px; padding: 18px 14px 20px; }
  .tray .msg { min-height: 108px; }
  .btnrow .btn { flex: 1 1 auto; }

  .grid2 { grid-template-columns: 1fr; }
  .seg .opts { grid-template-columns: 1fr; }
  .invite { padding-top: 28px; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .btn { width: 100%; }
  .form-note { max-width: none; text-align: center; }
  .audit li { grid-template-columns: 1fr; gap: 3px; }
  input, select, textarea { font-size: 16px; }
  .toolbar .field, .toolbar .field.narrow { flex: 1 1 100%; }
}

/* --- shared bits used by both surfaces --- */
.inline { display: inline-flex; margin: 0; }
.optional { color: var(--muted); font-weight: 600; letter-spacing: 0; text-transform: none; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; margin: 0; flex: 0 0 auto; }
.msg { width: 100%; min-height: 120px; }
.statline {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px;
}
.statline:last-of-type { border-bottom: 0; }
.statline span { color: var(--muted); }
.statline b { font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.tray h4.sp { margin-top: 18px; }
.record-actions .card + .card { margin-top: 0; }
.card summary { cursor: pointer; margin: 16px 0 0; }
.card summary::-webkit-details-marker { display: none; }
.card summary::after { content: " +"; color: var(--gold); }
.card details[open] summary::after { content: " −"; }

@media (max-width: 760px) {
  .toolbar-actions { flex: 1 1 100%; }
  .toolbar-actions .btn { flex: 1 1 auto; }
}

/* ---------- phones in portrait ---------- */
@media (max-width: 560px) {
  /* header: logo + account on one line, nav as a scrollable strip below */
  .topbar-in { flex-wrap: wrap; gap: 4px 12px; min-height: 0; padding: 9px 0 0; }
  .brand { order: 1; }
  .topbar-side { order: 2; margin-left: auto; gap: 6px; }
  .topnav {
    order: 3; flex: 1 1 100%; flex-wrap: nowrap; gap: 2px;
    overflow-x: auto; padding-bottom: 9px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav > a { flex: 0 0 auto; padding: 7px 11px; }
  .whoami { font-size: 11.5px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }
  .whoami small { font-size: 9px; padding: 0 4px; }
  .topbar-side .btn.sm { padding: 6px 10px; font-size: 11.5px; }

  /* metrics: three across, compact */
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi { padding: 10px 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .kpi:nth-child(2n) { border-right: 1px solid var(--line); }
  .kpi:nth-child(3n) { border-right: 0; }
  .kpi:nth-last-child(-n+3) { border-bottom: 0; }
  .kpi .k { font-size: 9px; letter-spacing: .09em; line-height: 1.3; }
  .kpi .v { font-size: 17px; margin-top: 3px; }
  .kpi .v small { display: block; margin: 1px 0 0; font-size: 10px; }

  /* the message is long: show most of it without a tiny scroll box */
  .tray .msg { min-height: 300px; }
  .page-head { padding: 20px 0 14px; }
  .page-head h1 { font-size: 27px; }
  .progress-row progress { flex: 1 1 auto; }
  .toolbar .field.narrow { flex: 1 1 46%; }

  /* account page: keep the manage panel inside the card */
  .c-actions { text-align: left; }
  .c-actions details { display: block; }
  .c-actions summary { display: inline-block; }
  .manage { min-width: 0; width: 100%; }
  .manage-row { flex-wrap: wrap; }
  tr.brow td.c-actions { padding-left: 14px; }
  tr.brow td.c-actions::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .toast { transform: translate(-50%, 0); }
}

.sortlink { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; }
.sortlink:hover { color: var(--gold); }
.sortlink.on { color: var(--gold); }
.sortlink .caret { display: inline-block; min-width: 9px; font-size: 9px; opacity: .85; }
.sortlink:not(.on) .caret { opacity: 0; }
th[aria-sort] { color: var(--gold); }

/* guest chip */
.chip.guest {
  background: rgba(126, 92, 168, .20);
  color: #d9c4ef;
  border: 1px solid rgba(126, 92, 168, .45);
  font-size: 10.5px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: 1px;
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- accounts ---------- */
.whoami {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: 12.5px; color: var(--ink-2); margin: 0 4px;
  white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.whoami small {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--gold-dim); border: 1px solid rgba(232,203,132,.28);
  padding: 1px 5px; border-radius: 4px;
}
.c-actions { text-align: right; }
.c-actions details { display: inline-block; text-align: left; }
.c-actions summary { list-style: none; cursor: pointer; }
.c-actions summary::-webkit-details-marker { display: none; }
.manage {
  margin-top: 10px; padding: 12px; min-width: 240px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  display: grid; gap: 8px;
}
.manage-row { display: flex; gap: 8px; align-items: center; margin: 0; }
.manage-row select, .manage-row input { flex: 1 1 auto; min-width: 0; height: 34px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--muted); }
.empty { padding: 26px 14px; text-align: center; color: var(--muted); }
.auth .err { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid rgba(236,143,139,.5); background: rgba(236,143,139,.10); color: #ffd9d7; font-size: 13px; }

/* ---------- response status strip ---------- */
.kpi-label {
  margin: 18px 0 7px;
  color: var(--muted); font-size: 10.5px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
}
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.four .kpi { border-bottom: 0; }
@media (max-width: 760px) {
  /* four cells wrap to two rows, so the inner dividers come back */
  .kpis.four { grid-template-columns: repeat(2, 1fr); }
  .kpis.four .kpi { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
  .kpis.four .kpi:nth-child(2n) { border-right: 0; }
  .kpis.four .kpi:nth-last-child(-n+2) { border-bottom: 0; }
}

/* over-capacity state */
.kpi.danger .v { color: var(--bad); }
.kpi.danger .k { color: #e2a09d; }
.warn { color: var(--bad); }

/* donation note in the row tray */
.donation {
  margin: 0 0 14px; padding: 9px 11px; border-radius: 8px;
  border: 1px solid rgba(232, 203, 132, .3); background: rgba(232, 203, 132, .07);
  font-size: 12.5px; color: var(--ink-2); line-height: 1.5;
}
.donation .k {
  display: block; color: var(--gold); font-size: 9.5px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; margin-bottom: 3px;
}

/* quick actions inside the row tray */
.tray h4.sp { margin-top: 16px; }
form.quick { display: grid; gap: 8px; margin: 0 0 4px; }
form.quick textarea { min-height: 56px; font-size: 13px; }
form.quick .btn { justify-self: start; }
form.quick-row { display: flex; gap: 8px; align-items: center; margin: 0 0 4px; }
form.quick-row input[type="number"] { width: 84px; height: 34px; text-align: center; }
form.quick-row .btn { flex: 0 0 auto; }

.free-note { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.check.sm { margin: 8px 0 0; font-size: 12px; align-items: flex-start; }
.check.sm input { margin-top: 2px; }
