:root {
  --blue: #1b6ca8;
  --blue-deep: #155887;
  --blue-soft: #e3eef7;
  --cream: #f4f1ea;
  --cream-deep: #ebe6da;
  --ink: #16212c;
  --muted: #5d6874;
  --line: #ddd6c8;
  --card: #ffffff;
  --good: #1f7a4d;
  --warn: #9a5b00;
  --danger: #b3261e;
  --radius: 20px;
  --head: 'Poppins', system-ui, sans-serif;
  --body: Calibri, Carlito, 'Segoe UI', system-ui, -apple-system, sans-serif;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
h1, h2, h3 { font-family: var(--head); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; }
[hidden] { display: none !important; }

#app { padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 24px); max-width: 560px; margin: 0 auto; }

/* ---- Hero ---- */
.hero {
  background: var(--blue);
  color: #fff;
  padding: calc(var(--safe-t) + 22px) 20px 64px;
  border-radius: 0 0 32px 32px;
  position: relative;
}
.wordmark { display: block; height: auto; margin-bottom: 30px; }
.eyebrow {
  font-family: var(--head);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 8px;
}
.hero-date { font-size: clamp(32px, 9vw, 42px); font-weight: 800; letter-spacing: -0.02em; }
.hero-time { font-family: var(--head); font-weight: 600; font-size: 19px; margin-top: 6px; }
.hero-venue { margin-top: 4px; opacity: 0.88; }

.bar { padding: calc(var(--safe-t) + 26px) 20px 6px; }
.bar h1 { font-size: 30px; font-weight: 800; color: var(--blue); }

/* ---- Cards ---- */
.stack { display: grid; gap: 14px; padding: 0 16px; }
.hero + .stack { margin-top: -40px; position: relative; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 10px;
}
.card-raised { box-shadow: 0 10px 30px -12px rgba(22, 33, 44, 0.25); }
.label {
  font-family: var(--head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
}
.muted { color: var(--muted); }
.small { font-size: 15px; }
.tiny { font-size: 13px; }
.center { text-align: center; }
.pre { white-space: pre-line; }
.topic { font-family: var(--head); font-weight: 600; color: var(--blue-deep); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.text-link { color: var(--blue); font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.line {
  font-family: var(--head);
  font-weight: 700;
  font-size: 20px;
  color: var(--blue);
  padding: 18px 6px 4px;
  line-height: 1.3;
}

.pills { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pills li {
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-family: var(--head);
  font-weight: 600;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
}

.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

/* ---- RSVP card states ---- */
.rsvp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chip {
  font-family: var(--head);
  font-weight: 600;
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  white-space: nowrap;
}
.chip-good { background: #e2f3ea; color: var(--good); }
.chip-warn { background: #fbefdc; color: var(--warn); }
.youre-in { display: flex; gap: 14px; align-items: center; }
.tick {
  flex: none;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--blue);
  display: grid; place-items: center;
}
.tick svg { width: 26px; height: 26px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.youre-in h2 { font-size: 24px; }

/* ---- Buttons ---- */
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 15px 22px;
  font-family: var(--head);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); }
.btn-ghost { background: transparent; color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); }
.btn-soft { background: var(--blue-soft); color: var(--blue-deep); min-height: 44px; padding: 10px 16px; font-size: 15px; }
.btn-plain { background: none; color: var(--muted); min-height: 40px; padding: 8px 4px; font-size: 14px; font-weight: 600; text-decoration: underline; }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Tabs ---- */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabs-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  z-index: 20;
}
.tab {
  flex: 1;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  font-family: var(--head);
  font-size: 12px;
  font-weight: 600;
  position: relative;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current='page'] { color: var(--blue); }
.tab .dot { position: absolute; top: 10px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

/* ---- News ---- */
.post { display: grid; gap: 8px; }
.post time { font-size: 14px; color: var(--muted); }
.empty { text-align: center; padding: 34px 20px; }

/* ---- Sheet ---- */
.sheet {
  border: 0;
  padding: 0;
  margin: auto auto 0;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  border-radius: 26px 26px 0 0;
  background: var(--card);
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(16, 26, 36, 0.55); }
.sheet[open] { animation: up 0.22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: 26px; }
}
#rsvp-form { padding: 22px 20px calc(22px + var(--safe-b)); display: grid; gap: 14px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-head h2 { font-size: 24px; color: var(--blue); }
.icon-btn { border: 0; background: var(--cream); border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn svg { width: 20px; height: 20px; stroke: var(--ink); stroke-width: 2.2; fill: none; stroke-linecap: round; }

.field { display: grid; gap: 6px; }
.field > span { font-family: var(--head); font-weight: 600; font-size: 14px; }
.field em { font-style: normal; color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select {
  font: inherit;
  font-size: 17px;
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.field input[aria-invalid='true'] { border-color: var(--danger); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); }

.pay { border: 0; padding: 16px; margin: 4px 0 0; background: var(--cream); border-radius: 18px; display: grid; gap: 10px; }
.pay legend { font-family: var(--head); font-weight: 700; font-size: 17px; padding: 0; float: left; width: 100%; }
.amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.amount {
  border: 2px solid transparent;
  background: #fff;
  border-radius: 14px;
  padding: 10px 4px;
  font-family: var(--head);
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  color: var(--ink);
  display: grid;
  gap: 1px;
  justify-items: center;
}
.amount small { font-size: 11px; font-weight: 600; color: var(--muted); }
.amount[aria-checked='true'] { border-color: var(--blue); color: var(--blue); }
.amount[aria-checked='true'] small { color: var(--blue); }
.form-error { color: var(--danger); font-weight: 700; }
.sheet-actions { display: grid; gap: 10px; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs-h) + var(--safe-b) + 14px);
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 600;
  z-index: 50;
  max-width: calc(100% - 32px);
  width: max-content;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
}

/* ---- Loading ---- */
.skeleton { height: 92px; border-radius: 12px; background: linear-gradient(90deg, var(--cream) 0%, var(--cream-deep) 50%, var(--cream) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

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

/* ---- Venue (shown once confirmed) ---- */
.venue { background: var(--cream); border-radius: 16px; padding: 14px 16px; display: grid; gap: 4px; justify-items: start; }
.venue-name { font-family: var(--head); font-weight: 700; font-size: 18px; }
.venue .btn { margin-top: 6px; }
.request-note { background: var(--blue-soft); color: var(--blue-deep); border-radius: 14px; padding: 12px 14px; font-weight: 600; font-size: 15px; }
