/* Reusable component styles for ChristmasHQ 2 (Heirloom style).
   Pairs with the JS components in /components/*.js — those return DOM, this
   provides the visual layer. Everything pulls from tokens.css.
*/

/* ---- App shell layout --------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  min-height: 100svh;
}

/* Responsive overrides live at the BOTTOM of this file (search for
   "Responsive overrides") so they reliably win over the base component rules
   at the same specificity. */

/* ---- Sidebar ------------------------------------------------------------ */

.sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: var(--space-5) var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
}

.sidebar-brand {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  font-size: var(--text-lg);
  color: var(--secondary);
  padding: 0 var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
/* Brand mark: pine tile with a little tree (shared by sidebar + phone header). */
.brand-mark {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 9px;
  background: var(--secondary);
  color: var(--on-secondary);
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark svg { width: 18px; height: 18px; }


.sidebar-search {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.sidebar-search::placeholder { color: var(--text-secondary); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--text-secondary) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-secondary) 55%, transparent);
  border-radius: 999px;
  border: 2px solid var(--card);
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}
.sidebar-cluster {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-cluster-head {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3) var(--space-1);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  border: 1px solid transparent;
}
.sidebar-item:hover {
  background: var(--bg);
  text-decoration: none;
}
.sidebar-item[aria-current="page"] {
  background: var(--nav-active-bg);
  color: var(--nav-active-fg);
  font-weight: 600;
}
.sidebar-item[aria-current="page"] .sidebar-icon { color: var(--nav-active-fg); }
.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-footer-mark {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  padding-top: var(--space-3);
}

/* ---- Bottom nav (mobile only) ------------------------------------------ */

.bottom-nav {
  display: none;
  grid-template-columns: repeat(5, 1fr);
  position: fixed;
  inset: auto 0 0 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  /* Above the .overlay (z 80) so taps on a tab while a drawer is open still
     reach the bottom-nav — the click handler swaps drawers instead of
     closing-only. */
  z-index: 90;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 11px;
  padding: 6px 0;
  min-height: 44px;
  background: none;
  border: 0;
  cursor: pointer;
}
.bottom-nav-item { font-weight: 600; gap: 3px; }
.bottom-nav-item[aria-current="page"] { color: var(--nav-active-fg); }
.bottom-nav-item .sidebar-icon { width: 22px; height: 22px; color: inherit; }
/* Active tab: the icon sits in a soft pill. */
.bottom-nav-item[aria-current="page"] .sidebar-icon {
  width: 54px; height: 30px; padding: 4px 16px;
  border-radius: var(--radius-pill);
  background: var(--nav-active-bg);
}

/* ---- Mobile header ------------------------------------------------------ */

.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: var(--bg);
  padding: 10px var(--space-4);
  border-bottom: 1px solid var(--border);
}
.mobile-header .brand {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  color: var(--secondary);
  font-size: var(--text-md);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.mobile-header .brand-mark { width: 28px; height: 28px; border-radius: 8px; }

/* ---- Main content area -------------------------------------------------- */

main#app {
  padding: var(--space-6) var(--space-5);
  max-width: 100%;
}
main#app .view {
  max-width: var(--content-max);
  margin: 0 auto;
}
@media (max-width: 639px) {
  main#app { padding: var(--space-4); }
}

/* ---- Card / surface ----------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}
/* Stacked cards get vertical rhythm — but only outside grid rows,
   where the grid's own `gap` already spaces siblings. Without this scope,
   the second card in a dashboard grid row gets pushed down out of line. */
:not(.dash-stat-row):not(.dash-chart-row):not(.dash-list-row):not(.recipient-grid) > .card + .card { margin-top: var(--space-4); }
.card-section + .card-section { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--border); }

.card h2 { margin-bottom: var(--space-2); }
.card .subhead { color: var(--text-secondary); margin-bottom: var(--space-4); }

/* ---- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 10px var(--space-5);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--card-2); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--primary) 30%, transparent);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover { background: var(--card-2); }

.btn-danger {
  border-color: var(--primary);
  color: var(--primary-text);
  background: transparent;
}
.btn-danger:hover { background: var(--primary-soft); }
html[data-theme="dark"] .btn-danger { border-color: var(--primary-text); }

.btn-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ---- Form fields -------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-4);
}
.field label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}
.field .hint {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.input, .select {
  min-height: 44px;
  padding: 10px var(--space-3);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  width: 100%;
}
.input:focus-visible, .select:focus-visible {
  border-color: var(--secondary);
  outline-offset: 1px;
}

/* ---- Toggle (theme switch) --------------------------------------------- */

/* Theme picker: one swatch card per theme. */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
.theme-option {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px 8px 10px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  min-height: 44px;
}
.theme-option:hover { border-color: color-mix(in srgb, var(--secondary) 45%, var(--border)); }
.theme-option[aria-checked="true"] {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--secondary) 18%, transparent);
}
.theme-swatch {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 46px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.theme-swatch i { flex: 1; height: 14px; border-radius: 4px; }
.theme-name { text-align: center; line-height: 1.2; }

/* On/off switch row (e.g. Falling snow). The whole row is the label. */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  cursor: pointer;
}
.switch-row .hint { display: block; font-weight: 400; margin-top: 2px; font-size: var(--text-sm); color: var(--text-secondary); }
.switch {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 50px; height: 30px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text-secondary) 45%, var(--border));
  position: relative;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
  margin: 0;
}
.switch::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--dur-fast) var(--ease);
}
.switch:checked { background: var(--secondary); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }

/* ---- Welcome card (first-load Settings) --------------------------------- */

.welcome-card {
  background: linear-gradient(135deg, var(--accent-muted) 0%, var(--card) 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.welcome-card .welcome-body { flex: 1; }
.welcome-card h3 { margin: 0 0 6px; font-size: var(--text-md); }
.welcome-card p { margin: 0; color: var(--text-primary); }
.welcome-card .welcome-import { margin: var(--space-3) 0 var(--space-2); }
.welcome-card .btn { background: var(--card); }

/* Settings → Data & backup: "Last backed up …" */
.backup-status {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-weight: 600;
  color: var(--success);
}
.backup-status svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.backup-status.is-stale { color: var(--warn-text); }

.welcome-card .dismiss {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 0;
}
.welcome-card .dismiss:hover { color: var(--text-primary); }

/* ---- Danger zone -------------------------------------------------------- */

.danger-zone {
  border: 1px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-top: var(--space-6);
  background: transparent;
}
.danger-zone h3 { color: var(--primary-text); margin-top: 0; }
.danger-zone p { color: var(--text-secondary); }

/* ---- Meal Planner: day head + sections + steps ------------------------ */

.meal-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-2) 0 var(--space-4);
  flex-wrap: wrap;
}
.meal-day-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
}
.meal-day-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.meal-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.meal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.meal-section-head h3 {
  margin: 0;
  font-size: var(--text-md);
  font-family: var(--font-body);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-primary);
}
.meal-section-head h3 svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}
.meal-add-mini {
  min-height: 36px;
  padding: 6px 12px;
  font-size: var(--text-sm);
  color: var(--secondary);
}
.meal-add-mini svg { width: 14px; height: 14px; }
.meal-section-empty {
  margin: 0;
  padding: var(--space-2) 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.meal-section .list-row {
  background: var(--bg);
  border-radius: var(--radius-md);
  border-bottom-width: 1px;
}
.meal-section .list-row + .list-row { margin-top: var(--space-2); border-top: 1px solid var(--border); }
.meal-section .list-row:first-child,
.meal-section .list-row:last-child {
  border-radius: var(--radius-md);
}

.dish-row { align-items: flex-start; }
.dish-steps {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dish-step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 6px 0;
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.dish-step .check { width: 20px; height: 20px; }
.dish-step .dish-step-text { flex: 1; word-break: break-word; }
.dish-step.is-done .dish-step-text {
  text-decoration: line-through;
  color: var(--text-secondary);
}
.dish-step .icon-btn { min-width: 32px; min-height: 32px; padding: 4px; }
.dish-step .icon-btn svg { width: 14px; height: 14px; }
.dish-step-add {
  align-self: flex-start;
  font-size: var(--text-sm);
  min-height: 36px;
  padding: 6px 12px;
  color: var(--secondary);
}
.dish-step-add svg { width: 14px; height: 14px; }

/* Buying details fieldset (Decorations "Need to buy") */
.buy-fieldset {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4) var(--space-2);
  margin-bottom: var(--space-3);
}
.buy-fieldset[hidden] { display: none; }
.buy-fieldset-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: var(--space-2);
}
.buy-fieldset-head svg { width: 16px; height: 16px; }

.buy-summary {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  align-items: center;
}
.buy-summary svg { width: 14px; height: 14px; margin-right: 4px; color: var(--accent); vertical-align: -2px; }
.buy-summary a { color: var(--secondary); text-decoration: none; }
.buy-summary a:hover { text-decoration: underline; }
.buy-summary .buy-notes { font-style: italic; }

/* Step rows inside the Add/Edit dish modal */
.dish-step-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.dish-step-field {
  display: grid;
  grid-template-columns: 28px 1fr 36px;
  gap: var(--space-2);
  align-items: center;
}
.dish-step-field .dish-step-done {
  width: 20px;
  height: 20px;
  accent-color: var(--secondary);
  justify-self: center;
}
.dish-step-field .dish-step-text {
  min-height: 40px;
  padding: 8px var(--space-3);
}
.dish-step-field .icon-btn { min-width: 36px; min-height: 36px; padding: 4px; }
.dish-step-field .icon-btn svg { width: 14px; height: 14px; }
.dish-steps-empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-style: italic;
}

/* Chip with count badge (day tabs) + the "+ Day" add chip */
.chip .chip-count {
  font-family: var(--font-numeral);
  font-size: var(--text-xs);
  background: var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  margin-left: 4px;
}
.chip[aria-pressed="true"] .chip-count { background: rgba(255,255,255,0.25); color: var(--on-secondary); }
.chip-add {
  border-style: dashed;
  color: var(--text-secondary);
}
.chip-add svg { width: 14px; height: 14px; }

/* ---- Star rating display ----------------------------------------------- */

.rating-stars {
  display: inline-flex;
  gap: 1px;
  font-size: var(--text-sm);
  letter-spacing: 1px;
  line-height: 1;
}
.rating-stars .star { color: var(--border); }
.rating-stars .star.is-on { color: var(--accent); }

.row-notes {
  margin-top: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Quick start guide list ------------------------------------------- */

.quickstart-list {
  list-style: none;
  counter-reset: qs;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.quickstart-list li {
  counter-increment: qs;
  position: relative;
  padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-7) + var(--space-3));
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.quickstart-list li::before {
  content: counter(qs);
  position: absolute;
  left: var(--space-3);
  top: var(--space-3);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--bg);
  font-family: var(--font-numeral);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
}
.quickstart-list li strong { color: var(--text-primary); }

/* ---- Inline note / advisory (warm, never harsh — §24) ------------------ */

.note-info {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
}

/* ---- Sticky save bar (first-load Settings on mobile) ------------------- */

.sticky-save {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: var(--space-4) 0;
  margin-top: var(--space-5);
}
.sticky-save .btn-primary { width: 100%; }
@media (min-width: 640px) {
  .sticky-save { position: static; background: none; padding: 0; }
  .sticky-save .btn-primary { width: auto; }
}

/* ---- Module header ------------------------------------------------------ */

.module-header { margin-bottom: var(--space-6); }
/* Small gold capitals ("GIFTS · SHOPPING LIST") with a holly sprig — or a
   snowflake in Nordic Frost. */
.module-header .eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--eyebrow);
  margin: 0 0 6px;
}
.module-header .eyebrow::before {
  content: "";
  width: 28px; height: 20px;
  flex-shrink: 0;
  background: url("../assets/illustrations/holly.svg") center / contain no-repeat;
}
html[data-theme="nordic"] .module-header .eyebrow::before {
  width: 20px;
  background-image: url("../assets/illustrations/snowflake.svg");
}
.module-header h1 { margin-bottom: 6px; }

/* ---- Dashboard view: uniform vertical rhythm -------------------------- */
/* Every top-level child sits in a flex column with the same gap, so cards
   never inherit ad-hoc margins. */

.dash-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.dash-view > * { margin: 0; }

/* ---- Dashboard hero ---------------------------------------------------- */
/* Heirloom: cream card, garland along the top, countdown inside a wreath.
   Nordic Frost: night-sky card with a snowy cabin scene along the bottom.
   Both scenes are in the markup; the theme decides which one shows. */

.dash-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: 76px var(--space-5) var(--space-6);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--hero-top) 0%, var(--hero-bottom) 100%);
  box-shadow: var(--shadow-md);
  color: var(--hero-ink);
}
.dash-hero::after { /* gold-foil hairline just inside the edge */
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: calc(var(--radius-xl) - 6px);
  border: 1px solid var(--hero-foil);
  pointer-events: none;
  z-index: 2;
}
.dash-hero-garland {
  position: absolute;
  inset: -6px 0 auto 0;
  height: 84px;
  background: url("../assets/illustrations/garland.svg") left top / auto 84px repeat-x;
  z-index: 1;
  pointer-events: none;
}
.dash-hero .nordic-scene { display: none; }

.dash-hero-text { position: relative; z-index: 3; order: 2; min-width: 0; }
.dash-hero-date {
  margin: 0 0 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hero-eyebrow);
}
.dash-hero h1 {
  font-size: var(--text-xl);
  margin: 0 0 4px;
  color: var(--hero-ink);
  line-height: 1.12;
}
.dash-hero-sub { margin: 0; color: var(--hero-ink-2); font-size: var(--text-base); }
.dash-next-up {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-4);
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: left;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.dash-next-up:hover { text-decoration: none; border-color: var(--accent); }
.dash-next-up b { color: var(--text-primary); font-weight: 600; }
.dash-next-up svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--primary-text); }

.dash-countdown {
  position: relative;
  z-index: 3;
  order: 1;
  width: 196px;
  height: 206px;
  display: grid;
  place-items: center;
}
.dash-wreath { position: absolute; inset: 0; }
.dash-wreath svg { width: 100%; height: 100%; display: block; }
.dash-count {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -14px;
}
.dash-count-num {
  font-family: var(--font-numeral);
  font-weight: 700;
  font-size: 60px;
  line-height: 1;
  color: var(--hero-num);
  letter-spacing: -0.02em;
}
.dash-count-unit { font-size: var(--text-sm); font-weight: 600; color: var(--hero-ink-2); margin-top: 2px; }
.dash-count-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.1;
  color: var(--hero-num);
  text-align: center;
}

/* Gentle snowfall (Settings → Falling snow). Off for reduced motion. */
.dash-snow { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.dash-snow .flake {
  position: absolute;
  top: -10px;
  border-radius: 50%;
  background: var(--snow);
  box-shadow: var(--snow-glow);
  animation: hq-snowfall linear infinite;
}
@keyframes hq-snowfall { to { transform: translate3d(var(--drift, 0), 440px, 0); } }
@media (prefers-reduced-motion: reduce) { .dash-snow { display: none; } }

@media (min-width: 900px) {
  .dash-hero {
    grid-template-columns: 1fr auto;
    justify-items: start;
    align-items: center;
    text-align: left;
    padding: 84px var(--space-8) var(--space-7);
    column-gap: var(--space-6);
  }
  .dash-hero-text, .dash-countdown { order: 0; }
  .dash-hero h1 { font-size: var(--text-2xl); }
  .dash-countdown { width: 230px; height: 242px; }
  .dash-count-num { font-size: 72px; }
}

/* Nordic Frost hero: snowy night scene instead of wreath + garland. */
html[data-theme="nordic"] .dash-hero {
  border-color: transparent;
  justify-items: start;
  text-align: left;
  padding: var(--space-6) var(--space-5) 168px;
  grid-template-columns: 1fr;
}
html[data-theme="nordic"] .dash-hero-garland,
html[data-theme="nordic"] .dash-wreath { display: none; }
html[data-theme="nordic"] .dash-hero .nordic-scene {
  display: block;
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  width: 100%;
  height: 200px;
  z-index: 1;
}
html[data-theme="nordic"] .dash-hero-text { order: 1; }
html[data-theme="nordic"] .dash-countdown {
  order: 2;
  width: auto;
  height: auto;
  display: block;
}
html[data-theme="nordic"] .dash-count {
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
}
html[data-theme="nordic"] .dash-count-num { font-size: 84px; line-height: 0.9; letter-spacing: -0.04em; }
html[data-theme="nordic"] .dash-count-unit { font-size: var(--text-md); font-weight: 500; max-width: 5.5em; line-height: 1.2; }
html[data-theme="nordic"] .dash-next-up {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--hero-ink-2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
html[data-theme="nordic"] .dash-next-up b { color: var(--hero-ink); }
html[data-theme="nordic"] .dash-next-up svg { color: #F2C66D; }
@media (min-width: 900px) {
  html[data-theme="nordic"] .dash-hero {
    grid-template-columns: 1fr auto;
    align-items: end;
    padding: var(--space-7) var(--space-8) 190px;
  }
  html[data-theme="nordic"] .dash-hero .nordic-scene { height: 240px; }
  html[data-theme="nordic"] .dash-count-num { font-size: 112px; }
}

/* ---- Backup status line --------------------------------------------- */
.dash-backup {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-1);
  font-size: var(--text-sm);
  color: var(--success);
}
.dash-backup svg { width: 18px; height: 18px; flex-shrink: 0; }
.dash-backup.is-stale { color: var(--warn-text); }
.dash-backup-go {
  margin-left: auto;
  background: none;
  border: 0;
  padding: 10px 4px;
  min-height: 44px;
  color: var(--secondary);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
}
.dash-backup-go:hover { text-decoration: underline; }

/* ---- Dashboard sections + two-column layout -------------------------- */
.dash-section {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-lg);
  margin: var(--space-3) var(--space-1) 0;
}
.dash-section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.dash-layout { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
.dash-col { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
@media (min-width: 1100px) {
  .dash-layout { grid-template-columns: 1.1fr 1fr; align-items: start; }
}

/* ---- Dashboard rows (equal height + uniform gap) ---------------------- */

.dash-stat-row,
.dash-chart-row,
.dash-list-row {
  display: grid;
  gap: var(--space-3);
  align-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.dash-stat-row > *,
.dash-chart-row > *,
.dash-list-row > * { min-width: 0; }

/* Stat tiles: coloured icon chip, big figure, slim progress bar. */
.stat-tile { gap: 2px; padding: var(--space-4); }
.stat-chip {
  width: 40px; height: 40px;
  border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-3);
}
.stat-chip svg { width: 20px; height: 20px; }
.tone-gold  { --tone: var(--cat-gold);  --tone-soft: var(--cat-gold-soft); }
.tone-berry { --tone: var(--cat-berry); --tone-soft: var(--cat-berry-soft); }
.tone-pine  { --tone: var(--cat-pine);  --tone-soft: var(--cat-pine-soft); }
.tone-plum  { --tone: var(--cat-plum);  --tone-soft: var(--cat-plum-soft); }
.tone-frost { --tone: var(--cat-frost); --tone-soft: var(--cat-frost-soft); }
.stat-chip[class*="tone-"] { background: var(--tone-soft); color: var(--tone); }
.stat-tile .stat-value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.stat-tile .stat-sub { font-size: var(--text-sm); }
.stat-bar {
  height: 7px;
  margin-top: auto;
  border-radius: var(--radius-pill);
  background: var(--track);
  overflow: hidden;
}
.stat-tile .stat-sub + .stat-bar, .stat-tile .stat-value + .stat-bar { margin-top: var(--space-3); }
.stat-bar i {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--tone);
  transition: width 400ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.stat-bar.is-over i { background: var(--warn-border); }

/* Gift journey: one dot per stage, joined by a dotted line. */
.journey-card { cursor: pointer; }
.journey {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--stages, 3), minmax(0, 1fr));
}
.journey::before {
  content: "";
  position: absolute;
  top: 23px;
  left: calc(50% / var(--stages, 3));
  right: calc(50% / var(--stages, 3));
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 11px);
}
.journey-stage { position: relative; text-align: center; color: var(--tone); }
.journey-dot {
  width: 48px; height: 48px;
  margin: 0 auto 6px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card);
  border: 2px solid var(--border);
  color: var(--text-secondary);
}
.journey-stage.is-on .journey-dot { border-color: var(--tone); color: var(--tone); background: var(--tone-soft); }
.journey-dot svg { width: 20px; height: 20px; }
.journey-stage b { display: block; font-size: var(--text-lg); color: var(--text-primary); line-height: 1.1; }
.journey-stage span:last-child { font-size: var(--text-xs); color: var(--text-secondary); font-weight: 500; }

.chart-card {
  padding: var(--space-4) var(--space-5) var(--space-5);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.chart-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.chart-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  min-height: 28px;
}
.chart-card-head h3 {
  margin: 0;
  font-size: var(--text-md);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chart-card-head h3 svg { width: 18px; height: 18px; color: var(--accent); }
.chart-card-head .text-meta { white-space: nowrap; }

/* The chart-wrap is a strict-height box and the canvas is absolutely
   positioned inside it. This is Chart.js's recommended responsive layout
   and is the only reliable way to prevent ResizeObserver feedback loops
   in flex/grid parents (the canvas grows → parent grows → ResizeObserver
   fires → canvas grows again). Do not change without re-testing the
   "infinite-growth" regression on Dashboard + Analytics. */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 240px;
}
.chart-wrap > canvas {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
.dash-card-link {
  color: var(--primary-text);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
}
.dash-card-link:hover { text-decoration: underline; }
.dash-empty-line {
  margin: var(--space-2) 0 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* ---- Dashboard To-Do list -------------------------------------------- */

.todo-card { display: flex; flex-direction: column; padding: var(--space-4) var(--space-5); }
.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.todo-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.todo-item:last-child { border-bottom: 0; }
.todo-item .check { flex-shrink: 0; width: 24px; height: 24px; position: relative; }
.todo-item .check::before { content: ''; position: absolute; inset: -10px; }
.todo-text {
  flex: 1;
  min-width: 0;
  font-size: var(--text-base);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.todo-meta {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  white-space: nowrap;
}
.todo-meta.is-overdue { color: var(--primary-text); border-color: var(--tone-primary-border); background: var(--tone-primary-bg); }
.todo-item.is-done .todo-text {
  text-decoration: line-through;
  color: var(--text-secondary);
}

/* ---- Dashboard Upcoming Events --------------------------------------- */

.events-card { display: flex; flex-direction: column; padding: var(--space-4) var(--space-5); cursor: pointer; transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.events-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.events-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.event-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: var(--space-3);
  align-items: center;
}
/* Little tear-off calendar page. */
.dash-date-tile {
  text-align: center;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
}
.dash-date-tile small {
  display: block;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 0;
}
.dash-date-tile b { display: block; font-size: 22px; padding: 2px 0 4px; color: var(--text-primary); }
.event-body { min-width: 0; }
.event-title {
  font-size: var(--text-base);
  color: var(--text-primary);
  font-weight: 600;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.event-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---- Stat grid (Dashboard) --------------------------------------------- */

.stat-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  height: 100%;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.stat-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}
.stat-card-head svg { width: 18px; height: 18px; color: var(--text-secondary); }
.stat-card h3 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}
.stat-card .stat-value {
  font-family: var(--font-numeral);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.stat-card .stat-sub { color: var(--text-secondary); font-size: var(--text-sm); margin: 0; }
.stat-card .stat-card-foot { margin-top: auto; }
.stat-card.feature,
.stat-card.ring-feature {
  background: var(--card);
}

.stat-list { display: flex; flex-direction: column; gap: var(--space-2); }
.stat-list-item { font-size: var(--text-sm); color: var(--text-primary); display: flex; align-items: center; gap: var(--space-2); }
.stat-list-item .text-meta { margin-left: auto; }

/* ---- Progress ring ----------------------------------------------------- */

.progress-ring { position: relative; display: inline-block; }
.progress-ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.progress-ring-value { font-size: var(--text-xl); font-weight: 700; color: var(--secondary); line-height: 1; }
.progress-ring-label { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; }

.ring-card { display: flex; align-items: center; gap: var(--space-5); }
.ring-card .ring-side { flex: 1; }
.ring-card h3 { margin: 0 0 var(--space-2); font-size: var(--text-lg); text-transform: none; letter-spacing: var(--display-tracking); font-family: var(--font-display); font-weight: var(--display-weight); color: var(--text-primary); }
.ring-card .ring-tier {
  display: inline-block;
  align-self: flex-start;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--tone-gold-bg);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

/* ---- Budget bar -------------------------------------------------------- */

.budget-bar { display: flex; flex-direction: column; gap: 6px; }
.budget-bar-row { display: flex; justify-content: space-between; align-items: baseline; }
.budget-bar-label { font-size: var(--text-sm); color: var(--text-primary); }
.budget-bar-amount { font-size: var(--text-sm); color: var(--text-primary); }
.budget-bar-track {
  width: 100%; height: 10px;
  background: var(--track);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.budget-bar-fill {
  height: 100%;
  background: var(--secondary);
  border-radius: var(--radius-pill);
  transition: width 400ms cubic-bezier(0.2,0.7,0.2,1);
}
.budget-bar.is-over .budget-bar-fill { background: var(--warn-border); }
.budget-bar.is-over .budget-bar-label::after { content: " · over"; color: var(--warn-text); }

.budget-cat-title-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  flex: 1;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  min-width: 0;
}
.budget-cat-title-btn:hover .title { color: var(--primary-text); }
.budget-cat-title-btn:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; border-radius: 4px; }

/* ---- Empty state ------------------------------------------------------- */

.empty-state {
  background: var(--card);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-5) var(--space-7);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
/* The icon hangs inside a Christmas bauble: gold cap and a thin ribbon. */
.empty-state-icon {
  position: relative;
  width: 76px; height: 76px;
  margin-top: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.55) 0 10%, transparent 26%),
    var(--primary-soft);
  border: 2px solid color-mix(in srgb, var(--primary-text) 35%, transparent);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-text);
}
.empty-state-icon::before { /* cap */
  content: "";
  position: absolute; top: -9px; left: 50%;
  width: 18px; height: 10px; margin-left: -9px;
  border-radius: 3px 3px 2px 2px;
  background: var(--accent);
}
.empty-state-icon::after { /* ribbon */
  content: "";
  position: absolute; top: -34px; left: 50%;
  width: 2px; height: 26px; margin-left: -1px;
  background: var(--accent);
}
.empty-state-icon svg { width: 30px; height: 30px; }
.empty-state-body {
  max-width: 380px;
  color: var(--text-primary);
  font-size: var(--text-base);
  margin: 0;
}

/* ---- List rows --------------------------------------------------------- */

.list { display: flex; flex-direction: column; gap: 0; }
.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-width: 0;
  font-size: var(--text-base);
}
.list-row:first-child { border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg); }
.list-row:last-child { border-bottom-width: 1px; border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); }
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 500; color: var(--text-primary); }
.list-row .sub { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }
.list-row.is-done .title { text-decoration: line-through; color: var(--text-secondary); }

.list-section { margin-bottom: var(--space-5); }
.list-section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--space-3);
}
.list-section-head h3 { margin: 0; font-size: var(--text-md); }

.row-actions { display: flex; gap: 4px; align-items: center; }
.icon-btn {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { color: var(--text-primary); background: var(--bg); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn[data-danger="true"]:hover { color: var(--primary); }

/* ---- Checkbox / tick row ---------------------------------------------- */

.check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--text-secondary) 45%, var(--border));
  background: var(--card);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.check[aria-checked="true"] {
  background: var(--secondary);
  border-color: var(--secondary);
}
.check[aria-checked="true"]::after {
  content: '';
  width: 6px; height: 11px;
  border: 2px solid var(--on-secondary);
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.check-row { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.check-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--secondary);
}

/* ---- Status pills + filters chips ------------------------------------ */

.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.status-pill.tone-success { background: var(--tone-success-bg); border-color: var(--tone-success-border); color: var(--success); }
.status-pill.tone-info { background: var(--tone-info-bg); border-color: var(--tone-info-border); color: var(--secondary); }
.status-pill.tone-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.status-pill.tone-primary { background: var(--tone-primary-bg); border-color: var(--tone-primary-border); color: var(--primary-text); }
.status-pill.tone-secondary { background: var(--tone-gold-bg); border-color: var(--tone-gold-border); color: var(--text-primary); }

.chip-row {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  min-height: 36px;
}
.chip[aria-pressed="true"] { background: var(--secondary); border-color: var(--secondary); color: var(--on-secondary); }

/* ---- Segmented tabs (Indoor/Outdoor, day tabs, etc.) ------------------ */

.seg-tabs {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.seg-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}
.seg-tab svg { width: 16px; height: 16px; }
.seg-tab:hover { color: var(--text-primary); }
.seg-tab[aria-selected="true"] {
  background: var(--card-2);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.seg-tab .seg-count {
  font-family: var(--font-numeral);
  font-size: var(--text-xs);
  background: var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
  min-width: 20px;
  text-align: center;
}
.seg-tab[aria-selected="true"] .seg-count {
  background: var(--secondary);
  color: var(--on-secondary);
}

/* ---- Action row above lists ------------------------------------------ */

.action-bar {
  display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.action-bar .grow { flex: 1; }

/* Mobile: drop the right-aligning spacer and force the buttons to share
   the row equally instead of stacking. A row of filter chips in the bar
   (Checklist, Calendar, Decorations, Meals, Recipes, Movies) is NOT a spacer:
   it gets a full-width line of its own above the buttons and wraps. It used
   to be hidden with the spacer, so phones lost every filter. Buttons have a
   zero flex-basis, so they still share one line. */
@media (max-width: 639px) {
  .action-bar { gap: var(--space-2); flex-wrap: wrap; }
  .action-bar .grow:not(.chip-row) { display: none; }
  .action-bar .chip-row { flex: 1 1 100%; min-width: 0; margin-bottom: var(--space-1); }
  .action-bar .btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding-inline: 8px;
    white-space: nowrap;
  }
}

/* ---- FAB --------------------------------------------------------------- */

.fab {
  position: fixed;
  right: max(var(--space-5), env(safe-area-inset-right));
  bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 40;
  transition: transform var(--dur-fast) var(--ease);
}
.fab:hover { transform: translateY(-1px); }
.fab:active { transform: scale(1.04); }
.fab svg { width: 26px; height: 26px; }
/* Wherever the bottom nav shows (phones AND iPads, ≤1024px) the FAB sits
   above it. */
@media (max-width: 1024px) {
  .fab { bottom: calc(var(--bottom-nav-h) + var(--space-4) + env(safe-area-inset-bottom)); }
}

/* ---- Overlay + Sheet (modals, bottom sheets, confirms) ----------------- */

.overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(2px);
  z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  animation: hq-overlay-in var(--dur-base) var(--ease) both;
}
.overlay-bottom { align-items: flex-end; padding: 0; }
@keyframes hq-overlay-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  padding: var(--space-5);
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: hq-sheet-in var(--dur-slow) var(--ease) both;
}
.sheet-narrow { max-width: 420px; }
.sheet-bottom {
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
}
.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--border);
  margin: 0 auto var(--space-3);
}
@keyframes hq-sheet-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.sheet-header h2 { margin: 0; }
.sheet-body p { margin: 0 0 var(--space-3); }
.sheet-actions { display: flex; gap: var(--space-3); justify-content: flex-end; margin-top: var(--space-4); }
.sheet-actions .btn { min-width: 100px; }
/* Several choices: stack them full-width — first choice on top, Cancel last. */
.sheet-actions-stack { flex-direction: column; align-items: stretch; }
.sheet-actions-stack .btn { width: 100%; }
.sheet-actions-stack [data-cancel] { order: 99; }

body.overlay-open { overflow: hidden; }

/* ---- Journal photo ----------------------------------------------------- */

.journal-photo {
  display: block;
  width: 100%;
  max-width: 280px;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  cursor: zoom-in;
}
@media (max-width: 639px) {
  .journal-photo { max-width: 100%; max-height: 220px; }
}

/* ---- Calendar month grid ---------------------------------------------- */

.cal-grid {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.cal-grid-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.cal-grid-header {
  padding: 8px 4px;
  text-align: center;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}
.cal-grid-body { display: flex; flex-direction: column; }
.cal-grid-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
}
.cal-grid-row:last-child { border-bottom: 0; }

.cal-cell {
  appearance: none;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border);
  padding: 6px 6px 8px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  cursor: pointer;
  color: var(--text-primary);
  text-align: left;
  font-family: inherit;
  font-size: var(--text-sm);
  transition: background var(--dur-fast) var(--ease);
}
.cal-cell:last-child { border-right: 0; }
.cal-cell:hover:not(.cal-cell-out) { background: var(--bg); }
.cal-cell:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: -2px;
}

.cal-cell-day {
  font-family: var(--font-numeral, var(--font-display));
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}
.cal-cell-out .cal-cell-day { color: var(--text-secondary); opacity: 0.4; }
.cal-cell-today .cal-cell-day {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 999px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
}

.cal-cell-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cal-cell-item {
  font-size: 11px;
  line-height: 1.2;
  padding: 2px 4px;
  border-radius: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-left: 3px solid transparent;
  background: var(--bg);
  color: var(--text-primary);
}
.cal-cell-item-event     { border-left-color: var(--secondary); }
.cal-cell-item-task      { border-left-color: var(--accent); }
.cal-cell-item-entry     { border-left-color: var(--text-secondary); }
.cal-cell-item-tradition { border-left-color: var(--primary); }

.cal-cell-dots {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
}
.cal-cell-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-secondary);
  flex-shrink: 0;
}
.cal-cell-dot-event     { background: var(--secondary); }
.cal-cell-dot-task      { background: var(--accent); }
.cal-cell-dot-entry     { background: var(--text-secondary); }
.cal-cell-dot-tradition { background: var(--primary); }
.cal-cell-more {
  font-size: 10px;
  color: var(--text-secondary);
  margin-left: 2px;
}

/* Dots-only rendering on every viewport. Text labels expanded day cells
   unevenly and made the grid look messy — tapping a day opens the full
   list in a popup instead. */
.cal-cell-items { display: none; }
.cal-cell-dots-all { display: flex; flex-wrap: wrap; gap: 3px; padding: 0; }

@media (max-width: 1024px) { .cal-cell { min-height: 72px; padding: 4px 3px 6px; } }
@media (max-width: 639px) {
  .cal-cell { min-height: 56px; padding: 3px 2px 4px; }
  .cal-grid-header { padding: 6px 2px; font-size: 10px; }
}

/* ---- Calendar paginator ----------------------------------------------- */

.cal-paginator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}
.cal-paginator-label {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--text-primary);
}
.cal-paginator-spacer { flex: 1; }
.cal-today-btn { padding: 6px 12px; font-size: var(--text-sm); }

/* ---- More drawer (mobile bottom sheet) -------------------------------- */

.more-drawer .sheet-handle { margin-top: -8px; }
.more-drawer-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.more-drawer-cluster-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.more-drawer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}
.more-drawer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-3) var(--space-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  min-height: 80px;
  text-align: center;
}
.more-drawer-item:hover { border-color: var(--primary); }
.more-drawer-item svg { color: var(--secondary); }
.more-drawer-item span { line-height: 1.2; word-break: break-word; }

/* ---- Quick-add tabs --------------------------------------------------- */

/* All five tabs always fit — no hidden sideways scroll (audit 2026-10-05). */
.qa-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.qa-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-width: 0;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  font-weight: 600;
}
.qa-tab span { max-width: 100%; line-height: 1.15; text-align: center; white-space: nowrap; }
.qa-tab[aria-selected="true"] {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text-primary);
}
.qa-tab svg { width: 20px; height: 20px; }

/* ---- Pipeline (Gift Planner stepper) ---------------------------------- */

.pipeline { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pipeline-step {
  display: inline-flex; align-items: center;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.pipeline-step .dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--border);
  margin-right: 4px;
  border: 2px solid var(--card);
  outline: 1px solid var(--border);
}
.pipeline-step.done .dot { background: var(--success); outline-color: var(--success); }
.pipeline-step.current .dot { background: var(--accent); outline-color: var(--accent); }

/* ---- Gift Planner: tabs, person cards, gift rows ------------------------ */

.gift-tabs { display: flex; width: 100%; }
.gift-tabs .seg-tab { flex: 1 1 0; justify-content: center; text-align: center; line-height: 1.2; }
@media (max-width: 639px) {
  .gift-tabs .seg-tab { padding: 8px 6px; font-size: var(--text-xs); flex-direction: column; gap: 2px; min-height: 48px; }
  .gift-tabs .seg-tab svg { display: none; }
}

.recipient-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 900px) { .recipient-grid { grid-template-columns: repeat(2, 1fr); } }

.recipient-grid > .recipient-card { margin-top: 0; }
.recipient-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}
.recipient-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}
.recipient-head h2 {
  font-size: var(--text-lg);
  margin: 0;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.recipient-head-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  min-width: 0;
}

.recipient-budget { display: flex; flex-direction: column; gap: 6px; }
.recipient-budget-row,
.recipient-budget-meta { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.recipient-budget-bar {
  height: 8px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
}
.recipient-budget-bar-fill {
  height: 100%;
  background: var(--secondary);
  border-radius: 999px;
  transition: width 200ms ease;
}
.recipient-budget-bar.over .recipient-budget-bar-fill { background: var(--warn-border); }

.recipient-notes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-2) var(--space-3);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.recipient-notes p { margin: 0; font-size: var(--text-sm); color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; }
.gift-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; }

.gift-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.gift-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.gift-list .gift-row:first-child { border-top: 0; }
.gift-main { min-width: 0; }
.gift-title {
  font-weight: 600;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.gift-meta { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; overflow-wrap: anywhere; }
.gift-spot { display: inline-flex; align-items: center; gap: 3px; }
.gift-spot svg { width: 13px; height: 13px; }
.gift-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-primary);
  background: var(--tone-gold-bg);
  border-radius: var(--radius-pill);
  padding: 1px 8px;
}
.gift-tag svg { width: 12px; height: 12px; color: var(--cat-gold); }
.gift-controls { display: flex; align-items: center; gap: var(--space-1); }
.gift-controls .row-actions { gap: 0; }
.gift-assign { min-height: 36px; padding: 6px 12px; font-size: var(--text-sm); }
.gift-add { align-self: flex-start; }
.gift-add svg { width: 14px; height: 14px; }

/* Stage picker: a compact select tinted by stage. */
.select.select-compact {
  padding: 6px 28px 6px 10px;
  font-size: var(--text-sm);
  min-height: 36px;
  width: auto;
}
.gift-stage[class*="tone-"] {
  background-color: var(--tone-soft);
  border-color: color-mix(in srgb, var(--tone) 35%, transparent);
  color: var(--text-primary);
  font-weight: 600;
}
.stage-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--tone-soft);
  color: var(--text-primary);
  white-space: nowrap;
}

@media (max-width: 639px) {
  .gift-row { grid-template-columns: minmax(0, 1fr); }
  .gift-controls { justify-content: space-between; }
  .gift-controls .row-actions { margin-left: auto; }
}

/* ---- Where is everything? ------------------------------------------------ */
.where-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .where-grid { grid-template-columns: repeat(2, 1fr); } }
.where-grid > .card { margin-top: 0; }
.where-head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-lg); margin: 0 0 var(--space-2); }
.where-head span:first-of-type { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.where-head svg { width: 20px; height: 20px; color: var(--primary-text); flex-shrink: 0; }
.where-list { list-style: none; margin: 0; padding: 0; }
.where-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title badge" "for badge";
  gap: 0 var(--space-3);
  align-items: center;
  text-align: left;
  padding: var(--space-3) var(--space-1);
  min-height: 44px;
  background: none;
  border: 0;
  border-top: 1px solid var(--border);
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.where-list li:first-child .where-row { border-top: 0; }
.where-row:hover { background: var(--card-2); }
.where-title { grid-area: title; font-weight: 600; overflow-wrap: anywhere; }
.where-for { grid-area: for; font-size: var(--text-sm); color: var(--text-secondary); }
.where-row .stage-badge { grid-area: badge; }

/* ---- Gift editor ----------------------------------------------------------- */
.gift-fieldset { border: 0; padding: 0; margin: 0 0 var(--space-4); min-width: 0; }
.gift-fieldset legend { font-size: var(--text-sm); font-weight: 500; padding: 0; margin-bottom: 6px; }
.people-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); }
.person-chip { position: relative; display: inline-flex; cursor: pointer; }
.person-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.person-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 500;
}
.person-chip input:checked + span {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--on-secondary);
}
.person-chip input:checked + span::before { content: "✓"; margin-right: 6px; }
.person-chip input:focus-visible + span { outline: 2px solid var(--secondary); outline-offset: 2px; }
.split-rows { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.split-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px; align-items: center; gap: var(--space-3); }
.split-row label { font-size: var(--text-sm); overflow-wrap: anywhere; }
.split-row .input:disabled { opacity: 0.75; }
.split-sum { margin: var(--space-2) 0 0; }
.form-error {
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  font-size: var(--text-sm);
}
.wrap-summary { margin: var(--space-3) var(--space-1) 0; }
@media (max-width: 639px) {
  .wrap-row { flex-wrap: wrap; }
  .wrap-row .grow { flex-basis: 100%; }
  .wrap-row .btn { width: 100%; }
}

/* ---- Dinner timeline ------------------------------------------------------- */
.meal-views { margin: 0 0 var(--space-4); }
.timing-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.timing-grid label { display: block; font-size: var(--text-sm); font-weight: 500; margin-bottom: 4px; }
@media (max-width: 420px) { .timing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dish-timing-line { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; font-size: var(--text-sm); color: var(--text-secondary); }
.dish-timing-line svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.timeline-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3); }
.timeline-top .serve-times { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.timeline-top .field { margin: 0; }
.timeline-top .input { width: auto; min-width: 150px; }
.timeline-clash, .timeline-top + .note-info { margin-top: var(--space-4); }
.timeline-clash svg { width: 16px; height: 16px; vertical-align: -3px; }
.timeline-card { margin-top: var(--space-4); }
.timeline-head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-lg); margin-bottom: var(--space-3); }
.timeline-head svg { width: 20px; height: 20px; color: var(--accent); }
.tl-ahead { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.tl-hour + .tl-hour { margin-top: var(--space-4); }
.tl-hour h4 {
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--eyebrow);
}
.tl-steps { list-style: none; margin: 0; padding: 0 0 0 var(--space-3); border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: var(--space-2); }
.tl-step { display: grid; grid-template-columns: 76px 20px minmax(0, 1fr); gap: var(--space-2); align-items: start; font-size: var(--text-sm); }
.tl-step time { font-family: var(--font-numeral); font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.tl-step svg { width: 18px; height: 18px; color: var(--text-secondary); }
.tl-step span { overflow-wrap: anywhere; }
.tl-step.kind-oven svg { color: var(--primary-text); }
.tl-step.kind-serve { font-weight: 600; }
.tl-step.kind-serve svg { color: var(--success); }
.timeline-untimed { margin: var(--space-4) var(--space-1) 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--secondary); text-decoration: underline; cursor: pointer; min-height: 0; }

/* Kitchen mode: full screen, big type. */
.kitchen-mode { padding: 0; align-items: stretch; background: var(--overlay); }
.kitchen-sheet {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  min-height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  padding: max(env(safe-area-inset-top), var(--space-5)) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom));
}
.kitchen-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.kitchen-title { margin: 0; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--eyebrow); }
.kitchen-clock { margin: 4px 0 0; font-size: var(--text-md); color: var(--text-secondary); }
.kitchen-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: var(--space-6) 0; }
.kitchen-count { margin: 0 0 var(--space-2); color: var(--text-secondary); font-size: var(--text-base); }
.kitchen-time { margin: 0; font-family: var(--font-numeral); font-weight: 700; font-size: clamp(40px, 11vw, 64px); line-height: 1; color: var(--primary-text); }
.kitchen-text { margin: var(--space-4) 0; font-family: var(--font-display); font-weight: var(--display-weight); font-size: clamp(28px, 8vw, 44px); line-height: 1.2; overflow-wrap: anywhere; }
.kitchen-next { margin: 0; font-size: var(--text-md); color: var(--text-secondary); }
.kitchen-foot { display: grid; grid-template-columns: 1fr 1.6fr; gap: var(--space-3); }
.kitchen-btn { min-height: 64px; font-size: var(--text-md); }
.kitchen-now { grid-column: 1 / -1; }
.kitchen-awake { grid-column: 1 / -1; text-align: center; margin: 0; font-size: var(--text-sm); color: var(--text-secondary); }

/* ---- Fairness balance ------------------------------------------------------- */
.balance-groups { margin-bottom: var(--space-4); }
.balance-card { display: flex; flex-direction: column; gap: var(--space-4); }
.balance-card .recipient-head h2 { margin: 0; }
.balance-note {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--tone-gold-bg);
  color: var(--text-primary);
  font-size: var(--text-sm);
}
.balance-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.balance-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-bottom: 6px; }
.balance-name { font-weight: 600; overflow-wrap: anywhere; }
.balance-figures { font-size: var(--text-sm); color: var(--text-secondary); white-space: nowrap; }
.balance-figures b { color: var(--text-primary); font-size: var(--text-md); }
.balance-bar { display: flex; height: 14px; border-radius: var(--radius-pill); background: var(--track); overflow: hidden; }
.balance-bar i { display: block; height: 100%; }
.is-bought { background: var(--chart-spent); }
.is-planned { background: var(--chart-planned); }
.balance-sub { margin-top: 4px; font-size: var(--text-xs); }
.balance-legend { display: flex; gap: var(--space-4); margin: 0; font-size: var(--text-xs); }
.balance-legend span { display: inline-flex; align-items: center; gap: 6px; }
.balance-legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.balance-slots-toggle { padding-top: var(--space-3); border-top: 1px solid var(--border); }
.slot-table { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.slot-row { display: grid; grid-template-columns: minmax(0, 1.1fr) repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.slot-row:first-child { border-top: 0; }
.slot-row > span { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); min-width: 0; overflow-wrap: anywhere; }
.slot-head { background: var(--card-2); font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.slot-head > span { font-size: var(--text-xs); }
.slot-person { font-weight: 600; }
.slot-cell { display: flex; align-items: flex-start; gap: 4px; }
.slot-cell.is-filled { background: color-mix(in srgb, var(--cat-pine-soft) 60%, transparent); }
.slot-cell svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 3px; color: var(--success); }
.slot-gaps { margin: 0; }
@media (max-width: 639px) {
  /* Phones: one card per person, slots listed underneath. */
  .slot-head { display: none; }
  .slot-row { grid-template-columns: 1fr 1fr; }
  .slot-person { grid-column: 1 / -1; background: var(--card-2); }
  .slot-cell { flex-direction: column; gap: 0; }
  .slot-cell::before { content: attr(data-label); font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
  .slot-cell svg { display: none; }
}

/* ---- Surprise mode -------------------------------------------------------- */
.surprise-lock {
  max-width: 460px;
  margin: var(--space-4) auto 0;
  text-align: center;
  padding: var(--space-7) var(--space-5) var(--space-5);
}
.surprise-lock-icon {
  width: 64px; height: 64px;
  margin: 0 auto var(--space-3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary-text);
}
.surprise-lock-icon svg { width: 28px; height: 28px; }
.surprise-lock h2 { margin-bottom: var(--space-2); }
.pin-form { display: flex; gap: var(--space-2); justify-content: center; margin-top: var(--space-4); }
.pin-input {
  max-width: 180px;
  text-align: center;
  font-size: var(--text-lg);
  letter-spacing: 0.3em;
}
.sheet .pin-form { justify-content: flex-start; }
.field .pin-input { max-width: 220px; }
.pin-msg { min-height: 1.5em; margin: var(--space-3) 0 0; font-size: var(--text-sm); color: var(--warn-text); }
.pin-forgot { margin-top: var(--space-1); }
.pin-form.is-wrong { animation: hq-pin-shake 320ms ease; }
@keyframes hq-pin-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .pin-form.is-wrong { animation: none; } }
.surprise-list { margin: 0 0 var(--space-3); padding-left: 20px; color: var(--text-primary); }
.surprise-reset-note { margin-bottom: var(--space-3); }
.list-row.is-masked .title { color: var(--text-secondary); font-style: italic; }
.masked-lock { width: 18px; height: 18px; color: var(--text-secondary); margin: 0 13px; }
button.sidebar-item { width: 100%; background: none; font: inherit; cursor: pointer; text-align: left; }
#mobile-header-actions { display: flex; align-items: center; }

/* ---- Help / About slides ---------------------------------------------- */

.help-slides { display: flex; flex-direction: column; gap: var(--space-4); }
.help-slide {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}
.help-slide h3 { margin-top: 0; }

/* ---- Field tweaks for sheets ------------------------------------------ */

.sheet .field { margin-bottom: var(--space-3); }
.sheet .field:last-child { margin-bottom: 0; }
.field-row { flex-direction: row; align-items: center; }

/* ---- Swipe row (mobile gestures, §15) --------------------------------- */

.swipe-wrap { position: relative; }
.swipe-wrap + .swipe-wrap > .swipe-row { border-top: 1px solid var(--border); }
.swipe-row { position: relative; z-index: 1; touch-action: pan-y; }

.swipe-underlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.swipe-badge {
  display: flex; align-items: center;
  padding: 0 var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--bg);
  opacity: 0;
  transition: opacity 120ms ease;
}
.swipe-badge-complete { background: var(--success); justify-content: flex-start; }
.swipe-badge-delete   { background: var(--primary); justify-content: flex-end; }
.swipe-underlay.reveal-complete .swipe-badge-complete { opacity: 1; }
.swipe-underlay.reveal-delete   .swipe-badge-delete   { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .swipe-row { transition: none !important; }
}

/* ---- Toast pill -------------------------------------------------------- */

.toast-pill {
  background: var(--card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px 8px 18px;
  font-size: var(--text-sm);
  box-shadow: var(--shadow-md);
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 100%;
  opacity: 0;
  transform: translateY(6px);
  animation: hq-toast-in 180ms cubic-bezier(0.2,0.7,0.2,1) forwards;
}
.toast-pill.toast-out { animation: hq-toast-out 180ms cubic-bezier(0.2,0.7,0.2,1) forwards; }
@keyframes hq-toast-in  { to { opacity: 1; transform: translateY(0); } }
@keyframes hq-toast-out { to { opacity: 0; transform: translateY(6px); } }

.toast-action {
  background: transparent;
  border: 0;
  color: var(--secondary);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 6px 10px;
  min-height: 32px;
  border-radius: var(--radius-pill);
}
.toast-action:hover { background: var(--bg); }

/* ---- 44px tap-target audit (§15) -------------------------------------- */

/* The visual checkbox can stay 22x22, but its hit area must hit 44x44. */
.list-row .check {
  position: relative;
}
.list-row .check::before {
  content: '';
  position: absolute;
  inset: -11px;
  border-radius: 8px;
}

/* Pipeline steps act as tap targets — give each a 44px minimum height. */
.pipeline-step {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  color: var(--text-primary);
}
.pipeline-step:hover { background: var(--bg); }
.pipeline-step.current { border-color: var(--accent); }

/* Status pills used AS buttons (e.g. Card "Sent?" toggle) need full target. */
button.status-pill {
  cursor: pointer;
  min-height: 32px;
  padding: 6px 12px;
}

/* QA tabs become a comfortable height on mobile. */
@media (max-width: 639px) {
  .qa-tab { min-height: 56px; padding: 8px 0; font-size: clamp(11px, 3.2vw, 13px); }
  .chip { min-height: 44px; padding: 10px 16px; }
}

/* Star rating: enlarge tap area so the tiny visual stars are still reachable. */
.icon-btn[data-star] {
  min-width: 32px;
  min-height: 32px;
  padding: 6px;
}

/* ---- Skip link (a11y §17) -------------------------------------------- */

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9999;
  background: var(--primary);
  color: var(--on-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform var(--dur-fast) var(--ease);
}
.skip-link:focus,
.skip-link:focus-visible { transform: translateY(0); outline: 2px solid var(--secondary); outline-offset: 2px; text-decoration: none; }

/* ---- Update banner (top of page) -------------------------------------- */

#update-banner {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  background: var(--accent);
  color: #2F2F2F;
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
#update-banner button {
  background: var(--text-primary);
  color: var(--bg);
  border: 0;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  cursor: pointer;
  min-height: 36px;
}
#update-banner button:hover { opacity: 0.88; }

/* ---- Install banner (bottom) ----------------------------------------- */

.install-banner {
  position: fixed;
  z-index: 70;
  right: var(--space-4);
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}
.install-banner-body { display: flex; gap: var(--space-3); align-items: flex-start; }
.install-banner-body strong { display: block; margin-bottom: 4px; }
.install-banner-body p { margin: 0; color: var(--text-secondary); font-size: var(--text-sm); }
.install-banner-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.install-banner-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }
@media (max-width: 1024px) {
  .install-banner { bottom: calc(var(--bottom-nav-h) + var(--space-4) + env(safe-area-inset-bottom)); }
}
@media (max-width: 639px) {
  .install-banner { left: var(--space-4); max-width: none; }
}

/* ---- Responsive overrides (must be at the bottom) ---------------------- */
/* These intentionally live at file-end so they win over the base component
   rules at the same specificity. Breakpoints: tablet ≤1024, mobile ≤639 (§16).
*/

/* Mobile + tablet (incl. iPad) — sidebar hidden, bottom nav appears, main is
   full-width. The collapsed icon-rail variant is ambiguous on a touch device
   without hover, so we drop it and route everything through the bottom nav. */
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-header { display: flex; }
  .bottom-nav { display: grid; }
  main#app {
    padding-bottom: calc(var(--bottom-nav-h) + 80px); /* room for FAB + nav */
  }

  /* While a sheet, dialog or menu is open, hide the bottom nav and FAB —
     otherwise they cover its bottom (Save / Cancel, the last menu row).
     Close with Cancel / Save / Esc / tapping outside instead. This was
     phone-only, and on iPad (which also gets the bottom nav) Save buttons
     sat underneath it. */
  body.overlay-open .bottom-nav,
  body.overlay-open .fab { display: none !important; }

  /* Smaller page titles — the desktop sizes overwhelm a phone or tablet. */
  .module-header h1,
  .view h1 { font-size: 1.6rem; line-height: 1.2; }
  .module-header .text-meta { font-size: var(--text-sm); }
}

/* Phone-only typography + sheet polish. */
@media (max-width: 639px) {
  .module-header h1,
  .view h1 { font-size: 1.4rem; }

  /* §16: full-screen modals/sheets on mobile so forms breathe.
     iOS scroll model: put scroll on the OVERLAY (the only scroll surface),
     let the sheet have natural height. Nesting an overflow:auto inside a
     fixed parent on iOS Safari produced the "scroll won't take, snaps back
     to top" bug — flattening to one scroller fixes it. */
  .overlay {
    padding: 0;
    align-items: stretch;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Stack header → form → actions vertically inside the overlay so
       the sticky-actions calc still tracks the scroll viewport. */
    display: block;
  }
  .sheet {
    max-width: 100%;
    height: auto;
    max-height: none;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border: 0;
    padding-top: max(env(safe-area-inset-top), var(--space-5));
    padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
    overflow: visible;
    margin: 0;
  }
  .sheet-bottom {
    height: auto;
    max-height: none;
    min-height: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  /* Save / Cancel pinned to the bottom of the visible viewport — sticky
     binds to the overlay (the scroll ancestor), so the bar stays in view
     as the user scrolls through a tall form. */
  .sheet-actions {
    position: sticky;
    bottom: 0;
    background: var(--card);
    padding-top: var(--space-3);
    padding-bottom: env(safe-area-inset-bottom, 0);
    margin-top: var(--space-4);
    margin-bottom: 0;
    z-index: 2;
    box-shadow: 0 -8px 12px -8px rgba(0, 0, 0, 0.08);
  }
}

/* iPad / tablet: sheets stay centred cards, but never taller than the
   visible screen (dvh leaves out Safari's toolbars, vh doesn't), and Save /
   Cancel stay pinned to the bottom of the card while a long form scrolls. */
@media (min-width: 640px) and (max-width: 1024px) {
  .sheet { max-height: calc(100vh - 2 * var(--space-4)); max-height: calc(100dvh - 2 * var(--space-4)); }
  .sheet-bottom { max-height: 92vh; max-height: 92dvh; }
  .sheet-actions {
    position: sticky;
    bottom: calc(-1 * var(--space-5));
    margin-bottom: calc(-1 * var(--space-5));
    padding: var(--space-3) 0 var(--space-5);
    background: var(--card);
    z-index: 2;
    box-shadow: 0 -8px 12px -8px rgba(0, 0, 0, 0.08);
  }
}

/* Tablet sidebar in icon-rail mode expands horizontally on hover/focus so
   the user can still reach module labels without leaving the page. */
@media (min-width: 640px) and (max-width: 1024px) {
  .sidebar { transition: width var(--dur-base) var(--ease); width: var(--sidebar-rail-w); overflow: hidden; }
  .app-shell:focus-within .sidebar,
  .app-shell .sidebar:hover { width: var(--sidebar-w); }
  .app-shell:focus-within .sidebar .sidebar-label,
  .app-shell .sidebar:hover .sidebar-label,
  .app-shell:focus-within .sidebar .sidebar-cluster-head,
  .app-shell .sidebar:hover .sidebar-cluster-head,
  .app-shell:focus-within .sidebar .sidebar-search,
  .app-shell .sidebar:hover .sidebar-search,
  .app-shell:focus-within .sidebar .sidebar-footer-mark,
  .app-shell .sidebar:hover .sidebar-footer-mark { display: block; }
  .app-shell:focus-within .sidebar .sidebar-item,
  .app-shell .sidebar:hover .sidebar-item { justify-content: flex-start; padding: 10px var(--space-3); }
  .app-shell:focus-within .sidebar .sidebar-brand span:last-child,
  .app-shell .sidebar:hover .sidebar-brand span:last-child { display: inline; }
}

/* ---- Card Tracker rows ------------------------------------------------- */
/* Name + Sent/Received toggles + edit/delete didn't fit a 375px phone and
   pushed the whole page sideways. The row now wraps: the toggles drop to
   their own line on narrow screens. */
.card-row { flex-wrap: wrap; }
.card-row .grow { min-width: 0; flex: 1 1 160px; }
.card-row .grow .title,
.card-row .grow .text-meta { overflow-wrap: anywhere; }
.card-row-toggles { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
@media (max-width: 639px) {
  .card-row-toggles { order: 3; width: 100%; }
}

/* Long unbroken text (a pasted link, a long name) wraps instead of widening
   the page on a phone. */
.list-row .grow { min-width: 0; }
.list-row .title,
.list-row .sub { overflow-wrap: anywhere; }

/* ---- Swipe badge contrast -------------------------------------------- */
/* The delete badge sits on --primary, so it uses the button text colour. */
.swipe-badge-delete { color: var(--on-primary); }

/* ---- Returns & receipts (V2) ----------------------------------------- */

.returns-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.returns-stat {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.returns-stat b { font-size: var(--text-lg); color: var(--text-primary); overflow-wrap: anywhere; }
.returns-list { display: flex; flex-direction: column; gap: var(--space-3); }
.return-row {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 0;
}
.return-main { display: flex; gap: var(--space-3); align-items: flex-start; min-width: 0; }
.return-thumb {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-2);
  overflow: hidden;
  cursor: zoom-in;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
}
.return-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.return-thumb.is-empty { cursor: default; }
.return-thumb.is-empty svg { width: 22px; height: 22px; }
.return-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.return-title { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.return-meta { font-size: var(--text-sm); color: var(--text-secondary); overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.return-notes { font-size: var(--text-sm); color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
.return-deadline { font-weight: 600; color: var(--text-primary); }
.return-deadline.is-warn {
  color: var(--warn-text);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-pill);
  padding: 0 8px;
}
.return-deadline.is-closed { color: var(--text-secondary); font-weight: 500; }
.return-refund { font-weight: 600; color: var(--success); }
.return-row.is-done .return-title { color: var(--text-secondary); }
.return-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.return-icons { display: flex; align-items: center; gap: 0; margin-left: auto; }
.return-actions .btn-sm { min-height: 40px; padding: 6px var(--space-4); font-size: var(--text-sm); }
.return-actions .btn-sm svg { width: 16px; height: 16px; }
.receipt-sheet .receipt-full {
  display: block;
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--card-2);
  margin-bottom: var(--space-4);
}
@media (max-width: 639px) {
  .returns-summary { gap: var(--space-2); }
  .returns-stat { padding: var(--space-2) var(--space-3); }
  .returns-stat b { font-size: var(--text-md); }
}

/* Dashboard: Returns closing soon */
.returns-dash-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.returns-dash-list li { display: flex; gap: var(--space-3); align-items: baseline; justify-content: space-between; min-width: 0; }
.returns-dash-list .todo-text { min-width: 0; overflow-wrap: anywhere; }
.returns-dash-list .todo-meta { flex: 0 0 auto; }

/* ---- New season wizard + Past Christmases (V2) ------------------------- */

.season-wizard { max-width: 760px; }
.season-step + .season-step { margin-top: var(--space-4); }
.season-step-title { display: block; font-size: var(--text-md); margin: 0 0 var(--space-3); }
.season-step .season-step-title + .season-summary + .season-step-title { margin-top: var(--space-4); }
.season-label-field .input { max-width: 260px; }
.season-label-hint { margin: var(--space-2) 0 0; }
.season-options { display: flex; flex-direction: column; }
.season-option {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.season-option:first-child { border-top: 0; padding-top: 0; }
.season-option input { width: 22px; height: 22px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--secondary); }
.season-option-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.season-option-label { font-weight: 600; color: var(--text-primary); }
.season-option-detail { font-size: var(--text-sm); color: var(--text-secondary); }
.season-count {
  display: inline-block; margin-left: 6px; padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--card-2); border: 1px solid var(--border);
  font-size: var(--text-xs, 12px); font-weight: 600; color: var(--text-secondary);
}
.season-option.is-empty { cursor: default; }
.season-option.is-empty .season-option-label { color: var(--text-secondary); font-weight: 500; }
.season-summary { margin: 0; color: var(--text-primary); }
.season-actions { display: flex; gap: var(--space-3); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--space-5); }
@media (max-width: 639px) {
  .season-actions .btn { flex: 1 1 100%; }
  .season-actions .btn-primary { order: -1; }
}

.season-prompt { margin-bottom: var(--space-4); }

.season-card + .season-card { margin-top: var(--space-4); }
.season-saved { margin: 0 0 var(--space-3); }
.season-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.season-stat { display: flex; flex-direction: column; min-width: 0; }
.season-stat b { font-size: var(--text-lg); color: var(--text-primary); overflow-wrap: anywhere; }
@media (max-width: 639px) { .season-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.season-section { border-top: 1px solid var(--border); }
.season-section summary {
  display: flex; align-items: center; gap: var(--space-2);
  min-height: 44px; cursor: pointer; font-weight: 600; color: var(--text-primary);
}
.season-section summary svg { width: 18px; height: 18px; color: var(--text-secondary); }
.season-section-body { padding: 0 0 var(--space-3); }
.season-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.season-list li { overflow-wrap: anywhere; color: var(--text-primary); }
.season-budget li { display: flex; justify-content: space-between; gap: var(--space-3); }
.season-journal + .season-journal { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.season-journal p { margin: 0 0 var(--space-2); }
.season-journal-note { white-space: pre-wrap; overflow-wrap: anywhere; }
.recipient-history p + p { margin-top: 4px; }

/* ---- Luna Sync card (Settings → Use on more than one device) ----------- */

.sync-actions { margin: var(--space-3) 0; flex-wrap: wrap; }
.sync-new { margin-bottom: 0; }
.sync-status { display: inline-flex; align-items: flex-start; gap: 6px; margin: 0 0 var(--space-3); padding: 8px 12px;
  border-radius: var(--radius-md); background: var(--card-2); border: 1px solid var(--border); color: var(--text-primary); }
.sync-status svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 3px; color: var(--success); }
.sync-status.is-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.sync-more { margin-top: var(--space-3); border-top: 1px solid var(--border); padding-top: var(--space-3); }
.sync-more summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; color: var(--text-primary); }
.sync-code {
  font-family: var(--font-display); font-size: 2.6rem; letter-spacing: 0.12em; text-align: center;
  margin: var(--space-3) 0; color: var(--text-primary);
}
.sync-code-input { font-size: 1.4rem; letter-spacing: 0.15em; text-align: center; }
.sync-pics { display: flex; justify-content: center; gap: var(--space-5); margin: var(--space-4) 0; flex-wrap: wrap; }
.sync-pics > span { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sync-pic { font-size: 2.6rem; line-height: 1; }
.sync-key {
  display: block; width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-sm); line-height: 1.6; word-break: break-all; text-align: left;
  padding: var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--card-2); color: var(--text-primary); margin: var(--space-2) 0;
}
button.sync-key { cursor: pointer; }
.sync-key-hidden { color: transparent; text-shadow: 0 0 8px var(--text-secondary); user-select: none; }

/* ---- Free demo (tools/make-demo.py) — inert in the paid app ------------- */

html.is-demo .demo-hide { display: none !important; }
.demo-bar {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3);
  padding: 8px var(--space-4);
  background: var(--tone-gold-bg); border-bottom: 1px solid var(--tone-gold-border);
  color: var(--text-primary); font-size: var(--text-sm); font-weight: 500; text-align: center;
}
.demo-bar .btn-sm { min-height: 36px; padding: 6px var(--space-4); font-size: var(--text-sm); }
.demo-card { border-color: var(--tone-gold-border); background: var(--tone-gold-bg); }

/* ---- Print -------------------------------------------------------------- */
/* Ctrl+P / Share → Print outputs just the page content: no navigation,
   buttons, banners or empty app-shell space, in natural document flow. */
@media print {
  @page { margin: 14mm; }
  html, body { background: #FFFFFF !important; color: #000000 !important; }
  body { position: static !important; top: auto !important; padding-top: 0 !important; }
  .sidebar, .bottom-nav, .mobile-header, .fab, #update-banner, .skip-link,
  .install-banner, .toast-pill, .overlay, .action-bar, .row-actions, .return-actions, .season-actions, .season-prompt, .demo-bar,
  .icon-btn, .btn, .cal-paginator, .chip-row, #db-notice { display: none !important; }
  .app-shell { display: block !important; min-height: 0 !important; }
  .app-main-col, main#app { display: block !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .view { animation: none !important; }
  .card, .list-row, .stat-card, .recipient-card {
    background: #FFFFFF !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .list-row { border-color: #BBBBBB !important; }
  /* Dashboard: keep the wreath and words, drop the moving and night-sky parts. */
  .dash-snow, .nordic-scene, .dash-hero-garland, .dash-backup, .backup-nudge { display: none !important; }
  /* Screen-only controls: view tabs, switches, kitchen mode. */
  .seg-tabs, .switch-row, .switch, .pin-form, .pin-forgot, #mobile-header-actions { display: none !important; }
  .dash-hero { box-shadow: none !important; padding-top: var(--space-5) !important; padding-bottom: var(--space-5) !important; }
  a { color: inherit !important; text-decoration: none !important; }
  canvas { max-width: 100% !important; }
}
