/* Card builder. Same brand as the homepage: warm charcoal and champagne on soft white,
   serif only for the couple's names. One shape rule: buttons, chips and
   segmented controls are pills; inputs are 10px; panels and cards are 16px. */
:root {
  color-scheme: light dark;
  --ground: #f7f4f0;
  --paper: #fdfbf8;
  --sunken: #efebe5;
  --ink: #2a2725;
  --muted: #6a6460;
  --line: #ddd6cd;
  --line-soft: #ece6de;
  --accent: #2a2725;
  --accent-dark: #45403c;
  --accent-tint: #f1e8db;
  --on-accent: #fbf9f6;
  --warn-ink: #774810;
  --warn-tint: #faefd9;
  --error-ink: #9c3619;
  --error-tint: #fae4db;
  --radius: 10px;
  --radius-lg: 16px;
  --pill: 999px;
  --shadow: 0 1px 1px rgb(42 39 37 / 0.04);
  --shadow-lg: 0 24px 64px -16px rgb(20 26 16 / 0.35);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --serif: Georgia, "Times New Roman", serif;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #161514;
    --paper: #1e1c1a;
    --sunken: #252220;
    --ink: #eee9e3;
    --muted: #aaa39b;
    --line: #3a3633;
    --line-soft: #2c2927;
    --accent: #d2b48b;
    --accent-dark: #e0c7a3;
    --accent-tint: #332c22;
    --on-accent: #1a1817;
    --warn-ink: #eec27e;
    --warn-tint: #33280f;
    --error-ink: #f2a38b;
    --error-tint: #3b2018;
    --shadow: 0 1px 1px rgb(0 0 0 / 0.25);
    --shadow-lg: 0 24px 64px -16px rgb(0 0 0 / 0.7);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; line-height: 1.5; background: var(--ground); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.015em; line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 3vw, 2rem); letter-spacing: -0.025em; }
h2 { font-size: 1.15rem; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-tint); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; border-radius: var(--radius); }
.skip-link:focus { left: 8px; z-index: 30; }

/* Top bar */
.app-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 1.15rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand img { width: 30px; height: 30px; display: block; }
.brand:hover { color: var(--ink); }
.account { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 0.9rem; color: var(--muted); }
.account-email { overflow-wrap: anywhere; }

/* Page shells */
.view { outline: none; }
.narrow { max-width: 560px; margin: 0 auto; padding: 56px 24px 72px; display: flex; flex-direction: column; gap: 18px; }
.narrow.wide { max-width: 960px; }
.lead { margin: 0; color: var(--muted); font-size: 1.02rem; line-height: 1.55; max-width: 62ch; }
.hint { margin: 0; font-size: 0.83rem; color: var(--muted); line-height: 1.45; }
.group-label { margin: 8px 0 0; font-size: 0.88rem; font-weight: 650; }

/* Loading: a skeleton in the shape of the page that's coming */
.loading { display: flex; flex-direction: column; align-items: center; gap: 20px; margin: 0; padding: 56px 24px; color: var(--muted); font-size: 0.92rem; }
.loading::after {
  content: ""; width: min(880px, 100%); height: 220px; border-radius: var(--radius-lg);
  background: linear-gradient(100deg, var(--sunken) 30%, var(--paper) 50%, var(--sunken) 70%) 0 0 / 220% 100%;
}

.note { margin: 0; padding: 12px 16px; border-radius: var(--radius); background: var(--sunken); color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.note.warning { background: var(--warn-tint); color: var(--warn-ink); }

.form-status { margin: 0; min-height: 1.2em; font-size: 0.9rem; color: var(--muted); }
.form-status.error { color: var(--error-ink); font-weight: 600; }
.form-status.error:empty { display: none; }

/* Buttons: all pills */
.primary-button, .secondary-button, .danger-button, .add-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: var(--pill); white-space: nowrap;
  font: inherit; font-weight: 650; font-size: 0.93rem; text-decoration: none; cursor: pointer;
}
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); }
.primary-button:hover { border-color: var(--accent-dark); background: var(--accent-dark); color: var(--on-accent); }
.secondary-button { border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-weight: 600; }
.secondary-button:hover { color: var(--ink); border-color: var(--accent); background: var(--accent-tint); }
.danger-button { border: 1px solid var(--error-ink); background: var(--paper); color: var(--error-ink); }
.danger-button:hover { background: var(--error-tint); }
.add-button { align-self: flex-start; border: 1px dashed var(--accent); background: transparent; color: var(--accent); }
.add-button:hover { background: var(--accent-tint); }
.add-button.is-disabled, button:disabled { opacity: 0.45; cursor: not-allowed; }
.text-button { border: 0; background: none; padding: 8px 4px; min-height: 44px; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.text-button:hover { color: var(--accent-dark); text-decoration: underline; }
.text-button--danger, .text-button--danger:hover { color: var(--error-ink); }
.icon-button { width: 44px; height: 44px; flex: none; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: var(--pill); background: var(--paper); color: var(--muted); font: inherit; font-size: 1.05rem; cursor: pointer; }
.icon-button:hover { color: var(--ink); border-color: var(--accent); }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* Fields: labels above, 10px inputs */
.card-form { display: flex; flex-direction: column; gap: 18px; padding: 28px; background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 0.88rem; font-weight: 600; }
.field input, .field textarea, .field select, .cell input, .toolbar input, .toolbar select {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); font: inherit; font-size: 0.97rem;
}
.field input::placeholder, .field textarea::placeholder, .toolbar input::placeholder { color: var(--muted); opacity: 0.85; }
.field input:hover, .field textarea:hover, .field select:hover, .cell input:hover, .toolbar input:hover, .toolbar select:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible, .cell input:focus-visible, .toolbar input:focus-visible, .toolbar select:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:disabled { background: var(--sunken); color: var(--muted); }
.card-form > .primary-button { align-self: flex-start; }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; }
.field-row > .field { flex: 1 1 180px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* Card list */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.wedding-card {
  display: flex; flex-direction: column; gap: 6px; padding: 22px;
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none;
}
.wedding-card:hover { border-color: var(--line); }
.wedding-card strong { margin-top: 6px; font-family: var(--serif); font-weight: 400; font-size: 1.45rem; line-height: 1.2; }
.wedding-card .button-row { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); gap: 8px; }
.wedding-card .secondary-button { min-height: 38px; padding: 0 14px; font-size: 0.86rem; }
.status-chip { align-self: flex-start; display: inline-flex; align-items: center; padding: 3px 11px; border-radius: var(--pill); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.01em; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.status-chip.status-published { background: var(--accent-tint); color: var(--accent-dark); }
.status-chip.status-suspended { background: var(--error-tint); color: var(--error-ink); }

/* Editor */
.editor-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 10px 24px; background: var(--paper); border-bottom: 1px solid var(--line-soft);
}
.editor-title { font-family: var(--serif); font-weight: 400; font-size: 1.25rem; }
.save-status { font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.save-status[data-tone="error"] { color: var(--error-ink); font-weight: 600; }
.spacer { flex: 1 1 auto; }
.editor-banner { max-width: 1440px; margin: 16px auto 0; padding: 0 24px; }

.editor-body {
  max-width: 1440px; margin: 0 auto; padding: 24px;
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px;
}
.step-nav {
  flex: 1 1 220px; max-width: 250px; position: sticky; top: 16px;
  display: flex; flex-direction: column; gap: 2px; padding: 8px;
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.step-link {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
  border-radius: var(--radius); color: var(--ink); text-decoration: none; font-size: 0.93rem;
}
.step-link:hover { background: var(--sunken); color: var(--ink); }
.step-link.is-active { background: var(--accent-tint); color: var(--accent-dark); font-weight: 650; }
.step-number {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; font-size: 0.74rem; font-weight: 700; color: var(--muted); background: var(--paper);
  font-variant-numeric: tabular-nums;
}
.step-link.is-active .step-number { border-color: var(--accent); color: var(--accent-dark); }
.step-link.is-done .step-number { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

.editor-main {
  flex: 999 1 480px; min-width: 0;
  display: flex; flex-direction: column; gap: 22px; padding: 32px;
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.step { display: flex; flex-direction: column; gap: 20px; }
.step-header { display: flex; flex-direction: column; gap: 6px; }
.step-footer { display: flex; justify-content: space-between; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line-soft); }

.preview { flex: 0 1 340px; display: flex; flex-direction: column; align-items: center; gap: 12px; position: sticky; top: 16px; }
.phone { width: 320px; max-width: 100%; height: 660px; border: 10px solid #1c1a19; border-radius: 40px; overflow: hidden; background: var(--paper); box-shadow: 0 30px 60px -24px rgb(42 39 37 / 0.45); }
.preview-frame { width: 100%; height: 100%; border: 0; display: block; }
.preview .hint { max-width: 300px; text-align: center; }

/* Choices */
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--paper); }
.choice:hover { border-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-tint); }
.choice:has(input:disabled) { opacity: 0.55; cursor: not-allowed; border-color: var(--line); }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; }
.choice__text { display: flex; flex-direction: column; gap: 2px; }
.choice__text span { font-size: 0.85rem; color: var(--muted); }

/* Lists */
.list-editor { display: flex; flex-direction: column; gap: 10px; }
.list-rows { display: flex; flex-direction: column; gap: 10px; }
.list-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--sunken); }
.cell { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cell--wide { flex: 3 1 220px; }
.cell label { font-size: 0.84rem; font-weight: 600; }
.row-controls { display: flex; gap: 6px; }

/* Images */
.image-slot { flex: 1 1 200px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.image-slot img { width: 100%; height: 200px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line-soft); background: var(--sunken); }
.image-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.gallery-item { position: relative; margin: 0; }
.gallery-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); display: block; }
.gallery-remove { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; background: color-mix(in srgb, var(--paper) 92%, transparent); }

/* Details & publish */
.advanced { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.advanced summary { cursor: pointer; font-weight: 600; min-height: 28px; }
.advanced[open] { gap: 14px; }
.advanced[open] > * + * { margin-top: 12px; }
.advanced.danger summary { color: var(--error-ink); }
.plan-box { padding: 18px; border-radius: var(--radius-lg); background: var(--sunken); display: flex; flex-direction: column; gap: 6px; }
.plan-box p { margin: 0; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: baseline; }
.check-mark { width: 22px; height: 22px; flex: none; display: inline-grid; place-items: center; border-radius: 50%; font-size: 0.78rem; font-weight: 700; background: var(--sunken); align-self: center; }
.checklist .is-ok .check-mark { background: var(--accent); color: var(--on-accent); }
.checklist .is-missing { color: var(--error-ink); }
.checklist .is-missing .check-mark { background: var(--error-tint); }
.checklist .is-optional { color: var(--muted); }
.live-box { padding: 20px; border-radius: var(--radius-lg); background: var(--accent-tint); display: flex; flex-direction: column; gap: 10px; }
.live-title { margin: 0; font-weight: 700; color: var(--accent-dark); font-size: 1.05rem; }
.live-box a:not([class]) { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .app-bar, .editor-bar { padding: 8px 16px; }
  /* Keep the account line on one row: long addresses are shortened, Sign out stays visible. */
  .app-bar { flex-wrap: nowrap; }
  .brand { flex: none; }
  .account { flex-wrap: nowrap; min-width: 0; justify-content: flex-end; }
  .account-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
  .account .text-button { flex: none; white-space: nowrap; }
  .editor-body { padding: 16px; gap: 16px; }
  .step-nav { position: static; max-width: none; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .step-link { flex: none; }
  .editor-main { padding: 20px; }
  .preview { position: static; flex-basis: 100%; }
  .narrow { padding: 32px 16px 56px; }
  .card-form { padding: 20px; }
}

/* View tabs (Edit card / Guests and wishes / Gallery) */
.view-tabs { display: flex; gap: 2px; padding: 3px; border-radius: var(--pill); background: var(--sunken); }
.view-tab { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border-radius: var(--pill); color: var(--muted); text-decoration: none; font-size: 0.88rem; font-weight: 600; white-space: nowrap; }
.view-tab:hover { color: var(--ink); }
.view-tab.is-active { background: var(--paper); color: var(--accent-dark); box-shadow: 0 1px 2px rgb(42 39 37 / 0.12); }

/* Dashboard */
.dash-body { max-width: 1280px; margin: 0 auto; padding: 28px 24px 64px; display: flex; flex-direction: column; gap: 20px; }
.share-box {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  padding: 18px 22px; border-radius: var(--radius-lg); background: var(--accent-tint);
}
.share-box a:not([class]) { overflow-wrap: anywhere; font-weight: 600; }
.share-box .group-label { margin: 0 0 2px; }
.stat-grid { display: grid; grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-tile { padding: 18px 20px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-tile p { margin: 0; }
.stat-label { font-size: 0.83rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.85rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-tile--main { background: var(--accent); border-color: var(--accent); }
.stat-tile--main .stat-label, .stat-tile--main .hint { color: color-mix(in srgb, var(--on-accent) 82%, transparent); }
.stat-tile--main .stat-value { color: var(--on-accent); font-size: 2.6rem; }
.stat-tile--alert { border-color: var(--error-ink); background: var(--error-tint); }
.stat-tile--alert .stat-value { color: var(--error-ink); }

.dash-columns { display: grid; grid-template-columns: minmax(0, 1fr) 390px; align-items: start; gap: 20px; }
@media (max-width: 1100px) { .dash-columns { grid-template-columns: minmax(0, 1fr); } }
.dash-panel { min-width: 0; padding: 22px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--paper); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.dash-panel--guests { flex: 999 1 560px; }
.dash-panel--wishes { flex: 1 1 320px; }
.dash-panel--sharing { max-width: 760px; }
.member-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.member { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.member:last-child { border-bottom: 0; }
.member-email { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.invite-box { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.invite-box .member-list { align-self: stretch; }
.invite-link { margin: 4px 0; padding: 8px 12px; border-radius: var(--radius); background: var(--paper); overflow-wrap: anywhere; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.82rem; }
.share-box--invite { align-self: stretch; }
.share-box--invite > div:first-child { flex: 1 1 320px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
.toolbar input { flex: 1 1 220px; min-width: 0; width: auto; }
.toolbar select { width: auto; }
.table-box { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.guest-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 0.91rem; }
.guest-table th, .guest-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.guest-table thead th { background: var(--sunken); color: var(--muted); font-size: 0.78rem; font-weight: 700; position: sticky; top: 0; }
.guest-table tbody th { font-weight: 600; }
.guest-table tbody tr:hover { background: color-mix(in srgb, var(--accent-tint) 45%, transparent); }
.guest-table tbody tr:last-child th, .guest-table tbody tr:last-child td { border-bottom: 0; }
.guest-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; color: var(--muted); }
/* On phones each reply is a short block: name and answer, then the numbers, then contact. */
@media (max-width: 640px) {
  .table-box { overflow: visible; border: 0; border-radius: 0; }
  .guest-table { min-width: 0; display: block; }
  .guest-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .guest-table tbody { display: flex; flex-direction: column; gap: 8px; }
  .guest-table tr {
    display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 4px 14px; padding: 12px 14px;
    grid-template-areas: "name name name coming" "adults children . ." "phone phone phone phone" "date date date action";
    border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper);
  }
  .guest-table th, .guest-table td { padding: 0; border: 0; text-align: left; }
  .guest-table tbody tr:hover { background: var(--paper); }
  .guest-table .col-name { grid-area: name; font-size: 1rem; align-self: center; overflow-wrap: anywhere; }
  .guest-table .col-coming { grid-area: coming; align-self: center; }
  .guest-table .col-adults, .guest-table .col-children { font-size: 0.88rem; color: var(--muted); }
  .guest-table .col-adults { grid-area: adults; }
  .guest-table .col-children { grid-area: children; }
  .guest-table .col-adults::after { content: " adults"; }
  .guest-table .col-children::after { content: " children"; }
  .guest-table .col-phone { grid-area: phone; font-size: 0.9rem; }
  .guest-table .col-date { grid-area: date; align-self: center; font-size: 0.8rem; }
  .guest-table .col-action { grid-area: action; }
  .guest-table .col-action .text-button { min-height: 36px; padding: 4px 0; }
}
.pill { display: inline-block; padding: 2px 10px; border-radius: var(--pill); font-size: 0.76rem; font-weight: 700; white-space: nowrap; }
.pill--yes { background: var(--accent-tint); color: var(--accent-dark); }
.pill--no { background: var(--sunken); color: var(--muted); }
.empty-box { margin: 0; padding: 36px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty-box p { margin: 0; max-width: 46ch; }
.empty-box--left { align-items: flex-start; text-align: left; padding: 18px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-box--left p { max-width: 60ch; }

.segmented { display: flex; gap: 2px; padding: 3px; border-radius: var(--pill); background: var(--sunken); overflow-x: auto; scrollbar-width: none; }
.segment { flex: 1 0 auto; min-height: 36px; padding: 0 10px; border: 0; border-radius: var(--pill); background: transparent; font: inherit; font-size: 0.84rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.segment:hover { color: var(--ink); }
.segment.is-active { background: var(--paper); color: var(--accent-dark); box-shadow: 0 1px 2px rgb(42 39 37 / 0.12); }
.wish-list { display: flex; flex-direction: column; gap: 10px; }
.wish { padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius); display: flex; flex-direction: column; gap: 6px; }
.wish p { margin: 0; }
.wish-name { font-weight: 700; }
.wish-message { line-height: 1.55; overflow-wrap: anywhere; white-space: pre-line; }
.wish .button-row { gap: 8px; margin-top: 6px; }
.wish .primary-button, .wish .secondary-button { min-height: 36px; padding: 0 14px; font-size: 0.84rem; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .stat-tile--main { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-tile { padding: 14px; }
  .stat-value { font-size: 1.45rem; }
  .stat-tile--main .stat-value { font-size: 2rem; }
  .dash-body { padding: 16px 16px 48px; }
  .dash-panel { padding: 16px; }
  .view-tabs { order: 10; width: 100%; }
  .view-tab { flex: 1; padding: 0 8px; }
}

/* Gallery */
.share-box--qr { align-items: flex-start; justify-content: flex-start; gap: 22px; background: var(--paper); border: 1px solid var(--line-soft); box-shadow: var(--shadow); }
.qr-canvas { width: 168px; height: 168px; flex: none; image-rendering: pixelated; border-radius: var(--radius); border: 1px solid var(--line-soft); background: #fff; }
.qr-text { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.qr-text a:not([class]) { overflow-wrap: anywhere; font-weight: 600; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--sunken); cursor: pointer; }
.toggle input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; }
.memory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.memory { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--paper); min-width: 0; }
.memory p { margin: 0; }
.memory-photo { padding: 0; border: 0; background: var(--sunken); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; }
.memory-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.memory audio { width: 100%; }
.memory-note { padding: 14px; border-radius: var(--radius); background: var(--sunken); font-family: var(--serif); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; min-height: 80px; }
.memory-caption { font-size: 0.88rem; overflow-wrap: anywhere; }
.memory-meta { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.memory .button-row { gap: 6px; }
.memory .secondary-button { min-height: 36px; padding: 0 12px; font-size: 0.84rem; }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgb(14 17 12 / 0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 110px); object-fit: contain; border-radius: var(--radius); }
.lightbox-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; color: #f4f6f0; }

.slideshow { position: fixed; inset: 0; z-index: 60; background: #11140f; color: #f6f7f1; display: flex; flex-direction: column; }
.slide { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.slide img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); }
.slide-note { margin: 0; max-width: 900px; font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 3rem); line-height: 1.35; text-align: center; white-space: pre-line; }
.slide-empty { font-size: 1.4rem; opacity: 0.8; }
.slide-footer { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 12px 24px 20px; }
.slide-caption { margin: 0; font-size: 1.2rem; opacity: 0.9; }
.slide-share { display: flex; align-items: center; gap: 12px; }
.slide-qr { width: 96px; height: 96px; image-rendering: pixelated; border-radius: var(--radius); }
.slide-hint { margin: 0; max-width: 220px; font-size: 0.9rem; opacity: 0.85; overflow-wrap: anywhere; }
.slide-close { position: absolute; top: 16px; right: 16px; min-height: 44px; padding: 0 18px; border: 1px solid rgb(255 255 255 / 0.4); border-radius: var(--pill); background: rgb(0 0 0 / 0.35); color: #f6f7f1; font: inherit; font-weight: 600; cursor: pointer; }
.slide-close:hover { background: rgb(0 0 0 / 0.55); }
@media (max-width: 760px) {
  .qr-canvas { width: 132px; height: 132px; }
  .memory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
.memory-video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: #11140f; }
.slide video { max-width: 100%; max-height: 100%; border-radius: var(--radius); }
.memory-meta .pill { margin-left: 6px; }

/* Printable QR poster and table cards */
.print-preview { position: fixed; inset: 0; z-index: 70; background: #2c3327; display: flex; flex-direction: column; }
.print-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 20px; background: var(--paper); }
.print-toolbar .hint { flex: 1 1 260px; }
.print-stage { flex: 1; overflow: auto; padding: 24px; display: flex; justify-content: center; align-items: flex-start; }
.print-page {
  width: 210mm; height: 297mm; flex: none; box-sizing: border-box; overflow: hidden;
  background: #fbf7ee; color: #2f3a28; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
@media screen and (max-width: 900px) {
  .print-stage { padding: 12px; }
  .print-page { zoom: 0.42; }
}
.print-poster { padding: 14mm; }
.poster-frame {
  height: 100%; box-sizing: border-box; border: 1.2mm solid #b08d57; outline: 0.4mm solid #b08d57; outline-offset: -4mm;
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18mm 14mm 12mm;
}
.poster-eyebrow { margin: 0; font-size: 13pt; font-weight: 700; letter-spacing: 0.35em; text-transform: uppercase; color: #5c7049; }
.poster-names { margin: 6mm 0 2mm; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-weight: 400; font-size: 40pt; line-height: 1.1; }
.poster-event { margin: 0; font-size: 13pt; color: #5e6656; }
.poster-qr { width: 100mm; height: 100mm; margin: 10mm 0 7mm; padding: 3mm; background: #fff; border-radius: 3mm; }
.poster-qr svg, .table-card__qr svg { width: 100%; height: 100%; display: block; }
.poster-call { margin: 0 0 5mm; font-family: Georgia, serif; font-size: 18pt; }
.poster-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 2.5mm; font-size: 12.5pt; }
.poster-steps li { counter-increment: step; }
.poster-steps li::before { content: counter(step) ".  "; font-weight: 700; color: #b08d57; }
.poster-link { margin: auto 0 1mm; font-size: 12pt; font-weight: 700; color: #445535; overflow-wrap: anywhere; }
.poster-note { margin: 0; font-size: 10pt; color: #5e6656; }

.print-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.table-card {
  box-sizing: border-box; padding: 9mm 8mm; border: 0.3mm dashed #b9ad92;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2.5mm;
}
.table-card p { margin: 0; }
.table-card__eyebrow { font-size: 8.5pt; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; color: #5c7049; }
.table-card__names { font-family: Georgia, serif; font-style: italic; font-size: 20pt; line-height: 1.15; }
.table-card__qr { width: 62mm; height: 62mm; margin: 2mm 0; background: #fff; padding: 2mm; border-radius: 2mm; }
.table-card__call { font-family: Georgia, serif; font-size: 12pt; }
.table-card__link { font-size: 8.5pt; font-weight: 700; color: #445535; overflow-wrap: anywhere; }

@page { size: A4 portrait; margin: 0; }
@media print {
  body.is-printing > *:not(.print-preview) { display: none !important; }
  body.is-printing { background: #fff; }
  .print-preview { position: static; background: none; display: block; }
  .print-toolbar { display: none; }
  .print-stage { padding: 0; overflow: visible; display: block; }
  .print-page { box-shadow: none; zoom: 1; }
}


/* Gallery retention notice */
.retention { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--radius-lg); background: var(--sunken); font-size: 0.92rem; }
.retention.is-soon { background: var(--warn-tint); color: var(--warn-ink); }
.retention.is-closed { background: var(--error-tint); color: var(--error-ink); }
.retention p { margin: 0; flex: 1 1 280px; }

/* Sign in with Google (Google's branding: white button, the G mark, dark text, in both themes) */
.google-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 48px; padding: 0 22px; border: 1px solid #747775; border-radius: var(--pill);
  background: #ffffff; color: #1f1f1f; font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer;
}
.google-button:hover { background: #f4f6f4; }
.google-button:disabled { opacity: 0.6; cursor: progress; }
.divider { display: flex; align-items: center; gap: 12px; margin: 4px 0 0; font-size: 0.84rem; color: var(--muted); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Upgrade dialog and admin table */
.upgrade-dialog { background: rgb(18 22 16 / 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.upgrade-sheet { width: min(880px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; margin: 0 auto; background: var(--paper); color: var(--ink); border-radius: var(--radius-lg); padding: 26px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-lg); }
.upgrade-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.upgrade-plan { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: 10px; }
.upgrade-plan.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-tint); }
.upgrade-plan h3 { margin: 0; font-size: 1.05rem; }
.upgrade-price { margin: 0; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.upgrade-plan ul { margin: 0; padding-left: 18px; font-size: 0.9rem; color: var(--muted); }
.upgrade-plan .primary-button { margin-top: auto; }
.admin-table { min-width: 860px; }
.admin-table select { min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: inherit; }

/* Motion: feedback on press and a moving loading skeleton.
   All of it is off for people who ask for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .primary-button, .secondary-button, .danger-button, .add-button, .icon-button, .google-button,
  .segment, .view-tab, .step-link, .choice, .wedding-card, .text-button,
  .field input, .field textarea, .field select, .cell input, .toolbar input, .toolbar select {
    transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease);
  }
  .primary-button:active, .secondary-button:active, .danger-button:active, .add-button:active,
  .icon-button:active, .google-button:active, .segment:active { transform: translateY(1px) scale(0.985); }
  .loading::after { animation: shimmer 1.4s linear infinite; }
}
@keyframes shimmer { to { background-position: -220% 0; } }
