:root {
  color-scheme: light;
  --ink: #1c1b18;
  --muted: #656158;
  --canvas: #f6f3ec;
  --surface: #fcfaf6;
  --surface-strong: #ffffff;
  --line: rgba(28, 27, 24, 0.16);
  --primary: #5f674c;
  --primary-ink: #ffffff;
  --accent: #70470e;
  --accent-soft: #f1e5b9;
  --secondary: #a8784f;
  --floral: #6d3343;
  --floral-soft: #ebd7dc;
  --danger: #8b2e2e;
  --danger-soft: #fbefec;
  --success: #436249;
  --success-soft: #e5eee4;
  --shadow: 0 1.2rem 3rem rgba(48, 39, 27, 0.1);
  --serif: "Iowan Old Style", Baskerville, Georgia, serif;
  --sans: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="rosewood"] {
  --ink: #2f2026;
  --muted: #6e5a62;
  --canvas: #fff9f4;
  --surface: #fdf8f4;
  --surface-strong: #ffffff;
  --line: rgba(47, 32, 38, 0.16);
  --primary: #743f50;
  --accent: #634814;
  --accent-soft: #f1e2c4;
  --secondary: #c78e9d;
  --floral: #743f50;
  --floral-soft: #f4e7e8;
  --success: #46523e;
  --success-soft: #e8ede3;
  --shadow: 0 1.2rem 3rem rgba(77, 41, 54, 0.1);
  --serif: Newsreader, Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Trebuchet MS", Arial, sans-serif;
}

html[data-theme="meadow"] {
  --ink: #1d2522;
  --muted: #5a6661;
  --canvas: #f7f5ee;
  --surface: #fbfaf6;
  --surface-strong: #ffffff;
  --line: rgba(29, 37, 34, 0.16);
  --primary: #36554a;
  --accent: #70440e;
  --accent-soft: #f1e2c9;
  --secondary: #587087;
  --floral: #3f5366;
  --floral-soft: #dde7e3;
  --success: #2d4b40;
  --success-soft: #dde7e3;
  --shadow: 0 1.2rem 3rem rgba(29, 50, 43, 0.1);
  --serif: Charter, Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible", Verdana, Arial, sans-serif;
}

:root { --preview-bar-height: 3rem; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 20rem; background: var(--canvas); color: var(--ink); font-family: var(--sans); line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button { color: inherit; }
.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; }
.skip-link { position: fixed; z-index: 1000; top: .5rem; left: .5rem; padding: .75rem 1rem; transform: translateY(-140%); background: var(--ink); color: #fff; }
.skip-link:focus { transform: translateY(0); }
.prototype-banner { position: sticky; z-index: 80; top: 0; display: flex; min-height: var(--preview-bar-height); padding: .35rem 1rem; gap: .7rem; align-items: center; justify-content: center; background: var(--ink); color: #fff; font-size: .74rem; letter-spacing: .04em; text-align: center; }
.prototype-banner strong { text-transform: uppercase; letter-spacing: .1em; }
.prototype-banner .prototype-return { color: #fff; }
.prototype-viewer { display: inline-flex; align-items: center; gap: .4rem; }
.prototype-viewer select { min-height: 2.2rem; padding: .25rem .5rem; border: 1px solid #fff8; border-radius: .2rem; background: #fff; color: #171714; }
body:not([data-viewer="owner"]) [data-owner-only], [data-permission-denied] { display: none !important; }

.app-shell { display: grid; grid-template-columns: 17rem minmax(0, 1fr); min-height: calc(100vh - var(--preview-bar-height)); }
.sidebar { position: sticky; top: var(--preview-bar-height); height: calc(100vh - var(--preview-bar-height)); display: flex; flex-direction: column; padding: 1.2rem; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; width: 100%; min-height: 3.5rem; align-items: center; gap: .8rem; padding: .55rem; border: 0; background: transparent; text-align: left; cursor: pointer; }
.brand span:last-child, .circle-switcher span:last-child, .sidebar-footer span:last-child { display: grid; }
.brand small, .circle-switcher small, .sidebar-footer small { color: var(--muted); }
.brand-mark { display: grid; width: 2.75rem; height: 2.75rem; place-items: center; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-family: var(--serif); font-weight: 700; }
.circle-switcher { display: flex; margin: 1rem 0; padding: .9rem .65rem; align-items: center; gap: .7rem; border-block: 1px solid var(--line); }
.avatar { display: grid; width: 2.65rem; height: 2.65rem; flex: 0 0 auto; place-items: center; border: 2px solid var(--secondary); border-radius: 50%; background: var(--floral-soft); color: var(--floral); font-family: var(--serif); font-weight: 700; }
.avatar--small { width: 2.25rem; height: 2.25rem; font-size: .78rem; }
.avatar--large { width: 5.5rem; height: 5.5rem; font-size: 1.4rem; }
.avatar--xlarge { width: 7rem; height: 7rem; font-size: 1.65rem; }
.primary-nav { display: grid; gap: .25rem; }
.nav-item { display: flex; min-height: 3rem; align-items: center; gap: .75rem; padding: .65rem .8rem; border: 0; border-radius: .3rem; background: transparent; font-weight: 700; text-align: left; cursor: pointer; }
.nav-item > span:first-child { width: 1.35rem; color: var(--primary); font-size: 1.15rem; text-align: center; }
.nav-item:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.nav-item.is-active { background: var(--primary); color: var(--primary-ink); }
.nav-item.is-active > span:first-child { color: inherit; }
.nav-count { min-width: 1.5rem; margin-left: auto; padding: .12rem .38rem; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-size: .7rem; text-align: center; }
.sidebar-footer { display: flex; margin-top: auto; padding: 1rem .65rem 0; gap: .7rem; align-items: center; border-top: 1px solid var(--line); }

.workspace { min-width: 0; }
.topbar { position: sticky; z-index: 50; top: var(--preview-bar-height); display: flex; min-height: 6rem; padding: 1.1rem clamp(1rem, 4vw, 3rem); justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--canvas) 94%, transparent); backdrop-filter: blur(18px); }
.topbar h1 { margin: .1rem 0 0; font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.45rem); font-weight: 400; line-height: 1; }
.topbar-actions { display: flex; gap: .65rem; align-items: center; }
.topbar-actions .button { white-space: nowrap; }
.eyebrow, .card-kicker, .provider { margin: 0; color: var(--primary); font-size: .72rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.icon-button { display: grid; min-width: 2.75rem; min-height: 2.75rem; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-strong); font-weight: 800; cursor: pointer; }
.button { display: inline-flex; min-height: 2.9rem; padding: .68rem 1rem; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: .18rem; font-weight: 850; letter-spacing: .035em; text-decoration: none; cursor: pointer; }
.button--primary { background: var(--primary); color: var(--primary-ink); }
.button--secondary { border-color: var(--primary); background: transparent; color: var(--primary); }
.button--quiet { border-color: var(--line); background: var(--surface-strong); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button:active, .icon-button:active, .nav-item:active, .mobile-nav button:active, .more-card:active { transform: scale(.98); }
.text-link { min-height: 2.75rem; padding: 0; border: 0; background: transparent; color: var(--primary); font-weight: 850; text-decoration: underline; text-underline-offset: .22em; cursor: pointer; }

main { width: min(86rem, 100%); margin: 0 auto; padding: clamp(1rem, 4vw, 3rem); }
.screen { display: none; }
.screen.is-active { display: block; animation: screen-in .22s ease-out; }
h2[tabindex="-1"]:focus { outline: none; }
@keyframes screen-in { from { opacity: .25; transform: translateY(.35rem); } to { opacity: 1; transform: none; } }
.welcome-row, .page-intro, .section-heading, .modal-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.25rem; }
.welcome-row { margin-bottom: 1.5rem; align-items: center; }
.welcome-row h2, .page-intro h2 { margin: .2rem 0 .35rem; font-family: var(--serif); font-size: clamp(2.2rem, 5vw, 4.5rem); font-weight: 400; line-height: .98; }
.welcome-row p:last-child, .page-intro p:last-child { max-width: 46rem; color: var(--muted); }
.page-intro { margin-bottom: 2rem; align-items: end; }
.page-intro > div { max-width: 55rem; }
.page-intro .button { flex: 0 0 auto; }

.status-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: clamp(1.35rem, 4vw, 2.4rem); gap: 1.5rem; align-items: center; overflow: hidden; border: 1px solid var(--line); border-top: 5px solid var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--surface)); box-shadow: var(--shadow); }
.status-card__accent { position: absolute; right: -3rem; bottom: -5rem; width: 14rem; height: 14rem; border: 2.2rem solid color-mix(in srgb, var(--secondary) 20%, transparent); border-radius: 50%; opacity: .6; }
.status-card > *:not(.status-card__accent) { position: relative; }
.status-card h2 { max-width: 28ch; margin: .3rem 0 .6rem; font-family: var(--serif); font-size: clamp(1.9rem, 4vw, 3.1rem); font-weight: 400; line-height: 1.05; }
.status-card p:last-child { max-width: 52rem; margin-bottom: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.5rem 0; }
.metric-grid article { display: grid; grid-template-columns: auto auto 1fr; padding: 1.1rem; gap: .65rem; align-items: center; border: 1px solid var(--line); background: var(--surface); }
.metric-grid strong { font-family: var(--serif); font-size: 2rem; }
.metric-grid span:last-child { color: var(--muted); font-size: .85rem; }
.metric-icon { color: var(--primary); font-size: 1.35rem; }
.dashboard-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.25rem; }
.panel, .update-card, .support-link-grid article, .preference-grid article, .pass-grid article { padding: clamp(1.2rem, 3vw, 2rem); border: 1px solid var(--line); border-top: 4px solid var(--primary); background: var(--surface); }
.panel h2, .support-section h2 { margin: .2rem 0; font-family: var(--serif); font-size: clamp(1.7rem, 3vw, 2.6rem); font-weight: 400; line-height: 1.05; }
.panel > p:last-child { margin-bottom: 0; }
.update-meta, .muted { color: var(--muted); }
.badge { display: inline-flex; width: fit-content; padding: .26rem .55rem; border-radius: 999px; background: var(--floral-soft); color: var(--floral); font-size: .7rem; font-weight: 850; letter-spacing: .04em; }
.badge--warm { background: var(--accent-soft); color: var(--accent); }
.badge--success { background: var(--success-soft); color: var(--success); }
.mini-task, .need-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .85rem 0; border-top: 1px solid var(--line); }
.mini-task span:nth-child(2), .need-row span:nth-child(2) { display: grid; }
.mini-task small, .need-row small { color: var(--muted); }
.task-date { display: grid; width: 3rem; height: 3rem; place-items: center; align-content: center; border: 1px solid var(--secondary); background: var(--surface-strong); line-height: 1; }
.task-date strong { font-family: var(--serif); font-size: 1.25rem; }
.task-date small { margin-top: .18rem; font-size: .62rem; font-weight: 850; text-transform: uppercase; }

.composer { max-width: 56rem; margin: 0 auto 1.5rem; }
.field { display: grid; gap: .4rem; margin-bottom: 1rem; }
.field label, fieldset legend { font-weight: 850; }
.field input, .field textarea, .filter-row input, .filter-row select, .person-detail select { width: 100%; min-height: 3rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 0; background: var(--surface-strong); color: var(--ink); }
.field textarea { resize: vertical; }
.field small { color: var(--muted); }
.check-row { display: flex; min-height: 2.75rem; gap: .65rem; align-items: center; }
.check-row input, .permission-option input { width: 1.2rem; height: 1.2rem; flex: 0 0 auto; }
.form-actions { display: flex; margin-top: 1rem; justify-content: flex-end; gap: .65rem; }
.feed { display: grid; max-width: 56rem; margin: 0 auto; gap: 1rem; }
.update-card { border-top-color: var(--secondary); }
.update-card__author { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; align-items: center; }
.update-card__author span:nth-child(2) { display: grid; }
.update-card__author small { color: var(--muted); }
.update-card h3 { margin: 1.2rem 0 .4rem; font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 400; }
.update-card__footer { display: flex; gap: 1.2rem; border-top: 1px solid var(--line); }
.wish-copy { font-family: var(--serif); font-size: clamp(1.35rem, 3vw, 1.8rem); }
.wish-card.is-moderated .wish-copy { opacity: .45; text-decoration: line-through; }
.wish-card.is-removed .wish-copy { color: var(--muted); font-family: var(--sans); font-size: 1rem; font-style: italic; text-decoration: none; }
.moderation-state { margin-bottom: 0; padding: .7rem; border-left: 4px solid var(--danger); background: var(--danger-soft); font-weight: 750; }

.filter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.filter-row .search-field { grid-column: span 2; }
.search-field { display: block; }
.people-workspace { display: grid; grid-template-columns: minmax(18rem, .75fr) minmax(25rem, 1.25fr); min-height: 35rem; border: 1px solid var(--line); background: var(--surface); }
.people-list { border-right: 1px solid var(--line); }
.person-row { display: grid; width: 100%; min-height: 5.25rem; grid-template-columns: auto minmax(0, 1fr) auto; padding: .8rem 1rem; gap: .7rem; align-items: center; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.person-row:hover, .person-row.is-active { background: color-mix(in srgb, var(--primary) 9%, var(--surface)); }
.person-row.is-active { box-shadow: inset 4px 0 var(--primary); }
.person-row__copy { display: grid; min-width: 0; }
.person-row__copy small { color: var(--muted); overflow-wrap: anywhere; }
.status-label { display: grid; justify-items: end; font-size: .72rem; font-weight: 850; }
.status-label small { color: var(--muted); font-weight: 600; }
.person-detail { padding: clamp(1.1rem, 3vw, 2rem); }
.person-detail__heading { display: flex; gap: .9rem; align-items: center; }
.person-detail h2 { margin: 0; font-family: var(--serif); font-size: 2.25rem; font-weight: 400; }
.person-detail__heading span:last-child { display: grid; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 1.5rem 0; }
.detail-grid div { padding: .8rem; border: 1px solid var(--line); }
.detail-grid dt { color: var(--muted); font-size: .7rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.detail-grid dd { margin: .25rem 0 0; font-weight: 700; }
.permission-fieldset { margin: 1.5rem 0 0; padding: 1rem; border: 1px solid var(--line); }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .75rem; }
.permission-option { display: flex; min-height: 4rem; padding: .7rem; gap: .65rem; align-items: flex-start; border: 1px solid var(--line); background: var(--surface-strong); }
.permission-option span { display: grid; }
.permission-option small { color: var(--muted); }
.unsaved-bar, .sticky-save { position: sticky; bottom: .75rem; display: flex; margin-top: 1.25rem; padding: .8rem; align-items: center; justify-content: flex-end; gap: .65rem; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.unsaved-bar span, .sticky-save span { margin-right: auto; color: var(--muted); font-weight: 700; }

.allergy-alert { display: grid; grid-template-columns: auto minmax(0, 1fr); margin-bottom: 1rem; padding: 1.25rem; gap: 1rem; border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); border-left: 6px solid var(--danger); background: var(--danger-soft); }
.allergy-alert > div:first-child { display: grid; width: 2.4rem; height: 2.4rem; place-items: center; border-radius: 50%; background: var(--danger); color: #fff; font-weight: 900; }
.allergy-alert .eyebrow { color: var(--danger); }
.allergy-alert h3 { margin: .2rem 0; font-family: var(--serif); font-size: 2rem; font-weight: 400; }
.allergy-alert p { margin: .3rem 0; }
.allergy-alert small { font-weight: 800; }
.preference-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.preference-grid article:nth-child(1) { border-top-color: var(--accent); }
.preference-grid article:nth-child(2) { border-top-color: var(--floral); background: linear-gradient(145deg, var(--surface), var(--floral-soft)); }
.preference-grid article:nth-child(3) { border-top-color: var(--primary); }
.preference-grid article:nth-child(4) { border-top-color: var(--secondary); }
.preference-grid h3, .support-link-grid h3, .pass-grid h3 { margin: .4rem 0; font-family: var(--serif); font-size: 1.55rem; font-weight: 400; line-height: 1.1; }
.support-section { margin-bottom: 1rem; border-top-color: var(--secondary); }
.support-link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.support-link-grid article { border-top-color: var(--accent); }
.support-link-grid .button { margin: .5rem 0; }
.support-link-grid small { display: block; color: var(--muted); }

.keepsake-layout { display: grid; grid-template-columns: minmax(18rem, .85fr) minmax(22rem, 1.15fr); gap: 1.5rem; align-items: start; }
.book-preview { padding: clamp(1rem, 3vw, 2rem); background: color-mix(in srgb, var(--secondary) 18%, var(--canvas)); }
.book-cover { display: grid; min-height: 32rem; padding: 3rem 2rem; place-items: center; align-content: center; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.book-cover h3 { margin: 1rem 0 .5rem; font-family: var(--serif); font-size: 3.6rem; font-weight: 400; }
.consent-row { display: flex; padding: .85rem 0; justify-content: space-between; border-bottom: 1px solid var(--line); }

.theme-fieldset { margin: 0 0 1.5rem; padding: 0; border: 0; }
.theme-fieldset legend { margin-bottom: .8rem; font-size: 1.1rem; }
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.theme-card { position: relative; display: grid; padding: 1rem; gap: .55rem; border: 2px solid var(--line); background: var(--surface); cursor: pointer; }
.theme-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.theme-card input { position: absolute; top: .8rem; right: .8rem; width: 1.2rem; height: 1.2rem; }
.theme-card small { color: var(--muted); }
.theme-swatch { display: grid; height: 6rem; grid-template-columns: repeat(4, 1fr); overflow: hidden; }
.theme-swatch i:nth-child(1) { background: #5f674c; } .theme-swatch i:nth-child(2) { background: #8f5d16; } .theme-swatch i:nth-child(3) { background: #a8784f; } .theme-swatch i:nth-child(4) { background: #ebd7dc; }
.theme-swatch--rosewood i:nth-child(1) { background: #743f50; } .theme-swatch--rosewood i:nth-child(2) { background: #66725b; } .theme-swatch--rosewood i:nth-child(3) { background: #c78e9d; } .theme-swatch--rosewood i:nth-child(4) { background: #8b6b34; }
.theme-swatch--meadow i:nth-child(1) { background: #36554a; } .theme-swatch--meadow i:nth-child(2) { background: #587087; } .theme-swatch--meadow i:nth-child(3) { background: #a9681e; } .theme-swatch--meadow i:nth-child(4) { background: #d6c8b3; }
.photo-choice { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1.25rem; align-items: center; }
.photo-choice h2 { margin: .2rem 0; }
.pass-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.pass-grid article { position: relative; display: flex; min-height: 18rem; flex-direction: column; border-top-color: var(--secondary); }
.pass-grid article .button { margin-top: auto; }
.pass-grid article.is-recommended { border-color: var(--primary); border-top-width: 6px; }
.pass-grid .badge { position: absolute; top: -1rem; left: 1rem; }
.policy-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1rem; }
.policy-list h3 { margin-bottom: .3rem; }
.policy-list p { color: var(--muted); }
.settings-grid, .more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.settings-grid article { display: grid; align-content: start; gap: .65rem; }
.settings-grid .button, .settings-grid .text-link { width: fit-content; }
.notification-admin { grid-column: 1 / -1; }
.notification-admin__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.alert-inbox { margin-bottom: 1rem; }
.alert-history { display: grid; gap: .65rem; }
.alert-history__item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .8rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.alert-history__item:first-child { border-top: 0; }
.alert-history__item > div { display: grid; gap: .12rem; }
.alert-history__item small { color: var(--muted); }
.alert-history__item:not(.is-unread) { opacity: .72; }
.danger-link { color: var(--danger); }
.more-card { display: grid; min-height: 11rem; gap: .35rem; align-content: center; color: var(--ink); text-align: left; cursor: pointer; }
.more-card > span { color: var(--primary); font-size: 1.5rem; }
.more-card strong { font-family: var(--serif); font-size: 1.65rem; font-weight: 500; }
.more-card small { color: var(--muted); }
.welcome-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem; }
.access-request-panel { margin-bottom: 1rem; }
.request-row { display: flex; padding: .85rem 0; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); }
.request-row > span { display: grid; gap: .2rem; }
.request-row small { color: var(--muted); }
.request-row > div { display: flex; flex-wrap: wrap; gap: .5rem; }
.access-state { display: grid; justify-items: start; gap: .45rem; margin: 1rem 0; padding: 1.1rem; border: 1px solid var(--line); background: var(--surface-strong); }
.access-state h3 { margin: 0; font-family: var(--serif); font-size: 2rem; font-weight: 500; }
.access-state p { margin: 0; }
.access-state .field, .access-state .notice { width: 100%; }

.mobile-nav { display: none; }
.modal { width: min(42rem, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(28, 27, 24, .62); backdrop-filter: blur(3px); }
.modal form { padding: clamp(1.2rem, 4vw, 2rem); }
.modal h2 { margin: .2rem 0; font-family: var(--serif); font-size: 2.4rem; font-weight: 400; }
.step-row { display: grid; grid-template-columns: repeat(3, 1fr); margin: 1.3rem 0; border-bottom: 1px solid var(--line); }
.step-row span { padding: .6rem; color: var(--muted); font-size: .78rem; font-weight: 800; text-align: center; }
.step-row .is-active { border-bottom: 4px solid var(--primary); color: var(--ink); }
.step-row span:focus, .step-label:focus { outline: none; }
.notice { margin: 1rem 0; padding: .85rem; border-left: 4px solid var(--accent); background: var(--accent-soft); }
.notice p { margin: .25rem 0 0; }
.review-list { display: grid; margin: 1rem 0; border: 1px solid var(--line); }
.review-list > div { display: grid; padding: .8rem; border-bottom: 1px solid var(--line); }
.review-list > div:last-child { border-bottom: 0; }
.review-list small { color: var(--muted); }
.batch-entry-list { display: grid; gap: .75rem; margin: 1rem 0; }
.batch-entry-row { position: relative; display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: .75rem; padding: .85rem; border: 1px solid var(--line); background: var(--surface-strong); }
.batch-entry-row .field { margin: 0; }
.batch-entry-row label { display: grid; gap: .35rem; }
.batch-entry-remove { position: absolute; top: -.65rem; right: -.65rem; width: 2.75rem; height: 2.75rem; min-height: 2.75rem; }
.setup-fieldset { padding: 0; border: 0; }
.choice-row { display: flex; min-height: 3.8rem; padding: .65rem; gap: .75rem; align-items: center; border: 1px solid var(--line); border-bottom: 0; background: var(--surface-strong); }
.choice-row:last-child { border-bottom: 1px solid var(--line); }
.choice-row input { width: 1.2rem; height: 1.2rem; }
.choice-row span { display: grid; }
.choice-row small { color: var(--muted); }
.setup-progress { height: .5rem; margin-top: 1rem; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--primary) 14%, transparent); }
.setup-progress span { display: block; height: 100%; background: var(--primary); }
.step-label { color: var(--muted); font-weight: 700; }
.toast { position: fixed; z-index: 1000; right: 1rem; bottom: 1rem; max-width: 26rem; padding: .9rem 1rem; border-left: 5px solid var(--accent); background: var(--ink); color: #fff; box-shadow: var(--shadow); font-weight: 700; }

@media (max-width: 74rem) {
  .app-shell { grid-template-columns: 14.5rem minmax(0, 1fr); }
  .preference-grid, .pass-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 58rem) {
  .prototype-banner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: .25rem; line-height: 1.3; text-align: left; }
  .prototype-banner > span { grid-column: 1 / -1; }
  .prototype-return { grid-column: 2; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { top: 0; }
  .topbar-actions .button { padding-inline: .75rem; }
  main { padding-bottom: 7rem; }
  .mobile-nav { position: fixed; z-index: 100; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: .45rem max(.35rem, env(safe-area-inset-right)) calc(.45rem + env(safe-area-inset-bottom)) max(.35rem, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(18px); }
  .mobile-nav button { display: grid; min-height: 3.25rem; place-items: center; align-content: center; gap: .1rem; border: 0; background: transparent; color: var(--muted); font-size: .67rem; font-weight: 750; }
  .mobile-nav button span { font-size: 1.15rem; }
  .mobile-nav button.is-active { color: var(--primary); }
  .unsaved-bar, .sticky-save { bottom: calc(4.7rem + env(safe-area-inset-bottom)); }
  .people-workspace { grid-template-columns: minmax(14rem, .72fr) minmax(0, 1.28fr); }
  .dashboard-grid, .keepsake-layout, .settings-grid, .notification-admin__fields { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: 1fr; }
  .photo-choice { grid-template-columns: auto minmax(0, 1fr); }
  .photo-choice > .button { grid-column: 1 / -1; }
}

@media (max-width: 44rem) {
  .prototype-banner { position: relative; display: flex; min-height: 2.8rem; flex-direction: column; gap: .25rem; line-height: 1.3; text-align: center; }
  .topbar { top: 0; min-height: 5.1rem; padding: .75rem 1rem; }
  .topbar-actions .button { display: none; }
  main { padding: 1rem 1rem 6.5rem; }
  .welcome-row, .page-intro, .status-card { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
  .welcome-actions, .request-row { align-items: stretch; flex-direction: column; }
  .welcome-actions .button, .request-row .button { width: 100%; }
  .welcome-row h2, .page-intro h2 { font-size: clamp(2.25rem, 12vw, 3.6rem); }
  .status-card .button, .page-intro .button { width: 100%; }
  .metric-grid, .preference-grid, .support-link-grid, .pass-grid, .policy-list, .more-grid { grid-template-columns: 1fr; }
  .metric-grid article { grid-template-columns: auto auto 1fr; }
  .filter-row { grid-template-columns: 1fr; }
  .batch-entry-row { grid-template-columns: 1fr; }
  .filter-row .search-field { grid-column: auto; }
  .people-workspace { display: block; min-height: 0; }
  .people-list { border-right: 0; }
  .person-detail { display: none; }
  .people-workspace.is-detail-open .people-list { display: none; }
  .people-workspace.is-detail-open .person-detail { display: block; }
  .person-detail__back { display: inline-flex !important; margin-bottom: 1rem; }
  .detail-grid, .permission-grid { grid-template-columns: 1fr; }
  .unsaved-bar, .sticky-save { bottom: 4.7rem; flex-wrap: wrap; }
  .unsaved-bar span, .sticky-save span { width: 100%; }
  .unsaved-bar .button, .sticky-save .button { flex: 1; }
  .need-row { grid-template-columns: auto minmax(0, 1fr); }
  .need-row .button { grid-column: 1 / -1; }
  .photo-choice { grid-template-columns: 1fr; text-align: left; }
  .photo-choice .avatar { justify-self: start; }
  .update-card__author { grid-template-columns: auto minmax(0, 1fr); }
  .update-card__author .badge { grid-column: 2; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .toast { right: .75rem; bottom: calc(5.25rem + env(safe-area-inset-bottom)); left: .75rem; max-width: none; }
  .modal { width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0; border: 0; border-top: 5px solid var(--primary); }
}

@media (min-width: 44.01rem) {
  .person-detail__back { display: none !important; }
}

@media (max-width: 58rem) and (max-height: 44rem) {
  .people-workspace { display: block; min-height: 0; }
  .people-list { border-right: 0; }
  .person-detail { display: none; }
  .people-workspace.is-detail-open .people-list { display: none; }
  .people-workspace.is-detail-open .person-detail { display: block; }
  .person-detail__back { display: inline-flex !important; margin-bottom: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar, .mobile-nav, .unsaved-bar, .sticky-save { background: var(--surface); backdrop-filter: none; }
  .modal::backdrop { backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root, html[data-theme] { --line: currentColor; --muted: var(--ink); }
  .topbar, .mobile-nav, .unsaved-bar, .sticky-save { background: var(--surface); backdrop-filter: none; }
  .button, .icon-button, .panel, .update-card, .preference-grid article, .support-link-grid article { border-width: 2px; }
}
