/* Guest page: styled after the save-the-date card (blue ink, sage, dotted border, watercolour). Admin styles are at the bottom. */
:root {
  --paper: #f6f3ec;
  --paper-2: #eee9de;
  --card: #fbf9f4;
  --ink: #34495c;           /* body text: slate blue */
  --muted: #5b6874;
  --line: #ddd6c8;
  --aegean: #2c5a85;        /* the card's blue ink */
  --sage: #9db58f;          /* dots and leaves */
  --dot: #93abc4;
  --gold-ink: #4f6b49;      /* accent text (green): 5.4:1 on paper */
  --gold-soft: #c9d3c3;     /* soft lines */
  --sans: "Jost", "Helvetica Neue", system-ui, sans-serif;
  --script: "Hurricane", "Segoe Script", "Apple Chancery", cursive;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); font: 400 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased;
  background: var(--paper) url("/paper.svg");
}
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
img, svg { display: block; max-width: 100%; }
a { color: var(--aegean); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--gold-ink); }
h1, h2, h3 { font-weight: 400; line-height: 1.15; margin: 0; color: var(--aegean); }
p { margin: 0 0 1rem; }
:focus-visible { outline: 2px solid var(--aegean); outline-offset: 3px; }
#names:focus { outline: none; } /* focused by script after the envelope, not by the guest */

/* Spaced capitals, like "SAVE THE DATE" on the card */
.kicker, .hero-date, .hero-place, .hero-note, .section-title, .event-when {
  font-family: var(--sans); font-weight: 400; text-transform: uppercase; color: var(--aegean);
}
.wave { width: 46px; height: 12px; color: var(--aegean); margin: 0 auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 2rem;
  border: 1px solid var(--aegean); border-radius: 999px; background: var(--aegean); color: #fff; text-decoration: none;
  font: 500 .82rem var(--sans); letter-spacing: .2em; text-transform: uppercase; cursor: pointer;
  transition: background .2s, color .2s;
}
.btn:hover { background: #22486b; color: #fff; }
.btn-ghost { background: transparent; color: var(--aegean); }
.btn-ghost:hover { background: var(--aegean); color: #fff; }
.btn[disabled] { opacity: .6; cursor: progress; }
button.link {
  background: none; border: 0; padding: .5rem 0; font: inherit; color: var(--aegean); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}

/* ---------- Envelope ---------- */
/* Built like a real one, upright like the card: a lined back, a copy of the card inside, three pockets folded over it
   (each casting a soft shadow on the one below), a flap that opens to show the lining, a stamp and a wax seal.
   Opening: the flap lifts, the card slides out, the envelope dissolves and the card glides onto its place on the page. */
/* Room above the envelope for the flap and the card coming out, so neither leaves the screen. */
.envelope { --w: min(88vw, 480px, 70vh); position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 1rem; padding-top: calc(var(--w) * .4); }
.envelope::before { content: ""; position: absolute; inset: 0; background: var(--paper) url("/paper.svg"); transition: opacity .9s ease; }
.env {
  --paper-env: url("/envelope-paper.jpg");
  position: relative; width: var(--w); aspect-ratio: 146 / 100; perspective: 1400px;
}
.env-back, .env-pockets, .env-side, .env-bottom, .env-flap-wrap, .env-flap, .env-slot { position: absolute; }
/* The lining shows inside once the flap is open: pale blue with the card's blue and green dots. */
.envelope {
  --lining:
    radial-gradient(circle, rgba(157, 181, 143, .9) 1.3px, transparent 1.8px) 6px 6px / 12px 12px,
    radial-gradient(circle, rgba(255, 255, 255, .7) 1px, transparent 1.5px) 0 0 / 12px 12px,
    linear-gradient(#cfdbe6, #dfe7ee);
}
.env-back, .envelope.open .env-flap { background: var(--lining); }
.env-back {
  inset: 0; border-radius: 3px;
  box-shadow: inset 0 14px 18px -10px rgba(20, 40, 60, .35), 0 24px 40px -18px rgba(44, 62, 80, .4), 0 2px 4px rgba(44, 62, 80, .12);
}
/* The card stands upright inside, centred. */
.env-slot { left: 29%; top: 4%; width: 42%; aspect-ratio: 2 / 3; z-index: 2; }
.env-slot .card-frame { position: absolute; left: 0; top: 0; transform-origin: 0 0; transition: transform .8s cubic-bezier(.3, .1, .2, 1); }
.env-pockets { inset: 0; z-index: 3; }
.env-side, .env-bottom { inset: 0; background: var(--paper-env) 0 0 / 400px; }
.env-left, .env-right, .env-bottom { background-size: 100% 100%, 400px; }
.env-left { clip-path: polygon(0 0, 53% 50%, 0 100%); background-image: linear-gradient(90deg, rgba(255, 255, 255, .25), rgba(120, 100, 70, .07)), var(--paper-env); }
.env-right { clip-path: polygon(100% 0, 47% 50%, 100% 100%); background-image: linear-gradient(270deg, rgba(255, 255, 255, .15), rgba(120, 100, 70, .1)), var(--paper-env); }
/* The bottom pocket is folded last, so it sits on top and casts a shadow along its two edges. */
.env-bottom {
  clip-path: polygon(0 100%, 0 99.4%, 50% 44%, 100% 99.4%, 100% 100%);
  background-image: linear-gradient(rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 40%), var(--paper-env);
  filter: drop-shadow(0 -2px 3px rgba(80, 60, 30, .22));
}
/* The stamp sits on the front, below the flap. */
.stamp {
  position: absolute; z-index: 8; top: 57%; right: 6%; width: 12%; aspect-ratio: 4 / 5; padding: 5px; transform: rotate(3deg);
  background: #fbf9f3; display: grid; place-items: center;
  /* perforated edge */
  -webkit-mask: linear-gradient(#000, #000) center / calc(100% - 6px) calc(100% - 6px) no-repeat,
    radial-gradient(circle at 3px 3px, transparent 1.6px, #000 1.9px) -3px -3px / 6px 6px;
  mask: linear-gradient(#000, #000) center / calc(100% - 6px) calc(100% - 6px) no-repeat,
    radial-gradient(circle at 3px 3px, transparent 1.6px, #000 1.9px) -3px -3px / 6px 6px;
}
.stamp img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 50%; background: #eef2f3; }
.postmark { position: absolute; z-index: 9; top: 59%; right: 14%; width: 22%; color: #3f5872; opacity: .45; transform: rotate(-8deg); }
.env-address { position: absolute; z-index: 4; left: 0; right: 0; bottom: 11%; margin: 0; padding: 0 20%; text-align: center; display: grid; }
.env-address em {
  font: 400 calc(var(--w) * .036)/1.5 var(--sans); font-style: normal; letter-spacing: .14em; text-transform: uppercase;
  color: var(--aegean); text-shadow: 0 0 1px rgba(44, 90, 133, .25); /* a little ink bleed */
}
.env-flap-wrap {
  inset: 0 0 auto; height: 52%; z-index: 6; transform-origin: top;
  filter: drop-shadow(0 3px 3px rgba(80, 60, 30, .25));
  transition: transform .8s cubic-bezier(.6, .1, .3, 1), z-index 0s .34s;
}
.env-flap {
  inset: 0; clip-path: polygon(0 0, 100% 0, 53% 96%, 50% 100%, 47% 96%);
  background: linear-gradient(rgba(120, 100, 70, .06), rgba(255, 255, 255, .22)), var(--paper-env) 0 0 / 400px;
}
.seal {
  position: absolute; left: 50%; top: 50%; z-index: 7; transform: translate(-50%, -50%) rotate(-8deg);
  width: 84px; height: 84px; border: 0; padding: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .3)) drop-shadow(0 8px 10px rgba(0, 0, 0, .15));
}
.seal svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* The monogram looks pressed into the wax: dark, with a light edge below. */
.seal img {
  position: relative; width: 44px; height: auto; margin: 0 auto; opacity: .75;
  filter: brightness(0) drop-shadow(0 1px 0 rgba(255, 255, 255, .45));
}
.seal:hover { transform: translate(-50%, -50%) rotate(-3deg) scale(1.05); }
.hint { position: relative; font-size: 1rem; color: var(--muted); margin: 0; }
.seal, .hint, .env-address, .stamp, .postmark { transition-property: opacity, transform; }
.seal, .hint, .env-address, .stamp, .postmark { transition-duration: .3s; }
.envelope.open .seal, .envelope.open .hint { opacity: 0; }
.envelope.open .env-flap-wrap { transform: rotateX(180deg); z-index: 1; }
/* Flip the flap to its lined side when it's edge-on (about 340ms in, given the easing). */
.envelope.open .env-flap { animation: show-lining .8s steps(1) forwards; }
@keyframes show-lining { 0% { background: linear-gradient(rgba(120, 100, 70, .06), rgba(255, 255, 255, .22)), var(--paper-env) 0 0 / 400px; } 42%, 100% { background: var(--lining); } }
/* Then the envelope and the backdrop dissolve while the card glides into place. */
.envelope.fly::before, .envelope.fly .env-back, .envelope.fly .env-pockets, .envelope.fly .env-flap-wrap,
.envelope.fly .env-address, .envelope.fly .stamp, .envelope.fly .postmark { opacity: 0; }
.envelope.fly .env-back, .envelope.fly .env-pockets, .envelope.fly .env-flap-wrap,
.envelope.fly .env-address, .envelope.fly .stamp, .envelope.fly .postmark { transition: opacity .5s ease; }
.envelope.fly .env-back, .envelope.fly .env-address, .envelope.fly .stamp, .envelope.fly .postmark { transition-duration: .2s; } /* before they ghost through */
.envelope.fly .env-slot .card-frame { transition: transform .95s cubic-bezier(.45, 0, .2, 1); }
.load-error {
  position: fixed; inset: auto 1rem 2rem; z-index: 70; max-width: 26rem; margin: 0 auto; padding: 1.2rem 1.5rem;
  background: var(--card); border: 1px solid var(--line); text-align: center;
}

/* ---------- Page ---------- */
#site { opacity: 0; transition: opacity .8s ease; }
#site.visible { opacity: 1; }
.preview-banner { margin: 0; padding: .7rem 1rem; background: var(--aegean); color: #fff; text-align: center; font-size: .9rem; }

/* Spacing scale used on the guest page: 8 / 16 / 24 / 40 / 64px. */
.hero { display: grid; justify-items: center; gap: 1.5rem; padding: clamp(1.5rem, 5vw, 4rem) 1rem 1.5rem; text-align: center; }

/* The card, laid out exactly like the couple's save-the-date card (1024×1536). Every size and position is in
   card units (--u = 1% of the card's width), measured from the original, so it scales like the picture.
   While a phase has a card image (config hero.<phase>.image), the picture itself is shown instead. */
.card-frame {
  --cw: min(calc(100vw - 32px), 520px); --u: calc(var(--cw) / 100);
  position: relative; width: var(--cw); height: calc(var(--u) * 150); color: var(--aegean);
  background: #f7f4ed url("/paper.svg");
  box-shadow: 0 1px 2px rgba(52, 73, 92, .08), 0 22px 44px -26px rgba(52, 73, 92, .45);
}
.card-frame > * { position: absolute; margin: 0; }
.card-image { inset: 0; width: 100%; height: 100%; }
.card-frame.waiting { visibility: hidden; }
.card-frame.is-image::before, .card-frame.is-image .corner { display: none; }
/* Dots every 2.4 units, 3.3 units in: blue, small green, blue, large green. */
.card-frame::before {
  content: ""; position: absolute; inset: calc(var(--u) * 2.8); pointer-events: none;
  --g: calc(var(--u) * 2.4); --g2: calc(var(--u) * 4.8); --g4: calc(var(--u) * 9.6); --d: calc(var(--u) * 1);
  background:
    radial-gradient(circle, #7a9cc0 calc(var(--u) * .24), transparent calc(var(--u) * .3)) 0 0 / var(--g2) var(--d) repeat-x,
    radial-gradient(circle, #9fba92 calc(var(--u) * .17), transparent calc(var(--u) * .23)) var(--g) 0 / var(--g4) var(--d) repeat-x,
    radial-gradient(circle, #8fb083 calc(var(--u) * .36), transparent calc(var(--u) * .42)) calc(var(--g) * 3) 0 / var(--g4) var(--d) repeat-x,
    radial-gradient(circle, #7a9cc0 calc(var(--u) * .24), transparent calc(var(--u) * .3)) 0 100% / var(--g2) var(--d) repeat-x,
    radial-gradient(circle, #9fba92 calc(var(--u) * .17), transparent calc(var(--u) * .23)) var(--g) 100% / var(--g4) var(--d) repeat-x,
    radial-gradient(circle, #8fb083 calc(var(--u) * .36), transparent calc(var(--u) * .42)) calc(var(--g) * 3) 100% / var(--g4) var(--d) repeat-x,
    radial-gradient(circle, #7a9cc0 calc(var(--u) * .24), transparent calc(var(--u) * .3)) 0 0 / var(--d) var(--g2) repeat-y,
    radial-gradient(circle, #9fba92 calc(var(--u) * .17), transparent calc(var(--u) * .23)) 0 var(--g) / var(--d) var(--g4) repeat-y,
    radial-gradient(circle, #8fb083 calc(var(--u) * .36), transparent calc(var(--u) * .42)) 0 calc(var(--g) * 3) / var(--d) var(--g4) repeat-y,
    radial-gradient(circle, #7a9cc0 calc(var(--u) * .24), transparent calc(var(--u) * .3)) 100% 0 / var(--d) var(--g2) repeat-y,
    radial-gradient(circle, #9fba92 calc(var(--u) * .17), transparent calc(var(--u) * .23)) 100% var(--g) / var(--d) var(--g4) repeat-y,
    radial-gradient(circle, #8fb083 calc(var(--u) * .36), transparent calc(var(--u) * .42)) 100% calc(var(--g) * 3) / var(--d) var(--g4) repeat-y;
}
/* Each pair of leaves sits on a patch of paper, so the dots stop short of it like on the card. */
.corner { width: calc(var(--u) * 4.6); height: calc(var(--u) * 4.6); padding: calc(var(--u) * .4); background: #f7f4ed; border-radius: 50%; }
.corner.tl { top: calc(var(--u) * 2.2); left: calc(var(--u) * 2.2); }
.corner.tr { top: calc(var(--u) * 2.2); right: calc(var(--u) * 2.2); transform: scaleX(-1); }
.corner.bl { bottom: calc(var(--u) * 2.2); left: calc(var(--u) * 2.2); transform: scaleY(-1); }
.corner.br { bottom: calc(var(--u) * 2.2); right: calc(var(--u) * 2.2); transform: scale(-1); }
/* The monogram and watercolour are cut from the card, so they go back exactly where they were cut from. */
.monogram { left: calc(var(--u) * 39.06); top: calc(var(--u) * 16.6); width: calc(var(--u) * 22.46); height: auto; }
.watercolor { left: calc(var(--u) * 13.67); top: calc(var(--u) * 100.59); width: calc(var(--u) * 73.24); height: auto; }
.card-frame .ct {
  left: calc(var(--u) * var(--dx, 0)); right: 0; text-align: center; line-height: 1; white-space: nowrap;
  top: calc(var(--u) * var(--t)); font-size: calc(var(--u) * var(--fs));
  letter-spacing: calc(var(--u) * var(--ls, 0)); padding-left: calc(var(--u) * var(--ls, 0));
}
.kicker { --t: 46.49; --fs: 3.168; --ls: 1.823; --dx: .39; }
.names { --t: 53.56; --fs: 12.4; --dx: .49; font-family: var(--script); }
.names .amp, .footer-names .amp { margin: 0 .04em 0 .14em; }
.card-frame .rule { left: calc(var(--u) * 44.5); top: calc(var(--u) * 72.5); width: calc(var(--u) * 11); border-top: 1px solid #8fa99a; }
.hero-date { --t: 77.93; --fs: 3.168; --ls: 1.546; font-weight: 500; }
.hero-place { --t: 84.71; --fs: 2.25; --ls: .921; --dx: .15; line-height: calc(var(--u) * 4.1) !important; }
.hero-note { --t: 133.6; --fs: 1.97; --ls: .648; --dx: .15; }
.card-frame .wave { left: calc(var(--u) * 46.2); top: calc(var(--u) * 138.5); width: calc(var(--u) * 7.8); height: calc(var(--u) * 1.6); }
.greeting { font: 400 1.15rem/1.6 var(--sans); color: var(--ink); max-width: 26rem; margin: 1rem 0 0; }
.greeting, .section-title, .event h3, .faq dt { text-wrap: balance; }
.cal-link { flex-basis: 100%; font-size: .95rem; padding: .3rem 0; }
.invite-error { max-width: 30rem; margin: 1rem 0 0; text-wrap: balance; padding: 1rem 1.25rem; border: 1px solid #d8b4a8; background: #fbf1ec; color: #7a3326; font-size: .95rem; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.not-you { font-size: .9rem; color: var(--muted); margin: 0; }

.section { padding: clamp(3rem, 7vw, 4rem) 1rem; }
.section > * { max-width: 600px; margin-left: auto; margin-right: auto; }
.section-tint { background: rgba(238, 233, 222, .65); }
.section-title { font-size: .95rem; letter-spacing: .4em; padding-left: .4em; text-align: center; margin-bottom: 2.4rem; }
.section-title::after { content: ""; display: block; width: 46px; height: 12px; margin: .9rem 0 0 calc(50% - 23px - .2em); background: url("/wave.svg") center / contain no-repeat; }
.lede { text-align: center; color: var(--muted); margin-top: -1.2rem; margin-bottom: 2rem; }

/* ---------- When & where ---------- */
.events { display: grid; }
.event { padding: 1rem 0; text-align: center; }
.event + .event::before { content: ""; display: block; width: 46px; height: 12px; margin: 0 auto 2rem; background: url("/wave.svg") center / contain no-repeat; opacity: .6; }
.event-when { font-size: .88rem; letter-spacing: .24em; margin-bottom: .2rem; }
.event h3 { font: 400 clamp(2.6rem, 9vw, 3.1rem)/1.1 var(--script); margin-bottom: .3rem; }
.event p { margin-bottom: .4rem; }
.event p:last-child { margin-bottom: 0; }
.event-meta { font-size: .92rem; color: var(--muted); text-wrap: balance; }
.event-meta a { display: inline-block; padding: .3rem 0; }

/* ---------- RSVP ---------- */
/* The form and the thank-you sit on the same quiet card as the hero, so the two states don't jump. */
.rsvp form, .thanks { background: var(--card); border: 0; padding: clamp(1.25rem, 5vw, 2.2rem); box-shadow: 0 1px 2px rgba(52, 73, 92, .06), 0 18px 40px -28px rgba(52, 73, 92, .35); }
.rsvp form { display: grid; gap: 1.4rem; }
.all-yes { justify-self: center; font-size: .95rem; }
.guest { border: 0; padding: 0 0 1.4rem; margin: 0; border-bottom: 1px dashed var(--gold-soft); display: grid; gap: .8rem; min-width: 0; }
.guest > legend { float: left; width: 100%; padding: 0; font: 500 1.15rem var(--sans); color: var(--aegean); }
.choice { display: grid; gap: .45rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.choice legend, .field > span { float: left; width: 100%; padding: 0; font: 400 .92rem var(--sans); color: var(--muted); }
.toggle { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.toggle label { position: relative; display: block; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle span {
  display: grid; place-items: center; min-height: 48px; padding: .3rem .6rem; text-align: center;
  border: 1px solid #c9cfd4; border-radius: 999px; background: transparent;
  font: 500 .98rem/1.2 var(--sans); transition: background .2s, border-color .2s, color .2s;
}
.toggle label:hover span { border-color: var(--aegean); }
.toggle input:checked + span { background: var(--aegean); border-color: var(--aegean); color: #fff; }
.toggle .no input:checked + span { background: var(--muted); border-color: var(--muted); }
.toggle input:focus-visible + span { outline: 2px solid var(--aegean); outline-offset: 2px; }
.choice.invalid .toggle span { border-color: #b4553f; background: #fbf1ec; }
.field-error { margin: 0; font-size: .88rem; color: #9b3d2e; }
.field-error:empty { display: none; }
.extras { display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field > span { float: none; }
input[type=text], input[type=email], input[type=password], input[type=search], textarea, select {
  width: 100%; min-height: 46px; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fffefb; font: 400 1rem var(--sans); color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--aegean); }
input[aria-invalid=true] { border-color: #b4553f; }
.rsvp-actions { display: grid; justify-items: center; gap: 0; }
.status { text-align: center; font: 400 1rem var(--sans); color: var(--aegean); margin: 0; }
.status:not(:empty) { margin-top: .6rem; }
.status.error { color: #9b3d2e; }
.empty { text-align: center; color: var(--muted); }

.thanks { text-align: center; overflow-wrap: anywhere; }
.summary { margin: 0 auto 1.5rem; max-width: 30rem; text-align: left; }
.summary div:last-child { border-bottom: 0; }
.summary div { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: .6rem 0; border-bottom: 1px dashed var(--gold-soft); }
.summary dt { font-size: .95rem; color: var(--muted); }
.summary dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }


/* ---------- FAQ ---------- */
.faq { margin: 0 auto; display: grid; gap: 1.4rem; }
.faq dt { font: 400 1.08rem var(--sans); letter-spacing: .02em; color: var(--aegean); margin-bottom: .2rem; }
.faq dd { margin: 0; color: var(--muted); }

/* ---------- Footer ---------- */
.footer { text-align: center; padding: 1rem 1rem 4rem; }
.footer .wave { margin-bottom: 1rem; }
.footer-names { font: 400 clamp(1.75rem, 8.5vw, 2.4rem)/1.1 var(--script); color: var(--aegean); margin: 0; text-wrap: balance; }
.footer-contact { font-size: .92rem; color: var(--muted); margin-top: .8rem; }
.footer-contact:empty { display: none; }

/* ---------- Petals ---------- */
.petal {
  position: fixed; top: -20px; z-index: 60; pointer-events: none; width: 9px; height: 13px;
  border-radius: 80% 0 80% 0; animation: fall 3.4s ease-in forwards;
}
@keyframes fall { to { transform: translate(var(--drift), 110vh) rotate(var(--spin)); opacity: .3; } }

@media (max-width: 520px) {
  .summary div { grid-template-columns: 1fr; gap: .1rem; }
}

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

/* ---------- Admin ---------- */
.admin-body { background: var(--paper); }
.admin { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; font-variant-numeric: lining-nums tabular-nums; }
.admin-narrow { max-width: 680px; }
.admin h1 { font: 400 clamp(2.8rem, 7vw, 3.6rem)/1.1 var(--script); margin-bottom: .2rem; }
.admin-narrow h1, .admin-login h1 { font: 400 1.9rem var(--sans); }
.admin h2 { font: 500 1.3rem var(--sans); margin: 0; }
.admin h2 small { font: 400 .85rem var(--sans); color: var(--muted); margin-left: .5rem; }
.admin h3 { font: 500 1.05rem var(--sans); }
.admin .sub, .muted { color: var(--muted); }
.admin code { font-size: .85em; background: var(--paper-2); padding: .1rem .35rem; border-radius: 3px; overflow-wrap: anywhere; }
.admin-login { max-width: 380px; padding-top: 6rem; }
.stack { display: grid; gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; margin: 1.5rem 0; }
.btn-sm { min-height: 40px; padding: 0 1.1rem; font-size: .72rem; letter-spacing: .16em; }
.btn[disabled] { background: var(--paper-2); border-color: var(--line); color: var(--muted); cursor: default; transform: none; }
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.5rem; }
.admin-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.admin-actions form { margin: 0; }
.flash { background: #eef3ea; border: 1px solid #c9d8bf; color: #2f5130; padding: .8rem 1rem; border-radius: var(--radius); }
.flash-error { background: #fbf1ec; border-color: #e3c2b6; color: #7a3326; }
.note-box { background: var(--card); border: 1px dashed var(--gold-soft); padding: .7rem 1rem; border-radius: var(--radius); font-size: .92rem; }
.note-error { border-color: #d8b4a8; color: #7a3326; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; display: grid; gap: .25rem; align-content: start; }
.stat b { font: 300 2.4rem/1 var(--sans); color: var(--aegean); }
.stat b small { font-size: .5em; color: var(--muted); }
.stat span { font-size: .9rem; }
.stat small { font-size: .82rem; color: var(--muted); }
.admin-section { margin-top: 3rem; display: grid; gap: 1rem; }
.section-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.email-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.email-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.25rem; display: grid; gap: .7rem; align-content: start; }
.email-card .sub { margin: 0; font-size: .9rem; }
.email-links { display: grid; gap: .4rem; font-size: .88rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; margin: 0; }
.inline-form input { min-height: 36px; padding: .35rem .6rem; font-size: .85rem; }
.add-guest { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .2rem 1.25rem; }
.add-guest summary { cursor: pointer; padding: .8rem 0; font-weight: 500; color: var(--aegean); }
.add-guest form { padding-bottom: 1.25rem; }
.check { display: flex; gap: .6rem; align-items: center; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--aegean); }
.filter { max-width: 320px; }
.empty-admin { background: var(--card); border: 1px dashed var(--gold-soft); padding: 2rem; text-align: center; color: var(--muted); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.admin table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.admin th { background: var(--paper-2); font-weight: 500; font-size: .85rem; color: var(--muted); }
.admin th, .admin td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin td.wrap { overflow-wrap: break-word; word-break: normal; max-width: 16rem; }
.who-name { min-width: 7rem; }
.guest-line { display: flex; flex-wrap: wrap; gap: .3rem .4rem; align-items: center; padding: .1rem 0; }
.ans { font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.ans-yes { background: #eef3ea; border-color: #c9d8bf; color: #2f5130; }
.ans-no { background: #fbf1ec; border-color: #e3c2b6; color: #7a3326; }
.ans-wait { color: var(--muted); }
.pill { display: inline-block; font-size: .78rem; padding: .15rem .6rem; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line); white-space: nowrap; }
.pill-done { background: #eef3ea; border-color: #c9d8bf; color: #2f5130; }
.pill-muted { color: var(--muted); }
.copy { border: 1px solid var(--aegean); background: transparent; border-radius: 999px; padding: .45rem .9rem; font: 500 .85rem var(--sans); cursor: pointer; color: var(--aegean); white-space: nowrap; }
.copy:hover { background: var(--aegean); color: #fff; }
.card.stack, .card .stack { gap: .5rem; }
.card p { margin: 0; }
.admin-two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; }
.admin-two > div { display: grid; gap: 1rem; align-content: start; }
.admin-list { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-list li { padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-size: .92rem; overflow-wrap: anywhere; }
.admin-list li:last-child { border-bottom: 0; }
.admin-list b { font-weight: 500; }
.email-sent, .email-saved { color: #2f5130; }
.email-failed { color: #9b3d2e; }
.email-queued { color: var(--gold-ink); }
.danger-zone { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
button.link.danger { color: #9b3d2e; }
.admin .btn { text-transform: none; letter-spacing: .02em; font-size: .9rem; }
.phase-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.25rem; margin-bottom: 1.5rem; }
.phase-bar .sub { margin: 0; flex: 1; min-width: 14rem; font-size: .92rem; }
.phase-bar form { margin: 0; }
.steps { display: flex; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.steps li { font-size: .85rem; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.steps li.on { background: var(--aegean); border-color: var(--aegean); color: #fff; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.row-actions form { margin: 0; }
.sent-note { display: block; font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.flash p { margin: 0; }
.flash ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.filters { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; }
.chips { display: flex; gap: .4rem; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: .45rem .9rem; font: 500 .85rem var(--sans); color: var(--muted); cursor: pointer; }
.chip.on { background: var(--aegean); border-color: var(--aegean); color: #fff; }
.who summary { cursor: pointer; font-size: .88rem; color: var(--aegean); }
.who p { margin: .4rem 0 0; font-size: .88rem; color: var(--muted); }
.test-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .92rem; }
.test-form select { width: auto; min-height: 40px; }
.test-form input { width: auto; flex: 1; min-width: 200px; min-height: 40px; }
.admin h2 + .card, .admin-narrow > h2 { margin-top: 2rem; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.field-label { font-size: .92rem; color: var(--muted); padding: 0; margin-bottom: .3rem; }
@media (max-width: 760px) {
  .admin { padding: 1.5rem 1rem 3rem; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .stat { padding: .8rem; }
  .stat b { font-size: 1.7rem; }
  .stat span { font-size: .8rem; }
  .stat > small { display: none; }
  /* The guests table becomes one card per guest on phones, with Copy link always visible. */
  #guest-table thead { display: none; }
  #guest-table tr { display: grid; grid-template-columns: 1fr auto; gap: .4rem .8rem; padding: .9rem; border-bottom: 1px solid var(--line); }
  #guest-table td { border: 0; padding: 0; }
  #guest-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  #guest-table td:nth-child(4) { grid-row: 3; }
  #guest-table td:nth-child(5) { grid-row: 4; grid-column: 1 / -1; }
  .row-actions { justify-content: flex-start; }
  .col-email { display: none; }
}
