.portal-body {
  min-height: 100svh;
  background: var(--paper);
}

.portal-body [hidden] { display: none !important; }
.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;
}

.portal-nav {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0; min-height: 68px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: max(15px, env(safe-area-inset-top)) clamp(18px, 4vw, 48px) 15px;
  color: var(--white); background: rgba(19, 31, 22, .92); backdrop-filter: blur(10px);
  font: 500 .68rem var(--sans); letter-spacing: .08em; text-transform: uppercase;
}
.portal-nav a { text-decoration: none; }
.portal-nav__back { display: inline-flex; align-items: center; gap: .55rem; }
.portal-nav__back > span:first-child { font-size: 1.2rem; line-height: 1; }
.portal-nav__back > span:last-child { font-size: inherit; line-height: 1.35; }
.portal-nav__monogram { font: 500 .95rem var(--serif); letter-spacing: .18em; }
.portal-nav__monogram { flex: 0 0 auto; white-space: nowrap; }
.portal-nav__actions { display: flex; align-items: center; gap: clamp(.8rem, 2.5vw, 1.5rem); }
.language-switch--portal { color: var(--white); }
.portal-nav__brand { display: inline-flex; align-items: center; gap: .9rem; }
.portal-nav__logout { padding: .45rem 0; border: 0; color: inherit; background: transparent; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }

.guest-rsvp { min-height: 100svh; display: grid; grid-template-columns: minmax(320px, .9fr) minmax(480px, 1.1fr); }
.guest-rsvp__photo { position: relative; min-height: 100svh; overflow: hidden; background: var(--forest); }
.guest-rsvp__photo::after { content: ""; position: absolute; inset: 0; background: rgba(12, 22, 15, .3); }
.guest-rsvp__photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 44%; }
.guest-rsvp__photo-copy { position: absolute; z-index: 2; left: clamp(24px, 5vw, 64px); right: 24px; bottom: clamp(36px, 7vw, 80px); color: var(--white); }
.guest-rsvp__photo-copy p { margin: 0; font: 600 .68rem var(--sans); letter-spacing: .2em; text-transform: uppercase; }
.guest-rsvp__photo-copy h1 { margin: .5rem 0 0; font: 400 clamp(3.5rem, 7vw, 6.5rem) var(--script); line-height: .85; text-shadow: 0 3px 20px rgba(0,0,0,.35); }
.guest-rsvp__form-panel { display: grid; place-items: center; min-height: 100svh; padding: 7rem clamp(24px, 7vw, 100px) 4rem; }
.guest-rsvp__form-inner { width: min(100%, 560px); }
.guest-rsvp__form-inner > h2, .rsvp-success h2 { margin: 0; color: var(--forest); font-size: clamp(2.9rem, 6vw, 4.8rem); font-weight: 400; line-height: .95; }
.guest-rsvp__intro { margin: 1.3rem 0 .6rem; color: var(--muted); font-size: 1.12rem; line-height: 1.6; }
.portal-deadline { margin: 0 0 2rem; color: var(--sage); font-style: italic; }

.rsvp-form, .login-form { display: grid; gap: 1.15rem; }
.form-field { position: relative; }
.form-field label { display: block; margin: 0 0 .45rem; color: var(--forest); font: 600 .66rem var(--sans); letter-spacing: .11em; text-transform: uppercase; }
.form-field input {
  width: 100%; min-height: 52px; padding: .85rem .95rem; border: 1px solid rgba(36,51,39,.32); border-radius: 4px;
  color: var(--ink); background: rgba(255,255,255,.62); font: 500 1rem var(--sans); outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.form-field input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(135,150,123,.2); }
.form-field input[aria-invalid="true"] { border-color: var(--wine); }
.field-error { min-height: 1rem; margin: .3rem 0 0; color: var(--wine); font: 500 .68rem var(--sans); }
.form-field--website { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { min-height: 1.2rem; margin: -.15rem 0 0; color: var(--muted); font: 500 .74rem var(--sans); line-height: 1.5; }
.form-status.is-error { color: var(--wine); }
.rsvp-form__submit { width: 100%; }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.additional-guests { display: grid; gap: 1rem; }
.rsvp-person {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1rem;
  padding: 1.25rem; border: 1px solid rgba(36,51,39,.2); border-radius: 6px;
  background: rgba(255,255,255,.38);
}
.rsvp-person__heading { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.rsvp-person__heading h3 { margin: 0; color: var(--forest); font: 500 1.22rem var(--serif); }
.rsvp-person__remove {
  display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; padding: 0;
  border: 1px solid rgba(36,51,39,.25); border-radius: 4px; color: var(--forest); background: transparent;
  font: 400 1.35rem/1 var(--sans); cursor: pointer;
}
.rsvp-person__remove:hover, .rsvp-person__remove:focus-visible { border-color: var(--forest); background: rgba(36,51,39,.06); }
.rsvp-add-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.rsvp-add-button {
  display: inline-flex; min-height: 54px; align-items: center; justify-content: center; gap: .65rem; padding: .8rem 1rem;
  border: 1px solid rgba(36,51,39,.38); border-radius: 4px; color: var(--forest); background: transparent;
  font: 600 .66rem var(--sans); letter-spacing: .08em; line-height: 1.35; text-transform: uppercase; cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.rsvp-add-button:hover, .rsvp-add-button:focus-visible { border-color: var(--forest); background: rgba(36,51,39,.06); }
.rsvp-add-button:disabled { opacity: .5; cursor: not-allowed; }
.rsvp-add-button__icon { font-size: 1.2rem; font-weight: 400; line-height: 1; }

.rsvp-success { padding: 1rem 0; }
.rsvp-success__mark { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 1.25rem; border: 1px solid var(--sage); border-radius: 50%; color: var(--forest); font: 500 1.4rem var(--sans); }
.rsvp-success p { margin: 1.2rem 0 2rem; color: var(--muted); font-size: 1.1rem; line-height: 1.65; }

.portal-body--couple { background: #f5f5f1; }
.couple-login { min-height: 100svh; display: grid; grid-template-columns: 1fr 1fr; padding-top: 68px; }
.couple-login__photo { min-height: calc(100svh - 68px); background: var(--forest) url("assets/photos/photo-1.webp") center 42% / cover no-repeat; }
.couple-login__content { display: flex; flex-direction: column; justify-content: center; width: min(100% - 48px, 520px); margin-inline: auto; padding: 4rem 0; }
.couple-login__content h1, .couple-dashboard__heading h1 { margin: 0; color: var(--forest); font-size: clamp(3rem, 6vw, 5rem); font-weight: 400; line-height: .95; }
.couple-login__content > p:not(.section-kicker) { margin: 1.2rem 0 2rem; color: var(--muted); font-size: 1.08rem; line-height: 1.6; }
.login-form .button { justify-self: start; min-width: 150px; }

.couple-dashboard { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 8rem 0 5rem; }
.couple-dashboard__heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding-bottom: 2.2rem; border-bottom: 1px solid rgba(36,51,39,.18); }
.couple-dashboard__heading > div:first-child > p:last-child { margin: .75rem 0 0; color: var(--muted); }
.dashboard-actions { display: flex; align-items: center; gap: .7rem; flex: 0 0 auto; }
.icon-button { width: 50px; height: 50px; border: 1px solid rgba(36,51,39,.35); border-radius: 4px; color: var(--forest); background: transparent; font-size: 1.5rem; cursor: pointer; }
.dashboard-summary { display: flex; align-items: end; justify-content: space-between; padding: 2.2rem 0; border-bottom: 1px solid rgba(36,51,39,.18); }
.dashboard-summary span { color: var(--muted); font: 600 .68rem var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.dashboard-summary strong { color: var(--forest); font: 400 3.4rem var(--serif); line-height: .8; }
.dashboard-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.5rem 0; }
.dashboard-search { width: min(100%, 380px); }
.dashboard-status { margin: 0; color: var(--muted); font: 500 .7rem var(--sans); }
.rsvp-table-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--forest); }
.rsvp-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.rsvp-table th, .rsvp-table td { padding: 1rem .75rem; border-bottom: 1px solid rgba(36,51,39,.15); text-align: left; }
.rsvp-table th { color: var(--sage); font: 600 .65rem var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.rsvp-table td { color: var(--ink); font-size: 1.08rem; }
.rsvp-table td:last-child { color: var(--muted); font: 500 .76rem var(--sans); }
.guest-type { display: inline-block; padding: .35rem .55rem; border: 1px solid rgba(36,51,39,.2); border-radius: 4px; color: var(--forest); font: 600 .62rem var(--sans); text-transform: uppercase; }
.guest-type--child { color: var(--wine); border-color: rgba(124,31,36,.25); }
.dashboard-empty { margin: 0; padding: 3rem 1rem; color: var(--muted); text-align: center; }

.password-dialog {
  width: min(560px, calc(100% - 28px)); max-height: calc(100svh - 28px); padding: 0;
  border: 0; border-radius: 6px; color: var(--ink); background: var(--paper);
  box-shadow: 0 24px 70px rgba(18,28,20,.3);
}
.password-dialog::backdrop { background: rgba(16,24,18,.72); backdrop-filter: blur(3px); }
.password-form { display: grid; gap: 1rem; padding: clamp(1.4rem, 5vw, 2.5rem); }
.password-dialog__heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: .35rem; }
.password-dialog__heading h2 { margin: 0; color: var(--forest); font-size: clamp(2.2rem, 8vw, 3.4rem); font-weight: 400; line-height: 1; }
.password-dialog__close {
  display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; padding: 0;
  border: 1px solid rgba(36,51,39,.28); border-radius: 4px; color: var(--forest);
  background: transparent; font-size: 1.5rem; cursor: pointer;
}
.password-dialog__actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: .25rem; }

@media (max-width: 820px) {
  .guest-rsvp { grid-template-columns: 1fr; }
  .guest-rsvp__photo { min-height: 48svh; }
  .guest-rsvp__form-panel { min-height: auto; padding: 4.5rem 24px; }
  .couple-login { grid-template-columns: 1fr; }
  .couple-login__photo { min-height: 42svh; }
  .couple-login__content { padding: 3.5rem 0 5rem; }
}

@media (max-width: 600px) {
  .portal-nav { min-height: 62px; }
  .portal-nav__back { font-size: .58rem; }
  .guest-rsvp__photo { min-height: 43svh; }
  .guest-rsvp__photo-copy h1 { font-size: clamp(3.4rem, 17vw, 5rem); }
  .rsvp-person { grid-template-columns: 1fr; padding: 1rem; }
  .rsvp-person__heading { grid-column: 1; }
  .rsvp-add-actions { grid-template-columns: 1fr; }
  .couple-dashboard { width: min(100% - 28px, 1240px); padding-top: 6.5rem; }
  .couple-dashboard__heading { align-items: stretch; flex-direction: column; }
  .dashboard-actions { width: 100%; }
  .dashboard-actions .button { flex: 1; }
  .dashboard-toolbar { align-items: stretch; flex-direction: column; }
  .dashboard-search { width: 100%; }
  .password-dialog__actions .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-nav { backdrop-filter: none; }
}

/* Keep the photo panels stable on shorter phones and give all couple actions room. */
.guest-rsvp__photo img { position: absolute; inset: 0; }
.dashboard-actions { flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 820px) {
  .guest-rsvp__photo { height: 48svh; min-height: 360px; max-height: 520px; }
}

@media (max-width: 600px) {
  .dashboard-actions { display: grid; grid-template-columns: 1fr 50px; }
  .dashboard-actions > a { grid-column: 1 / -1; }
  .dashboard-actions .button { width: 100%; }
  .dashboard-actions #openPasswordDialog { grid-column: 1 / -1; }
  .dashboard-actions #exportButton { grid-column: 1; grid-row: 3; }
  .dashboard-actions #refreshButton { grid-column: 2; grid-row: 3; }
}
