/* Shared layouts for phones and tablets; loaded after each page's own styles. */
html { -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
button, .button { white-space: normal; }
input, select, textarea { max-width: 100%; font-size: 16px; }
#rsvp-form input { font-size: 16px; }
.dashboard, .birthday-page, .login-card, .panel, .hero > *, .detail,
.rsvp > *, .gift, .create-grid > *, .edit-form > *, .birthday-hero > * { min-width: 0; }
.dashboard, .login-card, .birthday-page, .detail, .gift, #rsvp-form { overflow-wrap: anywhere; }
.birthday-music { right: max(12px, env(safe-area-inset-right, 0px)); bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
.birthday-music button { min-height: 44px; }
/* Jeorgina's invitation preview uses the same section container as guests. */
main > #rsvp.rsvp { display: block; max-width: 1120px; margin: auto; padding: 48px 28px; }
main > #rsvp.rsvp p, main > #rsvp.rsvp h2 { margin-bottom: 16px; }
@media (max-width: 1024px) {
  button, .button, input, select { min-height: 44px; }
  .parent-corner a { display: inline-flex; align-items: center; min-height: 44px; }
  .details-grid { grid-template-columns: minmax(0, 1fr); }
  .detail { padding: 24px; }
  .rsvp { gap: 28px; }
  .create-grid, .edit-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .create-grid button, .edit-form button { grid-column: 1 / -1; justify-self: start; }
  .birthday-hero { grid-template-columns: minmax(0, 1fr) 200px; gap: 24px; padding: 24px; }
  .birthday-hero img { width: 200px; height: 267px; }
}
@media (max-width: 760px) {
  button, .button, input, select { min-height: 44px; }
  input, select, textarea, #rsvp-form input { font-size: 16px; }
  .dashboard { padding: 24px 16px; }
  .dashboard h1, .login-card h1 { font-size: clamp(28px, 7.5vw, 36px); }
  .dashboard h2 { font-size: clamp(23px, 6vw, 28px); }
  .dashboard header { gap: 14px; }
  .dashboard header > div { min-width: 0; width: 100%; }
  .dashboard header p { font-size: 14px; }
  .panel { padding: 20px 16px; }
  .panel h2 { margin-top: 0; }
  .section-head { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
  .section-head .button { text-align: center; }
  .summary { gap: 10px; }
  .summary article { padding: 16px; }
  .create-grid, .edit-form { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .create-grid button, .edit-form button { width: 100%; justify-self: stretch; margin-bottom: 0; }
  .create-grid input, .edit-form input { margin-bottom: 8px; }
  .dashboard nav a, .birthday-page nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 4px; }
  .dashboard details summary { min-height: 44px; padding-block: 8px; }
  .dashboard .table-wrap { overflow: visible; }
  .dashboard table, .dashboard tbody { display: block; width: 100%; }
  .dashboard thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
  .dashboard tbody > tr:not(.edit-row) { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 16px 0 0; }
  .dashboard td { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; padding: 9px 0; min-width: 0; font-size: 15px; }
  .dashboard td[data-label]::before { content: attr(data-label); color: #796477; font-size: 13px; font-weight: 600; }
  .dashboard td:first-child { min-width: 0; }
  .dashboard td[data-label="Family"] { display: block; font-weight: 600; font-size: 18px; }
  .dashboard td[data-label="Family"]::before { display: block; margin-bottom: 4px; }
  .dashboard td details { font-weight: 400; }
  .dashboard td[data-label="Invitation"] { display: block; border: 0; }
  .dashboard td[data-label="Invitation"]::before { display: block; margin-bottom: 8px; }
  .dashboard .table-actions { gap: 8px; }
  .dashboard .table-actions button { flex: 1 1 100%; font-size: 14px; padding: 10px 12px; }
  .dashboard .edit-row.open { display: block; border: 1px solid var(--line); border-top: 0; padding: 12px; background: #fffcf7; }
  .dashboard .edit-row td { display: block; padding: 0; border: 0; }
  .login-shell { min-height: 100svh; padding: 28px 16px; }
  .login-card { padding: 28px 22px; }
  .parent-corner { position: static; justify-content: flex-end; max-width: none; padding: 12px 16px 0; gap: 8px; }
  .parent-corner a { display: inline-flex; align-items: center; min-height: 44px; font-size: 12px; padding: 8px 12px; }
  .parent-corner + .login-shell { min-height: calc(100svh - 68px); padding-top: 24px; padding-bottom: 28px; }
  #invitation-content header { padding: 18px 16px; }
  #invitation-content header nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; width: 100%; }
  #invitation-content header nav a, #invitation-content header nav a:first-child { display: flex; align-items: center; justify-content: center; min-height: 44px; text-align: center; font-size: 14px; }
  .signout-bar { align-items: center; gap: 10px; padding: 8px 16px; font-size: 14px; }
  .signout-bar span { min-width: 0; overflow-wrap: anywhere; }
  .signout-bar button { flex-shrink: 0; padding: 8px 0 8px 12px; }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 32px 20px; gap: 28px; }
  .hero h1 { font-size: clamp(48px, 15vw, 76px); }
  .hero .intro { margin-inline: auto; }
  .hero .buttons { flex-direction: column; align-items: stretch; }
  .hero .buttons .button { width: 100%; font-size: 15px; }
  .art img { width: min(100%, 340px); height: auto; max-height: none; }
  .art .seal { width: 92px; height: 92px; right: 0; bottom: 0; }
  .art .seal b { font-size: 44px; }
  .countdown { flex-direction: column; gap: 18px; padding: 24px 16px; }
  .clock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; width: 100%; max-width: 320px; }
  .section { padding: 44px 20px; }
  .section h2, .rsvp h2 { font-size: clamp(30px, 8.5vw, 40px); }
  .detail h3 { font-size: 26px; line-height: 1.2; overflow-wrap: anywhere; }
  .wear-palette { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; }
  .wear-palette span { font-size: 12px; }
  .rsvp { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  #rsvp-form { padding: 22px 16px; }
  .choices { flex-direction: column; gap: 10px; }
  .choice { width: 100%; min-height: 48px; font-size: 15px; }
  .field-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .names-group label { display: block; }
  .family { font-size: 25px; line-height: 1.3; }
  .gift-grid { grid-template-columns: minmax(0, 1fr); }
  main > #rsvp.rsvp { padding: 36px 20px; }
  .envelope-gate { min-height: 100svh; padding: 28px 20px; }
  .gate-heading { font-size: clamp(34px, 10vw, 48px); }
  .envelope-control { width: 100%; max-width: 480px; margin-top: 72px; }
  .gate-date { letter-spacing: .08em; line-height: 1.8; }
  .birthday-page { padding: 20px 16px; }
  .birthday-header { flex-direction: row; flex-wrap: wrap; padding: 0; }
  .birthday-header > a { font-size: 18px; }
  .birthday-hero { grid-template-columns: minmax(0, 1fr); text-align: center; padding: 24px 20px; gap: 24px; }
  .birthday-hero img { width: 180px; height: 240px; justify-self: center; }
  .birthday-hero .button { display: inline-flex; margin-top: 12px; }
  .birthday-families { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .birthday-families .panel { margin: 0; }
  .birthday-families li span { min-width: 0; }
  footer { padding: 32px 20px; }
}
@media (max-width: 420px) {
  .photo-gallery { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .photo-gallery figure { padding: 7px; }
  .login-card { padding: 26px 20px; }
  .birthday-totals { gap: 8px; }
  .birthday-totals article { padding: 16px 4px; }
  .birthday-totals span { font-size: 13px; }
}
@media (max-height: 500px) and (max-width: 1024px) {
  .login-shell, .envelope-gate { min-height: auto; }
  .envelope-gate { padding-block: 24px; }
  .envelope-control { max-width: 300px; margin-top: 60px; }
}
