/* SPDX-License-Identifier: AGPL-3.0-only */
/* Layout and components. Colors come from themes.css custom properties (SPEC section 10);
   the design rules behind them are in docs/design.md, the visual direction in D-097:
   frosted glass over an illustrated seasonal scene, rounded type, a sidebar on wide screens
   and a floating tab bar on phones. */
:root {
  --space: 1rem; --radius: 20px; --radius-sm: 12px; --radius-lg: 28px;
  --shadow: 0 1px 2px rgb(0 0 0 / 5%), 0 6px 18px -8px rgb(0 0 0 / 14%);
  --shadow-lg: 0 18px 50px -18px rgb(0 0 0 / 35%), 0 2px 6px rgb(0 0 0 / 8%);
  --content: 72rem; --narrow: 38rem; --sidebar-w: 16.5rem;
  --bar-h: 3.5rem; --band: clamp(260px, 40vh, 440px); --overlap: 9rem;
  --blur: blur(28px) saturate(1.7);
  --spring: cubic-bezier(0.3, 1.5, 0.5, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 100%; }
@media (max-width: 40rem) { html { font-size: 106.25%; } }
body {
  margin: 0; min-width: 0; min-height: 100vh; overflow-wrap: anywhere; position: relative;
  font-family: var(--font); line-height: 1.5; font-feature-settings: "ss01", "cv11";
  background: var(--bg); color: var(--text);
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 0.5rem; }
h1 { font-size: 2.1rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 750; margin-top: 2rem; }
h3 { font-size: 1.05rem; font-weight: 700; margin-top: 1.25rem; }
p { margin: 0 0 0.75rem; }
img, svg { max-width: 100%; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.narrow { max-width: var(--narrow); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 0.5rem; z-index: 80; border-radius: var(--radius-sm); }
.skip-link:focus { left: 0.5rem; top: 0.5rem; }
.num, .metrics dd, .big-number, table.data td { font-variant-numeric: tabular-nums; }

/* ---- Scene, particles and glass ---- */
/* The scene is a banner across the top of every page; the content sheet overlaps its foot. */
.scene { position: absolute; top: 0; left: 0; right: 0; height: var(--band); z-index: 0; pointer-events: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
.particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; width: 100%; height: 100%; }
.scene-art { display: none; width: 100%; height: 100%; }
body[data-theme="christmas"] .scene-christmas, body[data-theme="hanukkah"] .scene-hanukkah,
body[data-theme="kwanzaa"] .scene-kwanzaa, body[data-theme="neutral"] .scene-neutral { display: block; }
.scene .stop-sky-top { stop-color: var(--scene-sky-top); }
.scene .stop-sky-bottom { stop-color: var(--scene-sky-bottom); }
.scene .stop-glow { stop-color: var(--scene-glow); stop-opacity: 0.55; }
.scene .stop-clear { stop-opacity: 0; }
.scene .f-far { fill: var(--scene-far); } .scene .f-mid { fill: var(--scene-mid); }
.scene .f-near { fill: var(--scene-near); } .scene .f-ground { fill: var(--scene-ground); }
.scene .f-glow { fill: var(--scene-glow); } .scene .f-star { fill: var(--scene-star); }
.scene .f-deco-1 { fill: var(--scene-deco-1); } .scene .f-deco-2 { fill: var(--scene-deco-2); }
.scene .f-deco-3 { fill: var(--scene-deco-3); }
.scene .s-deco-1 { fill: none; stroke: var(--scene-deco-1); stroke-width: 12; stroke-linecap: round; }
.scene .s-string { fill: none; stroke: var(--scene-near); stroke-width: 2; opacity: 0.6; }
.scene .stars { opacity: 0.85; } .scene .cloud { opacity: 0.55; } .scene .shine { opacity: 0.45; }
.scene .window { opacity: 0.75; }
.celebrate { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; }

.glass, .bottom-nav {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-lg);
}
/* The main sheet paints its glass on a layer underneath: a backdrop-filter on the sheet itself
   would make it the containing block for fixed children (the phone "Add gift" button). */
main.page.glass { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; border: 0; box-shadow: none; position: relative; }
main.page.glass::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-lg);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .bottom-nav, main.page.glass::before { background: var(--glass-strong); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .bottom-nav, main.page.glass::before { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .scene { opacity: 0.4; }
}

/* ---- App shell: sidebar (wide), header and floating tab bar (phones) ---- */
.shell { position: relative; z-index: 1; padding: calc(var(--band) - var(--overlap)) 1rem 1rem; }
main.page { max-width: var(--content); margin: 0 auto; padding: 1.75rem 2rem 2.25rem; border-radius: var(--radius-lg); animation: settle 0.5s var(--ease) backwards; }
.site-header { position: sticky; top: 0; z-index: 20; }
.site-header .bar { border-width: 0 0 1px; border-radius: 0; box-shadow: none; padding: 0 var(--space); min-height: var(--bar-h); display: flex; gap: 0.75rem; align-items: center; }
.site-name { font-weight: 800; color: var(--text); text-decoration: none; display: inline-flex; gap: 0.6rem; align-items: center; min-height: 44px; margin-right: auto; letter-spacing: -0.01em; }
.site-name img { width: 28px; height: 28px; transition: transform 0.4s var(--spring); }
.site-name:hover img { transform: rotate(-8deg) scale(1.08); }
.site-footer { max-width: var(--content); margin: 1rem auto 0; padding: 0.6rem 1.25rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; color: var(--muted); font-size: 0.85rem; border-radius: 999px; box-shadow: none; }
.motion-toggle { font-weight: 600; color: var(--muted); }
.motion-toggle[aria-pressed="true"] { color: var(--accent); }

.sidebar { display: none; }
.bottom-nav { display: none; }
@media (min-width: 48rem) {
  body.has-bottom-nav .site-header .bar { display: none; }
  body.has-bottom-nav .shell { margin-left: calc(var(--sidebar-w) + 1rem); }
  .sidebar {
    display: flex; flex-direction: column; gap: 0.9rem; position: fixed; z-index: 20;
    top: 1rem; bottom: 1rem; left: 1rem; width: var(--sidebar-w); padding: 1.1rem 0.85rem 0.85rem;
    border-radius: var(--radius-lg); overflow-y: auto; scrollbar-width: thin;
  }
  .sidebar .site-name { margin: 0 0.35rem; font-size: 1.02rem; line-height: 1.2; }
  .sidebar .site-name img { width: 32px; height: 32px; }
}
.sidebar .search { position: relative; display: flex; align-items: center; }
.sidebar .search .icon { position: absolute; left: 0.75rem; color: var(--muted); pointer-events: none; width: 1.1rem; height: 1.1rem; }
.sidebar .search input { padding-left: 2.35rem; padding-right: 0.85rem; border-radius: 999px; background: var(--surface); }
.side-nav { display: grid; gap: 2px; }
.side-nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.side-nav a { min-height: 44px; display: flex; align-items: center; gap: 0.65rem; padding: 0 0.75rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-weight: 600; transition: background 0.2s, transform 0.25s var(--spring); }
.side-nav a img { width: 22px; height: 22px; flex: none; }
.side-nav a:hover { background: var(--accent-soft); transform: translateX(2px); }
.side-nav a[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.side-nav .nav-new { color: var(--accent); }
.nav-heading { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0.9rem 0.75rem 0.25rem; font-weight: 750; }
.sidebar-foot { margin-top: auto; display: grid; gap: 0.35rem; }
.sidebar-foot .motion-toggle { justify-content: flex-start; }
.account-menu summary { width: 100%; min-height: 52px; padding: 0 0.6rem; border-radius: var(--radius-sm); color: var(--text); font-weight: 650; }
.account-menu summary:hover { background: var(--accent-soft); }
.account-menu summary .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu ul { left: 0; right: 0; }

/* Phones (D-117): the content starts right under a slim top bar. The scene stays as a short
   strip behind the bar and the sheet's top instead of a banner pushing the page down, and
   the bar scrolls away (the floating tab bar is the phone's navigation). */
@media (max-width: 47.99rem) {
  :root { --band: 10.5rem; --overlap: 9.25rem; --bar-h: 3.25rem; }
  .site-header { position: relative; }
  .site-name { font-size: 0.98rem; }
  .site-name img { width: 24px; height: 24px; }
  body.has-bottom-nav .shell { padding-bottom: 7rem; }
  main.page { padding: 1.1rem 1rem 1.5rem; border-radius: 24px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 25;
    left: max(0.75rem, env(safe-area-inset-left)); right: max(0.75rem, env(safe-area-inset-right));
    bottom: calc(0.75rem + env(safe-area-inset-bottom)); padding: 0.3rem; border-radius: 26px;
  }
  /* Direct children only: the account menu's own links must keep the menu's row layout. */
  .bottom-nav > a, .bottom-nav > .menu > summary { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem; min-height: 54px; color: var(--muted); text-decoration: none; font-size: 0.74rem; font-weight: 700; border-radius: 20px; transition: transform 0.25s var(--spring), background 0.2s; }
  .bottom-nav > a:active, .bottom-nav > .menu > summary:active { transform: scale(0.92); }
  .bottom-nav > .menu[open] > summary { color: var(--accent); }
  .bottom-nav [aria-current="page"] { color: var(--accent); background: var(--surface); box-shadow: var(--shadow); }
  .bottom-nav .menu ul { right: 0; left: auto; min-width: 16rem; }
  /* Account is a menu button: fill the cell like the links so its icon lines up with theirs. */
  .bottom-nav > .menu > summary { height: 100%; width: 100%; }
  body.has-bottom-nav .toasts { bottom: 6.25rem; }
  .site-footer { border-radius: var(--radius); }
}

/* Signed-out pages (sign-in, setup, recovery, invite and reset links): one centered sheet. */
main.page:not(.glass) { background: var(--surface); box-shadow: var(--shadow-lg); }
body:not(.has-bottom-nav) main.page { max-width: 32rem; margin: 0 auto; padding: 2rem 1.75rem; }
body:not(.has-bottom-nav) main.page form > button[type="submit"] { width: 100%; }
body:not(.has-bottom-nav) main.page input:not([type="checkbox"]):not([type="radio"]), body:not(.has-bottom-nav) main.page select { max-width: none; }
body:not(.has-bottom-nav) .site-footer { max-width: 32rem; justify-content: center; }
@media (max-width: 34rem) { body:not(.has-bottom-nav) main.page { padding: 1.5rem 1.1rem; } }
/* ---- Sign in (D-101): a friendly, centred card on the generic theme ---- */
.auth-head { text-align: center; margin: 0 0 1.5rem; }
.auth-mark { display: block; margin: -0.25rem auto 0.75rem; animation: bob 4s ease-in-out infinite; filter: drop-shadow(0 6px 12px rgb(0 0 0 / 15%)); }
.auth-eyebrow { margin: 0 0 0.25rem; font-size: 0.85rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.auth-head h1 { font-size: 2.2rem; margin: 0 0 0.35rem; }
.auth-lede { margin: 0; color: var(--muted); }
.auth-form .field { margin-bottom: 1rem; }
.auth-form input:not([type="checkbox"]) { min-height: 52px; font-size: 1.05rem; padding: 0 1rem; border-radius: 14px; }
.auth-form button[type="submit"] { min-height: 52px; font-size: 1.05rem; margin-top: 0.25rem; }
.auth-or { display: flex; align-items: center; gap: 0.75rem; margin: 1.1rem 0; color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.auth-alt { width: 100%; min-height: 52px; font-size: 1.02rem; }
.auth-help { margin: 1.25rem 0 0; text-align: center; font-size: 0.9rem; }

/* ---- Buttons: primary (one per screen), secondary, quiet, danger. Pills, 44 px tall. ---- */
button, .button, input, select, textarea { font: inherit; }
button, .button {
  min-height: 44px; min-width: 44px; padding: 0.55rem 1.1rem; border-radius: 999px; cursor: pointer;
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
  text-decoration: none; font-weight: 700; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  transition: transform 0.25s var(--spring), filter 0.2s, background 0.2s, box-shadow 0.2s;
}
button:hover, .button:hover { filter: brightness(0.97); }
button:active, .button:active { transform: scale(0.95); }
/* The main submit of a page form is primary; small inline forms stay secondary. */
.page form:not(.inline-form, .quiet-form, .menu *) > button[type="submit"]:not(.secondary):not(.quiet):not(.danger),
button.primary, .button.primary {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 22%), 0 6px 16px -6px var(--accent);
}
.page form:not(.inline-form, .quiet-form, .menu *) > button[type="submit"]:not(.secondary):not(.quiet):not(.danger):hover,
button.primary:hover, .button.primary:hover { filter: brightness(1.08); }
button.secondary, .button.secondary { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
button.quiet, .button.quiet, .link-button {
  background: none; border-color: transparent; color: var(--accent); font-weight: 700; padding-inline: 0.7rem;
}
.link-button { text-decoration: underline; text-underline-offset: 3px; }
button.quiet:hover, .button.quiet:hover, .link-button:hover { background: var(--accent-soft); }
button.danger, .button.danger { color: var(--warning); border-color: transparent; background: none; }
button.danger:hover, .button.danger:hover { background: var(--warning-soft); }
button.danger-solid { background: var(--warning); color: var(--surface); border-color: var(--warning); }
button.small, .button.small { min-height: 36px; padding: 0.35rem 0.85rem; font-size: 0.9rem; }
@media (pointer: coarse) { button.small, .button.small { min-height: 44px; } }

/* ---- Forms: one column, labels above fields ---- */
input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="url"],
input[type="date"], input[type="number"], input:not([type]), select, textarea {
  min-height: 44px; width: 100%; max-width: 32rem; padding: 0.55rem 0.85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 1px var(--accent); }
textarea { min-height: 6rem; }
/* Draw dropdowns ourselves: Safari's native select ignores min-height and looks squat. */
select:not([multiple]) {
  -webkit-appearance: none; appearance: none; padding-right: 2.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) 50%, calc(100% - 0.9rem) 50%;
  background-size: 0.35rem 0.35rem; background-repeat: no-repeat;
}
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); margin: 0; }
.inline-form { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0; }
.field { margin: 0 0 1.25rem; }
.field > label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.field input[type="checkbox"] + label { display: inline; font-weight: 400; margin-left: 0.4rem; }
fieldset { border: 0; border-radius: var(--radius); padding: 0.85rem 1.1rem; margin: 0 0 1.25rem; background: var(--glass-strong); box-shadow: var(--shadow); }
legend { font-weight: 750; padding: 0 0.35rem; float: left; width: 100%; margin-bottom: 0.35rem; }
legend + * { clear: both; }
fieldset > div > div, fieldset label:has(> input[type="radio"]), fieldset label:has(> input[type="checkbox"]) {
  min-height: 44px; display: flex; align-items: center; gap: 0.6rem;
}
fieldset label:has(> input:checked) { font-weight: 700; }
.help, .meta { color: var(--muted); font-size: 0.9rem; }
.help { margin: 0.35rem 0 0; }
/* A page's subheading (title, then a line of help) keeps room before the content below. */
h1 + .help { margin-bottom: 1.5rem; }
.help + :is(.settings-list, .card, .table-wrap, .people-board) { margin-top: 1.25rem; }
.error, .warning { color: var(--warning); }
/* ---- Errors and notices (D-120): a soft tinted card with a round badge, the field itself
   outlined and nudged, all in the theme's colors. ---- */
.form-errors, .messages > li {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.75rem; row-gap: 0; align-items: start;
  margin: 0 0 1.25rem; padding: 0.85rem 1.1rem 0.85rem 0.9rem; border-radius: var(--radius);
  background: var(--warning-soft); color: var(--text); font-weight: 600; line-height: 1.45;
  box-shadow: inset 0 0 0 1px var(--line); animation: rise-soft 0.4s var(--spring) backwards;
}
.form-errors::before, .messages > li::before, p.error::before {
  content: "!"; grid-row: span 20; display: inline-grid; place-items: center; flex: none;
  width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--warning); color: var(--surface);
  font-weight: 900; font-size: 0.95rem; line-height: 1; box-shadow: 0 0 0 4px var(--warning-soft);
}
.form-errors > p { margin: 0; padding-top: 0.1rem; }
.form-errors > p + p { margin-top: 0.35rem; }
/* Flash messages: errors look like the cards above; everything else is a friendly check. */
.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: 0.6rem; }
.messages > li { margin: 0; padding-top: 0.75rem; padding-bottom: 0.75rem; }
.messages > li:not(.message-error, .message-warning) { background: var(--accent-soft); }
.messages > li:not(.message-error, .message-warning)::before { content: "✓"; background: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
/* Under a field: a short line with a small badge; the field gets a warm outline and a nudge. */
p.error { display: flex; align-items: center; gap: 0.45rem; margin: 0.45rem 0 0; font-size: 0.92rem; font-weight: 650; }
p.error::before { width: 1.2rem; height: 1.2rem; font-size: 0.72rem; box-shadow: none; }
.field-invalid :is(input:not([type="checkbox"], [type="radio"]), select, textarea), [aria-invalid="true"]:not([type="checkbox"], [type="radio"]) {
  border-color: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); animation: nudge 0.4s var(--ease);
}
.field-invalid :is(input, select, textarea):focus-visible, [aria-invalid="true"]:focus-visible {
  border-color: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft), 0 0 0 1px var(--warning);
}
.person-group > header > p.error, .add-hero > p.error { flex-basis: 100%; }
.add-hero-big > p.error { justify-content: center; }
@keyframes nudge { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); } }
.warning { font-weight: 700; }
.check { display: flex; gap: 0.6rem; align-items: center; min-height: 44px; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 1rem 0; }
/* Buttons stacked outside a flex row still get the same breathing room. */
form:not(.actions) > button + button { margin-top: 0.75rem; }
/* Text after a button never sits on it: whatever follows a form (or a button inside one) gets
   room. Headings keep their own larger top margin. */
main form:not(.inline-form, .actions, .menu *) + :not(h1, h2, h3, form.inline-form) { margin-top: 1rem; }
main :is(button, .button) + :is(p, .help, div:not(.actions)) { margin-top: 0.85rem; }
.page > form:not(.inline-form), .narrow-form { max-width: var(--narrow); }
/* The gift page also opens as a sheet outside <main>, where the rule above doesn't reach:
   keep room under Save before the Photo card. */
.narrow-form { margin-bottom: 1.5rem; }

/* ---- Menus (details) ---- */
.menu { position: relative; }
.menu summary { min-height: 44px; display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; color: var(--accent); list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu ul {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--glass-edge);
  border-radius: 18px; box-shadow: var(--shadow-lg); list-style: none; padding: 0.4rem; margin: 0; min-width: 14rem; z-index: 40;
  animation: pop 0.22s var(--spring) backwards; transform-origin: top right;
}
.menu.up ul { top: auto; bottom: calc(100% + 6px); transform-origin: bottom left; }
.menu.left ul { left: 0; right: auto; }
.menu li a, .menu li button { display: flex; min-height: 44px; align-items: center; gap: 0.55rem; width: 100%; padding: 0 0.75rem; border-radius: var(--radius-sm); border: 0; background: none; color: var(--text); text-decoration: none; font-weight: 600; justify-content: flex-start; box-shadow: none; }
.menu li a:hover, .menu li button:hover { background: var(--surface-2); filter: none; }
.menu li.sep { border-top: 1px solid var(--line); margin: 0.35rem 0.5rem; }
.menu li .danger, .menu li button.danger { color: var(--warning); }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.9rem; flex: none; }

/* ---- Page heading and holiday header ---- */
.page-head { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; justify-content: space-between; margin: 0 0 1.5rem; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 0.6rem; }
.page-head .meta { margin: 0.3rem 0 0; }
.holiday-header { margin-bottom: 1.25rem; }
/* Switching sections (D-114): only what's under the header fades; it dims if loading lags. */
#main[aria-busy="true"] > .holiday-header ~ * { opacity: 0.55; transition: opacity 0.2s ease 0.15s; }
.holiday-header h1 img { width: 40px; height: 40px; animation: bob 4s ease-in-out infinite; }
.status { font-weight: 750; color: var(--accent); }

/* ---- Tabs and segmented controls: a soft track with a raised pill for the current one ---- */
.tabs, .segmented {
  display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--surface-2);
  max-width: 100%; overflow-x: auto; scrollbar-width: none; box-shadow: inset 0 1px 2px rgb(0 0 0 / 6%);
}
.tabs { margin: 1rem 0 0.25rem; }
.tabs a, .tabs summary, .segmented a {
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0 1rem;
  border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 700; white-space: nowrap;
  transition: background 0.2s, color 0.2s, transform 0.25s var(--spring);
}
.segmented a { font-size: 0.92rem; color: var(--text); }
.tabs a:hover, .segmented a:hover { color: var(--text); }
.tabs a:active, .segmented a:active { transform: scale(0.95); }
.tabs [aria-current="page"], .segmented a[aria-current="page"], .segmented a[aria-current="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
@media (pointer: coarse) { .tabs a, .segmented a { min-height: 44px; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; margin: 0 0 1rem; }
.toolbar h2 { margin: 0; }
.toolbar-end { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* ---- Cards: frosted, borderless, softly raised ---- */
.card, .table-wrap, .review, .settings-list, details.section, .quick-add, .totals, ol.timeline.card,
.people-board[data-layout="list"] {
  background: var(--glass-strong); border: 1px solid var(--glass-edge); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 1.15rem 1.35rem; margin: 0 0 1rem; animation: rise 0.55s var(--ease) backwards; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.cards, .card-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.card-grid > :nth-child(2), .bento > :nth-child(2) { animation-delay: 0.05s; }
.card-grid > :nth-child(3), .bento > :nth-child(3) { animation-delay: 0.1s; }
.card-grid > :nth-child(4), .bento > :nth-child(4) { animation-delay: 0.15s; }
.card-grid > :nth-child(n + 5), .bento > :nth-child(n + 5) { animation-delay: 0.2s; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.12rem 0.65rem; border-radius: 999px; font-size: 0.8rem; font-weight: 750; background: var(--surface); white-space: nowrap; box-shadow: inset 0 0 0 1px var(--line); }
.chip-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px var(--surface-2); }
.chip-idea { color: var(--stage-idea); } .chip-bought { color: var(--stage-bought); }
.chip-wrapped { color: var(--stage-wrapped); } .chip-away { color: var(--sw-orange); }
.chip .icon { width: 0.95rem; height: 0.95rem; }
.stage-bar, .flags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0.5rem 0; }
.flag { font-size: 0.78rem; border-radius: 999px; padding: 0.05rem 0.55rem; background: var(--surface-2); color: var(--muted); font-weight: 700; }
.empty {
  text-align: center; padding: 2.25rem 1rem; background: var(--glass-strong); border-radius: var(--radius);
  color: var(--muted); border: 2px dashed var(--line);
}
.empty::before { content: ""; display: block; width: 72px; height: 72px; margin: 0 auto 0.75rem; background: url("../img/theme-neutral.834928828feb.svg") center / contain no-repeat; animation: bob 4s ease-in-out infinite; }
body[data-theme="christmas"] .empty::before { background-image: url("../img/theme-christmas.dc3939ca48fb.svg"); }
body[data-theme="hanukkah"] .empty::before { background-image: url("../img/theme-hanukkah.0a1c2d65e90b.svg"); }
body[data-theme="kwanzaa"] .empty::before { background-image: url("../img/theme-kwanzaa.e1c198591511.svg"); }
.empty p { margin: 0 0 0.75rem; }
.empty strong { color: var(--text); font-size: 1.1rem; }

/* ---- Gift rows: one line of facts, one next-step button, everything else under "More" ---- */
.gift-list { list-style: none; padding: 0; margin: 0; }
.gift-card {
  background: var(--glass-strong); border: 1px solid var(--glass-edge); border-radius: 16px; padding: 0.75rem 0.9rem;
  margin: 0 0 0.6rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.55rem 0.5rem; align-items: start;
  grid-template-areas: "main more" "next next";
  box-shadow: var(--shadow); transition: transform 0.25s var(--spring), box-shadow 0.2s;
}
.gift-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.gift-card:focus-within, .gift-card:focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.gift-card.htmx-added, .gift-card.just-changed { animation: pop 0.45s var(--spring) backwards; }
/* The gift's text gets the full width: "⋯" sits top-right, the next step on its own row. */
.gift-card .gift-main { grid-area: main; min-width: 0; display: flex; gap: 0.75rem; align-items: flex-start; }
.gift-card .gift-text { min-width: 0; }
.gift-card header { display: flex; gap: 0.35rem 0.5rem; align-items: center; flex-wrap: wrap; min-height: 36px; }
.gift-title { font-weight: 750; color: var(--text); text-decoration: none; }
.gift-title:hover { text-decoration: underline; }
.gift-card .meta { margin: 0.2rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.45rem; }
.gift-card .meta > * + *::before { content: "·"; margin-right: 0.45rem; color: var(--muted); }
/* Price, editable in place on the card (D-100). */
/* The whole card opens the gift's details (D-103). */
#main .gift-card { cursor: pointer; }
#main .gift-card :is(a, button, summary, input, label) { cursor: auto; }
#main .gift-card :is(a, button, summary) { cursor: pointer; }
/* Gift details panel: from the right on wide screens, a bottom sheet on phones. */
.gift-sheet {
  position: fixed; inset: 0 0 0 auto; width: min(38rem, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh;
  margin: 0 0 0 auto; padding: 0; border: 0; border-radius: var(--radius-lg) 0 0 var(--radius-lg); overflow: auto;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.gift-sheet[open] { animation: slide-in 0.4s var(--spring) backwards; }
.gift-sheet::backdrop { background: rgb(0 0 0 / 38%); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.gift-sheet-bar {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding: 0.6rem 0.9rem;
  background: var(--surface);
}
.gift-sheet-body { padding: 0.75rem 1.5rem 2rem; }
.gift-sheet .back-link { display: none; }
.gift-sheet .narrow, .gift-sheet .narrow-form { max-width: none; }
.gift-sheet .page-head { margin-bottom: 1rem; }
.price-edit > summary {
  display: inline-flex; align-items: center; gap: 0.2rem; min-height: 32px; cursor: pointer; list-style: none; color: inherit;
  text-decoration: underline dotted; text-underline-offset: 3px; border-radius: 8px;
}
.price-edit > summary::-webkit-details-marker { display: none; }
.price-edit > summary:hover { color: var(--accent); }
.price-edit > summary .icon { width: 1rem; height: 1rem; }
.price-edit[open] { flex-basis: 100%; }
.price-edit[open]::before { display: none; }
.price-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.3rem 0 0.2rem; }
.price-form label { font-weight: 700; font-size: 0.85rem; color: var(--text); }
.price-form input { width: 7.5rem; min-height: 40px; }
.price-form button { min-height: 40px; }
.gift-card .flags { margin: 0.3rem 0 0; }
.gift-card.stage-wrapped .gift-title { text-decoration: line-through; text-decoration-color: var(--stage-wrapped); text-decoration-thickness: 2px; }
.card-actions { display: contents; }
.card-actions > form { grid-area: next; justify-self: start; margin: 0; }
.card-actions > details.more { grid-area: more; }
.card-actions > details.more > summary { min-height: 36px; }
@media (pointer: coarse) { .card-actions > details.more > summary { min-height: 44px; min-width: 44px; justify-content: center; } }
.gift-card .more ul { min-width: 17.5rem; }
/* Words never break mid-word inside controls and labels (only overly long user text wraps). */
button, .button, .chip, .rem, .tabs a, .segmented a, .menu li a, .menu li button, .who-name { overflow-wrap: normal; word-break: normal; }
.gift-card .more form { margin: 0; }
.gift-card .more .stage-form { display: flex; gap: 0.4rem; padding: 0.5rem 0.75rem; align-items: center; }
.gift-card .more .stage-form select { min-height: 40px; width: auto; flex: 1; }
.gift-card .more .flag-toggle .icon { color: var(--sw, var(--accent)); }
.gift-card .more .flag-toggle[aria-pressed="true"] { font-weight: 800; color: var(--text); }
.gift-card .more .flag-toggle[aria-pressed="true"]::after { content: "✓"; margin-left: auto; color: var(--sw, var(--accent)); }
.menu .menu-label { padding: 0.35rem 0.75rem 0.1rem; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stage-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.25rem; padding: 0.25rem 0.5rem 0.5rem; margin: 0; }
.menu .stage-pick button { justify-content: center; min-height: 40px; padding: 0 0.4rem; border-radius: 999px; background: var(--surface-2); font-weight: 750; white-space: nowrap; font-size: 0.92rem; }
.menu .stage-pick button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }


/* ---- People cards (a holiday's main list, grouped by person) ---- */
.people-board { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); align-items: start; }
.person-group { margin: 0; padding: 1rem 1.1rem 0.6rem; }
.person-group > header { display: flex; gap: 0.85rem; align-items: center; margin: 0 0 0.6rem; }
.person-group > header .who { flex: 1; min-width: 0; }
.person-group > header h2, .person-group > header h3 { margin: 0; font-size: 1.15rem; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: center; }
.person-group > header h2 a { color: var(--text); text-decoration: none; }
.person-group > header h2 a:hover { text-decoration: underline; }
.person-group > header .meta { margin: 0; display: block; }
.person-group .gift-list { margin: 0 -0.35rem; }
.person-group .gift-card { background: none; border: 0; box-shadow: none; margin: 0; padding: 0.85rem 0.4rem; border-top: 1px solid var(--line); border-radius: 0; }
.person-group .gift-card:hover { transform: none; background: var(--surface-2); border-radius: var(--radius-sm); }
.person-group > .meta { padding: 0.25rem 0 0.6rem; margin: 0; }
/* List layout (D-112, the default): one panel, a compact row per person with the add field
   on the row, their gifts indented under the name. Scans top to bottom; no ragged gaps. */
.people-board[data-layout="list"] { display: block; padding: 0.15rem 1rem; }
[data-layout="list"] .person-group { padding: 0.65rem 0; border-top: 1px solid var(--line); }
[data-layout="list"] .person-group:first-child { border-top: 0; }
[data-layout="list"] .person-group > header { margin: 0; gap: 0.5rem 0.75rem; flex-wrap: wrap; }
[data-layout="list"] .person-group > header .who { flex: 1 1 9rem; }
[data-layout="list"] .person-group > header h2 { font-size: 1.05rem; }
[data-layout="list"] .ring { width: 40px; height: 40px; }
[data-layout="list"] .ring .initial { font-size: 0.95rem; }
[data-layout="list"] .card-add { flex: 0 1 19rem; margin: 0; }
[data-layout="list"] .gift-list { margin: 0.4rem 0 0 calc(40px + 0.75rem - 0.4rem); }
[data-layout="list"] .gift-card {
  grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "main next more";
  align-items: center; padding: 0.4rem 0.4rem; border-top-color: transparent;
}
[data-layout="list"] .gift-card + .gift-card { border-top-color: var(--line); }
[data-layout="list"] .gift-card header { min-height: 32px; }
[data-layout="list"] .card-actions > form { justify-self: end; }
@media (max-width: 47.99rem) {
  [data-layout="list"] .card-add { flex: 1 1 100%; }
  [data-layout="list"] .gift-list { margin-left: -0.4rem; }
  [data-layout="list"] .card-actions > form { justify-self: start; }
  /* Phones (D-117): the gift's text gets the full width and "⋯" sits beside the next step,
     so a title and its stage chip usually share one line. With no next step, "⋯" stays
     top-right. */
  .gift-card, [data-layout="list"] .gift-card {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main main" "next more"; align-items: center; row-gap: 0.65rem;
  }
  [data-layout="list"] .gift-card { padding: 0.85rem 0.4rem; }
  [data-layout="list"] .person-group { padding: 1rem 0 0.5rem; }
  [data-layout="list"] .person-group > header { gap: 0.75rem; }
  [data-layout="list"] .gift-list { margin-top: 0.5rem; }
  .gift-card:not(:has(.card-actions > form)), [data-layout="list"] .gift-card:not(:has(.card-actions > form)) { grid-template-areas: "main more"; align-items: start; }
  .gift-card header { min-height: 28px; }
}
.ring { width: 52px; height: 52px; flex: none; position: relative; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--surface-2); stroke-width: 5; }
.ring .value { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray 0.8s var(--ease); animation: ring-in 1s var(--ease) backwards; }
.ring .initial { font-weight: 800; font-size: 1.1rem; color: var(--accent); }
.ring.done .value { stroke: var(--stage-wrapped); }
.ring.done .initial { color: var(--stage-wrapped); }

/* ---- File drop box (CSV import, D-112) ---- */
.drop-zone {
  position: relative; display: grid; justify-items: center; gap: 0.5rem; text-align: center; padding: 1.75rem 1rem; margin: 1rem 0;
  border: 2px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface-2);
  transition: border-color 0.2s, background 0.2s;
}
.drop-zone > .icon { width: 2rem; height: 2rem; color: var(--accent); }
.drop-zone p { margin: 0; }
.drop-zone.dragging, .drop-zone:focus-within { border-color: var(--accent); }
.drop-zone.dragging { background: var(--surface); }
/* The real file field stays in the page (keyboard, screen readers, no JavaScript) but the
   label button is what people see. */
.drop-zone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* ---- Summary, progress and metrics ---- */
.summary { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: center; margin: 0.25rem 0 1rem; color: var(--muted); }
.summary strong { color: var(--text); }
.progress { width: 100%; height: 0.7rem; accent-color: var(--accent); appearance: none; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 0.35rem 0 0.75rem; }
.progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
.progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.progress::-moz-progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: 0.6rem; margin: 0.5rem 0 1rem; }
.metrics div { background: var(--surface); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; }
.metrics dt { font-size: 0.82rem; color: var(--muted); font-weight: 600; } .metrics dd { margin: 0; font-weight: 800; font-size: 1.2rem; }

/* ---- Quick add and filters ---- */
.quick-add { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin: 0 0 1.25rem; padding: 0.85rem; }
.quick-add .field { margin: 0; flex: 1 1 12rem; }
.quick-add .field:nth-of-type(2) { flex: 0 1 12rem; }
.quick-add input, .quick-add select { max-width: none; }
.quick-add .help { display: none; }
/* Title-first add (D-098): one big friendly field, then "Who's it for?" */
.page > form.add-hero, .add-hero { display: block; max-width: none; padding: 1rem 1.15rem 1.1rem; margin: 0 0 0.85rem; animation: settle 0.5s var(--ease) backwards; }
.add-label { display: flex; align-items: center; gap: 0.45rem; font-weight: 800; font-size: 1.15rem; margin: 0 0 0.55rem; }
.add-label .icon { color: var(--accent); width: 1.4rem; height: 1.4rem; }
.add-row { display: flex; gap: 0.5rem; align-items: stretch; }
.add-row input { flex: 1; min-width: 0; max-width: none; }
.add-hero .add-row input { min-height: 56px; font-size: 1.15rem; padding: 0 1.2rem; border-radius: 999px; }
.add-hero .add-row button { min-height: 56px; padding: 0 1.35rem; white-space: nowrap; }
.card-add { display: flex; gap: 0.4rem; align-items: center; margin: 0.35rem -0.35rem 0.6rem; }
.card-add input { flex: 1; min-width: 0; max-width: none; border-radius: 999px; background: var(--surface-2); border-color: transparent; }
.card-add input:focus { background: var(--surface); border-color: var(--border); }
.card-add button { min-width: 44px; padding: 0; border-radius: 50%; }
.gift-card.just-added { animation: just-added 1.4s var(--ease) backwards; }
.who-sheet {
  width: min(34rem, calc(100vw - 1.5rem)); max-height: min(85vh, 44rem); overflow: auto; padding: 1.35rem 1.35rem 1rem;
  border: 1px solid var(--glass-edge); border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
}
.who-sheet[open] { animation: sheet-up 0.45s var(--spring) backwards; }
.who-sheet::backdrop { background: rgb(0 0 0 / 38%); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.who-sheet h2, .who-page h2 { margin: 0 0 0.15rem; font-size: 1.5rem; }
.who-gift { margin: 0 0 1rem; font-size: 1.15rem; font-weight: 750; color: var(--accent); }
.who-grid { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); margin: 0 0 1.1rem; }
.who-chip {
  display: flex; align-items: center; gap: 0.65rem; min-height: 64px; padding: 0.55rem 0.8rem 0.55rem 0.55rem; text-align: left;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 18px; box-shadow: none;
  transition: transform 0.25s var(--spring), background 0.2s;
}
.who-chip:hover { background: var(--accent-soft); filter: none; }
.who-chip .ring { width: 42px; height: 42px; }
.who-chip .ring .initial { font-size: 1rem; }
.who-text { min-width: 0; display: grid; }
.who-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-meta { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.who-new > label { display: block; font-weight: 700; margin: 0 0 0.35rem; }
.who-cancel { margin: 0.85rem 0 0; text-align: center; }
.who-cancel button { width: 100%; }
/* The glanceable budget line on the gift list; details live on "People & budget". */
.budget-line {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 0.75rem; margin: 0 0 1rem; padding: 0.65rem 1.1rem;
  background: var(--glass-strong); border: 1px solid var(--glass-edge); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--muted); text-decoration: none; transition: transform 0.25s var(--spring), box-shadow 0.2s;
}
.budget-line:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.budget-line strong { color: var(--text); }
.budget-line .progress { grid-column: 1 / -1; grid-row: 2; height: 0.45rem; margin: 0.4rem 0 0.1rem; }
.budget-go { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--accent); font-weight: 750; }
.budget-go .icon { width: 1rem; height: 1rem; transition: transform 0.25s var(--spring); }
.budget-line:hover .budget-go .icon { transform: translateX(3px); }
.progress.near::-webkit-progress-value, .near .progress::-webkit-progress-value { background: var(--accent-2); }
.progress.near::-moz-progress-bar, .near .progress::-moz-progress-bar { background: var(--accent-2); }
.progress.over::-webkit-progress-value, .over .progress::-webkit-progress-value { background: var(--warning); }
.progress.over::-moz-progress-bar, .over .progress::-moz-progress-bar { background: var(--warning); }
.progress.slim { height: 0.4rem; margin: 0.15rem 0 0.25rem; max-width: 18rem; }
.budget-card .budget-head { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: flex-start; justify-content: space-between; }
.budget-card h2 { margin: 0 0 0.25rem; }
.budget-big { margin: 0 0 0.15rem; font-size: 1.1rem; color: var(--muted); }
.budget-big strong { font-size: 2.1rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.section-title { margin-top: 1.5rem; }
.add-person { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; margin: 1.25rem 0; }
.add-person .field { margin: 0; flex: 1 1 12rem; }
.add-person input { max-width: none; }
.filters, .bulk { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: end; margin: 0.5rem 0; }
.filters label, .bulk label { display: grid; gap: 0.25rem; font-weight: 700; font-size: 0.9rem; }
.filters input, .filters select, .bulk select { width: auto; max-width: 100%; }
.filters > label, .bulk > label { min-width: 0; max-width: 100%; }
.filters select, .bulk select { width: 100%; }
.filters .check { align-self: center; display: inline-flex; font-weight: 600; }
.filters-end { margin-left: auto; }
td.nowrap { white-space: nowrap; }
/* Table row actions: one quiet row of equal icon buttons (labelled for screen readers). */
.row-actions { display: flex; gap: 0.15rem; align-items: center; justify-content: flex-end; flex-wrap: nowrap; }
.row-actions .icon-button { min-width: 40px; min-height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
@media (pointer: coarse) { .row-actions .icon-button { min-width: 44px; min-height: 44px; } }
.filters > label.check { display: flex; align-items: center; align-self: center; font-weight: 500; }
details.disclosure { margin: 0 0 1rem; }
.card details.disclosure:last-child { margin-bottom: 0; }
details.disclosure > summary { min-height: 44px; display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; color: var(--accent); font-weight: 700; padding: 0 0.75rem; border-radius: 999px; list-style: none; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary:hover { background: var(--accent-soft); }
details.disclosure[open] > summary { margin-bottom: 0.5rem; }
details.section { padding: 0 1.1rem; margin: 0 0 1rem; }
details.section > summary { min-height: 56px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 750; list-style: none; }
details.section > summary::-webkit-details-marker { display: none; }
details.section[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
details.section > summary .icon { transition: transform 0.3s var(--spring); }
details.section[open] > summary .icon { transform: rotate(180deg); }
details.section form + form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ---- Board (by stage): soft lanes ---- */
.board { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); align-items: start; }
.column { background: var(--surface-2); border-radius: var(--radius); padding: 0.75rem; box-shadow: inset 0 1px 2px rgb(0 0 0 / 5%); }
.column h2 { font-size: 0.95rem; margin: 0.15rem 0.25rem 0.7rem; display: flex; justify-content: space-between; align-items: center; }
.column .gift-card { background: var(--surface); }
@supports selector(:has(a)) {
  .board .select-gift { display: none; }
  #bulk-form:has(details[open]) + .board .select-gift { display: flex; }
}
/* ---- Reminders (D-099): colored chips, tick rows and chip-style choices ---- */
.sw-red { --sw: var(--sw-red); } .sw-orange { --sw: var(--sw-orange); } .sw-gold { --sw: var(--sw-gold); }
.sw-green { --sw: var(--sw-green); } .sw-teal { --sw: var(--sw-teal); } .sw-blue { --sw: var(--sw-blue); }
.sw-purple { --sw: var(--sw-purple); } .sw-slate { --sw: var(--sw-slate); }
.reminders { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0.5rem 0 0; }
.reminders > li { flex: none; }
.rem {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.6rem 0.1rem 0.45rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 750; color: var(--sw, var(--muted)); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; white-space: nowrap;
}
.rem .icon { width: 0.95rem; height: 0.95rem; }
.rem.place { color: var(--muted); }
a.rem:hover { box-shadow: inset 0 0 0 1px var(--sw, var(--accent)); }
p.rem { margin: 0 0 1rem; font-size: 0.95rem; }
.ticks { list-style: none; padding: 0; margin: 0.35rem 0 0.6rem; display: grid; gap: 0.35rem; }
.tick-row form { margin: 0; }
.tick {
  width: 100%; justify-content: flex-start; gap: 0.55rem; min-height: 44px; padding: 0.4rem 0.75rem; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); border: 1px solid var(--line); font-weight: 650; text-align: left;
}
.tick:hover { filter: none; border-color: var(--sw, var(--accent)); }
.tick .icon { color: var(--sw, var(--accent)); }
.tick .box {
  width: 1.35rem; height: 1.35rem; flex: none; display: grid; place-items: center; border-radius: 7px;
  border: 2px solid var(--sw, var(--accent)); background: var(--surface);
}
.tick.done .box { background: var(--sw, var(--accent)); }
.tick.done .box .icon { color: var(--surface); width: 0.95rem; height: 0.95rem; stroke-width: 3; }
.tick.done .tick-text { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.tick.done { animation: pop 0.35s var(--spring) backwards; }
.mode-item { padding: 0.75rem 0; border-top: 1px solid var(--line); }
.card h3 + .mode-item, .card .place-line + .mode-item { border-top: 0; padding-top: 0.25rem; }
.mode-title { margin: 0 0 0.25rem; }
.place-line { display: flex; align-items: center; gap: 0.35rem; margin: 0.25rem 0 0.25rem; }
.place-line .icon { width: 1rem; height: 1rem; }
.buy-form { margin-top: 0.4rem; }
.reminder-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; margin: 0 0 1rem; }
.reminder-summary .rem { font-size: 0.85rem; padding-top: 0.25rem; padding-bottom: 0.25rem; }
.reminder-summary .all-reminders { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 750; text-decoration: none; }
.reminder-summary .all-reminders .icon { width: 1rem; height: 1rem; }
.reminder-group h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.reminder-group h3 .rem { font-size: 0.95rem; padding: 0.2rem 0.75rem 0.2rem 0.55rem; }
.reminder-group h3 .meta { font-weight: 600; font-size: 0.9rem; }
.chip-choices { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip-choices legend { font-weight: 700; margin-bottom: 0.4rem; padding: 0; }
.chip-choice {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; padding: 0 0.9rem 0 0.7rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--sw, var(--text)); font-weight: 700; cursor: pointer;
}
.chip-choice input { width: 1.1rem; height: 1.1rem; accent-color: var(--sw, var(--accent)); }
.chip-choice:has(input:checked) { border-color: var(--sw, var(--accent)); box-shadow: inset 0 0 0 1px var(--sw, var(--accent)); }
.chip-choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
/* What kind and how many, under the reminder that asks (D-118). */
.reminder-detail { margin: -0.5rem 0 1.25rem; padding: 0.75rem 1rem 0.9rem; }
.reminder-detail[hidden] { display: none; }
.reminder-detail legend { display: flex; align-items: center; gap: 0.4rem; color: var(--sw, var(--text)); }
.detail-fields { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: 0.75rem; }
.detail-fields .field { margin: 0; display: block; min-height: 0; }
.rem .rem-detail { color: var(--text); font-weight: 700; }
/* A summary chip with totals can be long: let it wrap rather than widen the page. */
.reminder-summary .rem { white-space: normal; max-width: 100%; flex-wrap: wrap; row-gap: 0; }
.reminder-summary .rem .rem-detail { color: var(--muted); font-weight: 650; }
.kind-totals { margin: 0.1rem 0 0.75rem; display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; align-items: center; }
.kind-totals .total { display: inline-flex; align-items: baseline; gap: 0.3rem; padding: 0.2rem 0.75rem; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 650; }
.kind-totals .total strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; color: var(--sw, var(--accent)); }

/* ---- Guided steps, codes, timelines ---- */
.steps { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; list-style: none; color: var(--muted); margin: 0 0 1.25rem; font-size: 0.9rem; }
.steps li { display: inline-flex; align-items: center; gap: 0.35rem; }
.steps li + li::before { content: ""; width: 1rem; height: 2px; border-radius: 2px; background: var(--line); }
.steps [aria-current="step"] { color: var(--accent); font-weight: 800; }
.codes { font-family: ui-monospace, monospace; font-size: 1.1rem; padding: 1rem; border: 2px dashed var(--border); border-radius: var(--radius); white-space: pre-wrap; background: var(--surface); }
.link-list { padding-left: 1.25rem; } .link-list li { margin: 0.5rem 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
ol.timeline.card { padding: 0.25rem 1.25rem; }
.review { padding: 1.1rem 1.35rem; }
.review dt { font-weight: 700; color: var(--muted); font-size: 0.9rem; } .review dd { margin: 0 0 0.75rem; }
.wizard-cancel { float: right; }
.conflict { border: 2px solid var(--warning); padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; background: var(--surface); }

/* Photos */
.gift-photo { height: auto; border-radius: var(--radius); }
.gift-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius-sm); flex: none; }

/* Tables scroll inside themselves, never the page (320 px rule) */
.table-wrap { overflow-x: auto; max-width: 100%; position: relative; }
.match-status[data-state="ok"] { color: var(--accent); font-weight: 700; }
.match-status[data-state="no"] { color: var(--muted); }
table.sessions, table.data { border-collapse: collapse; width: 100%; }
table.sessions th, table.sessions td, table.data th, table.data td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: normal; word-break: normal; }
table.sessions tr:last-child td, table.data tr:last-child td { border-bottom: 0; }
table.sessions th, table.data th { font-size: 0.82rem; color: var(--muted); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
table.data tbody tr { transition: background 0.15s; }
table.data tbody tr:hover { background: var(--surface-2); }

/* ---- Dashboard: hero spotlight and bento tiles ---- */
.spotlight { position: relative; overflow: hidden; padding: 1.5rem 1.5rem 1.25rem; background: linear-gradient(140deg, var(--accent-soft), var(--glass-strong) 60%); }
.spotlight::after { content: ""; position: absolute; right: -30px; bottom: -40px; width: 200px; height: 200px; background: url("../img/theme-neutral.834928828feb.svg") center / contain no-repeat; opacity: 0.1; transform: rotate(-12deg); pointer-events: none; }
.spotlight[data-theme="christmas"]::after { background-image: url("../img/theme-christmas.dc3939ca48fb.svg"); }
.spotlight[data-theme="hanukkah"]::after { background-image: url("../img/theme-hanukkah.0a1c2d65e90b.svg"); }
.spotlight[data-theme="kwanzaa"]::after { background-image: url("../img/theme-kwanzaa.e1c198591511.svg"); }
.spotlight > * { position: relative; z-index: 1; }
.hero-top { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.25rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.75rem; font-weight: 800; color: var(--accent); margin: 0 0 0.25rem; }
.spotlight h2 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; }
.countdown { margin: 0; text-align: right; line-height: 1; }
.countdown .big-number { display: block; font-size: clamp(3rem, 9vw, 4.75rem); font-weight: 850; letter-spacing: -0.04em; color: var(--accent); }
.countdown .unit { display: block; font-weight: 750; margin-top: 0.3rem; }
.countdown .ticker { display: block; font-size: 0.85rem; color: var(--muted); font-weight: 650; margin-top: 0.35rem; font-variant-numeric: tabular-nums; min-height: 1.2em; }
.countdown.text-only .big-number { font-size: clamp(1.8rem, 5vw, 2.6rem); }
.bento { display: grid; gap: 0.75rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 1rem; }
.tile { background: var(--surface); border-radius: 18px; padding: 0.9rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; animation: rise 0.55s var(--ease) backwards; transition: transform 0.3s var(--spring); }
.tile:hover { transform: translateY(-2px); }
.tile.wide { grid-column: span 2; }
.tile .label { color: var(--muted); font-size: 0.85rem; font-weight: 700; display: flex; align-items: center; gap: 0.35rem; }
.tile .big-number { font-size: 2rem; font-weight: 850; letter-spacing: -0.03em; line-height: 1.1; }
.tile .progress { margin: 0.4rem 0 0.2rem; }
.tile p { margin: 0; }
.tile .ring { width: 44px; height: 44px; align-self: flex-start; }
@media (max-width: 60rem) { .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 26rem) { .bento { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .tile.wide { grid-column: 1 / -1; } .tile .big-number { font-size: 1.6rem; } }
.totals { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding: 0.85rem 1.1rem; margin: 0 0 1rem; }
.nudge { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: space-between; padding: 0.85rem 1.1rem; border-radius: var(--radius); background: var(--accent-soft); margin: 0 0 1.25rem; }
.nudge p { margin: 0; }
.nudge .icon { margin-right: 0.35rem; }
/* D-122: a dashboard card opens its holiday's list wherever it's tapped (app.js), and says
   so: the spotlight's name carries an arrow, and each holiday card ends in an "Open list" strip. */
[data-card-link] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.spotlight h2 a { color: inherit; text-decoration: none; }
.spotlight h2 a .icon { width: 0.7em; height: 0.7em; color: var(--accent); vertical-align: 0.05em; transition: transform 0.25s var(--spring); }
.spotlight h2 a:hover .icon, .holiday-card:hover .card-chyron .icon { transform: translateX(3px); }
.holiday-card { --pad-x: 1.35rem; --pad-b: 1.15rem; display: flex; flex-direction: column; overflow: hidden; }
.card-chyron {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin: auto calc(-1 * var(--pad-x)) calc(-1 * var(--pad-b));
  padding: 0.6rem var(--pad-x); border-top: 1px solid var(--line); background: var(--accent-soft); color: var(--text); font-weight: 700; font-size: 0.92rem;
}
.holiday-card > .card-chyron { margin-top: auto; }
.holiday-card > :nth-last-child(2) { margin-bottom: 0.85rem; }
.card-chyron .icon { color: var(--accent); transition: transform 0.25s var(--spring); }
[data-card-link]:active { transform: scale(0.985); }
.holiday-card { transition: transform 0.3s var(--spring), box-shadow 0.2s; }
.holiday-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.holiday-card h2, .holiday-card h3 { margin: 0 0 0.25rem; font-size: 1.15rem; display: flex; gap: 0.5rem; align-items: center; }
.holiday-card h2 a, .holiday-card h3 a { color: var(--text); text-decoration: none; }
.holiday-card h2 a:hover, .holiday-card h3 a:hover { text-decoration: underline; }
.holiday-card .progress { margin-bottom: 0.25rem; }

/* ---- Settings: left navigation on wide screens, a list on phones ---- */
.settings { display: grid; gap: 1.25rem; }
.settings > * { min-width: 0; }
.settings-nav ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 0.25rem; overflow-x: auto; }
.settings-nav h2 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0.75rem 0.6rem 0.25rem; }
.settings-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 0.85rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; white-space: nowrap; font-weight: 650; }
.settings-nav a:hover { background: var(--surface-2); }
.settings-nav [aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 800; }
@media (min-width: 64rem) {
  .settings { grid-template-columns: 13rem 1fr; }
  .settings-nav ul { flex-direction: column; overflow: visible; }
  .settings-nav a { display: flex; }
}
@media (max-width: 63.99rem) { .settings-nav h2 { display: none; } .settings-nav ul { flex-wrap: nowrap; } }
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.settings-list { list-style: none; padding: 0; margin: 0; overflow: hidden; }
.settings-list li + li { border-top: 1px solid var(--line); }
.settings-list a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.1rem; color: var(--text); text-decoration: none; min-height: 56px; }
.settings-list a:hover { background: var(--surface-2); }
.settings-list a > span { display: grid; gap: 0.1rem; }
.settings-list .icon { color: var(--muted); }
.people-list { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.person-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.person-row > * { min-width: 0; max-width: 100%; }
.person-main { flex: 1 1 12rem; }
.person-row h2 { font-size: 1.1rem; margin: 0 0 0.15rem; display: flex; gap: 0.5rem; align-items: center; }
.person-row h2 a { color: var(--text); text-decoration: none; }
.person-row p { margin: 0.1rem 0 0; }
.person-actions { display: flex; gap: 0.5rem; align-items: center; }
.person-actions label { font-weight: 700; font-size: 0.9rem; }
.person-actions input { width: 7rem; }
input[type="file"] { max-width: 100%; }

/* ---- Toasts (aria-live region) ---- */
.toasts { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); display: grid; gap: 0.5rem; z-index: 60; width: min(92vw, 30rem); }
/* See-through and frosted (D-113); --toast is checked for AA in build_themes.py. */
.toast { background: var(--toast); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); color: var(--bg); padding: 0.6rem 0.75rem 0.6rem 1.1rem; border-radius: 999px; display: flex; gap: 1rem; align-items: center; justify-content: space-between; box-shadow: var(--shadow-lg); animation: toast-in 0.45s var(--spring) backwards; transition: opacity 0.25s ease, transform 0.25s ease; }
.toast button { background: var(--bg); color: var(--text); border-color: var(--bg); }
.toast.is-bumped { animation: toast-bump 0.3s var(--spring); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }
@media (prefers-reduced-transparency: reduce) {
  .toast { background: var(--text); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---- Phones (D-096): everything important fits on one screen, thumbs reach the actions ---- */
.holiday-header .page-head { flex-wrap: nowrap; align-items: flex-start; }
.holiday-header .page-head > div { min-width: 0; }
.holiday-menu summary { padding: 0 0.75rem; border-radius: 999px; font-weight: 700; }
.holiday-menu summary:hover { background: var(--accent-soft); }
.holiday-menu ul { right: 0; }
.fab { display: none; }
button, .button, summary, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (max-width: 47.99rem) {
  .shell { padding-left: max(0.6rem, env(safe-area-inset-left)); padding-right: max(0.6rem, env(safe-area-inset-right)); }
  .site-header .bar { padding-left: max(var(--space), env(safe-area-inset-left)); padding-right: max(var(--space), env(safe-area-inset-right)); }
  h1 { font-size: 1.7rem; }
  .page-head { margin-bottom: 1.25rem; }
  .holiday-header h1 img { width: 30px; height: 30px; }
  .holiday-header .page-head { margin-bottom: 0.6rem; }
  .holiday-header { margin-bottom: 1rem; }
  .holiday-menu summary .label { display: none; }
  /* Four tabs share the width instead of scrolling. */
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; margin: 0.25rem 0 1rem; }
  .tabs a { padding: 0 0.25rem; font-size: 0.9rem; }
  .tabs a .icon { display: none; }
  /* Quick filters share the width too. */
  .toolbar { gap: 0.5rem; }
  .segmented { display: flex; width: 100%; }
  .segmented a { flex: 1 1 auto; justify-content: center; padding: 0 0.35rem; font-size: 0.85rem; min-width: 0; white-space: normal; overflow-wrap: normal; text-align: center; line-height: 1.1; }
  /* Summary and quick add stay compact so the list starts on the first screen. */
  .card { padding: 0.9rem 1rem; }
  .holiday-card { --pad-x: 1rem; --pad-b: 0.9rem; }
  .page > form.add-hero, .add-hero { padding: 0.95rem 1rem 1rem; margin-bottom: 1rem; }
  .add-label { font-size: 1.05rem; margin-bottom: 0.6rem; }
  .add-hero .add-row input { min-height: 52px; font-size: 1.05rem; padding: 0 1rem; }
  /* Narrow phones: the field gets the room, Add becomes a round "+" (name kept for AT). */
  .add-hero .add-row button { min-height: 52px; width: 52px; padding: 0; border-radius: 50%; }
  .add-hero .add-row button .icon { width: 1.5rem; height: 1.5rem; }
  .add-hero .btn-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* Budget: one line of text, then the bar with "Budget →" beside it. The ideas estimate is on
     the Budget page. */
  .budget-line { font-size: 0.95rem; padding: 0.8rem 1.05rem 0.75rem; margin-bottom: 1.1rem; gap: 0 0.9rem; }
  .budget-line .budget-text { grid-column: 1 / -1; }
  .budget-line .progress { grid-column: 1; grid-row: 2; height: 0.55rem; margin: 0.55rem 0 0.2rem; }
  .budget-line .budget-go { grid-column: 2; grid-row: 2; }
  .budget-word, .budget-ideas { display: none; }
  .toolbar { margin-bottom: 1rem; }
  /* Board: view switch, Filter and the count share one row; an open filter gets its own. */
  .board-toolbar { justify-content: flex-start; gap: 0.25rem 0.5rem; }
  .board-toolbar > .meta { margin-left: auto; order: 1; }
  .board-toolbar > details.disclosure { margin: 0; }
  .board-toolbar > details.disclosure[open] { order: 2; flex-basis: 100%; }
  .tab-more { display: none; }
  /* A gift's "⋯" menu opens as a bottom sheet (D-099); tapping the dimmed page closes it. */
  .gift-card details.more[open] > ul {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; min-width: 0; max-height: 80vh; overflow: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 0.75rem 0.75rem calc(1rem + env(safe-area-inset-bottom));
    z-index: 70; animation: sheet-up 0.35s var(--spring) backwards;
  }
  /* The page sits in its own layer under the top bar and tab bar; lift it above both while a
     sheet is open so the sheet and its dimmed backdrop cover the whole screen. */
  .shell:has(details.more[open]) { z-index: 30; }
  /* A transform or running animation on an ancestor would pin the sheet to that card. */
  .card:has(details.more[open]), .gift-card:has(details.more[open]) { animation: none; transform: none; }
  /* The button's hover filter and press transform would pin the backdrop to the button
     mid-tap, so the tap that should close the sheet would miss it. */
  .gift-card details.more[open] > summary,
  .gift-card details.more[open] > summary:hover,
  .gift-card details.more[open] > summary:active { transform: none; filter: none; }
  .gift-card details.more[open] > summary::before { content: ""; position: fixed; inset: 0; background: rgb(0 0 0 / 38%); z-index: 65; cursor: default; }
  .gift-sheet {
    inset: auto 0 0 0; width: 100%; height: 92dvh; max-height: 92dvh; margin: auto 0 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .gift-sheet[open] { animation: sheet-up 0.4s var(--spring) backwards; }
  .gift-sheet .narrow-form > button[type="submit"] { bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
  .gift-sheet-body { padding: 0.5rem 1rem 1.5rem; }
  /* "Who's it for?" rises from the bottom like a native sheet. */
  .who-sheet {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
  .quick-add { padding: 0.7rem; gap: 0.5rem; }
  .quick-add .field { flex: 1 1 100%; }
  .quick-add .field:nth-of-type(2) { flex: 1 1 8rem; }
  .quick-add label { font-size: 0.9rem; margin-bottom: 0.2rem; }
  .quick-add > button { flex: 0 0 auto; }
  .person-group { padding: 0.85rem 0.85rem 0.4rem; }
  /* Dashboard: the countdown sits beside the holiday's name, not under it. */
  .spotlight { padding: 1.25rem 1.15rem 1.15rem; }
  .hero-top { flex-wrap: nowrap; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
  .hero-top > div { min-width: 0; }
  .spotlight h2 { font-size: 1.5rem; }
  .countdown { flex: none; text-align: right; }
  .countdown .big-number { font-size: 3rem; }
  .countdown .unit { margin-top: 0.25rem; }
  .countdown.text-only .big-number { font-size: 1.3rem; }
  /* Open list across the width; the two modes side by side under it. */
  .spotlight .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; margin: 1.1rem 0 0.15rem; }
  .spotlight .actions .primary { grid-column: 1 / -1; }
  .spotlight .actions .button { padding-inline: 0.6rem; }
  /* Settings: every section in one sideways-scrolling row instead of three stacked rows. */
  .settings { gap: 1.25rem; }
  .settings-nav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem 0.25rem; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav ul { flex: none; overflow: visible; }
  .settings-nav a { padding: 0 0.95rem; border-radius: 999px; }
  .settings-nav [aria-current="page"] { scroll-margin-inline: 1rem; }
  /* One-handed "Add gift" button above the floating tab bar. */
  .fab {
    display: inline-flex; align-items: center; gap: 0.4rem; position: fixed; z-index: 24;
    right: max(1rem, env(safe-area-inset-right)); bottom: calc(5.75rem + env(safe-area-inset-bottom));
    min-height: 54px; padding: 0 1.2rem; border-radius: 999px; background: var(--accent); color: var(--accent-text);
    font-weight: 800; text-decoration: none; box-shadow: 0 10px 28px -8px var(--accent), var(--shadow-lg);
    animation: pop 0.4s var(--spring) backwards;
  }
  .fab[hidden] { display: none; }
  /* Long forms keep Save in reach. */
  .narrow-form > button[type="submit"] {
    position: sticky; bottom: calc(5.5rem + env(safe-area-inset-bottom)); z-index: 5; width: 100%;
    box-shadow: var(--shadow-lg);
  }
  /* People: budget and Save on one row. */
  .person-actions { width: 100%; flex-wrap: wrap; }
  .person-actions .inline-form { flex: 1 1 14rem; flex-wrap: nowrap; min-width: 0; }
  .person-actions input { flex: 1; width: auto; min-width: 4.5rem; }
}
/* Phones: on the gift list, adding a gift fills most of the first screen; the list is its own
   section under it (the floating "Add gift" button takes over once it scrolls away). */
.add-art, .list-title { display: none; }
@media (max-width: 47.99rem) {
  .page > form.add-hero-big, .add-hero-big {
    min-height: max(19rem, calc(100svh - 27rem)); display: flex; flex-direction: column; justify-content: center; align-items: stretch;
    text-align: center; padding: 1.5rem 1.15rem 1.6rem; margin-bottom: 1.75rem;
  }
  .add-hero-big .add-art { display: block; width: 76px; height: 76px; margin: 0 auto 0.85rem; animation: bob 4s ease-in-out infinite; filter: drop-shadow(0 6px 12px rgb(0 0 0 / 15%)); }
  .add-hero-big .add-label { justify-content: center; font-size: 1.65rem; font-weight: 800; letter-spacing: -0.015em; margin-bottom: 1.1rem; }
  .add-hero-big .add-label .icon { display: none; }
  .add-hero-big .add-row { flex-direction: column; gap: 0.8rem; }
  .add-hero-big .add-row input { min-height: 60px; font-size: 1.15rem; text-align: center; }
  .add-hero-big .add-row button { width: 100%; min-height: 56px; padding: 0 1.35rem; border-radius: 999px; font-size: 1.1rem; }
  .add-hero-big .add-row button .icon { width: 1.35rem; height: 1.35rem; }
  .add-hero-big .btn-text { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .list-title { display: block; margin: 0 0 0.9rem; font-size: 1.4rem; }
}
@media (max-width: 22rem) {
  h1 { font-size: 1.45rem; }
  .holiday-header h1 img { width: 24px; height: 24px; }
  .spotlight h2 { font-size: 1.35rem; }
  .countdown .big-number { font-size: 2.5rem; }
  .spotlight .actions .button .icon { display: none; }
  .segmented a { font-size: 0.78rem; padding: 0 0.15rem; }
  /* Very narrow phones (and wider system fonts): the four tabs still fit, and if a font is
     wider still they scroll inside their own bar instead of widening the page. */
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { font-size: 0.8rem; padding: 0 0.1rem; white-space: nowrap; }
}

/* ---- Motion. Entrances move but never fade, so text is always readable and testable. ---- */
@keyframes settle { from { transform: translateY(10px) scale(0.995); } }
@keyframes rise { from { transform: translateY(14px); } }
@keyframes pop { 0% { transform: scale(0.94); } 100% { transform: none; } }
@keyframes toast-in { from { transform: translateY(20px) scale(0.96); } }
@keyframes toast-bump { 50% { transform: scale(1.04); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-3deg); } }
@keyframes ring-in { from { stroke-dasharray: 0 100; } }
@keyframes sheet-up { from { transform: translateY(40px); } }
@keyframes slide-in { from { transform: translateX(40px); } }
@keyframes just-added { 0% { transform: translateY(-10px) scale(0.96); background: var(--accent-soft); } 60% { background: var(--accent-soft); } }
@keyframes rise-soft { from { transform: translateY(8px); } }
@keyframes unfold { from { clip-path: inset(0 0 100% 0); transform: translateY(-4px); } to { clip-path: inset(0 0 -20px 0); } }
@keyframes fill-in { from { clip-path: inset(0 100% 0 0 round 999px); } }
@keyframes pill-in { from { transform: scale(0.9); } }
@keyframes draw { from { stroke-dashoffset: 24; } }
@keyframes backdrop-in { from { opacity: 0; } }

/* Softer motion (D-119): things arrive, open and fill instead of snapping. Short, eased and
   transform-only (text never fades); all of it stops under Reduce Motion (below). */
/* A page's or holiday tab's content rises in a beat after its heading, people one by one. */
.holiday-header ~ *, #main > .page-head ~ * { animation: rise-soft 0.45s var(--ease) 0.05s backwards; }
.holiday-header ~ :nth-child(n + 4), #main > .page-head ~ :nth-child(n + 4) { animation-delay: 0.1s; }
.people-board .person-group { animation: rise-soft 0.45s var(--ease) backwards; }
.people-board .person-group:nth-child(2) { animation-delay: 0.04s; }
.people-board .person-group:nth-child(3) { animation-delay: 0.08s; }
.people-board .person-group:nth-child(4) { animation-delay: 0.12s; }
.people-board .person-group:nth-child(n + 5) { animation-delay: 0.16s; }
/* Opening a section, a filter or a gift's price unrolls it from the top. */
details.section[open] > :not(summary), details.disclosure[open] > :not(summary),
.price-edit[open] > :not(summary), .reminder-detail:not([hidden]) { animation: unfold 0.32s var(--ease) backwards; }
details.disclosure > summary .icon { transition: transform 0.3s var(--spring); }
/* The current tab and filter settle into place. */
.tabs [aria-current="page"], .segmented a[aria-current="page"], .segmented a[aria-current="true"],
.bottom-nav [aria-current="page"], .settings-nav [aria-current="page"] { animation: pill-in 0.35s var(--spring) backwards; }
/* Bars fill from the left; ticks draw their check; chosen chips give a small bounce. */
.progress { animation: fill-in 0.9s var(--ease) 0.15s backwards; }
.tick.done .box .icon path { stroke-dasharray: 24; animation: draw 0.35s var(--ease) 0.05s backwards; }
.chip-choice:has(input:checked) { animation: pop 0.3s var(--spring); }
/* Dimmed backdrops fade in behind sheets (the sheets themselves slide). */
.gift-sheet[open]::backdrop, .who-sheet[open]::backdrop { animation: backdrop-in 0.3s ease; }
/* Primary buttons lift a little under a mouse. */
@media (hover: hover) {
  .page form:not(.inline-form, .quiet-form, .menu *) > button[type="submit"]:not(.secondary):not(.quiet):not(.danger):hover,
  button.primary:hover, .button.primary:hover, .fab:hover { transform: translateY(-1px); }
}
/* "Pause effects" (festive.js) also stills the looping bobs, not just the particles. */
html[data-effects-paused] :is(.holiday-header h1 img, .auth-mark, .add-art),
html[data-effects-paused] .empty::before { animation: none; }

/* No page-to-page cross-fade (D-115): view-transition snapshots lose the backdrop blur, so the
   glass sidebar and sheet flashed see-through mid-fade. Pages switch in place instead. */

@media print {
  .site-header, .site-footer, .sidebar, .bottom-nav, .steps, form, .actions, .toasts, .scene, .particles, .celebrate, .fab { display: none !important; }
  body.has-bottom-nav .shell { margin: 0; }
  .glass, .card, main.page.glass::before { background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
