/* Fuuds — Brand Guidelines Implementation */

:root {
  /* Brand Design Tokens */
  --color-primary: #8A9A86;           /* Sage Green - buttons, active states */
  --color-primary-strong: #647360;    /* Sage fill under white text (5.04:1) */
  --color-primary-ink: #5A6B57;       /* Sage as text and focus rings (5.71:1 on white) */
  --color-primary-line: rgba(138, 154, 134, 0.35);
  --color-bg-base: #F7F5F0;           /* Oatmeal - app background */
  --color-text-main: #2C302E;         /* Charcoal - primary text */
  --color-text-muted: #6B6F6D;        /* Secondary text */
  --color-surface: #FFFFFF;           /* Card surfaces */
  --color-ui-border: #E2E0D9;         /* Stone - borders/dividers */
  --color-accent-warn: #C27867;       /* Terracotta - warning icons, rules, borders */
  --color-warn-ink: #A85A47;          /* Terracotta as text and danger fill (4.98:1) */
  --color-control-border: #8A877E;    /* Input edges (3.59:1 on white) */
  --color-tan-ink: #7A5C3A;           /* Second acts, regular days (5.3:1 on its tint) */
  --color-tan-tint: rgba(168, 132, 98, 0.15);
  --color-slate-ink: #4A6E8A;         /* Dietary tags, slow days (4.8:1 on its tint) */
  --color-slate-tint: rgba(104, 138, 168, 0.12);

  /* Spacing, Radius, Shadows */
  --radius: 6px;                      /* Small elements */
  --radius-md: 8px;                   /* Inline panels, flags */
  --radius-lg: 16px;                  /* Cards, modals */
  --radius-xl: 20px;                  /* Editorial hero and tiles */
  --shadow: 0 4px 20px rgba(44, 48, 46, 0.08);
  --shadow-lg: 0 8px 24px rgba(44, 48, 46, 0.12);
  --shadow-hero: 0 8px 40px rgba(44, 48, 46, 0.14);

  /* Layout */
  --nav-height: 68px;                 /* 0.75rem padding x2 + 44px touch target */
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'San Francisco', sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text-main);
  background: var(--color-bg-base);
  min-height: 100vh;
}

/* Typography */
h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-text-main);
}

h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text-main);
}

h3 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text-main);
}

p {
  font-size: 16px;
  line-height: 1.5;
}

small,
.text-small {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Layout */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow {
  max-width: 480px;
}

.container--wide {
  max-width: 1200px;
}

/* Navigation */
.nav {
  background: var(--color-primary-strong);
  color: var(--color-bg-base);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav__brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-surface);
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav__links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav__links a {
  color: var(--color-bg-base);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav__links a:hover {
  color: var(--color-surface);
  background: rgba(44, 48, 46, 0.2);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  margin: -0.25rem -0.5rem;
}

.nav__links a:focus-visible {
  outline: 2px solid var(--color-surface);
  outline-offset: 2px;
  border-radius: 4px;
}

.nav__links a.active {
  color: var(--color-surface);
  border-bottom: 2px solid var(--color-surface);
  padding-bottom: 2px;
}

.nav__link--disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Hamburger toggle — hidden on desktop */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-surface);
  cursor: pointer;
  padding: 0.25rem;
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
}

.nav__toggle-icon--close {
  display: none;
}

.nav[data-open] .nav__toggle-icon--open {
  display: none;
}

.nav[data-open] .nav__toggle-icon--close {
  display: block;
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 2rem 0 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0;
}

.page-header p {
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  margin-bottom: 0;
}

/* A bare subtitle wraps under the title; wrapped blocks and actions stay in the row. */
.page-header > p {
  flex-basis: 100%;
  margin-top: -0.75rem;
}

/* Cards */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card--hero {
  text-align: center;
  padding: 3rem 2rem;
}

.card h2 {
  font-size: 24px;
  margin-bottom: 0.75rem;
}

.card h3 {
  font-size: 18px;
  margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  min-height: 44px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.08s ease;
  line-height: 1.4;
}

/* Tactile press — buttons depress on tap so the action registers instantly. */
.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--color-primary-strong);
  color: var(--color-surface);
}

.btn--primary:hover:not(:disabled) {
  background: var(--color-primary-ink);
}

.btn--secondary {
  background: var(--color-ui-border);
  color: var(--color-text-main);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--color-text-muted);
  color: var(--color-surface);
}

.btn--outline {
  background: transparent;
  color: var(--color-primary-ink);
  border: 1px solid var(--color-primary-ink);
}

.btn--outline:hover:not(:disabled) {
  background: var(--color-bg-base);
}

.btn--lg {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

.btn--full {
  width: 100%;
}

.btn--danger {
  background: var(--color-warn-ink);
  color: var(--color-surface);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-main);
  border: 1px solid var(--color-ui-border);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--color-bg-base);
  border-color: var(--color-text-muted);
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 2px;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 0.375rem;
}

.form-group .hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  min-height: 44px;
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text-main);
  transition: border-color 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary-ink);
  box-shadow: 0 0 0 3px rgba(138, 154, 134, 0.15);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert--success {
  background: rgba(138, 154, 134, 0.15);
  color: var(--color-primary-ink);
}

.alert--error {
  background: rgba(194, 120, 103, 0.08);
  color: var(--color-warn-ink);
}

/* Tags / Badges */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge--slate {
  background: var(--color-ui-border);
  color: var(--color-text-muted);
}

/* Grid */
.grid {
  display: grid;
  gap: 1rem;
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ═══════════════════════════════════════════════════════════════
   MEAL PLAN PAGE — Redesigned components
   ═══════════════════════════════════════════════════════════════ */

/* Plan container */
.container--plan {
  max-width: 960px;
  padding-bottom: 6rem; /* Space for sticky confirm footer */
}

/* ── Plan header ───────────────────────────────────────────── */
.plan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 2rem 0 1rem;
  gap: 1rem;
}

.plan-header h1 {
  font-size: 28px;
  margin-bottom: 0.125rem;
}

.plan-header__meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.btn--regen {
  white-space: nowrap;
  gap: 0.375rem;
}

.btn__icon {
  flex-shrink: 0;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(44, 48, 46, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: modal-fade-in 0.15s ease-out;
}

.modal-backdrop[hidden] {
  display: none;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  animation: modal-slide-up 0.2s ease-out;
}

@keyframes modal-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.modal__sub {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.modal__field {
  margin-bottom: 1.5rem;
}

.modal__label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 0.375rem;
}

.modal__date-input {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text-main);
  width: 100%;
  min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.modal__date-input:focus {
  outline: none;
  border-color: var(--color-primary-ink);
  box-shadow: 0 0 0 3px rgba(138, 154, 134, 0.15);
}

.modal__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.modal__actions .btn {
  flex: 1;
}

.modal__cancel {
  color: var(--color-text-muted);
  border-color: var(--color-ui-border);
}

/* ── Segmented tabs (this/next plan) ── */
.plan-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  background: var(--color-ui-border);
  border-radius: var(--radius);
  padding: 3px;
}

.plan-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: all 0.15s ease;
  font-family: inherit;
  gap: 0.125rem;
  min-height: 44px;
}

.plan-tab__dates {
  font-size: 0.7rem;
  font-weight: 400;
  margin-top: 0.125rem;
}

.plan-tab__label {
  font-size: 0.9rem;
}

.plan-tab.is-active {
  background: var(--color-surface);
  color: var(--color-text-main);
  box-shadow: 0 1px 3px rgba(44, 48, 46, 0.08);
}

.plan-tab:hover:not(.is-active) {
  color: var(--color-text-main);
}

/* ── Next-plan summary + plan-ahead nudge ─────────────────── */
.upcoming-card {
  margin-top: 1rem;
  border-left: 3px solid var(--color-primary);
}

.upcoming-card__label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary-ink);
  margin-bottom: 0.375rem;
}

.upcoming-card__meta {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.nudge-card {
  margin-top: 1rem;
  text-align: center;
  padding: 2rem 1.5rem;
}

.nudge-card__heading {
  font-family: 'Playfair Display', Georgia, serif;
  margin-bottom: 0.25rem;
}

.nudge-card__body {
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
}

/* ── Day card (redesigned) ─────────────────────────────────── */
.day-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}

.day-card:hover {
  box-shadow: var(--shadow-lg);
}

.day-card--today {
  border: 2px solid var(--color-primary);
}

.day-card--today .day-card__header {
  background: rgba(138, 154, 134, 0.1);
}

.day-card--today .day-card__day::after {
  content: " · Today";
  font-weight: 400;
  color: var(--color-primary-ink);
}

.day-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  background: var(--color-bg-base);
  border-bottom: 1px solid var(--color-ui-border);
}

.day-card__day {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--color-text-main);
}

.day-card__date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.day-card__meals {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ── Meal card ─────────────────────────────────────────────── */
.meal-card {
  position: relative;
  padding: 0.875rem 1rem;
  background: var(--color-surface);
  transition: background 0.15s ease, opacity 0.3s ease;
}

/* Separator only between multiple meals stacked in one day */
.day-card__meals .meal-card + .meal-card {
  border-top: 1px solid var(--color-ui-border);
}

.meal-card:last-child {
  border-bottom: none;
}

/* RECIPE-17: generated card image — a calm banner above the card content */
.meal-card__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 0.625rem;
  background: var(--color-bg-base);
}

.meal-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.meal-card__type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary-ink);
}

.meal-card__name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text-main);
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.meal-card__desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin-bottom: 0.375rem;
}

.meal-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.meal-tag {
  display: inline-block;
  padding: 0.0625rem 0.4375rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  background: rgba(138, 154, 134, 0.1);
  color: var(--color-primary-ink);
  letter-spacing: 0.01em;
}

/* Tag colour variants by category */
.meal-tag--quick {
  background: rgba(138, 154, 134, 0.15);
  color: #5a6b57;
}

.meal-tag--perishable {
  background: rgba(194, 120, 103, 0.12);
  color: #a85a47;
}

.meal-tag--second-act {
  background: var(--color-tan-tint);
  color: var(--color-tan-ink);
  font-weight: 600;
  border: 1px solid rgba(168, 132, 98, 0.3);
}

.meal-tag--dietary {
  background: var(--color-slate-tint);
  color: var(--color-slate-ink);
}

/* ── Per-meal notes (defrost reminders, tips) ────────────────── */
.meal-card__notes {
  margin-top: 0.5rem;
  padding: 0.5rem 0.625rem;
  background: rgba(194, 120, 103, 0.06);
  border-left: 3px solid var(--color-accent-warn);
  border-radius: 0 6px 6px 0;
}

.meal-card__notes-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-warn-ink);
  margin-bottom: 0.3rem;
}

.meal-card__notes-label svg {
  flex-shrink: 0;
}

.meal-card__notes p {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--color-text-main);
  margin: 0;
}

.meal-card__notes p + p {
  margin-top: 0.25rem;
}

/* ── Dietary flag (SAFETY-4: "double-check" — careful, never alarming) ───── */
.meal-card__dietary-flag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-warn-ink);
  background: rgba(194, 120, 103, 0.08);
  border: 1px solid rgba(194, 120, 103, 0.35);
  border-radius: 8px;
}

.meal-card__dietary-flag svg {
  flex-shrink: 0;
}

/* Plan-level companion note, shown once when any meal is flagged. */
.plan-dietary-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--color-text-main);
  background: rgba(194, 120, 103, 0.06);
  border-left: 3px solid var(--color-accent-warn);
  border-radius: 0 8px 8px 0;
}

.plan-dietary-note svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: var(--color-warn-ink);
}

/* ── Meal card footer (portions + actions) ─────────────────── */
.meal-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-ui-border);
  gap: 0.5rem;
}

/* ── Meal actions (swap, skip) ─────────────────────────────── */
.meal-card__actions {
  display: flex;
  gap: 0.125rem;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.meal-card:hover .meal-card__actions,
.meal-card:focus-within .meal-card__actions {
  opacity: 1;
}

.meal-action {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: var(--radius);
  background: none;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: inherit;
  white-space: nowrap;
}

.meal-action--swap {
  color: var(--color-primary-ink);
}

.meal-action--swap:hover {
  background: rgba(138, 154, 134, 0.1);
}

.meal-action--skip {
  color: var(--color-text-muted);
}

.meal-action--skip:hover {
  color: var(--color-warn-ink);
  background: rgba(194, 120, 103, 0.08);
}

/* ── Focus-visible indicators for keyboard navigation ────── */
.meal-action:focus-visible,
.swap-chip:focus-visible,
.skip-chip:focus-visible {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 2px;
}

/* ── 44px hit areas for compact controls ───────────────────
   The visible control stays small; an invisible pseudo-element
   stretches the tap target to the 44px brand minimum. */
.meal-action,
.diner-chip,
.swap-chip,
.skip-chip,
.swap-panel__cancel,
.recipe-save__btn,
.recipe-pdf-btn {
  position: relative;
}

.meal-action::after,
.diner-chip::after,
.swap-chip::after,
.skip-chip::after,
.swap-panel__cancel::after,
.recipe-save__btn::after,
.recipe-pdf-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  min-width: 44px;
  min-height: 44px;
  transform: translate(-50%, -50%);
}

/* Touch screens have no hover, so actions show at full strength. */
@media (hover: none) {
  .meal-card__actions {
    opacity: 1;
  }
}

/* ── Remove button ─────────────────────────────────────────── */
.meal-action--remove {
  color: var(--color-text-muted);
}

.meal-action--remove:hover {
  color: var(--color-warn-ink);
  background: rgba(194, 120, 103, 0.08);
}

/* ── Ingredients list ─────────────────────────────────────── */
.meal-card__ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.375rem;
}

.meal-ingredient {
  display: inline-block;
  padding: 0.0625rem 0.4375rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--color-ui-border);
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
}

/* ── Meal card loading state (HTMX request in progress) ──── */
.meal-card__loading {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(247, 245, 240, 0.92);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-radius: inherit;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  z-index: 5;
}

.meal-card__loading span {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.meal-card--loading {
  position: relative;
  pointer-events: none;
}

.meal-card--loading .meal-card__loading {
  display: flex;
}

/* ── Generating state (plan being built) ───────────────── */

@keyframes generating-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes generating-pulse {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50%      { opacity: 0.5;  transform: scale(1.08); }
}

@keyframes generating-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes generating-progress {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}

.generating {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  max-width: 420px;
  margin: 0 auto;
}

.generating__indicator {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.generating__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--color-primary);
  animation: generating-spin 2.5s linear infinite;
}

.generating__ring--inner {
  inset: 8px;
  border-top-color: transparent;
  border-right-color: var(--color-ui-border);
  animation-duration: 1.8s;
  animation-direction: reverse;
}

.generating__icon {
  position: relative;
  z-index: 1;
  opacity: 0.7;
}

.generating__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin: 0 0 0.25rem;
}

.generating__meta {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0 0 2rem;
  letter-spacing: 0.01em;
}

.generating__details {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.generating__detail {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: left;
}

.generating__detail--fade-in {
  opacity: 0;
  animation: generating-fade-in 0.4s ease-out forwards;
}

.generating__detail-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(138, 154, 134, 0.1);
  color: var(--color-primary-ink);
  margin-top: 1px;
}

.generating__detail-content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.generating__detail-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.generating__detail-value {
  font-size: 0.875rem;
  color: var(--color-text-main);
  line-height: 1.4;
}

.generating__progress {
  width: 100%;
  max-width: 200px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-ui-border);
  overflow: hidden;
}

.generating__progress-bar {
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  animation: generating-progress 2s ease-in-out infinite;
}


/* ── Skeleton shimmer (background task in progress) ─────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-line {
  height: 0.75rem;
  border-radius: var(--radius);
  background: linear-gradient(
    90deg,
    var(--color-ui-border) 25%,
    rgba(255, 255, 255, 0.6) 50%,
    var(--color-ui-border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-line--type {
  width: 3rem;
  height: 0.5rem;
  margin-bottom: 0.25rem;
}

.skeleton-line--title {
  width: 70%;
  height: 1rem;
  margin-bottom: 0.375rem;
}

.skeleton-line--desc {
  width: 90%;
  margin-bottom: 0.25rem;
}

.skeleton-line--desc-short {
  width: 55%;
  margin-bottom: 0.375rem;
}

.skeleton-tags {
  display: flex;
  gap: 0.375rem;
  margin-top: 0.25rem;
}

.skeleton-tag {
  width: 3rem;
  height: 1.25rem;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--color-ui-border) 25%,
    rgba(255, 255, 255, 0.6) 50%,
    var(--color-ui-border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-tag:nth-child(2) {
  width: 4rem;
  animation-delay: 0.15s;
}

.skeleton-tag:nth-child(3) {
  width: 2.5rem;
  animation-delay: 0.3s;
}

.meal-card--skeleton {
  min-height: 120px;
}

/* ── Card reveal animation ────────────────────────────────── */
@keyframes card-reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.plan-content--revealing .meal-card {
  animation: card-reveal 0.3s ease-out both;
}

/* Stagger by day: each day-card delays its children */
.plan-content--revealing .day-card:nth-child(1) .meal-card { animation-delay: 0s; }
.plan-content--revealing .day-card:nth-child(2) .meal-card { animation-delay: 0.06s; }
.plan-content--revealing .day-card:nth-child(3) .meal-card { animation-delay: 0.12s; }
.plan-content--revealing .day-card:nth-child(4) .meal-card { animation-delay: 0.18s; }
.plan-content--revealing .day-card:nth-child(5) .meal-card { animation-delay: 0.24s; }
.plan-content--revealing .day-card:nth-child(6) .meal-card { animation-delay: 0.30s; }
.plan-content--revealing .day-card:nth-child(7) .meal-card { animation-delay: 0.36s; }

/* ── Recipe progress bar ──────────────────────────────────── */
.recipe-progress {
  padding: 1.5rem;
  text-align: center;
}

.recipe-progress__bar-track {
  width: 100%;
  max-width: 320px;
  height: 4px;
  background: var(--color-ui-border);
  border-radius: 2px;
  margin: 0 auto 1rem;
  overflow: hidden;
}

.recipe-progress__bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width 0.4s ease-out;
}

.recipe-progress__text {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ── Recipe checklist ─────────────────────────────────────── */
.recipe-checklist__heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin: 0 0 1rem;
  text-align: center;
}

.recipe-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.recipe-checklist__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  transition: opacity 0.3s ease, background 0.3s ease;
}

.recipe-checklist__type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  min-width: 3.5rem;
  flex-shrink: 0;
}

.recipe-checklist__name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-main);
}

.recipe-checklist__status {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recipe-checklist__item--pending {
  opacity: 0.55;
}

.recipe-checklist__item--pending .recipe-checklist__check {
  display: none;
}

.recipe-checklist__item--pending .recipe-checklist__spinner {
  animation: checklist-spin 0.8s linear infinite;
  color: var(--color-text-muted);
}

@keyframes checklist-spin {
  to { transform: rotate(360deg); }
}

.recipe-checklist__item--done {
  opacity: 1;
  background: rgba(138, 154, 134, 0.08);
}

.recipe-checklist__item--done .recipe-checklist__spinner {
  display: none;
}

.recipe-checklist__item--done .recipe-checklist__check {
  animation: checklist-done 0.35s ease-out;
  color: var(--color-primary-ink);
}

.recipe-checklist__item--skipped .recipe-checklist__spinner {
  display: none;
}

.recipe-checklist__item--skipped {
  opacity: 0.35;
}

.recipe-checklist__item--skipped .recipe-checklist__name {
  text-decoration: line-through;
  text-decoration-color: var(--color-ui-border);
}

@keyframes checklist-done {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Inline error on failed task ──────────────────────────── */
.task-error {
  padding: 1rem;
  text-align: center;
  color: var(--color-warn-ink);
}

.task-error__msg {
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

/* ── Swap panel (reason chips) ────────────────────────────── */
.meal-card__swap-panel {
  padding: 0.75rem 0 0.25rem;
  border-top: 1px solid var(--color-ui-border);
  margin-top: 0.5rem;
}

.swap-panel__prompt {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.swap-panel__form {
  display: flex;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.swap-panel__input {
  flex: 1;
  min-width: 0;
  padding: 0.4375rem 0.75rem;
  border: 1px solid var(--color-control-border);
  border-radius: 8px;
  background: var(--color-surface);
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--color-text-main);
}

.swap-panel__input::placeholder {
  color: var(--color-text-muted);
}

.swap-panel__input:focus {
  outline: none;
  border-color: var(--color-primary-ink);
  box-shadow: 0 0 0 3px rgba(138, 154, 134, 0.15);
}

.swap-panel__submit {
  flex-shrink: 0;
  white-space: nowrap;
}

.swap-panel__surprise {
  margin-right: 0.5rem;
}

.swap-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3125rem 0.75rem;
  border: 1px solid var(--color-ui-border);
  border-radius: 999px;
  background: var(--color-surface);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-main);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: inherit;
  white-space: nowrap;
}

.swap-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-ink);
  background: rgba(138, 154, 134, 0.06);
}

.swap-chip--primary {
  border-color: var(--color-primary);
  background: rgba(138, 154, 134, 0.08);
  color: var(--color-primary-ink);
  font-weight: 600;
}

.swap-chip--primary:hover {
  background: rgba(138, 154, 134, 0.15);
}

.swap-panel__cancel {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0;
  border: none;
  background: none;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: inherit;
}

.swap-panel__cancel:hover {
  color: var(--color-text-main);
}

/* ── Skipped meal card state ──────────────────────────────── */
.meal-card--skipped {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(0, 0, 0, 0.018) 6px,
    rgba(0, 0, 0, 0.018) 7px
  );
}

.meal-card--skipped .meal-card__name,
.meal-card--skipped .meal-card__desc,
.meal-card--skipped .meal-card__ingredients,
.meal-card--skipped .meal-card__tags {
  opacity: 0.45;
}

/* ── Skip badge (reason pill in card header) ──────────────── */
.skip-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: rgba(194, 120, 103, 0.1);
  color: var(--color-warn-ink);
  letter-spacing: 0.01em;
}

/* ── Diner chips (per-meal member toggles) ────────────────── */
.meal-diners {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.375rem;
  padding-top: 0.375rem;
  border-top: 1px solid var(--color-ui-border);
}

.diner-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.375rem;
  border: 1.5px solid var(--color-primary-ink);
  border-radius: 999px;
  background: rgba(138, 154, 134, 0.1);
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-primary-ink);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  letter-spacing: 0.02em;
}

.diner-chip:hover {
  background: rgba(138, 154, 134, 0.2);
}

.diner-chip--off {
  border-color: var(--color-ui-border);
  background: transparent;
  color: var(--color-text-muted);
  opacity: 0.5;
}

.diner-chip--off:hover {
  opacity: 0.75;
  border-color: var(--color-primary);
  background: rgba(138, 154, 134, 0.06);
}

.diner-chip:focus-visible {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 2px;
}

/* ── Restore button ───────────────────────────────────────── */
.meal-action--restore {
  color: var(--color-primary-ink);
  font-weight: 500;
}

.meal-action--restore:hover {
  background: rgba(138, 154, 134, 0.1);
}

/* ── Skip panel (reason chips) ────────────────────────────── */
.meal-card__skip-panel {
  padding: 0.75rem 0 0.25rem;
  border-top: 1px solid var(--color-ui-border);
  margin-top: 0.5rem;
}

.skip-panel__prompt {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.skip-panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.skip-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3125rem 0.75rem;
  border: 1px solid var(--color-ui-border);
  border-radius: 999px;
  background: var(--color-surface);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-main);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: inherit;
  white-space: nowrap;
}

.skip-chip:hover {
  border-color: var(--color-accent-warn);
  color: var(--color-warn-ink);
  background: rgba(194, 120, 103, 0.06);
}

.skip-chip--primary {
  border-color: var(--color-accent-warn);
  background: rgba(194, 120, 103, 0.08);
  color: var(--color-warn-ink);
  font-weight: 600;
}

.skip-chip--primary:hover {
  background: rgba(194, 120, 103, 0.15);
}

.skip-panel__cancel {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0;
  border: none;
  background: none;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: inherit;
}

.skip-panel__cancel:hover {
  color: var(--color-text-main);
}

.btn--sm {
  padding: 0.375rem 0.875rem;
  min-height: 36px;
  font-size: 0.8rem;
}

/* ── Plan notes ────────────────────────────────────────────── */
.plan-notes {
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
  background: rgba(138, 154, 134, 0.07);
  border: 1px solid rgba(138, 154, 134, 0.18);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}

.plan-notes__heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 0.625rem;
}

.plan-notes__heading svg {
  flex-shrink: 0;
  color: var(--color-primary-ink);
}

.plan-notes__list {
  list-style: none;
  padding: 0 0 0 1.75rem;
}

.plan-notes__list li {
  position: relative;
  font-size: 0.85rem;
  color: var(--color-text-main);
  line-height: 1.5;
  margin-bottom: 0.375rem;
  padding-left: 0.75rem;
}

.plan-notes__list li:last-child {
  margin-bottom: 0;
}

.plan-notes__list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-primary);
}

/* ── Confirm footer spacer (prevents fixed bar from overlapping content) ── */
.plan-confirm-spacer {
  height: 5rem;
}

/* ── Confirm footer ────────────────────────────────────────── */
.plan-confirm {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--color-surface);
  border-top: 1px solid var(--color-ui-border);
  box-shadow: 0 -4px 20px rgba(44, 48, 46, 0.08);
  padding: 0.875rem 0;
}

.plan-confirm__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.plan-confirm__inner[hidden] {
  display: none;
}

.plan-confirm__text strong {
  font-size: 0.9rem;
  display: block;
}

.plan-confirm__sub {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.plan-confirm__btn {
  flex-shrink: 0;
}

.plan-confirm__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Empty state (redesigned) ──────────────────────────────── */
.plan-empty {
  text-align: center;
  padding: 4rem 1rem;
  max-width: 400px;
  margin: 0 auto;
}

.plan-empty__icon {
  margin-bottom: 1.25rem;
  opacity: 0.5;
}

.plan-empty h2 {
  margin-bottom: 0.5rem;
}

.plan-empty p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.plan-empty__actions {
  display: flex;
  justify-content: center;
}

/* ── Plan grid wrapper ─────────────────────────────────────── */
.plan-grid {
  margin-bottom: 1rem;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}

.empty__icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.empty h3 {
  color: var(--color-text-main);
  margin-bottom: 0.5rem;
}

/* Loading / HTMX indicator */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

.spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-ui-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Landing page */
.hero {
  text-align: center;
  padding: 4rem 1rem;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hero h1 span {
  color: var(--color-primary-ink);
}

.hero p {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  max-width: 480px;
  margin: 0 auto 2rem;
}

.features {
  padding: 2rem 0 3rem;
}

.feature-card {
  text-align: center;
  padding: 1.5rem 1rem;
}

.feature-card__icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
  color: var(--color-primary-ink);
}

.feature-card h3 {
  margin-bottom: 0.375rem;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* Auth pages */
.auth-page {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 0.25rem;
}

.auth-tagline {
  text-align: center;
  color: var(--color-primary-ink);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--color-ui-border);
  margin-top: 3rem;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 0 24px;
  }

  .grid--2,
  .grid--3 {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 2.5rem 1rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .auth-card {
    padding: 1.25rem;
  }

  .meal-card__ingredients {
    flex-wrap: wrap;
  }

  /* Mobile nav collapse */
  .nav__toggle {
    display: flex;
  }

  .nav__inner {
    flex-wrap: wrap;
  }

  .nav__links {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    padding-top: 0.5rem;
  }

  .nav[data-open] .nav__links {
    display: flex;
  }

  .nav__links a {
    font-size: 0.9rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .nav__links li:last-child a {
    border-bottom: none;
  }

  .nav__links a.active {
    border-bottom-color: var(--color-surface);
  }

  /* Plan page mobile */
  .plan-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .plan-header__actions {
    width: 100%;
  }

  .plan-header__actions .btn {
    width: 100%;
  }

  .meal-card__actions {
    opacity: 1;
  }

  .meal-card__footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
  }

  .plan-confirm__inner {
    flex-direction: column;
    text-align: center;
  }

  .plan-confirm__btn {
    width: 100%;
  }

  .plan-confirm__actions {
    width: 100%;
    flex-direction: column;
  }

  .container--plan {
    padding-bottom: 8rem;
  }
}

/* HTMX transitions */
.fade-in {
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Preference chips (for exclusions/equipment) */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  background: var(--color-ui-border);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--color-text-main);
}

/* ═══════════════════════════════════════════════════════════════
   PREFERENCES WIZARD
   ═══════════════════════════════════════════════════════════════ */

/* ── Progress indicator ────────────────────────────────────── */
.wizard-progress {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
}

.wizard-progress::-webkit-scrollbar { display: none; }

/* Single connecting line behind all step circles */
.wizard-progress::before {
  content: "";
  position: absolute;
  top: calc(0.5rem + 0.875rem); /* vertically center on circles */
  left: calc(0.625rem + 0.875rem); /* center of first circle */
  right: calc(0.625rem + 0.875rem); /* center of last circle */
  height: 2px;
  background: var(--color-ui-border);
  z-index: 0;
}

.wizard-progress__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  transition: all 0.15s ease;
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  position: relative;
  z-index: 1;
}

.wizard-progress__step:hover {
  background: rgba(138, 154, 134, 0.06);
  color: var(--color-text-main);
}

.wizard-progress__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2px solid var(--color-ui-border);
  background: var(--color-bg-base);
  font-weight: 700;
  font-size: 0.75rem;
  transition: all 0.15s ease;
  position: relative;
  z-index: 2;
}

.wizard-progress__label {
  font-weight: 500;
  white-space: nowrap;
}

.wizard-progress__step--active .wizard-progress__num {
  background: var(--color-primary-strong);
  border-color: var(--color-primary-strong);
  color: var(--color-surface);
}

.wizard-progress__step--active {
  color: var(--color-text-main);
}

.wizard-progress__step--done .wizard-progress__num {
  background: var(--color-primary-strong);
  border-color: var(--color-primary-strong);
  color: var(--color-surface);
}

/* Checkmark inside done steps — hides number, shows SVG */
.wizard-progress__check {
  display: none;
}

.wizard-progress__step--done .wizard-progress__check {
  display: block;
}

.wizard-progress__step--done .wizard-progress__num-text {
  display: none;
}

/* ── Connecting line: colored segment for completed steps ──── */
/* Done steps paint a sage line from their center leftward to cover
   the grey base line behind them. */
.wizard-progress__step--done::before {
  content: "";
  position: absolute;
  top: calc(0.5rem + 0.875rem);
  right: 50%;
  left: -1px; /* extend to left edge (covers gap to previous step) */
  height: 2px;
  background: var(--color-primary-strong);
  z-index: 0;
}

.wizard-progress__step--done:first-child::before {
  left: 50%; /* first step: no line to the left */
  right: 50%;
  display: none;
}

/* Active step: colored line segment from left edge to center */
.wizard-progress__step--active::before {
  content: "";
  position: absolute;
  top: calc(0.5rem + 0.875rem);
  left: -1px;
  right: 50%;
  height: 2px;
  background: var(--color-primary-strong);
  z-index: 0;
}

.wizard-progress__step--active:first-child::before {
  display: none;
}

/* Phones: eight labels don't fit, so only the current step is named */
@media (max-width: 480px) {
  .wizard-progress__label {
    display: none;
  }

  .wizard-progress__step--active .wizard-progress__label {
    display: block;
  }

  /* End labels are wider than their step: anchor them inside the bar */
  .wizard-progress__step:first-child .wizard-progress__label {
    align-self: flex-start;
  }

  .wizard-progress__step:last-child .wizard-progress__label {
    align-self: flex-end;
  }
}

/* On/off switch row: label left, switch right */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.switch-row__hint {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.switch-row input[type="checkbox"] {
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 2.75rem;
  height: 1.625rem;
  margin: 0;
  border-radius: 999px;
  background: var(--color-ui-border);
  cursor: pointer;
  transition: background 0.2s ease;
}

.switch-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.switch-row input[type="checkbox"]:checked {
  background: var(--color-primary-strong);
}

.switch-row input[type="checkbox"]:checked::after {
  transform: translateX(1.125rem);
}

.switch-row input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 2px;
}

.wizard-progress__step--optional .wizard-progress__label::after {
  content: "";
  display: none;
}

/* ── Wizard step ────────────────────────────────────────────── */
.wizard-step {
  margin-bottom: 2rem;
}

.wizard-step h2 {
  font-size: 22px;
  margin-bottom: 0.25rem;
}

.wizard-step__desc {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.wizard-step__hint {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* ── Wizard navigation ─────────────────────────────────────── */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  gap: 0.75rem;
}

.wizard-nav__right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ── Member list: unified card container ───────────────────── */
#members-list {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.member-row.card {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem 1.125rem;
  margin-bottom: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--color-surface);
  position: relative;
}

/* Inset divider between rows */
.member-row.card + .member-row.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.125rem;
  right: 1.125rem;
  height: 1px;
  background: var(--color-ui-border);
}

/* ── Member avatar ─────────────────────────────────────────── */
.member-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: #fff;
  flex-shrink: 0;
  margin-top: 1px;
  transition: background 0.2s ease;
  text-transform: uppercase;
}

/* Each fill carries white initials at 4.6:1 or better. */
.member-avatar[data-color-idx="0"] { background: var(--color-primary-strong); }  /* sage */
.member-avatar[data-color-idx="1"] { background: var(--color-warn-ink); }        /* terracotta */
.member-avatar[data-color-idx="2"] { background: #577991; }  /* slate-blue */
.member-avatar[data-color-idx="3"] { background: #8C722A; }  /* amber */
.member-avatar[data-color-idx="4"] { background: #9D656E; }  /* dusty rose */

.member-avatar--sm {
  width: 24px;
  height: 24px;
  font-size: 0.6875rem;
  margin-top: 0;
}

/* ── Two-line content block ────────────────────────────────── */
.member-row__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Name input — borderless hero text */
.member-row .member-row__name {
  border: none;
  border-bottom: 1.5px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 0.125rem 0;
  min-height: auto;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-main);
  line-height: 1.4;
  width: 100%;
  transition: border-color 0.2s ease;
}

.member-row .member-row__name:focus {
  outline: none;
  border-bottom-color: var(--color-primary);
  box-shadow: none;
}

.member-row .member-row__name::placeholder {
  color: var(--color-text-muted);
  font-weight: 400;
}

/* ── Metadata row (age + portion) ──────────────────────────── */
.member-row__meta {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

/* Ghost selects — subtle inline dropdowns */
.member-row .member-row__select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  background: transparent;
  padding: 0.125rem 1.25rem 0.125rem 0;
  min-height: auto;
  width: auto;
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239B9F9D' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.125rem center;
}

.member-row .member-row__select:hover {
  color: var(--color-text-main);
}

.member-row .member-row__select:focus {
  outline: none;
  box-shadow: none;
  color: var(--color-text-main);
}

/* Dot separator between selects */
.member-row__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-muted);
  opacity: 0.45;
  flex-shrink: 0;
  margin: 0 0.25rem;
}

/* ── Ghost × remove button ─────────────────────────────────── */
.member-row__remove {
  font-size: 0;
  line-height: 0;
  min-height: 32px;
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  margin-top: 0.25rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  opacity: 0.4;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}

.member-row__remove::after {
  content: "\00d7";
  font-size: 1.25rem;
  line-height: 1;
  color: inherit;
}

.member-row:hover .member-row__remove {
  opacity: 0.7;
}

.member-row__remove:hover,
.member-row__remove:active {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
}

/* ── Remove animation ─────────────────────────────────────── */
.member-row--removing {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, max-height 0.25s ease 0.05s,
              padding 0.25s ease 0.05s, margin 0.25s ease 0.05s;
}

.member-row--removing::before {
  display: none;
}

/* ── Add-member ghost button ──────────────────────────────── */
.member-row--add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.875rem 1rem;
  border: none;
  border-top: 1px solid var(--color-ui-border);
  border-radius: 0;
  background: rgba(138, 154, 134, 0.03);
  color: var(--color-primary-ink);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
  box-shadow: none;
  margin: 0;
  width: 100%;
  font-family: inherit;
}

.member-row--add:hover {
  background: rgba(138, 154, 134, 0.08);
}

.member-row--add:active {
  background: rgba(138, 154, 134, 0.12);
}

/* ── Chip grid (tappable selection) ────────────────────────── */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip-toggle {
  position: relative;
  cursor: pointer;
}

/* Visually hidden, not display:none, so the input stays in the tab order. */
.chip-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.chip-toggle input:focus-visible + .chip-toggle__label {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 2px;
}

.chip-toggle__label {
  display: inline-flex;
  align-items: center;
  padding: 0.4375rem 0.875rem;
  border: 1.5px solid var(--color-ui-border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-main);
  background: var(--color-surface);
  transition: all 0.12s ease;
  user-select: none;
  min-height: 36px;
}

.chip-toggle__label:hover {
  border-color: var(--color-primary);
  background: rgba(138, 154, 134, 0.04);
}

.chip-toggle input:checked + .chip-toggle__label {
  background: rgba(138, 154, 134, 0.12);
  border-color: var(--color-primary-ink);
  color: var(--color-primary-ink);
  font-weight: 600;
}

.chip-toggle--lg .chip-toggle__label {
  padding: 0.625rem 1.125rem;
  font-size: 0.875rem;
  min-height: 44px;
}

.chip-toggle--sm .chip-toggle__label {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
}

.chip-toggle input:disabled + .chip-toggle__label {
  opacity: 0.55;
  cursor: default;
}

.chip-toggle input:checked:disabled + .chip-toggle__label {
  background: rgba(138, 154, 134, 0.08);
  border-color: var(--color-primary);
  color: var(--color-primary-ink);
  opacity: 0.55;
}

/* ── Member tabs ───────────────────────────────────────────── */
.member-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  background: var(--color-bg-base);
  border-radius: var(--radius);
  padding: 3px;
}

.member-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: none;
  background: none;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  text-align: center;
}

.member-tab--active {
  background: var(--color-surface);
  color: var(--color-text-main);
  box-shadow: 0 1px 3px rgba(44, 48, 46, 0.08);
}

.member-exclusions,
.member-prefs-panel {
  display: none;
}

.member-exclusions--active,
.member-prefs-panel--active {
  display: block;
}

/* ── Life pattern grid ─────────────────────────────────────── */
.life-pattern-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.life-pattern-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.life-pattern-row__day {
  width: 90px;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.life-pattern-row__options {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.pattern-toggle {
  flex: 1;
  position: relative;
  cursor: pointer;
}

/* Visually hidden, not display:none, so the input stays in the tab order. */
.pattern-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pattern-toggle input:focus-visible + .pattern-toggle__label {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 2px;
}

.pattern-toggle__label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border: 1.5px solid var(--color-ui-border);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: all 0.12s ease;
  text-align: center;
  min-height: 36px;
}

.pattern-toggle--quick input:checked + .pattern-toggle__label {
  background: rgba(138, 154, 134, 0.15);
  border-color: var(--color-primary-ink);
  color: var(--color-primary-ink);
}

.pattern-toggle--normal input:checked + .pattern-toggle__label {
  background: var(--color-tan-tint);
  border-color: var(--color-tan-ink);
  color: var(--color-tan-ink);
}

.pattern-toggle--slow input:checked + .pattern-toggle__label {
  background: var(--color-slate-tint);
  border-color: var(--color-slate-ink);
  color: var(--color-slate-ink);
}

.life-pattern-legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.life-pattern-legend__item--quick { color: var(--color-primary-ink); }
.life-pattern-legend__item--normal { color: var(--color-tan-ink); }
.life-pattern-legend__item--slow { color: var(--color-slate-ink); }

/* ── Radio cards ───────────────────────────────────────────── */
.radio-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-card {
  position: relative;
  cursor: pointer;
}

/* Visually hidden, not display:none, so the input stays in the tab order. */
.radio-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.radio-card input:focus-visible + .radio-card__content {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 2px;
}

.radio-card__content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--color-ui-border);
  border-radius: var(--radius-lg);
  transition: all 0.12s ease;
  background: var(--color-surface);
}

.radio-card__content strong {
  font-size: 0.9rem;
}

.radio-card__content span {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.radio-card__calc {
  font-weight: 600;
  color: var(--color-primary-ink);
}

.radio-card input:checked + .radio-card__content {
  border-color: var(--color-primary-ink);
  background: rgba(138, 154, 134, 0.06);
  box-shadow: 0 0 0 1px var(--color-primary-ink);
}

.radio-card:hover .radio-card__content {
  border-color: var(--color-primary);
}

/* ── Summary sections ──────────────────────────────────────── */
.summary-section {
  margin-bottom: 0.75rem;
}

.summary-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.summary-section__header h3 {
  font-size: 16px;
  margin-bottom: 0;
}

.summary-section__body {
  font-size: 0.875rem;
  color: var(--color-text-main);
}

.summary-section__body .text-muted {
  color: var(--color-text-muted);
}

.summary-patterns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.summary-pattern {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
}

.summary-pattern--quick { background: rgba(138, 154, 134, 0.15); color: var(--color-primary-ink); }
.summary-pattern--normal { background: var(--color-tan-tint); color: var(--color-tan-ink); }
.summary-pattern--slow { background: var(--color-slate-tint); color: var(--color-slate-ink); }

.summary-insight {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* ── Wizard responsive ─────────────────────────────────────── */
@media (max-width: 640px) {
  .wizard-progress__step {
    padding: 0.375rem 0.25rem;
    font-size: 0.65rem;
  }

  .wizard-progress__num {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.65rem;
  }

  .wizard-progress::before {
    top: calc(0.375rem + 0.75rem);
    left: calc(0.25rem + 0.75rem);
    right: calc(0.25rem + 0.75rem);
  }

  .wizard-progress__step--done::before,
  .wizard-progress__step--active::before {
    top: calc(0.375rem + 0.75rem);
  }

  /* ── Member list: tighter spacing on small screens ──────── */
  .member-row.card {
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
  }

  .member-avatar {
    width: 38px;
    height: 38px;
    font-size: 0.875rem;
  }

  .member-row .member-row__name {
    font-size: 0.9375rem;
  }

  .member-row .member-row__select {
    font-size: 0.75rem;
  }

  .life-pattern-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .life-pattern-row__day {
    width: auto;
  }

  .life-pattern-row__options {
    width: 100%;
  }

  .wizard-nav {
    flex-direction: column;
  }

  .wizard-nav__right {
    width: 100%;
    flex-direction: column;
  }

  .wizard-nav .btn {
    width: 100%;
  }

  .radio-cards {
    gap: 0.375rem;
  }
}

/* ── Chip input (tag-style multi-value input) ─────────────── */
.chip-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  min-height: 44px;
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: text;
  transition: border-color 0.15s;
}

.chip-input:focus-within {
  border-color: var(--color-primary-ink);
  box-shadow: 0 0 0 3px rgba(138, 154, 134, 0.15);
}

.chip-input__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5rem;
  background: var(--color-ui-border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-main);
  white-space: nowrap;
  animation: fadeIn 0.15s ease;
}

.chip-input__chip--exclusion {
  background: rgba(194, 120, 103, 0.1);
  color: #9a4a3a;
}

.chip-input__chip--like {
  background: rgba(138, 154, 134, 0.15);
  color: var(--color-primary-ink);
}

.chip-input__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1;
  padding: 0;
  border-radius: 50%;
  opacity: 0.5;
  transition: opacity 0.12s;
}

.chip-input__remove:hover {
  opacity: 1;
}

.chip-input__field {
  flex: 1;
  min-width: 80px;
  border: none;
  outline: none;
  font-size: 0.875rem;
  font-family: inherit;
  background: transparent;
  color: var(--color-text-main);
  padding: 0.25rem 0;
  min-height: 28px;
}

.chip-input__field::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* ── Chip variants for summary ────────────────────────────── */
.chip--warn {
  background: rgba(194, 120, 103, 0.1);
  color: #9a4a3a;
}

.chip--positive {
  background: rgba(138, 154, 134, 0.15);
  color: var(--color-primary-ink);
}

/* ── Summary member preferences ───────────────────────────── */
.summary-member {
  padding: 0.625rem 0;
}

.summary-member + .summary-member {
  border-top: 1px solid var(--color-ui-border);
}

.summary-member__name {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
}

.summary-member__prefs {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.summary-member__row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.summary-member__label {
  color: var(--color-text-muted);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 4.5rem;
}

/* ── Mobile member rows + tabs ─────────────────────────────── */
@media (max-width: 640px) {
  /* Member tabs: horizontal scroll on mobile */
  .member-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }

  .member-tabs::-webkit-scrollbar {
    display: none;
  }

  .member-tab {
    flex: 0 0 auto;
    min-width: 5rem;
  }
}

/* ===========================================================
   Shopping List Page
   =========================================================== */

.container--shopping { max-width: 48rem; }

.page-header__meta {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin: 0.25rem 0 0;
}

.page-header__actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.shopping-category {
  background: var(--color-surface);
  border: 1px solid var(--color-ui-border);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.shopping-category__title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: 0.625rem 1rem;
  background: var(--color-bg-base);
  border-bottom: 1px solid var(--color-ui-border);
  margin: 0;
}

.shopping-category__items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.shopping-item {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--color-ui-border);
}

.shopping-item:last-child {
  border-bottom: none;
}

.shopping-item__label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
}

.shopping-item__check {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.shopping-item__name {
  flex: 1;
  font-size: 0.9375rem;
}

.shopping-item__qty {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  min-width: 4rem;
  text-align: right;
}

.shopping-item__meals {
  display: block;
  padding-left: 2.375rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

.shopping-item--checked .shopping-item__name {
  text-decoration: line-through;
  opacity: 0.5;
}

/* "Probably in your cupboard": collapsed by default (BASKET-3) */
.shopping-cupboard {
  background: var(--color-bg-base);
  border: 1px dashed var(--color-ui-border);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.shopping-cupboard__summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  cursor: pointer;
  list-style: none;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.shopping-cupboard__summary::-webkit-details-marker {
  display: none;
}

.shopping-cupboard__summary::after {
  content: "";
  margin-left: auto;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.shopping-cupboard[open] .shopping-cupboard__summary::after {
  transform: rotate(-135deg);
}

.shopping-cupboard__count {
  min-width: 1.5rem;
  padding: 0 0.375rem;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-ui-border);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.75rem;
  text-align: center;
  letter-spacing: 0;
}

.shopping-cupboard__hint {
  margin: 0;
  padding: 0 1rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.shopping-cupboard__items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.shopping-cupboard-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--color-ui-border);
}

.shopping-cupboard-item .shopping-item__name {
  color: var(--color-text-muted);
}

.shopping-cupboard-item__need {
  flex-shrink: 0;
}

.btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  line-height: 1;
}

.shopping-copy-btn,
.pdf-download-btn {
  color: var(--color-text-muted);
  min-width: 44px;
  transition: color 0.15s;
}

.shopping-copy-btn:hover,
.pdf-download-btn:hover {
  color: var(--color-text-main);
}

/* ===========================================================
   Post-confirm navigation
   =========================================================== */

.plan-confirmed-nav {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* Recipe tags (recipe detail and library) */
.recipe-tag {
  display: inline-block;
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: var(--color-bg-base);
  color: var(--color-text-muted);
  border: 1px solid var(--color-ui-border);
}

/* ===========================================================
   Recipe Detail Page
   =========================================================== */

.recipe-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.recipe-nav__back {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--color-text-muted);
  text-decoration: none;
}

.recipe-nav__back:hover { color: var(--color-text-main); }

.recipe-detail__header {
  margin-bottom: 2rem;
}

.recipe-detail__date {
  font-size: 0.8125rem;
  color: var(--color-primary-ink);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.375rem;
}

.recipe-detail__header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.recipe-detail__desc {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0 0 1rem;
}

.recipe-detail__meta {
  display: flex;
  gap: 1.5rem;
}

.recipe-meta-item {
  display: flex;
  flex-direction: column;
}

.recipe-meta-item__label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.recipe-meta-item__value {
  font-size: 1.125rem;
  font-weight: 600;
}

.recipe-detail__tags {
  display: flex;
  gap: 0.375rem;
  margin-top: 1rem;
}

.recipe-ingredients__item {
  padding: 0.375rem 0.5rem 0.375rem 0;
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--color-ui-border);
}

.recipe-adaptations {
  border: 1px solid var(--color-primary-line);
  border-left: 4px solid var(--color-primary);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: rgba(138, 154, 134, 0.08);
  border-radius: var(--radius-lg);
}

.recipe-adaptations h3 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary-ink);
}

.recipe-adaptations h3 svg {
  flex-shrink: 0;
}

.recipe-adaptations ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recipe-adaptations li {
  font-size: 0.9375rem;
  padding: 0.25rem 0;
}


@media (max-width: 640px) {
  .page-header {
    flex-direction: column;
  }

  .page-header__actions {
    width: 100%;
  }

  .page-header__actions .btn {
    flex: 1;
    text-align: center;
  }

  .plan-confirmed-nav {
    flex-direction: column;
  }

  .plan-confirmed-nav .pdf-download-btn {
    align-self: flex-start;
  }
}

/* ═══════════════════════════════════════════════════════════════
   EDITORIAL KITCHEN — Design Refresh
   Premium food-magazine direction: warm, confident, photo-led.
   ═══════════════════════════════════════════════════════════════ */

/* ── Meal image placeholder ────────────────────────────────── */
.meal-image {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.meal-image--16x9  { aspect-ratio: 16 / 9; }
.meal-image--4x3   { aspect-ratio: 4 / 3; }
.meal-image--square { aspect-ratio: 1; }

.meal-image__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Placeholder: warm shimmer gradient + centred glyph */
.meal-image__placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    #EDE9E0 0%,
    #E4DDD4 35%,
    #DDD5CA 55%,
    #E4DDD4 75%,
    #EDE9E0 100%
  );
  background-size: 300% 300%;
  animation: placeholder-shimmer 4s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes placeholder-shimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.meal-image__glyph {
  width: 52px;
  height: 52px;
  color: rgba(138, 120, 98, 0.32);
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   HOME: Editorial header + stats strip
   ══════════════════════════════════════ */

.home-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2.25rem 0 1.75rem;
  flex-wrap: wrap;
}

.home-header .home-header__title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
}

/* Stats strip — plain, text-only, NOT card-chrome */
.home-stats-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  flex-shrink: 0;
}

.home-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.home-stat__value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary-ink);
  line-height: 1.1;
}

.home-stat__label {
  font-size: 0.675rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.home-stat__divider {
  display: block;
  width: 1px;
  height: 1.75rem;
  background: var(--color-ui-border);
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   HOME: Tonight hero card
   ══════════════════════════════════════ */

.tonight-hero {
  display: block;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-hero);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.tonight-hero:hover {
  box-shadow: 0 12px 48px rgba(44, 48, 46, 0.18);
  transform: translateY(-2px);
}

.tonight-hero:focus-visible {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 3px;
}

/* Tactile press — the hero settles back down when tapped. */
.tonight-hero:active {
  transform: translateY(0);
  box-shadow: var(--shadow);
  transition: box-shadow 0.08s ease, transform 0.08s ease;
}

.tonight-hero .meal-image {
  width: 100%;
  border-radius: 0;
  max-height: 320px;
}

.tonight-hero .meal-image--16x9 {
  aspect-ratio: 16 / 6; /* wider crop for hero */
  max-height: 280px;
}

.tonight-hero__body {
  padding: 1.75rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tonight-hero__eyebrow {
  display: inline-block;
  font-size: 0.675rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary-ink);
}

.tonight-hero__name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.65rem, 3.5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-text-main);
  margin: 0;
}

.tonight-hero__ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tonight-hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tonight-hero__cta {
  align-self: flex-start;
  margin-top: 0.25rem;
}

/* ══════════════════════════════════════
   PREFERENCES WIZARD: wider layout
   ══════════════════════════════════════ */

.container--wizard {
  max-width: 680px;
}

/* Bigger step rail at desktop — spread out, less cramped */
@media (min-width: 700px) {
  .wizard-progress__step {
    padding: 0.625rem 0.875rem;
  }

  .wizard-progress__num {
    width: 2rem;
    height: 2rem;
    font-size: 0.8rem;
  }

  .wizard-progress__label {
    font-size: 0.8rem;
  }

  .wizard-progress::before {
    top: calc(0.625rem + 1rem);
    left: calc(0.875rem + 1rem);
    right: calc(0.875rem + 1rem);
  }

  .wizard-progress__step--done::before,
  .wizard-progress__step--active::before {
    top: calc(0.625rem + 1rem);
  }
}

/* ── Desktop: step rail moves down the side (1–7 vertical) ──────
   The wizard becomes a two-column grid: a sticky vertical step rail
   beside a roomy content column. Mobile/tablet keep the horizontal rail. */
@media (min-width: 900px) {
  .container--wizard {
    display: grid;
    grid-template-columns: 160px 1fr;
    column-gap: 3rem;
    align-items: start;
    max-width: 940px;
  }

  .container--wizard .page-header {
    grid-column: 1 / -1;
  }

  .wizard-progress {
    grid-column: 1;
    flex-direction: column;
    gap: 0;
    margin-bottom: 0;
    overflow: visible;
    position: sticky;
    top: calc(var(--nav-height) + 1.5rem);
  }

  #step-container {
    grid-column: 2;
  }

  /* Steps read left-to-right: circle, then label */
  .wizard-progress__step {
    flex: none;
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    text-align: left;
  }

  .wizard-progress__label {
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Connector line runs vertically down the centre of the circles */
  .wizard-progress::before {
    top: 1.625rem;
    bottom: 1.625rem;
    left: calc(0.875rem + 1rem - 1px);
    right: auto;
    width: 2px;
    height: auto;
  }

  /* Completed/active segments paint from above the circle down to its centre */
  .wizard-progress__step--done::before,
  .wizard-progress__step--active::before {
    top: 0;
    bottom: 50%;
    left: calc(0.875rem + 1rem - 1px);
    right: auto;
    width: 2px;
    height: auto;
  }

  .wizard-progress__step--done:first-child::before,
  .wizard-progress__step--active:first-child::before {
    display: none;
  }
}

/* Member rows — more editorial at wider breakpoints */
@media (min-width: 600px) {
  .member-row.card {
    padding: 1.125rem 1.375rem;
    gap: 1rem;
  }

  .member-avatar {
    width: 48px;
    height: 48px;
    font-size: 1.05rem;
  }

  .member-row .member-row__name {
    font-size: 1.0625rem;
  }
}

/* ══════════════════════════════════════
   RECIPE DETAIL: Editorial two-pane layout
   ══════════════════════════════════════ */

.container--recipe-detail {
  max-width: 72rem;   /* Wider to accommodate two-pane */
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

/* Hero image — full-width portrait */
.recipe-editorial__hero {
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}

.recipe-editorial__hero .meal-image--4x3 {
  aspect-ratio: 16 / 7;   /* wider crop on portrait too */
}

/* Two panes — stacked portrait */
.recipe-editorial__panes {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Recipe header in editorial style */
.recipe-editorial .recipe-detail__header {
  margin-bottom: 1.75rem;
}

.recipe-editorial .recipe-detail__header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* Ingredients as clean list (not two-col grid) on mobile */
.recipe-ingredients__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.recipe-ingredients__list .recipe-ingredients__item {
  padding: 0.5rem 0;
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--color-ui-border);
  line-height: 1.45;
}

.recipe-ingredients__list .recipe-ingredients__item:last-child {
  border-bottom: none;
}

/* Method: editorial numbered steps */
.recipe-ingredients h2,
.recipe-method h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-ui-border);
}

.recipe-method__steps {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.recipe-method__step {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.recipe-method__step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-primary-strong);
  color: var(--color-surface);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 0.05rem;
  font-family: 'Inter', sans-serif;
}

.recipe-method__step-text {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--color-text-main);
  padding-top: 0.2rem;
}

/* ── LANDSCAPE: two-pane side-by-side ─── */
/* Trigger on orientation rather than a max-height proxy so the columns engage
   reliably across phone- and tablet-landscape — no more marooned single column. */
@media (orientation: landscape) and (min-width: 641px),
       (min-width: 900px) {

  .recipe-editorial__hero {
    /* In landscape we move the image into the left column;
       show it as a narrower hero-strip above the panes */
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-bottom: 0;
    box-shadow: none;
  }

  .recipe-editorial__hero .meal-image--4x3 {
    aspect-ratio: 21 / 6;  /* panoramic strip above panes */
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .recipe-editorial__panes {
    flex-direction: row;
    gap: 0;
    background: var(--color-surface);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-hero);
    /* clip, not hidden: hidden would make this the sticky scroll container */
    overflow: clip;
  }

  .recipe-editorial__left {
    flex: 0 0 45%;
    max-width: 45%;
    padding: 2rem 1.75rem 2.5rem;
    background: var(--color-bg-base);
    position: sticky;
    top: var(--nav-height);
    align-self: flex-start;
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    scrollbar-width: thin;
    border-right: 1px solid var(--color-ui-border);
  }

  .recipe-editorial__right {
    flex: 1;
    min-width: 0;
    padding: 2rem 2rem 2.5rem;
    background: var(--color-surface);
  }
}

/* Phone landscape specifically (narrow landscape) — tighter padding */
@media (orientation: landscape) and (min-width: 641px) and (max-width: 899px) {
  .recipe-editorial__hero .meal-image--4x3 {
    aspect-ratio: 32 / 7;
  }

  .recipe-editorial__left {
    padding: 1.25rem 1.25rem 1.5rem;
    flex: 0 0 42%;
    max-width: 42%;
  }

  .recipe-editorial__right {
    padding: 1.25rem 1.5rem 1.5rem;
  }

  .recipe-editorial .recipe-detail__header h1 {
    font-size: 1.375rem;
  }

  .recipe-method__steps {
    gap: 0.875rem;
  }
}

/* Tablet and desktop — more generous */
@media (min-width: 900px) {
  .recipe-editorial__left {
    flex: 0 0 40%;
    max-width: 40%;
    padding: 2.5rem 2rem 3rem;
  }

  .recipe-editorial__right {
    padding: 2.5rem 2.5rem 3rem;
  }
}

/* ══════════════════════════════════════
   HOME: Responsive adjustments
   ══════════════════════════════════════ */

@media (max-width: 640px) {
  .home-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem 0 1.25rem;
  }

  .home-header .home-header__title {
    font-size: 1.875rem;
  }

  .home-stats-strip {
    gap: 0.625rem;
  }

  .home-stat__value {
    font-size: 0.95rem;
  }

  .tonight-hero .meal-image--16x9 {
    aspect-ratio: 4 / 3;
    max-height: 200px;
  }

  .tonight-hero__body {
    padding: 1.25rem 1.25rem 1.5rem;
    gap: 0.625rem;
  }

  .tonight-hero__name {
    font-size: 1.45rem;
  }
}

/* Tablet-landscape home */
@media (min-width: 768px) {
  .tonight-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tonight-hero .meal-image {
    border-radius: 0;
    max-height: none;
  }

  .tonight-hero .meal-image--16x9 {
    aspect-ratio: auto;
    height: 100%;
    min-height: 240px;
  }

  .tonight-hero__body {
    padding: 2rem 2rem 2.5rem;
    justify-content: center;
  }
}

/* ══════════════════════════════════════
   TYPOGRAPHY UPGRADES
   ══════════════════════════════════════ */

/* Push h1 more editorial on wider screens */
@media (min-width: 900px) {
  h1 {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.025em;
  }
}

/* ══════════════════════════════════════
   RECIPE DETAIL: mobile overrides
   ══════════════════════════════════════ */

@media (max-width: 640px) {
  .recipe-editorial__hero {
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
  }

  .recipe-editorial__hero .meal-image--4x3 {
    aspect-ratio: 4 / 3;
  }

  .container--recipe-detail {
    padding-left: 16px;
    padding-right: 16px;
  }
}


/* ── Recipe library (RECIPE-14c) ──────────────────────────── */
.container--recipe-library {
  max-width: 1100px;
  padding-top: 2rem;
}

.recipes-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.recipes-header__sub {
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.recipes-filter {
  display: inline-flex;
  gap: 0.25rem;
  background: var(--color-bg-base);
  border: 1px solid var(--color-ui-border);
  border-radius: 999px;
  padding: 0.25rem;
}

.recipes-filter__tab {
  padding: 0.4375rem 1rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: all 0.12s ease;
}

.recipes-filter__tab--active {
  background: var(--color-surface);
  color: var(--color-text-main);
  box-shadow: 0 1px 2px rgba(44, 48, 46, 0.08);
}

.recipe-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.recipe-tile {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: none;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.18s ease;
}

.recipe-tile:hover {
  box-shadow: var(--shadow-hero);
  transform: translateY(-2px);
}

/* Tactile press — tile settles back down when tapped. */
.recipe-tile:active {
  transform: translateY(0);
  box-shadow: var(--shadow);
  transition: box-shadow 0.08s ease, transform 0.08s ease;
}

.recipe-tile .meal-image {
  border-radius: 0;
}

.recipe-tile__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.125rem 1.25rem;
  flex: 1;
}

.recipe-tile__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.recipe-tile__type {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.recipe-tile__link {
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
}

.recipe-tile__link:focus-visible {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 2px;
}

.recipe-tile__name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0.125rem 0;
}

.recipe-tile__desc {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.recipe-tile__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: auto;
}

.recipe-save {
  margin: 0;
}

.recipe-save__btn,
.recipe-pdf-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.3125rem 0.625rem;
  border: 1px solid var(--color-ui-border);
  border-radius: 999px;
  background: var(--color-surface);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}

.recipe-save__btn:hover,
.recipe-pdf-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-ink);
}

.recipe-pdf-btn {
  padding: 0.3125rem 0.5rem;
  text-decoration: none;
}

.recipe-save__btn--on {
  border-color: var(--color-primary);
  background: rgba(138, 154, 134, 0.1);
  color: var(--color-primary-ink);
}

.recipes-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--color-text-muted);
}

.recipes-empty h2 {
  margin-bottom: 0.5rem;
  color: var(--color-text-main);
}

/* ── Save control placement on plan cards + detail (RECIPE-14c) ── */
.meal-card__top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.recipe-detail__save {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  margin-bottom: 1.25rem;
}

/* ── Whole meal card clickable → recipe detail (recipe-entity) ──
   Stretched-link overlay: an invisible <a> covers the card; interactive
   controls are lifted above it via z-index so they still receive clicks. */
.meal-card__overlay-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.meal-card--linked {
  cursor: pointer;
}
.meal-card--linked:hover .meal-card__name {
  color: var(--color-primary-ink);
}
/* Interactive regions sit above the overlay link */
.meal-card__top-actions,
.meal-card__footer,
.meal-diners,
.meal-card__swap-panel,
.meal-card__skip-panel {
  position: relative;
  z-index: 2;
}

/* ── Reduced motion ───────────────────────────────────────────
   Honour the OS setting: animations and transitions become an
   instant change. Fade-ins with fill-mode forwards still land. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
