/*
 * Site styles: tokens, layout, components, host pages, guest pages, legal
 * pages. Mobile first; wider layouts in min-width media queries. Colours
 * are tokens on :root with a dark set under prefers-color-scheme. System
 * fonts only, so no font downloads.
 */

:root {
  color-scheme: light dark;
  --bg: #f7f4fb;
  --surface: #ffffff;
  --surface-2: #f1ecf8;
  --text: #1f1830;
  --muted: #625a73;
  --line: #e3dcec;
  --primary: #6d28d9;
  --primary-hover: #5b21b6;
  --on-primary: #ffffff;
  --primary-soft: #ede4ff;
  --yes: #15803d;
  --yes-soft: #dcf3e4;
  --no: #be123c;
  --no-soft: #fde2e8;
  --warn: #8a5a00;
  --warn-soft: #fff1cc;
  --info-soft: #e3eefa;
  --info: #1d4f86;
  --wa: #0f7a6c;
  --focus: #1f1830;
  --shadow: 0 1px 2px rgba(31, 24, 48, 0.06), 0 6px 20px rgba(31, 24, 48, 0.07);
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14111b;
    --surface: #1e1928;
    --surface-2: #2a2337;
    --text: #f1edf7;
    --muted: #b1a8c4;
    --line: #3a3149;
    --primary: #b79cff;
    --primary-hover: #cbb7ff;
    --on-primary: #1a1226;
    --primary-soft: #33284a;
    --yes: #6fdc98;
    --yes-soft: #17382a;
    --no: #ff8fa6;
    --no-soft: #43202b;
    --warn: #f3c969;
    --warn-soft: #3d3016;
    --info-soft: #1d2d42;
    --info: #9cc7ff;
    --wa: #33c2ad;
    --focus: #f1edf7;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
  overflow-x: hidden;
}
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 50; padding: 8px 12px; border-radius: 8px; background: var(--surface); color: var(--text); }
.skip-link:focus { top: 8px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 16px; padding-bottom: 40px; outline: none; }
.page { display: grid; gap: 14px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.lead { color: var(--muted); font-size: 1.05rem; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.help { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }
.label { font-weight: 700; margin: 8px 0 6px; }
.stack { display: grid; gap: 12px; }
.stack-sm { display: grid; gap: 6px; }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap-row { flex-wrap: wrap; }

/* ---------- header and footer ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand-mark { width: 28px; height: 28px; color: var(--primary); }
.header-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav-link, .header-nav > a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 10px;
  border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-weight: 600;
}
.nav-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.nav-cta { background: var(--primary); color: var(--on-primary); }
.nav-cta:hover { color: var(--on-primary); background: var(--primary-hover); }
.brand { white-space: nowrap; }
.header-nav { flex-wrap: nowrap; }
/* Phones: host navigation shows icons only; the text stays available to screen readers. */
@media (max-width: 480px) {
  .nav-link:not(.nav-cta) span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .nav-link:not(.nav-cta) { min-width: 44px; justify-content: center; }
  .nav-link:not(.nav-cta) .ic { width: 22px; height: 22px; }
}

.site-footer { border-top: 1px solid var(--line); padding: 18px 0 28px; color: var(--muted); font-size: 0.88rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.footer-links a { color: var(--muted); }
.footer-brand { margin: 10px 0 0; }
.made-with { margin: 0 0 10px; }
.made-with a { color: var(--muted); font-weight: 600; text-decoration: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border: 2px solid transparent; border-radius: 12px;
  background: var(--surface-2); color: var(--text); font: 700 1rem/1.2 var(--font);
  text-decoration: none; cursor: pointer; touch-action: manipulation;
}
.btn:hover { filter: brightness(0.97); color: inherit; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-secondary, .btn-outline { background: var(--surface); color: var(--primary); border-color: var(--primary); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-danger { background: var(--no); color: #fff; }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { color: #fff; }
.btn-lg { min-height: 56px; padding: 14px 26px; font-size: 1.1rem; }
.btn-provider { width: 100%; background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ic { width: 1.15em; height: 1.15em; flex: none; }
.ic-xl { width: 48px; height: 48px; color: var(--primary); }
.link-btn { border: 0; background: none; padding: 8px 4px; min-height: 44px; color: var(--primary); font: 600 0.95rem/1.3 var(--font); text-decoration: underline; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.link-btn.small { font-size: 0.88rem; min-height: 36px; }
.lang-switch { text-decoration: none; color: var(--text); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--primary); cursor: pointer;
}
.icon-btn .ic { width: 21px; height: 21px; }
.icon-btn-wa { background: var(--wa); color: #fff; }
.icon-btn-ok { background: var(--yes-soft); color: var(--yes); }
.icon-btn-danger { background: var(--no-soft); color: var(--no); }

/* ---------- panels, notices, chips ---------- */
.panel { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.panel.narrow { max-width: 480px; width: 100%; margin: 12px auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { margin: 0; overflow-wrap: anywhere; }
.page-head .lead { margin: 4px 0 0; }
.notice { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--text); margin: 0; }
.notice > .ic { color: var(--info); margin-top: 2px; }
.notice p { margin: 2px 0 0; }
.notice > div { flex: 1 1 220px; }
.notice-warn { background: var(--warn-soft); }
.notice-warn > .ic { color: var(--warn); }
.notice-error { background: var(--no-soft); }
.notice-ok { background: var(--yes-soft); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.chip-yes { background: var(--yes-soft); color: var(--yes); }
.chip-no { background: var(--no-soft); color: var(--no); }
.chip-pending { background: var(--surface-2); color: var(--muted); }
.chip-sent { background: var(--info-soft); color: var(--info); }
.chip-viewed { background: var(--primary-soft); color: var(--primary); }
.chip-self, .chip-new { background: var(--warn-soft); color: var(--warn); }
.chip-dup { background: var(--no-soft); color: var(--no); white-space: normal; }
.chip-status-published { background: var(--yes-soft); color: var(--yes); }
.chip-status-draft, .chip-status-hidden { background: var(--surface-2); color: var(--muted); }
.chip-status-on_hold { background: var(--warn-soft); color: var(--warn); }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 0; color: var(--muted); }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg);
  font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.toast-error { background: var(--no); color: #fff; }

/* ---------- forms ---------- */
.field { display: grid; gap: 4px; }
.field > label, .group legend { font-weight: 700; }
.optional { font-weight: 400; color: var(--muted); font-size: 0.88rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], input[type="search"],
input[type="date"], input[type="time"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text); font: 400 1rem/1.35 var(--font);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
[aria-invalid="true"] { border-color: var(--no) !important; }
.field-error { color: var(--no); font-weight: 600; font-size: 0.9rem; margin: 2px 0 0; }
.field-error:empty { display: none; }
.form-status { min-height: 1.3em; margin: 0; font-weight: 600; color: var(--muted); }
.form-status:empty { min-height: 0; }
.group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; min-width: 0; }
.group legend { padding: 0 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--primary); }
.counter { text-align: right; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 14px 0; font-size: 0.9rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.provider-list { display: grid; gap: 8px; }
.dev-box { border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: 12px; }
.bot-check:empty { display: none; }
.privacy-note { display: flex; gap: 8px; align-items: flex-start; font-size: 0.82rem; color: var(--muted); margin: 4px 0 0; text-align: left; }
.privacy-note .ic { margin-top: 2px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding: 10px 0; border-top: 1px solid var(--line); z-index: 2; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills.center { justify-content: center; }
.pill { position: relative; }
.pill input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pill span {
  display: flex; align-items: center; justify-content: center; min-height: 46px; min-width: 60px; padding: 8px 16px;
  border: 2px solid var(--primary); border-radius: 999px; background: var(--surface); color: var(--primary); font-weight: 700;
}
.pill input:checked + span { background: var(--primary); color: var(--on-primary); }
.pill input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.dialog { width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 0; border-radius: var(--radius); padding: 18px 16px; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); }
.dialog::backdrop { background: rgba(20, 14, 30, 0.5); }
.dialog form { display: grid; gap: 12px; }
.dialog h2 { margin: 0; }
.bubble-box { padding: 10px; border-radius: 12px; background: #efe7de; }
.bubble { margin: 0; padding: 8px 10px; border-radius: 4px 12px 12px 12px; background: #fff; color: #111b21; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12); }

/* ---------- landing ---------- */
.hero { text-align: center; padding: 28px 4px 10px; }
.hero-kicker { color: var(--primary); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.85rem; }
.hero-title { font-family: var(--font-display); font-size: clamp(1.9rem, 7vw, 3rem); margin: 0 auto 12px; max-width: 18ch; }
.hero-lead { color: var(--muted); font-size: 1.1rem; max-width: 36rem; margin: 0 auto 18px; }
.hero .btn-row { justify-content: center; }
.hero-free { color: var(--muted); font-size: 0.9rem; margin-top: 10px; }
.features h2 { text-align: center; margin: 10px 0 14px; }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: step; }
@media (min-width: 720px) { .feature-list { grid-template-columns: repeat(4, 1fr); } }
.feature { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.feature p { color: var(--muted); margin: 0; }
.feature-icon { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); margin-bottom: 8px; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check-list li { display: flex; gap: 8px; align-items: flex-start; }
.check-list .ic { color: var(--yes); margin-top: 3px; }

/* ---------- host pages ---------- */
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 900px) { .event-list { grid-template-columns: 1fr 1fr; } }
.event-item { display: grid; gap: 10px; }
.event-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.event-item h2 { margin: 0; overflow-wrap: anywhere; }
.event-item h2 a { color: var(--text); text-decoration: none; }
.event-when { display: flex; gap: 6px; align-items: center; color: var(--muted); margin: 0; }
.empty { padding: 28px 12px; color: var(--muted); }
.install-hint { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--primary-soft); }
.install-hint > .ic { width: 32px; height: 32px; color: var(--primary); }
.install-text { flex: 1 1 200px; }
.install-text p { margin: 2px 0 0; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.tile { grid-column: span 2; padding: 10px 6px 8px; border-radius: 14px; text-align: center; background: var(--surface); box-shadow: var(--shadow); }
.tile b { display: block; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { display: block; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.tile small { display: block; font-size: 0.75rem; color: var(--muted); }
.tile-total { grid-column: 1 / -1; background: var(--primary); color: var(--on-primary); }
.tile-total span, .tile-total small { color: inherit; opacity: 0.9; }
.tile-total b { font-size: 2.4rem; }
.tile-yes b { color: var(--yes); }
.tile-no b { color: var(--no); }
.tile-pending b { color: var(--warn); }
.tile-sent b { color: var(--info); }
.tile-viewed b, .tile-people b { color: var(--primary); }
.tiles-compact { grid-template-columns: repeat(4, 1fr); }
.tiles-compact .tile { grid-column: auto; box-shadow: none; background: var(--surface-2); }
@media (min-width: 760px) {
  .tiles { grid-template-columns: 1.6fr repeat(6, 1fr); }
  .tile, .tile-total { grid-column: auto; }
}

.fold > summary { display: flex; align-items: center; gap: 8px; min-height: 30px; cursor: pointer; list-style: none; font-weight: 800; font-size: 1.05rem; color: var(--primary); }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; line-height: 1; }
.fold[open] > summary::after { content: "−"; }
.fold-body { margin-top: 12px; }
.share-link { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); margin: 0; }
.bulk-preview:empty { display: none; }
.preview-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; max-height: 320px; overflow: auto; font-size: 0.92rem; }
.preview-list li { padding: 6px 8px; border-radius: 8px; background: var(--yes-soft); overflow-wrap: anywhere; }
.preview-list li.bad { background: var(--no-soft); color: var(--no); font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.filter { min-height: 40px; padding: 6px 12px; border: 2px solid var(--primary); border-radius: 999px; background: var(--surface); color: var(--primary); font: 700 0.9rem/1.1 var(--font); cursor: pointer; }
.filter[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.guest-list { margin-top: 10px; }

.guest-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.guest-table th, .guest-table td { padding: 8px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.guest-table thead th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); white-space: nowrap; }
.guest-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.guest-table tfoot td { font-weight: 800; color: var(--yes); border-bottom: 0; }
.guest-table tr.is-new { background: var(--warn-soft); }
.guest-name { display: grid; gap: 3px; overflow-wrap: anywhere; }
.guest-name .sub { font-size: 0.84rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Narrow screens: each table row becomes a card with labelled cells. */
@media (max-width: 899px) {
  .guest-table, .guest-table tbody, .guest-table tfoot, .guest-table tr, .guest-table td { display: block; width: 100%; }
  .guest-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .guest-table tbody tr { margin: 0 0 10px; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .guest-table tbody tr.is-new { background: var(--warn-soft); }
  .guest-table td { display: grid; grid-template-columns: 104px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
  .guest-table td::before { content: attr(data-label); font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); padding-top: 2px; }
  .guest-table td.col-name { grid-template-columns: 1fr; font-size: 1.05rem; }
  .guest-table td.col-name::before, .guest-table td.col-actions::before { display: none; }
  .guest-table td.col-actions { grid-template-columns: 1fr; border-bottom: 0; padding-top: 10px; }
  .guest-table td.col-actions .actions { justify-content: space-between; flex-wrap: nowrap; gap: 4px; }
  .guest-table td.col-actions .icon-btn { width: 42px; height: 42px; }
  .guest-table td { padding: 4px 0; }
  .guest-table td.empty { display: block; }
  .guest-table td.empty::before { display: none; }
}

.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.danger-zone { border: 2px solid var(--no-soft); }
.danger-zone h2 { color: var(--no); }
.status-panel h2 { margin: 0; }

/* ---------- guest pages ---------- */
.guest-body { background: radial-gradient(120% 60% at 50% 0%, var(--primary-soft), var(--bg) 70%); }
.guest-body .main { padding-top: 12px; }
.guest-page { display: grid; gap: 16px; max-width: 560px; margin: 0 auto; width: 100%; }
.card-stage { display: flex; justify-content: center; }
.guest-below { display: grid; gap: 16px; }
.preview-banner { position: sticky; top: 8px; z-index: 5; border: 2px solid var(--warn); box-shadow: 0 2px 8px rgb(0 0 0 / 0.15); }
.host-message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.05rem; text-align: center; }
.rsvp { text-align: center; display: grid; gap: 10px; justify-items: center; }
.rsvp > * { width: 100%; }
.rsvp .link-btn { width: auto; }
.rsvp form { text-align: left; }
.rsvp-hello { font-family: var(--font-display); font-size: 1.7rem; margin: 0; overflow-wrap: anywhere; }
.rsvp-question { font-size: 1.15rem; font-weight: 700; margin: 0; }
.rsvp-big { font-size: 1.25rem; font-weight: 800; color: var(--primary); margin: 0; }
.rsvp-buttons { display: grid; gap: 10px; }
.rsvp-buttons .btn { min-height: 58px; font-size: 1.15rem; width: 100%; }
.btn-yes { background: var(--primary); color: var(--on-primary); }
.btn-yes:hover { color: var(--on-primary); }
.btn-no { background: var(--surface); color: var(--text); border-color: var(--line); }
.rsvp-total { font-weight: 700; color: var(--primary); margin: 0; }
.rsvp-status { min-height: 1.4em; margin: 0; font-weight: 600; color: var(--muted); }
.rsvp-status.is-error { color: var(--no); }
.rsvp-status:empty { min-height: 0; }
.countdown { text-align: center; }
.countdown h2 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.units { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.unit { background: var(--surface); border-radius: 14px; padding: 10px 2px 8px; box-shadow: var(--shadow); }
.unit b { display: block; font-size: clamp(1.4rem, 7vw, 2rem); line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--primary); }
.unit span { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.countdown-done { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--primary); margin: 0; }
.guest-actions { display: grid; gap: 10px; }
.guest-actions > .btn { width: 100%; min-height: 54px; }
.cal-choices { display: grid; gap: 8px; }
.cal-choices .btn { width: 100%; }
.not-available { margin-top: 10vh; }

/* Invitation card (public/js/card.js). Template cards are inline SVG on a 4:5 canvas; image cards show the uploaded image. */
.invite-card {
  position: relative; width: 100%; max-width: 520px; border-radius: 8px; overflow: hidden; background: var(--surface);
  box-shadow: 0 2px 4px rgba(40, 20, 60, 0.12), 0 16px 40px rgba(40, 20, 60, 0.18);
}
.card-template { aspect-ratio: 4 / 5; }
.card-svg { display: block; width: 100%; height: 100%; }
.card-image-frame { position: relative; }
.card-image-frame img { display: block; width: 100%; height: auto; }
.card-band {
  position: absolute; left: 0; right: 0; margin: 0; padding: 18px 16px; text-align: center; overflow-wrap: anywhere;
  font-family: var(--font-display); font-size: clamp(1.2rem, 5.6vw, 1.75rem); font-weight: 800; line-height: 1.2;
}
.card-band-top { top: 0; padding-bottom: 40px; }
.card-band-bottom { bottom: 0; padding-top: 40px; }
.band-dark .card-band { color: #ffffff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55); }
.band-dark .card-band-top { background: linear-gradient(rgba(0, 0, 0, 0.66), rgba(0, 0, 0, 0)); }
.band-dark .card-band-bottom { background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.66)); }
.band-light .card-band { color: #1f1830; text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7); }
.band-light .card-band-top { background: linear-gradient(rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0)); }
.band-light .card-band-bottom { background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.88)); }
.card-greeting-below { margin: 0; padding: 14px 16px 4px; text-align: center; font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--text); overflow-wrap: anywhere; }
.card-details { padding: 10px 16px 16px; text-align: center; color: var(--text); }
.card-details p { margin: 2px 0; overflow-wrap: anywhere; }
.card-details-when { font-weight: 700; }
.card-details-venue { font-family: var(--font-display); font-style: italic; color: var(--primary); font-size: 1.1rem; }
.card-details-address { color: var(--muted); font-size: 0.92rem; }

/* ---------- card designer ---------- */
.designer { display: grid; gap: 20px; align-items: start; }
.designer-preview { display: grid; justify-items: center; gap: 8px; }
.designer-preview-title { margin: 0; font-weight: 700; color: var(--muted); font-size: 0.9rem; }
.phone { width: min(375px, 100%); border-radius: 28px; padding: 10px; background: #1b1724; box-shadow: var(--shadow); }
.phone-screen { border-radius: 20px; overflow: hidden auto; max-height: 72vh; padding: 12px 10px 16px; }
.phone-screen .guest-page { gap: 12px; }
.phone-screen .rsvp-buttons .btn { min-height: 48px; font-size: 1rem; }
.designer-empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 48px 16px; width: 100%; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); background: var(--surface); }
.designer-controls { display: grid; gap: 14px; min-width: 0; }
.designer-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.designer-tab { flex: 1 1 auto; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.designer-tab[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.designer-mode { margin: 0; color: var(--muted); font-size: 0.92rem; }
.designer-panel { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.design-choice { display: grid; gap: 6px; padding: 6px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: center; }
.design-choice[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.design-thumb { display: block; pointer-events: none; }
.design-thumb .invite-card { box-shadow: none; border-radius: 6px; border: 1px solid var(--line); }
.design-name { font-size: 0.82rem; font-weight: 700; }
.palette-row { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 6px 10px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.swatch[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.swatch-dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.18); }
.swatch-custom { font-weight: 700; font-size: 0.9rem; }
.color-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.color-field { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.color-field input { width: 48px; height: 40px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.text-row { display: grid; gap: 4px; margin-bottom: 12px; }
.text-row label { font-weight: 700; }
.text-row .check.small { font-weight: 600; font-size: 0.9rem; }
.text-row .link-btn { justify-self: start; }
.text-row input:disabled, .text-row textarea:disabled { opacity: 0.55; }
.help-list { margin: 0; padding-left: 1.2rem; color: var(--muted); font-size: 0.92rem; }
.help-list li { margin: 4px 0; }
.prompt-output { font-size: 0.95rem; line-height: 1.45; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
label.btn:has(+ .visually-hidden:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (min-width: 900px) {
  .designer { grid-template-columns: 395px minmax(0, 1fr); }
  .designer-preview { position: sticky; top: 16px; }
}
/* ---------- legal pages (generated by scripts/build-legal.mjs) ---------- */
.legal-page .site-header .header-nav a { color: var(--primary); }
.legal { padding-top: 20px; padding-bottom: 40px; flex: 1; }
.prose { max-width: 46rem; margin: 0 auto; background: var(--surface); border-radius: var(--radius); padding: 20px 18px 28px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.prose h1 { font-family: var(--font-display); font-size: 1.8rem; }
.prose h2 { margin-top: 1.6rem; }
.prose h3 { margin-top: 1.2rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin: 0.3rem 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0.8rem 0; font-size: 0.92rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose th, .prose td { overflow-wrap: break-word; hyphens: auto; }
mark.placeholder { background: var(--warn-soft); color: var(--warn); padding: 0 3px; border-radius: 4px; }

@media (min-width: 720px) {
  h1 { font-size: 1.9rem; }
  .panel { padding: 20px; }
  .main { padding-top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Moderation states, reports and the administrator area */
.chip-status-checking { background: var(--info-soft); color: var(--info); }
.chip-case-open { background: var(--warn-soft); color: var(--warn); }
.chip-case-closed { background: var(--surface-2); color: var(--muted); }
.event-item .notice { margin: 8px 0; }
.report-link { text-align: center; margin: 8px 0 0; }
.report-link .link-btn { color: var(--muted); }
.report-reasons { display: grid; gap: 10px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.admin-tab { padding: 8px 14px; min-height: 40px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--surface-2); color: var(--text); font-weight: 700; text-decoration: none; }
.admin-tab[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
.admin-filters { display: grid; gap: 12px; margin-bottom: 16px; }
.admin-list, .admin-reports { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.admin-reports li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.admin-item-title { font-size: 1.05rem; margin: 0 0 8px; overflow-wrap: anywhere; }
.admin-item .facts { margin-bottom: 0; }
.admin-quote { display: block; white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 500; border-left: 3px solid var(--line); padding-left: 10px; margin: 6px 0; }
.admin-preview img { display: block; max-width: 100%; max-height: 60vh; margin-top: 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.admin-actions .btn { flex: 1 1 auto; }
.wrap-any { overflow-wrap: anywhere; word-break: break-all; }
.service-banner { margin: 0 0 12px; }
.usage-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.usage-bar { display: block; width: 100%; height: 10px; margin: 0 0 12px; accent-color: var(--primary); }
.usage-bar.usage-warn { accent-color: var(--warn); }
.usage-bar.usage-high, .usage-bar.usage-over { accent-color: var(--no); }
.chip-usage-ok { background: var(--yes-soft); color: var(--yes); }
.chip-usage-warn { background: var(--warn-soft); color: var(--warn); }
.chip-usage-high, .chip-usage-over { background: var(--no-soft); color: var(--no); }
.chip-usage-unknown { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--muted); }
.usage-unknown { border-style: dashed; }
.usage-mode.is-protected { border-left: 4px solid var(--no); }
.usage-alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.usage-alerts li { padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .facts { grid-template-columns: 1fr; gap: 0 0; }
  .facts dd { margin-bottom: 8px; }
}

.designer-controls .sticky-actions { flex-wrap: nowrap; gap: 8px; }
.designer-controls .sticky-actions .btn { padding-left: 14px; padding-right: 14px; }

/* ---------- free-form card editor (public/js/cards/canvas-editor.js) ---------- */
.designer.is-canvas .designer-preview { display: none; }
.designer.is-canvas .designer-controls .sticky-actions { position: static; }
@media (min-width: 900px) {
  .designer.is-canvas { grid-template-columns: minmax(0, 1fr); }
}
.canvas-start { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.canvas-start-choice {
  display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 170px; padding: 20px 16px;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: inherit; text-align: center; cursor: pointer;
}
.canvas-start-choice:hover, .canvas-start-choice:focus-visible { border-color: var(--primary); }
.canvas-start-choice strong { font-size: 1.1rem; }
.canvas-start-choice span { color: var(--muted); font-size: 0.92rem; }
.cx { display: grid; gap: 12px; min-width: 0; }
.cx-canvas-wrap { position: relative; min-width: 0; }
.cx-viewport {
  position: relative; width: 100%; height: 420px; overflow: hidden; border-radius: 12px; touch-action: none;
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--bg) 0 50%) 0 0 / 24px 24px;
}
.cx-viewport:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.cx-stage { position: absolute; inset: 0; }
.cx-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.cx-zoom .icon-btn { background: var(--surface); box-shadow: var(--shadow); }
.cx-keys { margin: 0; }
.cx-toolbar {
  position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px;
  padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.cx-tool {
  display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 58px; padding: 6px 1px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); font: 600 0.7rem/1.1 var(--font); cursor: pointer; touch-action: manipulation;
}
.cx-tool .ic { width: 24px; height: 24px; color: var(--primary); }
.cx-tool span { max-width: 100%; text-align: center; hyphens: manual; }
.cx-tool:hover:not(:disabled) { background: var(--primary-soft); }
.cx-tool:disabled { opacity: 0.4; cursor: default; }
.cx-props { display: grid; gap: 14px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.cx-props-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cx-props-head h3 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.cx-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.cx-act { flex-direction: column; gap: 2px; min-height: 54px; padding: 6px 2px; font-size: 0.78rem; border-color: var(--line); }
.cx-act.btn-ghost { background: var(--surface-2); }
.cx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 16px; }
.cx-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; }
.cx-field > label { grid-column: 1 / -1; font-weight: 700; font-size: 0.92rem; }
.cx-field select, .cx-field textarea { grid-column: 1 / -1; width: 100%; }
.cx-field input[type="range"] { width: 100%; min-height: 40px; accent-color: var(--primary); }
.cx-field input[type="color"] { width: 64px; height: 44px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.cx-value { min-width: 3.6em; text-align: right; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.cx-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.cx-fieldset legend { padding: 0; margin-bottom: 6px; font-weight: 700; font-size: 0.92rem; }
.cx-checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.cx-bound { font-size: 0.92rem; }
.cx-sheet, .picker { width: min(720px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow-y: auto; }
.cx-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.cx-ornaments { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cx-ornament {
  display: grid; justify-items: center; gap: 4px; min-height: 44px; padding: 8px 4px; border: 2px solid var(--line); border-radius: 12px;
  background: #ffffff; color: #1f1830; font: 600 0.8rem/1.2 var(--font); cursor: pointer; text-align: center;
}
.cx-ornament:hover, .cx-ornament:focus-visible { border-color: var(--primary); }
.cx-thumb { width: 64px; height: 64px; }
.cx-layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cx-layers li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.cx-layer-name { flex: 1; min-height: 44px; padding: 6px 4px; border: 0; background: none; color: var(--text); font: 600 0.95rem/1.3 var(--font); text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.cx-layers li.is-selected .cx-layer-name { color: var(--primary); }
.picker-head h2 { margin: 0; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.picker-grid > p { grid-column: 1 / -1; margin: 0; }
.picker-item { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.picker-item:hover, .picker-item:focus-visible { border-color: var(--primary); }
.picker-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.picker-item .chip { position: absolute; left: 4px; bottom: 4px; }
.picker-generate { border-top: 1px solid var(--line); padding-top: 14px; }
.picker-generate h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
/* Phones: two rows of four tools keep every label whole and every target large. */
@media (max-width: 559px) {
  .designer.is-canvas .canvas-panel { padding: 10px; }
  .cx-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cx-tool { min-height: 52px; font-size: 0.74rem; }
  /* Sheets open at the bottom so the canvas above stays visible while their controls change it. */
  .cx-sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; max-height: 58dvh; border-radius: var(--radius) var(--radius) 0 0; }
}
@media (min-width: 1000px) {
  .cx { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .cx-canvas-wrap, .cx-keys, .cx-toolbar { grid-column: 1; }
  .cx-props { grid-column: 2; grid-row: 1 / span 3; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
}