/* ============================================================
   Forkato - Design System
   OKLCH dark mode, amber-tinted neutrals
   ============================================================ */

/* --- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; }

/* --- Tokens ------------------------------------------------ */
:root {
  /* Surface */
  --c-base:        oklch(0.13 0.008 70);
  --c-bg:          oklch(0.13 0.008 70);  /* alias - many rules use var(--c-bg) */
  --c-surface:     oklch(0.17 0.012 70);
  --c-surface-hi:  oklch(0.21 0.014 70);
  --c-surface-max: oklch(0.26 0.016 70);

  /* Accent - warm amber */
  --c-accent:       oklch(0.76 0.155 70);
  --c-accent-hover: oklch(0.83 0.12 70);
  --c-accent-subtle:oklch(0.24 0.04 70);
  --c-accent-fg:    oklch(0.16 0.02 70);

  /* Text */
  --c-text:   oklch(0.93 0.01 70);
  --c-text-2: oklch(0.68 0.01 70);
  --c-text-3: oklch(0.48 0.008 70);

  /* Borders */
  --c-border:    oklch(0.24 0.012 70);
  --c-border-hi: oklch(0.32 0.016 70);

  /* Semantic */
  --c-success: oklch(0.72 0.14 152);
  --c-error:   oklch(0.68 0.19 25);
  --c-warning: oklch(0.80 0.14 80);

  /* Spacing - 4pt. Token name ≈ 2x the pixel value. --s-10 was missing
     and several rules were silently resolving to 0 where it was used
     (pantry counts, rp-teaser gap, etc). */
  --s-2:  4px;   --s-4:  8px;   --s-6: 12px;
  --s-8: 16px;   --s-10: 20px;  --s-12: 24px;  --s-16: 32px;
  --s-24: 48px;  --s-32: 64px;  --s-48: 96px;

  /* Typography */
  --f-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --f-body:    'Figtree', system-ui, sans-serif;

  --t-xs:  0.75rem;
  --t-sm:  0.875rem;
  --t-base: 1rem;
  --t-lg:  1.25rem;
  --t-xl:  1.563rem;
  --t-2xl: 1.953rem;
  --t-3xl: 2.441rem;
  --t-4xl: 3.052rem;

  --lh-tight:  1.15;
  --lh-snug:   1.3;
  --lh-normal: 1.6;

  /* Radius */
  --r-sm:   6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-full: 9999px;

  /* Motion */
  --ease-out:  cubic-bezier(0.25, 1, 0.5, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast:   120ms;
  --dur-normal: 220ms;
  --dur-slow:   400ms;

  /* Shadows (dark mode: mostly elevation via surface lightness) */
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.5);
  --shadow-md: 0 4px 16px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 40px oklch(0 0 0 / 0.5);
}

/* ── Light-mode overrides ─────────────────────────────────────────
 *
 * Everything below is scoped to [data-theme='light'] on <html>. The
 * dark tokens above stay the defaults so any surface that hasn't been
 * opted into theming keeps working. Amber accent stays identical in
 * both modes; only neutrals + semantic colors shift.
 *
 * `:root[data-theme='light']` lets a signed-in user or a localStorage
 * preference force light even if the OS wants dark. The
 * `prefers-color-scheme: light` media query further down applies the
 * same overrides to visitors who have no Forkato preference set.
 */
:root[data-theme='light'] {
  /* Surface - warm cream base, pure white cards, muted card-hover. */
  --c-base:        oklch(0.98 0.005 70);  /* #faf8f4 */
  --c-bg:          oklch(0.98 0.005 70);  /* alias - see dark block above */
  --c-surface:     oklch(1    0    0);    /* #ffffff */
  --c-surface-hi:  oklch(0.94 0.006 70);  /* #f2ede6 */
  --c-surface-max: oklch(0.90 0.007 70);

  /* Accent - same amber in both modes. Foreground on a filled amber
     button is white in light mode so it still reads. */
  --c-accent:        oklch(0.72 0.15  70);
  --c-accent-hover:  oklch(0.66 0.16  70);
  --c-accent-subtle: oklch(0.94 0.04  70);
  --c-accent-fg:     oklch(1    0     0);

  /* Text - dark warm brown instead of cream. */
  --c-text:   oklch(0.17 0.012 70);
  --c-text-2: oklch(0.34 0.008 70);
  --c-text-3: oklch(0.54 0.007 70);

  /* Borders - soft warm grey. */
  --c-border:    oklch(0.88 0.006 70);
  --c-border-hi: oklch(0.80 0.008 70);

  /* Semantic - slightly darker so they stay legible on light bg. */
  --c-success: oklch(0.55 0.14 152);
  --c-error:   oklch(0.58 0.22 25);
  --c-warning: oklch(0.65 0.16 80);

  /* Shadows - light mode needs actual cast shadows, not elevation
     via lightness shifts. Subtle warm black. */
  --shadow-sm: 0 1px 2px  oklch(0 0 0 / 0.06);
  --shadow-md: 0 3px 10px oklch(0 0 0 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.12);
}

/* Default to light when the OS asks for light AND the user hasn't
   explicitly opted in. A user who has set data-theme (via the nav
   toggle or their saved preference) always overrides this. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']):not([data-theme='light']) {
    --c-base:        oklch(0.98 0.005 70);
    --c-bg:          oklch(0.98 0.005 70);
    --c-surface:     oklch(1    0    0);
    --c-surface-hi:  oklch(0.94 0.006 70);
    --c-surface-max: oklch(0.90 0.007 70);
    --c-accent:        oklch(0.72 0.15  70);
    --c-accent-hover:  oklch(0.66 0.16  70);
    --c-accent-subtle: oklch(0.94 0.04  70);
    --c-accent-fg:     oklch(1    0     0);
    --c-text:   oklch(0.17 0.012 70);
    --c-text-2: oklch(0.34 0.008 70);
    --c-text-3: oklch(0.54 0.007 70);
    --c-border:    oklch(0.88 0.006 70);
    --c-border-hi: oklch(0.80 0.008 70);
    --c-success: oklch(0.55 0.14 152);
    --c-error:   oklch(0.58 0.22 25);
    --c-warning: oklch(0.65 0.16 80);
    --shadow-sm: 0 1px 2px  oklch(0 0 0 / 0.06);
    --shadow-md: 0 3px 10px oklch(0 0 0 / 0.08);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.12);
  }
}

/* --- Base -------------------------------------------------- */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--f-body);
  font-weight: 400;
  font-size: var(--t-base);
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-base);
  min-height: 100vh;
}

::selection {
  background: oklch(0.76 0.155 70 / 0.3);
  color: var(--c-text);
}

/* --- Typography -------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 650;
  line-height: var(--lh-tight);
  color: var(--c-text);
  letter-spacing: -0.02em;
}
h1 { font-size: var(--t-4xl); }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-xl); }
h4 { font-size: var(--t-lg); }

.text-sm  { font-size: var(--t-sm); }
.text-xs  { font-size: var(--t-xs); }
.text-lg  { font-size: var(--t-lg); }
.text-muted { color: var(--c-text-3); }
.text-secondary { color: var(--c-text-2); }
.text-accent { color: var(--c-accent); }

/* --- Links ------------------------------------------------- */
a:not(.btn):not(.nav__brand):not(.recipe-card) {
  color: var(--c-accent);
  transition: color var(--dur-fast) var(--ease-out);
}
a:not(.btn):not(.nav__brand):not(.recipe-card):hover {
  color: var(--c-accent-hover);
}

/* --- Nav --------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  /* Derive the translucent bar from the active --c-base so light
     mode gets a warm cream frost + dark mode keeps the original
     near-black. 88% opacity + backdrop-filter gives the subtle
     glass effect without obscuring content beneath. */
  background: color-mix(in oklch, var(--c-base) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--c-border);
  padding: var(--s-6) var(--s-12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-8);
}

.nav__brand {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.nav__brand-mark {
  width: 28px;
  height: 28px;
  background: var(--c-accent);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-accent-fg);
  font-weight: 800;
  font-size: var(--t-sm);
  font-family: var(--f-display);
}

.nav__brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  object-fit: contain;
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

/* --- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-8);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--f-body);
  font-size: var(--t-sm);
  font-weight: 500;
  line-height: 1.4;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--c-accent);
  color: var(--c-accent-fg);
}
.btn--primary:hover {
  background: var(--c-accent-hover);
}
.btn--primary:active {
  background: oklch(0.70 0.16 70);
}

.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--ghost {
  background: transparent;
  color: var(--c-text-2);
  border-color: var(--c-border);
}
.btn--ghost:hover {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border-hi);
}
.btn--ghost:active {
  background: var(--c-surface-hi);
}

.btn--danger {
  background: transparent;
  color: var(--c-error);
  /* Derive the red border + hover tint from the active --c-error so
     light mode reads as a softer red wash instead of the hardcoded
     dark oklch that rendered nearly-black on white. */
  border-color: color-mix(in oklch, var(--c-error) 38%, var(--c-border));
}
.btn--danger:hover {
  background: color-mix(in oklch, var(--c-error) 12%, transparent);
}
.btn--danger:active {
  background: oklch(0.22 0.07 25);
}

.btn--text {
  background: transparent;
  color: var(--c-text-2);
  padding: var(--s-2) var(--s-4);
  border: none;
}
.btn--text:hover { color: var(--c-text); }

.btn--sm {
  padding: var(--s-2) var(--s-4);
  font-size: var(--t-xs);
}

.btn--lg {
  padding: var(--s-6) var(--s-12);
  font-size: var(--t-base);
  border-radius: var(--r-lg);
}

.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-md);
  font-size: var(--t-lg);
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* --- Inputs ------------------------------------------------ */
.input {
  width: 100%;
  padding: var(--s-6) var(--s-8);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  font-size: var(--t-base);
  line-height: 1.5;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.input::placeholder { color: var(--c-text-3); }
.input:focus {
  outline: none;
  border-color: var(--c-accent);
  background: var(--c-surface-hi);
}
textarea.input { resize: vertical; min-height: 140px; }

.input--lg {
  padding: var(--s-8) var(--s-12);
  font-size: var(--t-lg);
  border-radius: var(--r-lg);
}

.label {
  display: block;
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--c-text-2);
  margin-bottom: var(--s-4);
}

.form-hint {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  margin-top: var(--s-2);
}

.field { margin-bottom: var(--s-12); }

/* --- Alert ------------------------------------------------- */
.alert {
  padding: var(--s-6) var(--s-8);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  line-height: 1.5;
}
.alert--error {
  background: oklch(0.18 0.05 25);
  color: oklch(0.85 0.12 25);
}
.alert--success {
  background: oklch(0.18 0.04 152);
  color: oklch(0.82 0.10 152);
}

/* --- Tags -------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--s-2) var(--s-6);
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 500;
  line-height: 1.4;
}

.tag--platform {
  background: var(--c-surface-hi);
  color: var(--c-text-2);
  text-transform: capitalize;
}

/* --- Dropdown ---------------------------------------------- */
.dropdown {
  position: relative;
}
.dropdown__trigger {
  cursor: pointer;
}
.dropdown__menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 160px;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-2);
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.dropdown--open .dropdown__menu { display: block; }

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  width: 100%;
  padding: var(--s-4) var(--s-6);
  border: none;
  background: none;
  color: var(--c-text-2);
  font-size: var(--t-sm);
  border-radius: var(--r-sm);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.dropdown__item:hover {
  background: var(--c-surface-max);
  color: var(--c-text);
}
.dropdown__item--danger {
  color: var(--c-error);
}
.dropdown__item--danger:hover {
  background: color-mix(in oklch, var(--c-error) 14%, transparent);
  color: var(--c-error);
}
.dropdown__divider {
  height: 1px;
  margin: var(--s-2) calc(-1 * var(--s-2));
  background: var(--c-border);
}

/* --- Search Bar -------------------------------------------- */
.search-bar {
  position: relative;
}
.search-bar__icon {
  position: absolute;
  left: var(--s-8);
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-3);
  pointer-events: none;
  font-size: var(--t-lg);
}
.search-bar .input {
  padding-left: 44px;
}

/* --- Tabs -------------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--s-2);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--s-12);
}
.tab {
  padding: var(--s-4) var(--s-8);
  border: none;
  background: transparent;
  color: var(--c-text-3);
  font-size: var(--t-sm);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.tab:hover { color: var(--c-text-2); }
.tab--active {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
}

/* --- View Toggle ------------------------------------------- */
.view-toggle {
  display: flex;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.view-toggle__btn {
  padding: var(--s-2) var(--s-4);
  border: none;
  background: transparent;
  color: var(--c-text-3);
  font-size: var(--t-sm);
  transition: all var(--dur-fast) var(--ease-out);
  display: flex;
  align-items: center;
}
.view-toggle__btn--active {
  background: var(--c-surface-hi);
  color: var(--c-text);
}
.view-toggle__btn:hover:not(.view-toggle__btn--active) {
  color: var(--c-text-2);
}

/* ============================================================
   RECIPE CARDS
   ============================================================ */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-12);
}

.recipe-card {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3 / 2;
  background: var(--c-surface);
  transition: transform var(--dur-normal) var(--ease-out),
              box-shadow var(--dur-normal) var(--ease-out);
}
.recipe-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.recipe-card:hover .recipe-card__img { transform: scale(1.035); }
.recipe-card__img { transition: transform 420ms cubic-bezier(.2,.7,.25,1); }
/* Description excerpt is hidden in grid view, shown in list view */
.recipe-card__excerpt {
  display: none;
  font-size: var(--t-xs);
  color: oklch(0.78 0.008 70);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recipe-grid:not(.recipe-grid--list) .recipe-card__excerpt { display: none; }
.recipe-grid--list .recipe-card__excerpt { display: -webkit-box; }
.recipe-card:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

.recipe-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-card__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    oklch(0.05 0.005 70 / 0.88) 0%,
    oklch(0.05 0.005 70 / 0.35) 45%,
    transparent 70%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--s-8);
  gap: var(--s-2);
}

.recipe-card__title {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 600;
  color: oklch(0.96 0.005 70);
  line-height: var(--lh-snug);
  letter-spacing: -0.01em;
}

.recipe-card__meta {
  font-size: var(--t-xs);
  color: oklch(0.72 0.01 70);
  display: flex;
  align-items: center;
  gap: var(--s-6);
}

.recipe-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.recipe-card__tags .tag {
  background: oklch(1 0 0 / 0.12);
  color: oklch(0.90 0.01 70);
  font-size: 0.65rem;
}

/* No-image card */
.recipe-card--noimg {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--s-12);
  background: linear-gradient(
    135deg,
    var(--c-surface) 0%,
    var(--c-surface-hi) 100%
  );
}

.recipe-card--noimg::before {
  content: '';
  position: absolute;
  top: var(--s-8);
  right: var(--s-8);
  width: 48px;
  height: 48px;
  border-radius: var(--r-lg);
  background: var(--c-accent-subtle);
  opacity: 0.5;
}

.recipe-card--noimg .recipe-card__title {
  color: var(--c-text);
}

.recipe-card--noimg .recipe-card__meta {
  color: var(--c-text-3);
}

.recipe-card--noimg .recipe-card__tags .tag {
  background: var(--c-accent-subtle);
  color: var(--c-accent);
}

/* ─── List view variant ─────────────────────────────────────────
   Horizontal row: fixed-width thumbnail on the left, info stacked on
   the right. Card is a consistent height regardless of content. */
.recipe-grid--list {
  grid-template-columns: 1fr;
  gap: var(--s-4);
}

.recipe-grid--list .recipe-card {
  aspect-ratio: unset;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  height: 112px;
  border-radius: var(--r-md);
  overflow: hidden;
  /* Both of these are required to stop the card overflowing its parent grid
     track when a long unbreakable title/description pushes min-content wider:
     - min-width:0 overrides CSS Grid's default min-width:auto on grid items
     - width:100% and max-width:100% clamp the card to the container width */
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Thumbnail spans the full height; object-fit crops cleanly. */
.recipe-grid--list .recipe-card__img,
.recipe-grid--list .recipe-card__placeholder {
  width: 120px;
  height: 112px;
  object-fit: cover;
}

/* Platform badge (TikTok F / Facebook F / etc) stays pinned to the
   thumbnail corner - the card itself is position:relative so the
   absolutely-positioned badge lands on the thumbnail since the image
   occupies the first grid column at top-left. */
.recipe-grid--list .recipe-card__platform {
  top: 8px;
  left: 8px;
  right: auto;
}

.recipe-grid--list .recipe-card__scrim {
  position: static;
  background: none;
  /* Extra right padding so content never collides with the + quick-add
     button when it fades in on hover. */
  padding: var(--s-6) 44px var(--s-6) var(--s-8);
  justify-content: center;
  gap: 2px;
  min-width: 0; /* allow title/excerpt to ellipsize in the flex item */
  overflow: hidden;
}
.recipe-grid--list .recipe-card__meta,
.recipe-grid--list .recipe-card__tags {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.recipe-grid--list .recipe-card__tags {
  flex-wrap: nowrap;
}

.recipe-grid--list .recipe-card__title {
  color: var(--c-text);
  font-size: var(--t-base);
  line-height: 1.2;
  /* Clamp to a single line so card height stays fixed. */
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-grid--list .recipe-card__meta {
  color: var(--c-text-3);
}

.recipe-grid--list .recipe-card__excerpt {
  -webkit-line-clamp: 1;
  font-size: var(--t-xs);
  color: var(--c-text-3);
  margin-top: 2px;
}

.recipe-grid--list .recipe-card__tags {
  margin-top: 2px;
}

.recipe-grid--list .recipe-card__tags .tag {
  background: var(--c-accent-subtle);
  color: var(--c-accent);
}

/* AI badge in list view: small pill tucked right under the title. */
.recipe-grid--list .recipe-card__scrim .badge--ai,
.recipe-grid--list .recipe-card__scrim .badge--ai-partial {
  margin-top: 2px;
}

/* No-image variant: placeholder still fills the 120px thumbnail column. */
.recipe-grid--list .recipe-card--noimg {
  grid-template-columns: 120px 1fr;
  padding: 0;
  height: 112px;
}

.recipe-grid--list .recipe-card--noimg::before { display: none; }

/* Shrink on narrow screens - keep the horizontal row but reduce gaps. */
@media (max-width: 480px) {
  .recipe-grid--list .recipe-card {
    grid-template-columns: 96px 1fr;
    height: 100px;
  }
  .recipe-grid--list .recipe-card__img,
  .recipe-grid--list .recipe-card__placeholder {
    width: 96px;
    height: 100px;
  }
  .recipe-grid--list .recipe-card--noimg {
    grid-template-columns: 96px 1fr;
    height: 100px;
  }
  .recipe-grid--list .recipe-card__excerpt { display: none; }
}

/* ============================================================
   RECIPE DETAIL
   ============================================================ */
.recipe-detail { max-width: 960px; }

.recipe-detail__hero {
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  border-radius: var(--r-xl);
  margin-bottom: var(--s-16);
}

/* Editorial gradient hero for recipes without a photo:
   category emoji sits center-behind, title overlaid in display font.
   The hero inherits the warm Forkato palette and stays on-brand. */
.recipe-hero-fallback {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8;
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: var(--s-12);
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vw, 48px);
  isolation: isolate;
}
.recipe-hero-fallback__emoji {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(7rem, 18vw, 14rem);
  opacity: 0.18;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.4));
  z-index: 0;
  pointer-events: none;
}
.recipe-hero-fallback__overlay {
  position: relative;
  z-index: 1;
  max-width: 22ch;
  text-align: center;
}
.recipe-hero-fallback__eyebrow {
  font-family: var(--f-body);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: var(--s-4);
}
.recipe-hero-fallback__title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--c-text);
  margin: 0;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.45);
}

.recipe-detail__header {
  margin-bottom: var(--s-12);
}

.recipe-detail__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-8);
  flex-wrap: wrap;
}
.recipe-detail__jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: var(--t-xs);
  color: var(--c-text-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  text-decoration: none;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.recipe-detail__jump:hover {
  color: var(--c-accent);
  border-color: var(--c-accent);
  background: color-mix(in oklch, var(--c-accent) 8%, transparent);
}

.recipe-detail__confidence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--s-4);
  padding: 3px 10px;
  font-size: var(--t-xs);
  font-weight: 500;
  border-radius: var(--r-full);
  letter-spacing: 0.02em;
}
.recipe-detail__confidence--ai {
  background: color-mix(in oklch, var(--c-accent) 18%, transparent);
  color: var(--c-accent);
  border: 1px solid color-mix(in oklch, var(--c-accent) 60%, transparent);
}
.recipe-detail__confidence--partial {
  background: var(--c-surface-hi);
  color: var(--c-text-2);
  border: 1px solid var(--c-border-hi, var(--c-text-3));
}

.recipe-detail__title {
  font-size: var(--t-3xl);
  margin-bottom: var(--s-4);
}

.recipe-detail__desc {
  color: var(--c-text-2);
  font-size: var(--t-lg);
  line-height: var(--lh-normal);
  max-width: 65ch;
}

/* Meta pills: distinct bordered badges with amber icon chip, not plain text */
.recipe-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-6);
  margin-bottom: var(--s-12);
}

.recipe-detail__meta-item {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  padding: 6px 14px 6px 6px;
  font-size: var(--t-sm);
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  font-weight: 500;
}

.recipe-detail__meta-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.recipe-detail__source {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-12);
}

.recipe-detail__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-bottom: var(--s-16);
}

.recipe-detail__body {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--s-16);
  align-items: start;
}

@media (max-width: 768px) {
  .recipe-detail__body {
    grid-template-columns: 1fr;
    gap: var(--s-12);
  }
}

/* Ingredients - two-column layout on desktop for longer lists */
.ingredients {
  position: sticky;
  top: 80px;
}
.ingredients__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
/* Single-column ingredients list. Standard recipe-app layout:
   one ingredient per row, amount column vertically aligned. */
.ingredients__list--two-col {
  /* No-op - kept as a historical hook; list stays single column */
}

.ingredients__title,
.steps__title {
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
  margin-bottom: var(--s-8);
}

.ingredients__list li {
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--t-base);
  line-height: var(--lh-snug);
  color: var(--c-text);
}
.ingredients__list li:last-child { border-bottom: none; }

/* Amount + unit in amber, fixed minimum width so amounts align as a column.
   Inside a flex .ingredient-item LI, flex-shrink: 0 keeps long names from
   squeezing the amount back into a wrap. */
.ingredients__amount {
  display: inline-flex;
  flex-shrink: 0;
  min-width: 80px;
  color: var(--c-accent);
  font-family: var(--f-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .ingredients__amount { min-width: 64px; }
}
.ingredients__amount--empty { min-width: 80px; }
@media (max-width: 640px) {
  .ingredients__amount--empty { min-width: 64px; }
}
/* The ingredient name fills the remainder of the row and wraps cleanly */
.ingredients__name {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.45;
  color: var(--c-text);
}

/* Steps */
.steps__list { counter-reset: step; }

.steps__list li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: var(--s-12);
  padding: var(--s-12) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--t-lg);
  line-height: 1.6;
  color: var(--c-text);
  align-items: start;
}
.steps__list li:last-child { border-bottom: none; }

.steps__list li::before {
  content: counter(step);
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  background: color-mix(in oklch, var(--c-accent) 18%, transparent);
  color: var(--c-accent);
  border: 1px solid color-mix(in oklch, var(--c-accent) 35%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: var(--t-xl);
  flex-shrink: 0;
}

/* ============================================================
   IMPORT PAGE
   ============================================================ */
.import-page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--s-24) var(--s-12);
}

.import-page__title {
  font-size: var(--t-2xl);
  margin-bottom: var(--s-4);
}

.import-page__subtitle {
  color: var(--c-text-2);
  margin-bottom: var(--s-16);
  max-width: 50ch;
}

.import-page .tab-content {
  display: none;
}
.import-page .tab-content--active {
  display: block;
}

.import-progress {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-8);
  background: var(--c-surface);
  border-radius: var(--r-md);
  color: var(--c-text-2);
  font-size: var(--t-sm);
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--s-32) var(--s-12);
}

.empty-state__icon {
  font-size: 4rem;
  color: var(--c-text-3);
  opacity: 0.3;
  margin-bottom: var(--s-12);
}

.empty-state__title {
  font-family: var(--f-display);
  font-size: var(--t-xl);
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: var(--s-4);
}

.empty-state__desc {
  color: var(--c-text-3);
  margin-bottom: var(--s-12);
  max-width: 36ch;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--s-12);
}

.login-form {
  width: 100%;
  max-width: 380px;
}

.login-brand {
  margin-bottom: var(--s-24);
}

.login-brand__mark {
  width: 44px;
  height: 44px;
  background: var(--c-accent);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-accent-fg);
  font-weight: 800;
  font-size: var(--t-lg);
  font-family: var(--f-display);
  margin-bottom: var(--s-12);
}

.login-brand__title {
  font-family: var(--f-display);
  font-size: var(--t-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--s-4);
}

.login-brand__subtitle {
  color: var(--c-text-3);
  font-size: var(--t-sm);
}

.pw-strength {
  height: 4px;
  background: var(--c-border);
  border-radius: var(--r-full);
  margin-top: var(--s-4);
  overflow: hidden;
}
.pw-strength__bar {
  height: 100%;
  width: 0;
  border-radius: var(--r-full);
  transition: width 0.2s, background 0.2s;
}

/* ============================================================
   ADMIN
   ============================================================ */
.admin-layout {
  padding: var(--s-12);
  max-width: 1280px;
  margin: 0 auto;
}

/* Rate-limit-off dev banner. Rendered when RATE_LIMIT_DISABLED=true in .env.
   Deliberately loud so it's impossible to miss - this should never ship
   enabled to production. */
.adm-ratelimit-banner {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-8) var(--s-10);
  margin: 0 0 var(--s-10);
  background: color-mix(in oklch, var(--c-warning) 14%, var(--c-surface));
  border: 1px solid var(--c-warning);
  border-radius: var(--r-md);
  color: var(--c-text);
}
.adm-ratelimit-banner__mark {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--c-warning);
  color: var(--c-accent-fg);
  font-size: 20px;
  font-weight: 700;
}
.adm-ratelimit-banner__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-ratelimit-banner__title {
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-warning);
}
.adm-ratelimit-banner__desc { font-size: var(--t-sm); line-height: 1.5; color: var(--c-text-2); }
.adm-ratelimit-banner code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  background: rgba(0,0,0,0.3);
  color: var(--c-text);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-6);
  margin-bottom: var(--s-16);
}

.stat-block {
  background: var(--c-surface);
  /* Subtle border so cards read on the near-white light-mode base.
     In dark mode the border resolves to a darker surface-hi shade
     and largely disappears, which is fine. */
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-12);
}

.stat-block__label {
  font-size: var(--t-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
  margin-bottom: var(--s-4);
}

.stat-block__value {
  font-family: var(--f-display);
  font-size: var(--t-2xl);
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}

.stat-block--accent .stat-block__value,
.stat-block__value.stat-block--accent {
  color: var(--c-accent);
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}

.data-table th {
  text-align: left;
  padding: var(--s-6) var(--s-8);
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-3);
  border-bottom: 1px solid var(--c-border);
}

.data-table td {
  padding: var(--s-6) var(--s-8);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-2);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td {
  background: var(--c-surface);
}

.data-table .text-right { text-align: right; }
.data-table .text-nowrap { white-space: nowrap; }

.data-panel {
  background: var(--c-surface);
  /* Border added for light-mode readability (see .stat-block note). */
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--s-12);
}

/* Notification preferences rows - one per channel, each with a native
   checkbox that the JS treats as the source of truth. */
.notif-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-6);
  padding: var(--s-6) 0;
  cursor: pointer;
}
.notif-row + .notif-row {
  border-top: 1px solid var(--c-border);
}
.notif-row input {
  margin-top: 4px;
  flex: 0 0 auto;
  accent-color: var(--c-accent);
  width: 18px;
  height: 18px;
}
.notif-row__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notif-row__title {
  color: var(--c-text);
  font-size: var(--t-sm);
  font-weight: 600;
}
.notif-row__sub {
  color: var(--c-text-3);
  font-size: var(--t-xs);
  line-height: 1.4;
}

/* Grocery store preferences - profile panel */
.store-add-row { display: flex; gap: var(--s-4); margin-bottom: var(--s-6); }
.store-add-row .input { flex: 1; }
.store-search-results {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--s-6);
}
.store-search-head {
  padding: var(--s-4) var(--s-6);
  font-size: var(--t-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
  font-weight: 700;
}
.store-search-row {
  display: flex; align-items: center; gap: var(--s-4);
  width: 100%;
  padding: var(--s-4) var(--s-6);
  background: transparent;
  border: none; border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
  text-align: left;
  cursor: pointer;
}
.store-search-row:last-child { border-bottom: none; }
.store-search-row:hover { background: var(--c-surface); }
.store-search-row__main { flex: 1; font-size: var(--t-sm); font-weight: 600; }
.store-search-row__sub  { color: var(--c-text-3); font-size: var(--t-xs); }
.store-search-row__plus { color: var(--c-accent); font-weight: 700; font-size: var(--t-lg); }

/* Store location picker (step 2 of the preferred-store flow). Fixed
   overlay + centered card on desktop, full-width sheet on mobile. */
.store-picker {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-8);
}
.store-picker.hidden { display: none; }
.store-picker__sheet {
  width: 100%; max-width: 540px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: 0 32px 60px rgba(0,0,0,0.45);
  overflow: hidden;
}
.store-picker__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-8) var(--s-10);
  border-bottom: 1px solid var(--c-border);
}
.store-picker__title { font-family: var(--f-display); font-size: var(--t-lg); color: var(--c-text); margin: 0; }
.store-picker__sub   { color: var(--c-text-2); font-size: var(--t-xs); margin: 2px 0 0; }
.store-picker__body {
  padding: var(--s-8) var(--s-10);
  display: flex; flex-direction: column; gap: var(--s-6);
}
.store-picker__row {
  display: flex; gap: var(--s-4);
}
.store-picker__row .input { flex: 1; }
.store-picker__results {
  display: flex; flex-direction: column;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  max-height: 320px; overflow-y: auto;
}
.store-picker__results:empty { border: 0; }
.store-picker__foot {
  display: flex; gap: var(--s-4); justify-content: space-between;
  padding-top: var(--s-4); border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.store-picker__manual {
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-8);
}
@media (max-width: 520px) {
  .store-picker { padding: 0; align-items: flex-end; }
  .store-picker__sheet {
    max-width: none;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
}

/* Barcode scanner modal (shared by pantry + shopping list). Full-viewport
   black background with a centered video preview and an amber targeting
   frame. */
.bc-scanner {
  position: fixed; inset: 0; z-index: 140;
  display: flex; align-items: center; justify-content: center;
}
.bc-scanner__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.85);
}
.bc-scanner__panel {
  position: relative;
  width: min(540px, 100%);
  max-height: 92vh;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 40px 80px rgba(0,0,0,0.5);
}
.bc-scanner__head {
  display: flex; align-items: flex-start; gap: var(--s-6);
  padding: var(--s-8) var(--s-10);
  border-bottom: 1px solid var(--c-border);
}
.bc-scanner__title { font-family: var(--f-display); font-size: var(--t-lg); color: var(--c-text); margin: 0; }
.bc-scanner__subtitle { color: var(--c-text-2); font-size: var(--t-xs); margin: 2px 0 0; }
.bc-scanner__head > div:first-child { flex: 1; }
.bc-scanner__close {
  background: transparent; border: 0; color: var(--c-text-2);
  font-size: 28px; line-height: 1; padding: 0 4px;
  cursor: pointer;
}
.bc-scanner__count {
  background: var(--c-accent); color: var(--c-bg);
  font-size: var(--t-xs); font-weight: 700;
  padding: 4px 10px; border-radius: var(--r-full);
  align-self: center;
}

.bc-scanner__video-wrap {
  position: relative;
  background: #000;
  /* Explicit fallback height in case aspect-ratio isn't honored. */
  min-height: 300px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.bc-scanner__video {
  /* Absolutely positioned so width/height 100% always resolve, even if
     the parent's aspect-ratio isn't yet computed. Without this, the
     <video> element falls back to its intrinsic dimensions (640x480 from
     the stream) and floats inside the wrap with black bars. */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}
.bc-scanner__frame {
  position: absolute; inset: 12%;
  pointer-events: none;
}
.bc-scanner__frame span {
  position: absolute; width: 28px; height: 28px;
  border-color: var(--c-accent);
}
.bc-scanner__frame span:nth-child(1) { top: 0; left: 0;  border-top: 3px solid; border-left:  3px solid; }
.bc-scanner__frame span:nth-child(2) { top: 0; right: 0; border-top: 3px solid; border-right: 3px solid; }
.bc-scanner__frame span:nth-child(3) { bottom: 0; left: 0;  border-bottom: 3px solid; border-left:  3px solid; }
.bc-scanner__frame span:nth-child(4) { bottom: 0; right: 0; border-bottom: 3px solid; border-right: 3px solid; }

.bc-scanner__status {
  min-height: 22px;
  padding: var(--s-6) var(--s-10);
  font-size: var(--t-sm); color: var(--c-accent);
  text-align: center;
  font-weight: 600;
}
.bc-scanner__status--err { color: var(--c-error); font-weight: 500; }

/* Manual entry is always visible - the permission-prompt dance can
   fail in enough subtle ways (Chrome popups blocked, wrong tab focus,
   prior deny decision cached) that typing the UPC is a first-class
   input, not a hidden fallback. */
.bc-scanner__manual {
  padding: var(--s-6) var(--s-10) var(--s-8);
  border-top: 1px solid var(--c-border);
  background: color-mix(in oklch, var(--c-surface) 92%, var(--c-bg));
}
.bc-scanner__manual-label {
  display: block;
  font-size: var(--t-xs); font-weight: 700;
  color: var(--c-text-3); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 6px;
}
.bc-scanner__manual-row { display: flex; gap: var(--s-4); }
.bc-scanner__manual-input {
  flex: 1;
  font-family: var(--f-body);
  font-variant-numeric: tabular-nums;
}

/* Profile tabs: same sticky/amber pattern as the admin dashboard so
   the page stops being a 1000-line scroll. */
.profile-tabs {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  gap: 2px;
  padding: 0 var(--s-12);
  background: color-mix(in oklch, var(--c-bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.1) blur(8px);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--c-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.profile-tabs::-webkit-scrollbar { display: none; }
.profile-tabs__tab {
  appearance: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 14px;
  background: transparent; border: 0;
  color: var(--c-text-2);
  font-family: var(--f-body); font-size: var(--t-sm); font-weight: 500;
  cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent;
  transition: color 160ms ease-out, box-shadow 200ms ease-out;
}
.profile-tabs__tab:hover { color: var(--c-text); }
.profile-tabs__tab.is-active {
  color: var(--c-accent);
  box-shadow: inset 0 -2px 0 var(--c-accent);
}
.profile-tab { display: none; }
.profile-tab.is-active { display: block; animation: profileTabIn 220ms ease-out; }
@keyframes profileTabIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.profile-link-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-6) var(--s-8);
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  text-decoration: none;
  font-size: var(--t-sm);
  font-weight: 500;
  transition: border-color 160ms ease-out, background 160ms ease-out;
}
.profile-link-row:hover {
  border-color: var(--c-accent);
  background: var(--c-surface);
}

/* Units & Measurement section - pill toggle rows for system / unit
   choices + a standard select for radius. Dense but still tappable. */
.units-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
  padding: var(--s-6) 0;
  border-bottom: 1px solid var(--c-border);
}
.units-row:last-of-type { border-bottom: 0; }
.units-row__label {
  color: var(--c-text);
  font-size: var(--t-sm);
  font-weight: 500;
  flex: 1;
}
.units-toggle {
  display: inline-flex;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  padding: 2px;
  gap: 2px;
}
.units-toggle__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--c-text-2);
  font-family: var(--f-body);
  font-size: var(--t-xs);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: color 160ms ease-out, background 160ms ease-out;
}
.units-toggle__btn:hover { color: var(--c-text); }
.units-toggle__btn--on {
  background: var(--c-accent);
  color: var(--c-bg);
}
.units-radius {
  width: auto;
  min-width: 120px;
  padding: 6px 12px;
  font-size: var(--t-xs);
}

.bc-scanner__foot {
  display: flex; justify-content: space-between; gap: var(--s-6);
  padding: var(--s-6) var(--s-10) var(--s-10);
  border-top: 1px solid var(--c-border);
}

.store-list { display: flex; flex-direction: column; gap: var(--s-4); }
.store-row {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-6);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.store-row__grab  { color: var(--c-text-3); cursor: grab; user-select: none; font-family: monospace; letter-spacing: -2px; }
.store-row__mark  { color: var(--c-accent); display: grid; place-items: center; }
.store-row__body  { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.store-row__body strong { font-size: var(--t-sm); color: var(--c-text); }
.store-row__sub   { color: var(--c-text-3); font-size: var(--t-xs); }
.store-row__edit, .store-row__x {
  background: transparent; border: none; color: var(--c-text-3);
  cursor: pointer; padding: 4px; display: grid; place-items: center;
  border-radius: var(--r-sm);
}
.store-row__edit:hover { color: var(--c-accent); background: color-mix(in oklch, var(--c-accent) 10%, transparent); }
.store-row__x:hover    { color: var(--c-error);  background: color-mix(in oklch, var(--c-error) 10%, transparent); }
/* Small chip shown next to a nickname-label so the user still sees
   which chain they nicknamed when they pick an obscure custom label. */
.store-row__nick-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--c-surface-hi);
  color: var(--c-text-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.data-panel__header {
  padding: var(--s-8) var(--s-8);
  border-bottom: 1px solid var(--c-border);
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--c-text-2);
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--s-12);
  align-items: start;
}

.admin-grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-12);
  align-items: start;
}

@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-grid3 { grid-template-columns: 1fr; }
}

/* Tab bar: sticky so admins don't lose the switcher while scrolling a
   long tab. Horizontal scroll on narrow viewports keeps every tab
   reachable without hiding any. Active tab carries an amber underline
   drawn via box-shadow so the row height stays stable. */
.admin-tabs {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  gap: 2px;
  padding: 0 var(--s-12);
  background: color-mix(in oklch, var(--c-bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.1) blur(8px);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--c-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }

.admin-tabs__tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  color: var(--c-text-2);
  font-family: var(--f-body);
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent;
  transition: color 160ms ease-out, box-shadow 200ms ease-out;
}
.admin-tabs__tab:hover { color: var(--c-text); }
.admin-tabs__tab.is-active {
  color: var(--c-accent);
  box-shadow: inset 0 -2px 0 var(--c-accent);
}
.admin-tabs__tab svg { opacity: 0.9; }

/* Tab panels: only the active one renders. Keep them removed from the
   layout entirely (not just hidden) so long tables in inactive tabs
   don't affect scroll height on the current tab. */
.admin-tab { display: none; }
.admin-tab.is-active { display: block; animation: adminTabIn 220ms ease-out; }

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

/* Activity feed row used on the Overview tab. Small icon mark in an
   amber/success/error color, title + meta stacked to its right. */
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-8);
  padding: var(--s-6) 0;
  border-bottom: 1px solid var(--c-border);
}
.activity-row:last-child { border-bottom: 0; }
.activity-row__mark {
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  background: var(--c-surface-hi);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.activity-row__body { flex: 1; min-width: 0; }
.activity-row__title {
  font-size: var(--t-sm);
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-row__meta {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  margin-top: 2px;
}

/* Skeleton shimmer - used while a tab's data is still fetching. Not
   attached automatically; loaders can add the class to any element. */
.admin-skeleton {
  display: inline-block;
  height: 1em;
  width: 80%;
  border-radius: var(--r-sm);
  background: linear-gradient(
    90deg,
    var(--c-surface) 0%,
    var(--c-surface-hi) 45%,
    var(--c-surface) 90%
  );
  background-size: 200% 100%;
  animation: adminSkeleton 1.4s ease-in-out infinite;
}
@keyframes adminSkeleton {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--s-4);
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 500;
  line-height: 1.4;
}
/* Badge tints derive from the semantic tokens via color-mix so the
   backing reads on both dark and light surfaces without hardcoded
   oklch values. info keeps its blue hue as a color-mix too. */
.badge--success { background: color-mix(in oklch, var(--c-success) 20%, var(--c-surface)); color: var(--c-success); }
.badge--error   { background: color-mix(in oklch, var(--c-error)   20%, var(--c-surface)); color: var(--c-error); }
.badge--warning { background: color-mix(in oklch, var(--c-warning) 20%, var(--c-surface)); color: var(--c-warning); }
.badge--info    { background: color-mix(in oklch, oklch(0.62 0.16 240) 20%, var(--c-surface)); color: oklch(0.62 0.16 240); }
.badge--neutral { background: var(--c-surface-hi);  color: var(--c-text-3); }

/* Premium-type radio picker (admin: Grant Premium modal). Clickable
   rows with a radio + title + sub. The selected row gets an amber
   ring so it reads as "this is the one that'll fire". */
.premium-type-picker { display: flex; flex-direction: column; gap: var(--s-4); margin: var(--s-6) 0; }
.premium-type-opt {
  display: flex; align-items: flex-start; gap: var(--s-6);
  padding: var(--s-6);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.premium-type-opt:hover { border-color: var(--c-borderHi, var(--c-border)); }
.premium-type-opt input { margin-top: 4px; accent-color: var(--c-accent); flex: 0 0 auto; }
.premium-type-opt:has(input:checked) {
  border-color: var(--c-accent);
  background: color-mix(in oklch, var(--c-accent) 8%, var(--c-surface));
}
.premium-type-opt__body { display: flex; flex-direction: column; gap: 2px; }
.premium-type-opt__body strong { color: var(--c-text); font-size: var(--t-sm); font-weight: 700; }
.premium-type-opt__sub { color: var(--c-text-3); font-size: var(--t-xs); line-height: 1.4; }

/* Upgrade banner (import page + other high-intent surfaces) */
.upgrade-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-8);
  flex-wrap: wrap;
  padding: var(--s-6) var(--s-12);
  margin: 0 0 var(--s-12);
  background: linear-gradient(160deg, color-mix(in oklch, var(--c-accent) 20%, var(--c-surface)) 0%, var(--c-surface) 100%);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-md);
  color: var(--c-text);
  font-size: var(--t-sm);
}
.upgrade-banner strong { color: var(--c-accent); font-family: var(--f-display); margin-right: 4px; }

/* Upgrade modal (triggered from household invite, 10th-recipe) */
.upgrade-modal {
  position: fixed; inset: 0; z-index: 220;
  background: rgba(0,0,0,0.68);
  display: grid; place-items: center;
  padding: 20px;
}
.upgrade-modal__inner {
  width: min(480px, 100%);
  padding: clamp(24px, 3vw, 36px);
  background: linear-gradient(160deg, color-mix(in oklch, var(--c-accent) 18%, var(--c-surface)) 0%, var(--c-surface) 70%);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-lg);
  text-align: center;
  box-shadow: 0 32px 80px rgba(0,0,0,0.55);
}
.upgrade-modal__crown {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-accent-fg);
  display: grid; place-items: center;
  margin: 0 auto var(--s-8);
}
.upgrade-modal h3 {
  font-family: var(--f-display);
  font-size: var(--t-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-6);
}
.upgrade-modal p {
  color: var(--c-text-2);
  font-size: var(--t-sm);
  line-height: 1.6;
  margin: 0 0 var(--s-12);
}
.upgrade-modal__actions { display: flex; justify-content: center; gap: var(--s-6); flex-wrap: wrap; }

/* Celebration variant: a fuller, more visual treatment for 10th-recipe moment */
.upgrade-modal--celebrate .upgrade-modal__inner {
  background: radial-gradient(circle at 50% 0%, color-mix(in oklch, var(--c-accent) 30%, var(--c-surface)) 0%, var(--c-surface) 70%);
}
.upgrade-modal__confetti {
  font-size: 2.5rem;
  margin-bottom: var(--s-4);
  letter-spacing: 8px;
}

/* Grocery delivery affiliate CTA (shopping list) */
.grocery-cta {
  padding: var(--s-8) var(--s-12);
  margin-bottom: var(--s-12);
  background: linear-gradient(160deg, color-mix(in oklch, var(--c-accent) 18%, var(--c-surface)) 0%, var(--c-surface) 100%);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-lg);
}
.grocery-cta__row {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  flex-wrap: wrap;
  justify-content: space-between;
}
.grocery-cta__label {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: var(--t-base);
  color: var(--c-text);
  letter-spacing: -0.01em;
}
.grocery-cta__buttons { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.grocery-cta__btn { padding: 8px 16px; font-size: var(--t-sm); }
.grocery-cta__disclosure {
  margin: var(--s-4) 0 0;
  font-size: 11px;
  color: var(--c-text-3);
  letter-spacing: 0.02em;
}

/* Crop photo modal (crop.js) - uses Cropper.js inside, warm dark shell */
.crop-overlay {
  position: fixed; inset: 0;
  z-index: 2200;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 32px);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: crop-fade-in 180ms var(--ease-out);
}
@keyframes crop-fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .crop-overlay { animation: none; }
}

.crop-modal {
  width: min(720px, 100%);
  max-height: min(92vh, 800px);
  background: var(--c-surface);
  border: 1px solid var(--c-border-hi, var(--c-text-3));
  border-radius: var(--r-lg);
  box-shadow: 0 40px 100px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.crop-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-8) var(--s-12);
  border-bottom: 1px solid var(--c-border);
}
.crop-modal__title {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}
.crop-modal__close {
  background: transparent;
  border: 0;
  color: var(--c-text-3);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: color 150ms ease, background 150ms ease;
}
.crop-modal__close:hover { color: var(--c-text); background: var(--c-surface-hi); }

.crop-modal__stage {
  flex: 1;
  min-height: 280px;
  max-height: 56vh;
  background: oklch(0.10 0.005 70);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.crop-modal__stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* Cropper.js overrides - amber accent, thicker crop box border */
.crop-modal .cropper-view-box,
.crop-modal .cropper-face {
  outline: 0;
}
/* The crop box is locked (no move/resize) and is purely decorative. Let every
   pointer event fall through to the drag-box underneath, which is what
   dragMode:'move' uses to pan the image. Without this, the face/view-box/etc
   sit on top of the drag-box and swallow mousedown. */
.crop-modal .cropper-crop-box,
.crop-modal .cropper-view-box,
.crop-modal .cropper-face,
.crop-modal .cropper-line,
.crop-modal .cropper-point {
  pointer-events: none !important;
}
/* Grab cursor everywhere inside the cropper - the whole area is draggable. */
.crop-modal .cropper-container,
.crop-modal .cropper-drag-box,
.crop-modal .cropper-canvas {
  cursor: grab;
}
.crop-modal .cropper-container.cropper-dragging,
.crop-modal .cropper-container.cropper-dragging .cropper-drag-box,
.crop-modal .cropper-container.cropper-dragging .cropper-canvas,
.crop-modal .cropper-drag-box:active,
.crop-modal .cropper-canvas:active {
  cursor: grabbing;
}
.crop-modal .cropper-line,
.crop-modal .cropper-point {
  background-color: var(--c-accent);
}
.crop-modal .cropper-view-box {
  outline: 2px solid var(--c-accent);
  outline-offset: -1px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
.crop-modal .cropper-dashed {
  border-color: rgba(255, 255, 255, 0.4);
}
.crop-modal .cropper-modal {
  background: oklch(0.08 0.005 70);
  opacity: 0.72;
}

.crop-modal__toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-6) var(--s-12);
  border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.crop-modal__hint {
  margin-left: auto;
  font-size: var(--t-xs);
  color: var(--c-text-3);
  line-height: 1.4;
}
@media (max-width: 540px) {
  .crop-modal__hint { display: none; }
}

.crop-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-4);
  padding: var(--s-8) var(--s-12);
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-hi);
}
.crop-modal__actions .btn { min-width: 110px; }

/* "Have ingredients?" widget on the recipe grid */
.wcim-widget {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-6) var(--s-8);
  margin-bottom: var(--s-12);
  background: linear-gradient(160deg, color-mix(in oklch, var(--c-accent) 16%, var(--c-surface)) 0%, var(--c-surface) 100%);
  border: 1px solid color-mix(in oklch, var(--c-accent) 40%, var(--c-border));
  border-radius: var(--r-lg);
  text-decoration: none;
  color: inherit;
  transition: transform 200ms var(--ease-out), border-color 200ms ease;
}
.wcim-widget:hover { transform: translateY(-1px); border-color: var(--c-accent); }
.wcim-widget__icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-accent-fg);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.wcim-widget__body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wcim-widget__body strong {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: var(--t-base);
  letter-spacing: -0.01em;
  color: var(--c-text);
}
.wcim-widget__body span {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  line-height: 1.45;
}
.wcim-widget__arrow {
  color: var(--c-accent);
  font-size: 20px;
  transition: transform 200ms ease;
}
.wcim-widget:hover .wcim-widget__arrow { transform: translateX(3px); }

/* Meal planner empty state + generate-plan preview */
.mp-empty-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-8);
  flex-wrap: wrap;
  padding: clamp(20px, 3vw, 32px);
  background: linear-gradient(160deg, color-mix(in oklch, var(--c-accent) 14%, var(--c-surface)) 0%, var(--c-surface) 100%);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-12);
}
.mp-empty-cta h3 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: var(--t-xl);
  letter-spacing: -0.015em;
  margin: 0 0 var(--s-2);
}
.mp-empty-cta p { color: var(--c-text-2); font-size: var(--t-sm); margin: 0; max-width: 44ch; }

.mp-generate-btn svg { color: var(--c-accent-fg); }

.mp-gen-opts {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  margin-top: var(--s-8);
}

.mp-preview {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  margin-bottom: var(--s-8);
  max-height: 50vh;
  overflow-y: auto;
}
.mp-preview__day {
  padding: var(--s-6);
  background: var(--c-surface-hi);
  border-radius: var(--r-md);
}
.mp-preview__day h4 {
  font-family: var(--f-display);
  font-size: var(--t-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-accent);
  margin: 0 0 var(--s-4);
}
.mp-preview__slot {
  font-size: var(--t-sm);
  padding: 4px 0;
  color: var(--c-text);
  line-height: 1.5;
}
.mp-preview__new {
  display: inline-block;
  margin-top: 2px;
  color: var(--c-accent);
  font-size: var(--t-xs);
}
.mp-preview__reason {
  display: block;
  color: var(--c-text-3);
  font-size: var(--t-xs);
  margin-top: 2px;
}

/* Meal preferences form (profile.php + meal-planner) */
.mp-section { margin-bottom: var(--s-8); }
.mp-section:last-child { margin-bottom: 0; }
.mp-label {
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-3);
  font-weight: 600;
  margin-bottom: var(--s-4);
}
.mp-row {
  display: flex;
  gap: var(--s-8);
  flex-wrap: wrap;
}
.mp-meal-toggles, .mp-chips, .mp-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mp-toggle, .mp-chip-check, .mp-day-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  font-size: var(--t-sm);
  color: var(--c-text-2);
  cursor: pointer;
  user-select: none;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.mp-day-check { padding: 4px 10px; font-size: var(--t-xs); }
.mp-toggle input, .mp-chip-check input, .mp-day-check input {
  accent-color: var(--c-accent);
  margin: 0;
}
.mp-toggle:has(input:checked),
.mp-chip-check:has(input:checked),
.mp-day-check:has(input:checked) {
  background: color-mix(in oklch, var(--c-accent) 18%, transparent);
  border-color: var(--c-accent);
  color: var(--c-accent);
  font-weight: 500;
}

/* Per-meal day pills - three rows (Breakfast/Lunch/Dinner) each with 7 day toggles */
.mp-meals {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-surface);
}
.mp-meal-row {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-6) var(--s-8);
}
.mp-meal-row + .mp-meal-row {
  border-top: 1px solid var(--c-border);
}
.mp-meal-row__label {
  flex: none;
  width: 92px;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: var(--t-sm);
  color: var(--c-text);
  letter-spacing: -0.005em;
}
.mp-meal-row__pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mp-daypill {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-3);
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.mp-daypill:hover {
  border-color: var(--c-text-3);
  color: var(--c-text);
}
.mp-daypill:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}
.mp-daypill:active {
  transform: scale(0.94);
}
.mp-daypill--on {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-accent-fg);
}
.mp-daypill--on:hover {
  background: var(--c-accent);
  color: var(--c-accent-fg);
}
.mp-hint {
  margin-top: var(--s-4);
  font-size: var(--t-xs);
  color: var(--c-text-3);
  line-height: 1.5;
}
@media (max-width: 540px) {
  .mp-meal-row { flex-direction: column; align-items: flex-start; gap: var(--s-4); padding: var(--s-6); }
  .mp-meal-row__label { width: auto; }
  .mp-daypill { width: 36px; height: 36px; }
}

/* Scroll-to-top floating button (ui.js) */
.ui-scroll-top {
  position: fixed;
  bottom: var(--s-12);
  right: var(--s-12);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 1px solid var(--c-border-hi, var(--c-text-3));
  color: var(--c-text);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out), background 150ms ease, border-color 150ms ease;
  z-index: 40;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.ui-scroll-top--visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.ui-scroll-top:hover { background: var(--c-accent); color: var(--c-accent-fg); border-color: var(--c-accent); }
@media (max-width: 720px) {
  .ui-scroll-top { bottom: var(--s-8); right: var(--s-8); }
}

/* Page fade-in between navigations (ui.js) */
html.ui-page-fade-ready body {
  opacity: 0;
  transition: opacity 220ms var(--ease-out);
}
html.ui-page-fade-ready.ui-page-fade-in body { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  html.ui-page-fade-ready body,
  html.ui-page-fade-ready.ui-page-fade-in body { opacity: 1; transition: none; }
}

/* Suggested-search chips on the "no results" empty state */
.no-results__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  justify-content: center;
  margin-top: var(--s-8);
}
.no-results__chip {
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text-2);
  font-size: var(--t-xs);
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}
.no-results__chip:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
  background: color-mix(in oklch, var(--c-accent) 10%, transparent);
}

/* Amazon affiliate picks on recipe detail - editorial cards, not ads */
.recipe-amazon {
  margin-top: var(--s-16);
  padding-top: var(--s-12);
  border-top: 1px solid var(--c-border);
}
.recipe-amazon__head {
  margin-bottom: var(--s-8);
}
/* Heading warmed up: sentence case, larger, text-primary. Pairs with a
   friendly subtitle line beneath so the section reads as a helpful tip
   block, not a sponsored-carousel header. */
.recipe-amazon__heading {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-text);
  margin: 0 0 4px;
}
.recipe-amazon__subtitle {
  font-size: var(--t-sm);
  color: var(--c-text-3);
  margin: 0;
}
.recipe-amazon__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-6);
}
.recipe-amazon__card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--s-6);
  padding: var(--s-6);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: inherit;
  align-items: center;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}
.recipe-amazon__card:hover {
  border-color: var(--c-accent);
  transform: translateY(-1px);
  background: color-mix(in oklch, var(--c-accent) 6%, var(--c-surface));
}
.recipe-amazon__img {
  position: relative;
  width: 72px; height: 72px;
  border-radius: var(--r-sm);
  overflow: hidden;
  /* Warm amber-tinted fallback so a blank <img> never shows as a white box.
     A <span> sits beneath the <img>; image, if it loads, covers it. If the
     <img> 404s the JS removes it and the fallback stays visible. */
  background: linear-gradient(135deg,
    color-mix(in oklch, var(--c-accent) 22%, var(--c-surface)) 0%,
    color-mix(in oklch, var(--c-accent) 8%, var(--c-surface-hi)) 100%);
}
.recipe-amazon__img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.recipe-amazon__img-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 4px 6px;
  font-family: var(--f-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-accent);
  text-align: center;
  line-height: 1.15;
}
.recipe-amazon__cat {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-accent);
  font-weight: 600;
  margin-bottom: 2px;
}
.recipe-amazon__title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: var(--t-sm);
  color: var(--c-text);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.recipe-amazon__cta {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  margin-top: 2px;
}
.recipe-amazon__card:hover .recipe-amazon__cta { color: var(--c-accent); }
.recipe-amazon__disclosure {
  margin-top: var(--s-6);
  font-size: 11px;
  color: var(--c-text-3);
  line-height: 1.5;
}

/* Recipe notes - styled as a notepad rather than a generic textarea */
.recipe-notes {
  margin-top: var(--s-16);
  padding: var(--s-8) var(--s-12);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--r-md);
  position: relative;
}
.recipe-notes__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.recipe-notes__title {
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
}
.recipe-notes__status {
  font-size: 11px;
  color: var(--c-text-3);
  opacity: 0;
  transition: opacity 200ms ease;
}
.recipe-notes__status--visible { opacity: 1; color: var(--c-accent); }
.recipe-notes__textarea {
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  resize: vertical;
  min-height: 80px;
  padding: 0;
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--t-base);
  line-height: 1.6;
  /* Subtle lined-paper texture */
  background-image: repeating-linear-gradient(
    transparent 0,
    transparent calc(1.6em - 1px),
    color-mix(in oklch, var(--c-border) 50%, transparent) calc(1.6em - 1px),
    color-mix(in oklch, var(--c-border) 50%, transparent) 1.6em
  );
}
.recipe-notes__textarea::placeholder { color: var(--c-text-3); }

/* Platform icon in the corner of a recipe card thumbnail */
.recipe-card__platform {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(26, 22, 16, 0.88);
  display: grid;
  place-items: center;
  color: #fff;
  z-index: 2;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.recipe-card__platform svg { display: block; }

/* Upsell CTA pill in the nav - only for free users near their limit */
.upsell-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: color-mix(in oklch, var(--c-accent) 14%, transparent);
  border: 1px solid var(--c-accent);
  color: var(--c-accent);
  font-family: var(--f-body);
  font-size: var(--t-xs);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.upsell-cta:hover {
  background: var(--c-accent);
  color: var(--c-accent-fg);
  transform: translateY(-1px);
}
.upsell-cta__label { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.upsell-cta--maxed {
  background: var(--c-accent);
  color: var(--c-accent-fg);
  animation: upsell-breathe 2.8s ease-in-out infinite;
}
@keyframes upsell-breathe {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--c-accent) 50%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in oklch, var(--c-accent) 0%, transparent); }
}
@media (max-width: 720px) {
  .upsell-cta__label { display: none; }
  .upsell-cta { padding: 6px; }
}

/* Admin pills + flagged rows */
.admin-pill {
  display: inline-block;
  padding: 1px 8px;
  font-size: 11px;
  border-radius: var(--r-full);
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 4px;
}
.admin-pill--accent {
  background: color-mix(in oklch, var(--c-accent) 22%, transparent);
  color: var(--c-accent);
}
.admin-pill--muted {
  background: var(--c-surface-hi);
  color: var(--c-text-3);
}
.admin-row--flagged { background: color-mix(in oklch, oklch(0.65 0.18 25) 8%, transparent); }

/* Cost breakdown */
.cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-4) 0;
}
.cost-row + .cost-row { border-top: 1px solid var(--c-border); }

.cost-row__name {
  font-weight: 500;
  color: var(--c-text);
}
.cost-row__detail {
  font-size: var(--t-xs);
  color: var(--c-text-3);
}
.cost-row__amount {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--c-accent);
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page {
  padding: var(--s-12);
  max-width: 1200px;
  margin: 0 auto;
}

.page__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-12);
  gap: var(--s-8);
}

.page__header h2 {
  font-size: var(--t-xl);
}

/* ============================================================
   STAGGER ANIMATION
   ============================================================ */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stagger-in {
  animation: fade-up var(--dur-slow) var(--ease-expo) backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@media (prefers-reduced-motion: reduce) {
  .stagger-in {
    animation: none;
    opacity: 1;
  }
  .spinner { animation: none; }
  .skeleton-shimmer,
  .skeleton-line::after { animation: none; }
  .toast { transition: none; }
}

/* ============================================================
   UTILITY
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.hidden { display: none !important; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  :root {
    --t-3xl: 2rem;
    --t-4xl: 2.5rem;
  }

  .nav {
    padding: var(--s-4);
    gap: var(--s-4);
  }
  .nav__brand { font-size: var(--t-base); }
  .nav__actions { gap: var(--s-2); }
  .nav__actions .btn { padding: var(--s-2) var(--s-4); font-size: var(--t-xs); }
  .btn .btn-label-hide-mobile { display: none; }
  .hide-mobile { display: none !important; }

  .page { padding: var(--s-8); }
  .page__header h2 { font-size: var(--t-lg); }

  .recipe-grid {
    grid-template-columns: 1fr;
    gap: var(--s-8);
  }

  .recipe-card { aspect-ratio: 4 / 3; }

  .recipe-detail__title { font-size: var(--t-2xl); }
  .recipe-detail__body { grid-template-columns: 1fr; }
  .ingredients { position: static; }
  .recipe-detail__meta { gap: var(--s-4); }

  .recipe-detail__hero {
    aspect-ratio: 16 / 9;
    border-radius: var(--r-lg);
  }

  .steps__list li {
    font-size: var(--t-base);
    grid-template-columns: 32px 1fr;
    gap: var(--s-6);
  }

  .steps__list li::before {
    width: 32px;
    height: 32px;
    font-size: var(--t-sm);
  }

  .import-page { padding: var(--s-12) var(--s-8); }

  .stats-row { grid-template-columns: 1fr 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-layout { padding: var(--s-8); }

  .filter-bar { flex-wrap: wrap; }
  .filter-select { min-width: 0; flex: 1 1 120px; }

  .planner-grid { overflow-x: auto; }
  .planner-header, .planner-row { min-width: 700px; }

  .recipe-detail__actions { flex-wrap: wrap; }
  .recipe-detail__actions .btn { font-size: var(--t-xs); padding: var(--s-2) var(--s-4); }

  .nutrition-label { max-width: 100%; }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: var(--s-12);
  right: var(--s-12);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  pointer-events: none;
}

.toast {
  padding: var(--s-6) var(--s-12);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  opacity: 0;
  transition: all var(--dur-normal) var(--ease-out);
  pointer-events: auto;
}
.toast--visible {
  transform: translateY(0);
  opacity: 1;
}
.toast--success {
  background: oklch(0.22 0.06 152);
  color: oklch(0.88 0.10 152);
  border: 1px solid oklch(0.30 0.06 152);
}
.toast--error {
  background: oklch(0.20 0.06 25);
  color: oklch(0.88 0.12 25);
  border: 1px solid oklch(0.30 0.06 25);
}
.toast--info {
  background: var(--c-surface-hi);
  color: var(--c-text);
  border: 1px solid var(--c-border-hi, var(--c-text-3));
}

/* ============================================================
   MODAL SYSTEM (ui.js)
   ============================================================ */
.ui-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: var(--s-8);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 180ms var(--ease-out);
}
.ui-modal-overlay--open { opacity: 1; }
.ui-modal-overlay--open .ui-modal { transform: translateY(0) scale(1); opacity: 1; }

body.ui-modal-open { overflow: hidden; }

.ui-modal {
  width: min(440px, 100%);
  background: var(--c-surface);
  border: 1px solid var(--c-border-hi, var(--c-text-3));
  border-radius: var(--r-lg);
  padding: clamp(20px, 3vw, 28px);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03);
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 200ms var(--ease-out), opacity 200ms var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
  .ui-modal-overlay, .ui-modal { transition: none; }
}

.ui-modal__title {
  font-family: var(--f-display);
  font-size: var(--t-xl);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--c-text);
  margin: 0 0 var(--s-6);
}
.ui-modal__message {
  font-size: var(--t-sm);
  color: var(--c-text-2);
  line-height: 1.55;
  margin: 0 0 var(--s-8);
}
.ui-modal__label {
  display: block;
  font-size: var(--t-xs);
  color: var(--c-text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  margin: var(--s-6) 0 var(--s-4);
}
.ui-modal__label strong { color: var(--c-accent); font-family: var(--f-display); letter-spacing: 0.12em; }
.ui-modal__input { margin-bottom: var(--s-8); }
.ui-modal__input--error { border-color: var(--c-error); }
.ui-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-4);
  margin-top: var(--s-8);
  flex-wrap: wrap;
}
.ui-modal__actions .btn { min-width: 100px; }
@media (max-width: 420px) {
  .ui-modal__actions { flex-direction: column-reverse; }
  .ui-modal__actions .btn { width: 100%; }
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  gap: var(--s-4);
  margin-bottom: var(--s-12);
  flex-wrap: wrap;
}

/* ── Compact chip filter row (replaces stacked dropdowns) ── */
.search-row {
  display: flex;
  gap: var(--s-4);
  margin-bottom: var(--s-8);
  align-items: stretch;
}
.search-row .search-bar { flex: 1; margin: 0; }

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  /* Stretches to match the search input's computed height */
  align-self: stretch;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text-2);
  font-family: var(--f-body);
  font-size: var(--t-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.sort-btn:hover { border-color: var(--c-border-hi, var(--c-text-3)); color: var(--c-text); }
.sort-btn[aria-expanded="true"] {
  border-color: var(--c-accent);
  color: var(--c-accent);
}
.sort-btn__label {
  font-variant-numeric: tabular-nums;
}

.filter-chips {
  display: flex;
  gap: 6px;
  margin-bottom: var(--s-12);
  padding-bottom: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  scroll-padding-inline: 8px;
}
.filter-chips::-webkit-scrollbar { display: none; }

.fchip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 14px 6px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  font-family: var(--f-body);
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--c-text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
/* Larger touch targets on touch-primary devices */
@media (hover: none) and (pointer: coarse) {
  .fchip { min-height: 40px; padding: 8px 16px 8px 14px; }
}
.fchip:hover { border-color: var(--c-border-hi, var(--c-text-3)); color: var(--c-text); }
.fchip[aria-expanded="true"] { border-color: var(--c-accent); color: var(--c-accent); }
.fchip svg { flex: 0 0 auto; }

.fchip--active {
  background: color-mix(in oklch, var(--c-accent) 18%, transparent);
  border-color: var(--c-accent);
  color: var(--c-accent);
  font-weight: 600;
}
.fchip--active .fchip__caret { opacity: 0.6; }

.fchip__label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.fchip__caret {
  margin-left: 2px;
  opacity: 0.5;
  transition: transform var(--dur-fast) var(--ease-out);
}
.fchip[aria-expanded="true"] .fchip__caret { transform: rotate(180deg); opacity: 1; }

.fchip--clear {
  background: transparent;
  border: 1px dashed var(--c-border-hi, var(--c-text-3));
  color: var(--c-text-3);
  padding-inline: 12px;
  font-size: var(--t-xs);
  margin-left: 4px;
}
.fchip--clear:hover {
  color: var(--c-accent);
  border-color: var(--c-accent);
  border-style: solid;
  background: color-mix(in oklch, var(--c-accent) 10%, transparent);
}

.fchip:focus-visible,
.sort-btn:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* ── Popover ── */
.fpop {
  position: fixed;
  z-index: 120;
  min-width: 200px;
  max-width: 260px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border-hi, var(--c-text-3));
  border-radius: var(--r-md);
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.03);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 140ms var(--ease-out), transform 140ms var(--ease-out);
}
.fpop:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.fpop__list { display: flex; flex-direction: column; gap: 1px; }
.fpop__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  text-align: left;
  font-family: var(--f-body);
  font-size: var(--t-sm);
  color: var(--c-text);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.fpop__item:hover { background: color-mix(in oklch, var(--c-accent) 12%, transparent); }
.fpop__item--active {
  background: color-mix(in oklch, var(--c-accent) 20%, transparent);
  color: var(--c-accent);
  font-weight: 600;
}
.fpop__item--active::after {
  content: '✓';
  color: var(--c-accent);
  font-weight: 700;
}
.fpop__meta {
  color: var(--c-text-3);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
}
.fpop__divider {
  height: 1px;
  background: var(--c-border);
  margin: 4px 2px;
}
.fpop__empty {
  padding: 8px 10px 6px;
  margin-top: 4px;
  color: var(--c-text-3);
  font-size: var(--t-xs);
  line-height: 1.5;
  border-top: 1px solid var(--c-border);
}

.filter-select {
  padding: var(--s-4) var(--s-8) var(--s-4) var(--s-6);
  font-size: var(--t-xs);
  font-family: var(--f-body);
  border-radius: var(--r-md);
  min-width: 120px;
  flex: 0 1 auto;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text-2);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.filter-select:focus {
  outline: none;
  border-color: var(--c-accent);
  background-color: var(--c-surface-hi);
}
.filter-select:hover {
  border-color: var(--c-border-hi);
}
.filter-select option {
  background: var(--c-surface-hi);
  color: var(--c-text);
}

/* ============================================================
   LOADING SKELETON
   ============================================================ */
.recipe-card--skeleton {
  background: var(--c-surface);
  aspect-ratio: 3 / 2;
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
}

.skeleton-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    oklch(0.22 0.01 70 / 0.4) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.skeleton-line {
  height: 44px;
  background: var(--c-surface);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
}
.skeleton-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, oklch(0.22 0.01 70 / 0.4) 50%, transparent 100%);
  animation: shimmer 1.5s infinite;
}

/* ============================================================
   SERVING ADJUSTER
   ============================================================ */
.serving-adjuster {
  display: flex;
  align-items: center;
  gap: var(--s-6);
}

.serving-adjuster .serving-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: var(--t-xl);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface-hi);
  border-color: var(--c-border);
  color: var(--c-text);
}
.serving-adjuster .serving-btn:hover {
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  border-color: var(--c-accent);
}
.serving-adjuster .serving-btn:active {
  background: var(--c-accent);
  color: var(--c-accent-fg);
}

.serving-count {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: var(--t-xl);
  color: var(--c-accent);
  min-width: 2.5ch;
  text-align: center;
}

/* ============================================================
   INGREDIENT CHECKLIST
   ============================================================ */
.ingredient-item {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  cursor: pointer;
  padding: var(--s-6) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  transition: opacity var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
  user-select: none;
  min-height: 44px;
}
.ingredient-item:last-child { border-bottom: none; }
.ingredient-item:hover { background: oklch(0.15 0.01 70); }
.ingredient-item:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: -2px;
}

.ingredient-check {
  width: 18px;
  height: 18px;
  border-radius: var(--r-sm);
  border: 2px solid var(--c-border-hi);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
}

.ingredient-item--checked .ingredient-check {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.ingredient-item--checked .ingredient-check::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid var(--c-accent-fg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.ingredient-item--checked {
  opacity: 0.4;
  text-decoration: line-through;
}

/* ============================================================
   STEP PROGRESS TRACKER
   ============================================================ */
.step-item {
  cursor: pointer;
  transition: opacity var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
  user-select: none;
  border-radius: var(--r-md);
}
.step-item:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: -2px;
}

.step-item--active {
  background: oklch(0.22 0.04 70);
  border-radius: var(--r-md);
  padding-left: var(--s-4) !important;
  padding-right: var(--s-4) !important;
  margin-left: calc(-1 * var(--s-4));
  margin-right: calc(-1 * var(--s-4));
}
.step-item--active::before {
  background: var(--c-accent) !important;
  color: var(--c-accent-fg) !important;
}

.step-item--done {
  opacity: 0.35;
}
.step-item--done::before {
  background: var(--c-success) !important;
  color: oklch(0.16 0.02 152) !important;
  content: '\2713' !important;
}
.step-item--done .step-text {
  text-decoration: line-through;
}

/* ============================================================
   RECIPE DETAIL CONTROLS
   ============================================================ */
.recipe-detail__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: center;
  margin-bottom: var(--s-12);
}

.recipe-detail__actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.measurement-toggle {
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   NUTRITION LABEL
   ============================================================ */
.nutrition-label {
  max-width: 320px;
  background: var(--c-surface);
  border: 2px solid var(--c-text);
  border-radius: var(--r-md);
  padding: var(--s-6) var(--s-8);
  margin-top: var(--s-16);
  font-size: var(--t-sm);
}

.nutrition-label__header {
  margin-bottom: var(--s-2);
}

.nutrition-label__title {
  font-family: var(--f-display);
  font-size: var(--t-2xl);
  font-weight: 800;
  line-height: 1;
  color: var(--c-text);
  margin-bottom: var(--s-2);
  text-transform: none;
  letter-spacing: -0.02em;
}

.nutrition-label__servings {
  font-size: var(--t-sm);
  color: var(--c-text-2);
}

.nutrition-label__subtitle {
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: var(--s-2);
}

.nutrition-label__divider {
  height: 1px;
  background: var(--c-border-hi);
  margin: var(--s-2) 0;
}
.nutrition-label__divider--thick {
  height: 8px;
  background: var(--c-text);
  margin: var(--s-4) 0;
}
.nutrition-label__divider--medium {
  height: 3px;
  background: var(--c-text);
  margin: var(--s-2) 0;
}

.nutrition-label__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1px 0;
}

.nutrition-label__row--calories {
  font-size: var(--t-xl);
  font-weight: 700;
}

.nutrition-label__row--sub {
  padding-left: var(--s-8);
}

.nutrition-label__name {
  color: var(--c-text);
}

.nutrition-label__value {
  color: var(--c-text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.nutrition-label__footer {
  margin-top: var(--s-4);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-12);
  opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-out);
}
.modal-overlay--visible { opacity: 1; }

.modal {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal--sm { max-width: 400px; }

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-8) var(--s-12);
  border-bottom: 1px solid var(--c-border);
}
.modal__header h3 { margin: 0; }

.modal__body {
  padding: var(--s-12);
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-4);
  padding: var(--s-8) var(--s-12);
  border-top: 1px solid var(--c-border);
}

/* Edit form rows */
.edit-ingredient-row, .edit-step-row {
  display: flex;
  gap: var(--s-4);
  align-items: center;
  margin-bottom: var(--s-4);
}
.edit-step-row {
  align-items: flex-start;
}
.edit-step-row textarea {
  min-height: 40px;
  flex: 1;
}

.input--sm {
  padding: var(--s-2) var(--s-4);
  font-size: var(--t-sm);
}

.drag-handle {
  cursor: grab;
  color: var(--c-text-3);
  font-size: var(--t-lg);
  padding: var(--s-2);
  user-select: none;
  touch-action: none;
  line-height: 1;
}
.drag-handle:active { cursor: grabbing; }

.sortable-ghost {
  opacity: 0.3;
  background: var(--c-accent-subtle);
  border-radius: var(--r-sm);
}

/* ============================================================
   SHOPPING LIST
   ============================================================ */
.add-item-form {
  display: flex;
  gap: var(--s-4);
}
.add-item-form .input {
  flex: 1;
}

/* Grocery CTA: "Add another store" link appended to the delivery
   buttons row. Goes to the profile store-preferences panel. */
.grocery-cta__add {
  display: inline-flex; align-items: center;
  padding: 6px 10px;
  font-size: var(--t-xs);
  color: var(--c-text-3);
  text-decoration: none;
  border: 1px dashed var(--c-border);
  border-radius: var(--r-sm);
  margin-left: auto;
}
.grocery-cta__add:hover { color: var(--c-accent); border-color: var(--c-accent); }

/* Store pill row on the shopping list - picks the user's preferred
   store to trigger aisle sort. Matches the small rounded pill vocab
   used by filter chips elsewhere. */
.store-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 0 var(--s-8);
  margin-bottom: var(--s-8);
  border-bottom: 1px solid var(--c-border);
}
.store-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-2);
  font-size: var(--t-xs);
  font-weight: 600;
  cursor: pointer;
  max-width: 220px;
}
.store-pill:hover { border-color: var(--c-border-hi, var(--c-border)); }
.store-pill--on {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-accent-fg);
}
.store-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Inline aisle label on a shopping item. Clickable, amber, small. */
.shopping-item__body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.shopping-item__aisle {
  background: transparent; border: none; padding: 0;
  color: var(--c-accent); font-size: var(--t-xs); font-weight: 600;
  cursor: pointer; text-align: left;
}
.shopping-item__aisle:hover { text-decoration: underline; }

.shopping-category {
  margin-bottom: var(--s-12);
}

.shopping-category__title {
  font-family: var(--f-display);
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-accent);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--c-border);
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-4) var(--s-4);
  border-radius: var(--r-sm);
  transition: background var(--dur-fast) var(--ease-out);
}
.shopping-item:hover {
  background: var(--c-surface);
}
/* Flash-on-remote-update: amber wash that fades back over 1.5s. */
.shopping-item--flash {
  animation: shopping-flash 1800ms ease-out;
}
@keyframes shopping-flash {
  0%   { background: color-mix(in oklch, var(--c-accent) 22%, transparent); }
  100% { background: transparent; }
}
.shopping-item__actor {
  font-size: var(--t-xs);
  color: var(--c-accent);
  margin-left: auto;
  padding-left: var(--s-4);
  font-weight: 600;
  white-space: nowrap;
  animation: shopping-actor-fade 3000ms ease-out forwards;
}
@keyframes shopping-actor-fade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

/* "Live" pill shown next to the Shopping List heading when SSE is
   connected and the user is in a household. */
.sse-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--c-success) 18%, transparent);
  color: var(--c-success);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.sse-indicator__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--c-success);
  box-shadow: 0 0 0 0 color-mix(in oklch, var(--c-success) 60%, transparent);
  animation: sse-pulse 1800ms ease-out infinite;
}
@keyframes sse-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklch, var(--c-success) 60%, transparent); }
  70%  { box-shadow: 0 0 0 8px color-mix(in oklch, var(--c-success) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--c-success) 0%, transparent); }
}

.shopping-item__check {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}
.shopping-item__check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--c-accent);
  cursor: pointer;
  border-radius: var(--r-sm);
}

.shopping-item__text {
  flex: 1;
  font-size: var(--t-base);
  color: var(--c-text);
  transition: opacity var(--dur-fast);
}

.shopping-item__amount {
  color: var(--c-accent);
  font-weight: 500;
}

.shopping-item__recipe {
  flex-shrink: 0;
}

.shopping-item__delete {
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.shopping-item:hover .shopping-item__delete {
  opacity: 1;
}

.shopping-item--checked .shopping-item__text {
  opacity: 0.4;
  text-decoration: line-through;
}

/* ============================================================
   MEAL PLANNER
   ============================================================ */
.planner-grid {
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--c-surface);
}

.planner-header {
  display: grid;
  grid-template-columns: 90px repeat(7, 1fr);
  border-bottom: 2px solid var(--c-border);
}

.planner-row {
  display: grid;
  grid-template-columns: 90px repeat(7, 1fr);
  border-bottom: 1px solid var(--c-border);
}
.planner-row:last-child { border-bottom: none; }
.planner-row--totals {
  border-top: 2px solid var(--c-border);
  background: color-mix(in oklch, var(--c-surface-hi) 80%, transparent);
}
.planner-cell--totals {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--s-4);
  min-height: 44px;
}
.planner-totals__cal {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: var(--t-sm);
  color: var(--c-text);
}
.planner-totals__pct {
  font-size: 10px;
  color: var(--c-text-3);
  letter-spacing: 0.3px;
}
.planner-totals--low  { color: var(--c-text-2); }
.planner-totals--on   { color: var(--c-accent); }
.planner-totals--over { color: color-mix(in oklch, var(--c-error) 85%, var(--c-accent)); }

.planner-cell {
  padding: var(--s-4);
  min-height: 90px;
  border-right: 1px solid var(--c-border);
}
.planner-cell:last-child { border-right: none; }

.planner-cell--day-header {
  text-align: center;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: var(--t-sm);
  color: var(--c-text-2);
  min-height: auto;
  padding: var(--s-4);
}

.planner-cell--label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-3);
  min-height: auto;
  background: oklch(0.15 0.01 70);
}

.planner-cell--slot {
  cursor: pointer;
  transition: background var(--dur-fast);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  position: relative;
}
.planner-cell--slot:hover {
  background: var(--c-surface-hi);
}

.planner-cell__add {
  position: absolute;
  bottom: var(--s-2);
  right: var(--s-2);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--t-sm);
  color: var(--c-text-3);
  border-radius: var(--r-full);
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.planner-cell--slot:hover .planner-cell__add {
  opacity: 1;
}

.planner-item {
  background: var(--c-accent-subtle);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-4);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: 28px;
  max-height: 44px;
  overflow: hidden;
}

.planner-item__title {
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--c-accent);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
}

.planner-item__remove {
  background: none;
  border: none;
  color: var(--c-text-3);
  cursor: pointer;
  font-size: var(--t-sm);
  padding: 0;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.planner-item:hover .planner-item__remove {
  opacity: 1;
}

@keyframes pill-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.planner-item--new {
  animation: pill-in var(--dur-normal) var(--ease-expo);
}

/* ============================================================
   ADMIN: TEST OUTPUT
   ============================================================ */
.test-output {
  background: var(--c-base);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: var(--s-6);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: var(--t-xs);
  color: var(--c-text-2);
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================================
   PHOTO UPLOAD ZONE
   ============================================================ */
.photo-upload-zone {
  border: 2px dashed var(--c-border-hi);
  border-radius: var(--r-lg);
  padding: var(--s-16);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.photo-upload-zone:hover,
.photo-upload-zone--active {
  border-color: var(--c-accent);
  background: var(--c-accent-subtle);
}

/* ============================================================
   RECIPE CARD PLACEHOLDER
   ============================================================ */
.recipe-card__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recipe-card__placeholder-icon {
  font-size: 3.5rem;
  opacity: 0.35;
  filter: saturate(0.7);
}

/* ============================================================
   AI BADGE
   ============================================================ */
.badge--ai,
.badge--ai-partial {
  /* Must sit inline as a content-sized pill even when placed inside a flex
     column (where the default align-items: stretch would make a span span
     the full card width - see the recipe card scrim). */
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  width: max-content;
  max-width: 100%;
  font-size: 0.6rem;
  padding: 2px var(--s-4);
  border-radius: var(--r-full);
  letter-spacing: 0.02em;
  cursor: help;
  white-space: nowrap;
}
.badge--ai {
  background: oklch(0.24 0.06 70);
  color: var(--c-accent);
}
.badge--ai-partial {
  background: oklch(0.22 0.03 70);
  color: var(--c-text-2);
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-6);
  background: oklch(0.22 0.05 70);
  border: 1px solid oklch(0.30 0.06 70);
  border-radius: var(--r-md);
  font-size: var(--t-xs);
  color: var(--c-accent);
  margin-top: var(--s-4);
  cursor: help;
}

.ai-badge--partial {
  background: oklch(0.20 0.02 70);
  border-color: var(--c-border);
  color: var(--c-text-2);
}

.ai-badge__icon {
  font-size: var(--t-sm);
}

/* ============================================================
   CONTEXT SWITCHER
   ============================================================ */
.context-switcher {
  position: relative;
}
.context-switcher__btn {
  font-size: var(--t-xs);
  padding: var(--s-2) var(--s-6);
  border-radius: var(--r-full);
  background: var(--c-accent-subtle);
  border-color: transparent;
  color: var(--c-accent);
}
.context-switcher__menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-2);
  z-index: 300;
  box-shadow: var(--shadow-lg);
}
.context-switcher__menu--open { display: block; }

/* ============================================================
   NAV ICON BUTTON
   ============================================================ */
.btn--icon-nav {
  padding: var(--s-4);
  border-color: transparent;
  position: relative;
}

/* ============================================================
   NOTIFICATION BELL & DROPDOWN
   ============================================================ */
.notification-bell {
  position: relative;
}
.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  background: var(--c-error);
  color: oklch(0.98 0 0);
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 400px;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.notification-dropdown__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-6) var(--s-8);
  border-bottom: 1px solid var(--c-border);
  font-size: var(--t-sm);
}

.notification-dropdown__list {
  overflow-y: auto;
  flex: 1;
}

.notification-item {
  display: block;
  padding: var(--s-6) var(--s-8);
  border-bottom: 1px solid var(--c-border);
  transition: background var(--dur-fast);
}
.notification-item:hover { background: var(--c-surface-max); }
.notification-item:last-child { border-bottom: none; }

.notification-item--unread {
  background: oklch(0.19 0.02 70);
}

.notification-item__msg {
  display: block;
  font-size: var(--t-sm);
  color: var(--c-text);
  line-height: var(--lh-snug);
}

.notification-item__time {
  display: block;
  margin-top: var(--s-2);
}

/* ============================================================
   INVITE BANNER
   ============================================================ */
.invite-banner {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-6) var(--s-12);
  background: var(--c-accent-subtle);
  border-bottom: 1px solid oklch(0.30 0.06 70);
  font-size: var(--t-sm);
  color: var(--c-accent);
}

/* ============================================================
   ONBOARDING
   ============================================================ */
.onboarding {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-12);
  background: var(--c-base);
}

.onboarding__container {
  width: 100%;
  max-width: 520px;
}

.onboarding__brand {
  margin-bottom: var(--s-16);
}

.onboarding__title {
  font-size: var(--t-2xl);
  margin-bottom: var(--s-4);
}

.onboarding__desc {
  color: var(--c-text-2);
  margin-bottom: var(--s-16);
  line-height: var(--lh-normal);
  max-width: 50ch;
}

.onboarding__features {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  margin-bottom: var(--s-16);
}

.onboarding__feature {
  display: flex;
  gap: var(--s-8);
  align-items: flex-start;
}

.onboarding__feature-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--c-surface);
  border-radius: var(--r-md);
}

.onboarding__options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-8);
  margin-bottom: var(--s-8);
}

@media (max-width: 640px) {
  .onboarding__options { grid-template-columns: 1fr; }
}

.onboarding__progress {
  display: flex;
  justify-content: center;
  gap: var(--s-4);
  margin-top: var(--s-16);
}

.onboarding__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--c-border);
  transition: background var(--dur-normal);
}

.onboarding__dot--active {
  background: var(--c-accent);
}

/* ============================================================
   ONBOARDING CHECKLIST
   ============================================================ */
/* Slim onboarding nudge - replaces the old full checklist card on
   the dashboard. Amber-tinted, dismissible via the X button on the
   right, links to /welcome when the main body is clicked. */
.onboarding-nudge {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-4) var(--s-8);
  border-radius: var(--r-md);
  background: color-mix(in oklch, var(--c-accent) 12%, var(--c-bg));
  border: 1px solid var(--c-accent);
  color: var(--c-text);
  text-decoration: none;
  margin-bottom: var(--s-8);
  transition: background 180ms ease;
}
.onboarding-nudge:hover { background: color-mix(in oklch, var(--c-accent) 18%, var(--c-bg)); }
.onboarding-nudge__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); flex: 0 0 auto; }
.onboarding-nudge__copy { flex: 1; font-size: var(--t-sm); font-weight: 600; display: flex; align-items: baseline; gap: var(--s-4); }
.onboarding-nudge__count { color: var(--c-text-2); font-weight: 500; font-size: var(--t-xs); }
.onboarding-nudge__arrow { color: var(--c-accent); flex: 0 0 auto; }
.onboarding-nudge__x {
  background: transparent;
  border: none;
  color: var(--c-text-3);
  cursor: pointer;
  padding: 4px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
}
.onboarding-nudge__x:hover { color: var(--c-text); background: color-mix(in oklch, var(--c-text) 6%, transparent); }

.checklist-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-8);
  margin-bottom: var(--s-12);
}
.checklist-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-6);
  font-family: var(--f-display);
  font-size: var(--t-sm);
  color: var(--c-text);
}
.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-4) var(--s-6);
  border-radius: var(--r-sm);
  font-size: var(--t-sm);
  color: var(--c-text-2);
  transition: background var(--dur-fast);
}
.checklist-item:hover { background: var(--c-surface-hi); }
.checklist-item__check {
  width: 20px;
  height: 20px;
  border-radius: var(--r-sm);
  border: 2px solid var(--c-border-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--t-xs);
  flex-shrink: 0;
}
.checklist-item--done .checklist-item__check {
  background: var(--c-success);
  border-color: var(--c-success);
  color: oklch(0.16 0.02 152);
}
.checklist-item--done { opacity: 0.5; text-decoration: line-through; }

/* ============================================================
   SEARCH ENHANCEMENTS
   ============================================================ */
.search-highlight {
  background: oklch(0.76 0.155 70 / 0.25);
  color: var(--c-accent);
  border-radius: 2px;
  padding: 0 2px;
}

.recent-searches {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  margin-top: 4px;
  z-index: 50;
  box-shadow: var(--shadow-md);
  padding: var(--s-4);
}
.recent-searches__label {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  padding: var(--s-2) var(--s-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.recent-searches__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--s-4) var(--s-6);
  border: none;
  background: none;
  color: var(--c-text-2);
  font-size: var(--t-sm);
  cursor: pointer;
  border-radius: var(--r-sm);
}
.recent-searches__item:hover { background: var(--c-surface-max); color: var(--c-text); }

/* ============================================================
   STEP TIMER
   ============================================================ */
.step-timer-btn {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin-left: 4px;
  background: var(--c-accent-subtle);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-full);
  color: var(--c-accent);
  font-size: var(--t-xs);
  cursor: pointer;
  vertical-align: middle;
  transition: background var(--dur-fast);
  font-family: var(--f-display);
}
.step-timer-btn:hover { background: var(--c-accent); color: var(--c-accent-fg); }
.step-timer-btn--active {
  background: var(--c-accent);
  color: var(--c-accent-fg);
  min-width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.step-timer-btn--done { background: oklch(0.22 0.06 152); border-color: var(--c-success); color: var(--c-success); }

/* ============================================================
   SCALING NOTES
   ============================================================ */
.scaling-notes {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-8);
  padding: var(--s-6) var(--s-8);
  background: var(--c-accent-subtle);
  border-radius: var(--r-md);
}
.scaling-note {
  font-size: var(--t-xs);
  color: var(--c-accent);
  font-style: italic;
}

/* ============================================================
   RELATED RECIPES
   ============================================================ */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--s-8);
}
.related-card {
  cursor: pointer;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-surface);
  transition: transform var(--dur-fast), box-shadow var(--dur-fast);
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.related-card__img {
  width: 100%;
  height: 100px;
  object-fit: cover;
}
.related-card__title {
  padding: var(--s-4) var(--s-6);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--c-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   IMPORT PREVIEW
   ============================================================ */
.import-preview__card {
  display: flex;
  gap: var(--s-12);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.import-preview__img {
  width: 280px;
  min-height: 240px;
  object-fit: cover;
  flex-shrink: 0;
}
.import-preview__img-wrap {
  position: relative;
  width: 280px;
  flex-shrink: 0;
}
.import-preview__recrop {
  position: absolute;
  bottom: 8px; left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(26, 22, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--c-text);
  font-size: var(--t-xs);
  font-weight: 500;
  border-radius: 100px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.import-preview__recrop:hover {
  background: var(--c-accent);
  color: var(--c-accent-fg);
  border-color: var(--c-accent);
}

/* Nutrition mini-preview on the import success card */
.import-preview__nutrition {
  margin-top: var(--s-8);
  padding-top: var(--s-6);
  border-top: 1px solid var(--c-border);
}
.import-preview__n-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-3);
  font-weight: 600;
  margin-bottom: var(--s-4);
}
.import-preview__n-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
}
.import-preview__n-grid > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.import-preview__n-grid span {
  font-family: var(--f-display);
  font-size: var(--t-base);
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.import-preview__n-grid em {
  font-style: normal;
  font-size: 10px;
  color: var(--c-text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Share-to-household pill toggle */
.import-share-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--s-8);
  padding: var(--s-4) var(--s-8);
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: var(--c-surface-hi);
  cursor: pointer;
  user-select: none;
}
.import-share-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.import-share-toggle__track {
  width: 34px;
  height: 20px;
  background: var(--c-surface-max);
  border-radius: 100px;
  position: relative;
  flex-shrink: 0;
  transition: background 180ms ease;
}
.import-share-toggle__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-text-2);
  transition: transform 180ms ease, background 180ms ease;
}
.import-share-toggle input:checked + .import-share-toggle__track { background: var(--c-accent); }
.import-share-toggle input:checked + .import-share-toggle__track::after { transform: translateX(14px); background: var(--c-accent-fg); }
.import-share-toggle__label {
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--c-text);
}

/* Passive "already auto-shared" confirmation line. Shown in place of the
   share toggle when the server auto-shared this import based on the
   user's auto_share_household preference. */
.import-share-confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--s-6);
  padding: 6px 12px;
  border-radius: var(--r-md);
  background: color-mix(in oklch, var(--c-success) 14%, transparent);
  border: 1px solid var(--c-success);
  color: var(--c-success);
  font-size: var(--t-sm);
  font-weight: 600;
}

.import-preview__info {
  padding: var(--s-8);
  flex: 1;
  min-width: 0;
}

.import-preview__title {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--s-2);
}

.import-preview__desc {
  font-size: var(--t-sm);
  color: var(--c-text-2);
  line-height: 1.4;
  margin-bottom: var(--s-4);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.import-preview__meta {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  margin-bottom: var(--s-4);
}

.import-preview__stats {
  font-size: var(--t-xs);
  color: var(--c-accent);
  font-weight: 500;
  margin-bottom: var(--s-4);
}

.import-preview__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

@media (max-width: 640px) {
  .import-preview__card { flex-direction: column; }
  .import-preview__img { width: 100%; height: 160px; }
}

/* ============================================================
   QUICK MEAL PLAN ADD
   ============================================================ */
.recipe-card__quick-add {
  position: absolute;
  top: var(--s-4);
  right: var(--s-4);
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: oklch(0.13 0.01 70 / 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid oklch(1 0 0 / 0.15);
  color: var(--c-text);
  font-size: var(--t-lg);
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-fast), background var(--dur-fast);
  z-index: 5;
  line-height: 1;
}
.recipe-card:hover .recipe-card__quick-add { opacity: 1; }
.recipe-card__quick-add:hover { background: var(--c-accent); color: var(--c-accent-fg); }

/* Per-card "..." actions button. Sits left of the quick-add button so
   they don't overlap. Reveals on hover, same as the quick-add. */
.recipe-card__menu-btn {
  position: absolute;
  top: var(--s-4);
  right: 44px;
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: oklch(0.13 0.01 70 / 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid oklch(1 0 0 / 0.15);
  color: var(--c-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-fast), background var(--dur-fast);
  z-index: 5;
}
.recipe-card:hover .recipe-card__menu-btn { opacity: 1; }
.recipe-card__menu-btn:hover { background: var(--c-accent); color: var(--c-accent-fg); }

/* Singleton popover opened by the card menu. Absolute-positioned from JS. */
.recipe-card-menu-pop {
  position: absolute;
  z-index: 600;
  min-width: 200px;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: var(--s-2);
}
.recipe-card-menu-pop__item {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  width: 100%;
  padding: var(--s-4) var(--s-6);
  background: none;
  border: none;
  border-radius: var(--r-sm);
  color: var(--c-text);
  font-size: var(--t-sm);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.recipe-card-menu-pop__item:hover { background: var(--c-surface); }
.recipe-card-menu-pop__item svg { color: var(--c-text-2); flex: 0 0 auto; }

/* Select-mode: checkbox overlay on each card + outline on selected. */
.recipe-card__select-check {
  position: absolute;
  top: var(--s-4);
  left: var(--s-4);
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: 2px solid oklch(1 0 0 / 0.45);
  background: oklch(0.13 0.01 70 / 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 6;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.recipe-grid--select .recipe-card__select-check { display: flex; }
.recipe-grid--select .recipe-card__quick-add,
.recipe-grid--select .recipe-card__menu-btn { display: none; }
.recipe-card--selected .recipe-card__select-check {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.recipe-card--selected .recipe-card__select-check::after {
  content: '';
  width: 12px;
  height: 6px;
  border-left: 2px solid var(--c-accent-fg);
  border-bottom: 2px solid var(--c-accent-fg);
  transform: rotate(-45deg) translateY(-2px);
}
.recipe-card--selected {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* Bottom bulk-action bar. Fixed to the viewport; respects env()
   insets so it lifts above iOS home indicators / Android nav bars. */
.bulk-bar {
  position: fixed;
  left: 50%;
  bottom: max(var(--s-8), env(safe-area-inset-bottom, 0));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-4) var(--s-6);
  background: var(--c-surface-hi);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-lg);
  z-index: 700;
  max-width: min(540px, calc(100vw - var(--s-8)));
}
.bulk-bar__count {
  font-family: var(--f-display);
  font-weight: 700;
  color: var(--c-text);
  font-size: var(--t-sm);
  white-space: nowrap;
}
.bulk-bar__actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}
.bulk-bar__hint {
  color: var(--c-text-3);
  font-size: var(--t-xs);
}

.quick-meal-pop {
  position: absolute;
  z-index: 500;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-lg);
  width: 240px;
}

.qm-header {
  font-family: var(--f-display);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: var(--s-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.qm-day {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}

.qm-day__label {
  width: 32px;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--c-text-3);
}

.qm-slot {
  flex: 1;
  padding: var(--s-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-text-3);
  font-size: var(--t-xs);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  text-align: center;
}
.qm-slot:hover { background: var(--c-accent-subtle); color: var(--c-accent); border-color: var(--c-accent); }
.qm-slot--done { background: var(--c-accent); color: var(--c-accent-fg); border-color: var(--c-accent); }

/* ============================================================
   COOK MODE
   ============================================================ */
.cook-mode {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--c-base);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cook-mode__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-8) var(--s-12);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.cook-mode__progress {
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--c-accent);
  letter-spacing: 0.04em;
}

.cook-mode__exit {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  color: var(--c-text-2);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.cook-mode__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-16) var(--s-12);
  text-align: center;
  overflow-y: auto;
}

.cook-mode__step-num {
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-accent);
  margin-bottom: var(--s-8);
}

.cook-mode__instruction {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--c-text);
  max-width: 36ch;
  /* Warm amber glow behind the active step so the user's eye snaps to it */
  position: relative;
  padding: clamp(20px, 4vw, 32px) clamp(24px, 5vw, 40px);
  border-radius: var(--r-xl);
  background: radial-gradient(circle at 50% 30%, color-mix(in oklch, var(--c-accent) 10%, transparent) 0%, transparent 65%);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--c-accent) 20%, transparent);
  animation: cook-step-glow 3.2s ease-in-out infinite;
}
@keyframes cook-step-glow {
  0%, 100% { box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--c-accent) 20%, transparent); }
  50%      { box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--c-accent) 40%, transparent),
                        0 0 32px color-mix(in oklch, var(--c-accent) 15%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .cook-mode__instruction { animation: none; }
}

/* Completion celebration screen */
.cook-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 6vw, 64px);
  text-align: center;
  gap: var(--s-8);
  animation: cook-complete-in 500ms cubic-bezier(.2,.7,.25,1);
}
@keyframes cook-complete-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cook-complete__confetti {
  font-size: clamp(3rem, 8vw, 5rem);
  letter-spacing: 12px;
  margin-bottom: var(--s-6);
  /* Bouncing emojis reinforce "this is a good thing that happened" */
  animation: confetti-bob 2.6s ease-in-out infinite;
}
@keyframes confetti-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.cook-complete__title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: -0.025em;
  color: var(--c-text);
  margin: 0;
}
.cook-complete__sub {
  color: var(--c-text-2);
  font-size: var(--t-base);
  line-height: 1.55;
  max-width: 38ch;
  margin: 0 0 var(--s-8);
}
.cook-complete__actions {
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
  justify-content: center;
}

.cook-mode__nav {
  display: flex;
  gap: var(--s-6);
  padding: var(--s-8) var(--s-12);
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
}

.cook-mode__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-8);
  min-height: 64px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--t-lg);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.cook-mode__btn:hover { background: var(--c-surface-hi); border-color: var(--c-border-hi); }
.cook-mode__btn:disabled { opacity: 0.3; cursor: not-allowed; }
.cook-mode__btn--next { background: var(--c-accent); color: var(--c-accent-fg); border-color: transparent; }
.cook-mode__btn--next:hover { background: var(--c-accent-hover); }
.cook-mode__btn--ing { flex: 0 0 auto; padding: var(--s-8) var(--s-12); font-size: var(--t-sm); color: var(--c-text-2); }

/* Ingredient slide-up panel - now with a blurred backdrop scrim */
.cook-mode__ingredients {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 62vh;
  background: color-mix(in oklch, var(--c-surface) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid var(--c-border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  overflow-y: auto;
  padding: var(--s-8) var(--s-12) var(--s-16);
  z-index: 10;
  box-shadow: 0 -8px 40px oklch(0 0 0 / 0.5);
  animation: cook-ing-in 280ms cubic-bezier(.2,.7,.25,1);
}
@keyframes cook-ing-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
/* Inline per-step timer button + the fixed bar that shows every running
   timer across steps. The bar sits above the nav so the user can jump
   to any active timer without closing cook mode. */
.cook-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--s-8);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--c-accent);
  background: color-mix(in oklch, var(--c-accent) 14%, transparent);
  color: var(--c-accent);
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, transform 120ms ease;
}
.cook-timer:hover { background: color-mix(in oklch, var(--c-accent) 22%, transparent); }
.cook-timer:active { transform: scale(0.97); }
.cook-timer--running {
  background: var(--c-accent);
  color: var(--c-accent-fg, var(--c-accent-fg));
}
.cook-timer-bar {
  position: absolute;
  left: 0; right: 0;
  bottom: 90px; /* above the cook-mode__nav row */
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
  z-index: 2;
}
.cook-timer-bar__item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid var(--c-accent);
  background: color-mix(in oklch, var(--c-accent) 10%, var(--c-bg));
  color: var(--c-accent);
  font-family: var(--f-display);
  font-weight: 700;
  cursor: pointer;
  min-width: 84px;
  flex-shrink: 0;
}
.cook-timer-bar__step {
  font-size: 9px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--c-text-3);
  font-weight: 700;
}
.cook-timer-bar__time {
  font-variant-numeric: tabular-nums;
  font-size: var(--t-base);
}

/* Dim+blur behind the panel by dropping a scrim over the cook-mode body */
.cook-mode.cook-mode--panel-open .cook-mode__body,
.cook-mode.cook-mode--panel-open .cook-mode__nav,
.cook-mode.cook-mode--panel-open .cook-mode__header {
  filter: blur(8px) brightness(0.6);
  pointer-events: none;
  transition: filter 220ms var(--ease-out);
}

.cook-mode__ingredients-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-8);
  font-family: var(--f-display);
  font-size: var(--t-base);
  color: var(--c-text);
}

.cook-mode__ing-list {
  list-style: none;
}

.cook-ing {
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--t-base);
  color: var(--c-text);
}
.cook-ing:last-child { border-bottom: none; }

.cook-ing__amt {
  color: var(--c-accent);
  font-weight: 500;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .nav, .recipe-detail__actions, .recipe-detail__controls,
  .serving-adjuster, .btn, .filter-bar, .filter-chips, .search-row, .search-bar, .fpop, .ad-slot, .grocery-cta, .upgrade-banner, .upgrade-modal, .upsell-cta,
  .toast-container, .ui-scroll-top, .ui-modal-overlay, .recipe-extras__row,
  .recipe-amazon, .recipe-detail__jump, .recipe-detail__tags, .recipe-detail__source,
  .recipe-notes__head, .recipe-card__quick-add, .recipe-card__platform {
    display: none !important;
  }

  /* High-contrast black on white for printers */
  html, body {
    background: white !important;
    color: black !important;
    font-size: 10.5pt;
  }
  .recipe-detail, .recipe-detail__body { max-width: 100%; display: block; }
  .recipe-detail__body { grid-template-columns: 1fr !important; gap: 16pt !important; }

  /* Hero shrinks to a thumbnail strip for paper */
  .recipe-detail__hero,
  .recipe-hero-fallback {
    max-height: 180px;
    width: auto;
    margin: 0 0 8pt;
    border-radius: 4pt;
    page-break-inside: avoid;
  }
  .recipe-hero-fallback__emoji { display: none !important; }
  .recipe-hero-fallback__title { color: black !important; text-shadow: none !important; font-size: 22pt; }

  .recipe-detail__title { color: black !important; font-size: 22pt; margin-bottom: 4pt; }
  .recipe-detail__desc { color: #333 !important; font-size: 11pt; max-width: none; }
  .recipe-detail__meta-item { border-color: #000 !important; color: #000 !important; background: transparent !important; }
  .recipe-detail__meta-icon { display: none; }

  .ingredients { position: static; page-break-inside: avoid; }
  .ingredients__title, .steps__title {
    color: #000 !important;
    border-bottom: 1pt solid #000;
    padding-bottom: 4pt;
    margin-bottom: 6pt;
  }
  .ingredients__list { column-count: 2 !important; column-gap: 20pt; }
  .ingredients__list li { border-color: #ccc !important; padding: 3pt 0; page-break-inside: avoid; }
  .ingredients__amount { color: #000 !important; }

  .steps__list li {
    page-break-inside: avoid;
    border-color: #ccc !important;
    padding: 6pt 0;
    font-size: 11pt;
  }
  .steps__list li::before {
    background: transparent !important;
    color: #000 !important;
    border: 1pt solid #000 !important;
    width: 28pt; height: 28pt; font-size: 13pt;
  }
  .step-timer-btn { display: none !important; }

  .nutrition-label {
    border: 2pt solid #000 !important;
    background: white !important;
    color: black !important;
    max-width: 100%;
    page-break-inside: avoid;
  }
  .recipe-notes {
    border: 1pt solid #ccc !important;
    background: white !important;
    border-left: 3pt solid #000 !important;
    page-break-inside: avoid;
  }
  .recipe-notes__textarea { color: black !important; background: transparent !important; }

  a[href]::after { content: ''; }  /* no verbose link URLs */
  .recipe-detail__source a[href]::after { content: ' (' attr(href) ')'; font-size: 9pt; color: #666; }
}

/* ============================================================
   PANTRY  -  /pantry
   ============================================================ */
.pantry {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 32px);
}
.pantry__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-8);
  margin-bottom: var(--s-10);
  flex-wrap: wrap;
}
.pantry__head-text { flex: 1; min-width: 280px; }
.pantry__eyebrow {
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: var(--s-4);
}
.pantry__title {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--c-text);
  margin: 0 0 var(--s-4);
}
.pantry__deck {
  color: var(--c-text-2);
  font-size: var(--t-base);
  line-height: 1.55;
  max-width: 54ch;
  margin: 0;
}
.pantry__counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;             /* explicit 16px between the three cards */
  margin-bottom: var(--s-10);
}
.pantry__count-card {
  padding: 20px;         /* generous internal padding */
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  transition: border-color 160ms ease, background 160ms ease;
}
/* "Running low" - amber tint to draw the eye */
.pantry__count-card--warn {
  background: color-mix(in oklch, var(--c-warning) 8%, var(--c-surface));
  border-color: color-mix(in oklch, var(--c-warning) 48%, var(--c-border));
}
.pantry__count-card--warn .pantry__count-value { color: var(--c-warning); }
/* "Out" - subtle red tint */
.pantry__count-card--muted {
  background: color-mix(in oklch, var(--c-error) 6%, var(--c-surface));
  border-color: color-mix(in oklch, var(--c-error) 32%, var(--c-border));
  opacity: 1;
}
.pantry__count-card--muted .pantry__count-value { color: var(--c-error); }
.pantry__count-label {
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-3);
  font-weight: 600;
  margin-bottom: var(--s-2);
}
.pantry__count-value {
  font-family: var(--f-display);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.pantry__add {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-8);
  margin-bottom: var(--s-10);
}
.pantry__add-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 90px 100px 150px auto;
  gap: var(--s-4);
}
@media (max-width: 720px) {
  .pantry__add-row { grid-template-columns: 1fr 1fr; }
  .pantry__add-row .pantry__add-input { grid-column: 1 / -1; }
  .pantry__add-row > button { grid-column: 1 / -1; }
}
.pantry__add-helper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-top: var(--s-6);
  flex-wrap: wrap;
}
.pantry__add-hint {
  font-size: var(--t-xs);
  color: var(--c-text-3);
}

/* Category section */
.pan-sec { margin-bottom: var(--s-10); }
.pan-sec__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-4);
}
.pan-sec__title {
  font-family: var(--f-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-2);
  margin: 0;
}
.pan-sec__count {
  font-size: var(--t-xs);
  color: var(--c-text-3);
}
.pan-sec__list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

/* Individual items */
.pan-item {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-6) var(--s-8);
  border-bottom: 1px solid var(--c-border);
  transition: background 150ms ease;
}
.pan-item:last-child { border-bottom: 0; }
.pan-item:hover { background: var(--c-surface-hi); }
.pan-item--low { background: color-mix(in oklch, var(--c-warning) 6%, var(--c-surface)); }
.pan-item--out { opacity: 0.55; }
.pan-item--out .pan-item__name { text-decoration: line-through; }
.pan-item__main { flex: 1; min-width: 0; }
.pan-item__name {
  font-family: var(--f-display);
  font-size: var(--t-base);
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.3;
}
.pan-item__meta {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-top: 2px;
  font-size: var(--t-xs);
  color: var(--c-text-3);
}
.pan-item__qty { font-variant-numeric: tabular-nums; }
.pan-item__pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pan-item__pill--low { background: color-mix(in oklch, var(--c-warning) 24%, transparent); color: var(--c-warning); }
.pan-item__pill--out { background: color-mix(in oklch, var(--c-error) 18%, transparent); color: var(--c-error); }
.pan-item__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}
.pan-item__btn {
  padding: 6px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-2);
  font-family: var(--f-body);
  font-size: var(--t-xs);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.pan-item__btn:hover { border-color: var(--c-text-3); color: var(--c-text); }
.pan-item__btn--restock { background: var(--c-accent); color: var(--c-accent-fg); border-color: var(--c-accent); }
.pan-item__btn--restock:hover { background: var(--c-accent-hover, var(--c-accent)); color: var(--c-accent-fg); }
.pan-item__btn--del {
  padding: 6px 8px;
  color: var(--c-text-3);
}
.pan-item__btn--del:hover { color: var(--c-error); border-color: var(--c-error); }

/* Empty state */
.pantry__empty {
  text-align: center;
  padding: var(--s-16) var(--s-8);
  color: var(--c-text-2);
}
.pantry__empty-icon {
  color: var(--c-text-3);
  margin-bottom: var(--s-6);
  display: inline-flex;
}
.pantry__empty-title {
  font-family: var(--f-display);
  font-size: var(--t-xl);
  font-weight: 700;
  color: var(--c-text);
  margin: 0 0 var(--s-2);
}
.pantry__empty-sub {
  font-size: var(--t-sm);
  color: var(--c-text-3);
  margin: 0;
}

/* ============================================================
   PUBLIC RECIPE PREVIEW  -  /recipe/{id}/preview
   ============================================================ */
.rp-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-6) clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--c-border);
}
.rp-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: var(--t-lg);
  color: var(--c-text);
  text-decoration: none;
}
.rp-brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--c-accent);
  color: var(--c-accent-fg);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
}
.rp-top__nav { display: flex; gap: var(--s-3); }
.rp-main {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 32px);
}
.rp-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: var(--s-12);
}
.rp-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--c-surface-hi);
  overflow: hidden;
}
.rp-hero__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rp-body { padding: clamp(24px, 4vw, 40px); }
.rp-eyebrow {
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: var(--s-4);
}
.rp-title {
  font-family: var(--f-display);
  font-size: clamp(1.875rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--c-text);
  margin: 0 0 var(--s-6);
}
.rp-description {
  color: var(--c-text-2);
  font-size: var(--t-base);
  line-height: 1.65;
  max-width: 60ch;
  margin: 0 0 var(--s-8);
}
.rp-stats {
  display: flex;
  gap: var(--s-10);
  flex-wrap: wrap;
  padding: var(--s-6) 0;
  margin-bottom: var(--s-8);
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
}
.rp-stat { }
.rp-stat__value {
  font-family: var(--f-display);
  font-size: var(--t-2xl);
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 4px;
}
.rp-stat__label {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.rp-teaser { margin-bottom: var(--s-10); }
.rp-teaser__label {
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-3);
  font-weight: 600;
  margin-bottom: var(--s-3);
}
.rp-teaser__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}
.rp-teaser__list li {
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  font-size: var(--t-sm);
  font-weight: 500;
}
.rp-cta {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.rp-cta .btn { flex: 1; min-width: 200px; }
.rp-pitch {
  text-align: center;
  padding: var(--s-10) var(--s-6);
  max-width: 52ch;
  margin: 0 auto;
}
.rp-pitch__title {
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--c-text);
  margin: 0 0 var(--s-4);
}
.rp-pitch__body {
  color: var(--c-text-2);
  font-size: var(--t-base);
  line-height: 1.65;
  margin: 0;
}
.rp-footer {
  padding: var(--s-8) clamp(16px, 4vw, 48px);
  border-top: 1px solid var(--c-border);
  text-align: center;
  color: var(--c-text-3);
  font-size: var(--t-xs);
}
.rp-footer a { color: var(--c-text-2); text-decoration: none; }

/* ============================================================
   SOCIAL SHARE MODAL  (recipe detail → Share button)
   ============================================================ */
.sshare-overlay {
  position: fixed; inset: 0; z-index: 2200;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 32px);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: sshare-fade 180ms var(--ease-out);
}
@keyframes sshare-fade { from { opacity: 0; } to { opacity: 1; } }
.sshare-modal {
  width: min(520px, 100%);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: 0 40px 100px rgba(0,0,0,0.55);
  overflow: hidden;
}
.sshare-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-6) var(--s-8);
  border-bottom: 1px solid var(--c-border);
}
.sshare-modal__title {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.sshare-modal__close {
  background: transparent; border: 0;
  color: var(--c-text-3);
  font-size: 24px; line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: color 150ms ease, background 150ms ease;
}
.sshare-modal__close:hover { color: var(--c-text); background: var(--c-surface-hi); }
.sshare-preview {
  aspect-ratio: 1200 / 630;
  background: var(--c-bg);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.sshare-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sshare-link {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-6) var(--s-8);
}
.sshare-link .input { flex: 1; font-family: var(--f-mono, monospace); font-size: var(--t-sm); }
.sshare-actions {
  display: flex;
  gap: var(--s-3);
  padding: 0 var(--s-8) var(--s-4);
}
.sshare-actions__btn { flex: 1; }
.sshare-hint {
  padding: 0 var(--s-8) var(--s-8);
  font-size: var(--t-xs);
  color: var(--c-text-3);
  line-height: 1.5;
  margin: 0;
}
@media (max-width: 540px) {
  .sshare-link { flex-direction: column; }
  .sshare-actions { flex-direction: column; }
}


/* ============================================================
   DISCOVER (/trending)  search + cuisine chips + new-this-week
   ============================================================ */
.trend-search {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 520px;
  margin-top: var(--s-6);
}
.trend-search__icon {
  position: absolute;
  left: var(--s-6);
  color: var(--c-text-3);
  pointer-events: none;
}
.trend-search__input {
  width: 100%;
  padding: 12px 44px;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: var(--t-sm);
  transition: border-color 150ms ease;
}
.trend-search__input:focus {
  outline: 0;
  border-color: var(--c-accent);
}
.trend-search__clear {
  position: absolute;
  right: var(--s-4);
  color: var(--c-text-2);
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--r-full);
}
.trend-search__clear:hover { background: var(--c-surface-hi); color: var(--c-text); }
.trend-cuisines {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-6);
}
.trend-cuisine {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text-2);
  font-size: var(--t-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all 150ms ease;
}
.trend-cuisine:hover { border-color: var(--c-text-3); color: var(--c-text); }
.trend-cuisine--active {
  background: color-mix(in oklch, var(--c-accent) 18%, transparent);
  border-color: var(--c-accent);
  color: var(--c-accent);
}
.trend-cuisine__n {
  font-family: var(--f-body);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: rgba(0,0,0,0.25);
  color: inherit;
}

/* New-this-week ribbon on cards */
.trend-card__new {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--c-accent);
  color: var(--c-accent-fg);
  font-family: var(--f-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--r-full);
  box-shadow: 0 4px 10px rgba(196, 145, 30, 0.3);
}

/* ============================================================
   PUBLIC COLLECTION PAGE  -  /c/{token}
   ============================================================ */
.cp-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 32px);
}
.cp-masthead { margin-bottom: var(--s-12); max-width: 60ch; }
.cp-eyebrow {
  font-family: var(--f-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: var(--s-4);
}
.cp-title {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 var(--s-4);
}
.cp-description {
  color: var(--c-text-2);
  font-size: var(--t-base);
  line-height: 1.65;
  margin: 0 0 var(--s-6);
}
.cp-count {
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-3);
  font-weight: 600;
}
.cp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-6);
  margin-bottom: var(--s-12);
}
.cp-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
  color: var(--c-text);
  transition: transform 200ms ease, border-color 200ms ease;
}
.cp-card:hover { transform: translateY(-2px); border-color: var(--c-accent); }
.cp-card__thumb {
  aspect-ratio: 4 / 3;
  background: var(--c-surface-hi);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.cp-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cp-card__ph { font-size: 48px; opacity: 0.4; }
.cp-card__body { padding: var(--s-6); }
.cp-card__title {
  font-family: var(--f-display);
  font-size: var(--t-base);
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 var(--s-2);
}
.cp-card__time {
  font-size: var(--t-xs);
  color: var(--c-text-3);
}
.cp-empty {
  padding: var(--s-16) var(--s-6);
  text-align: center;
  color: var(--c-text-3);
}

/* ============================================================
   SYSTEM ANNOUNCEMENT BANNER  (admin-set, rendered by nav.php)
   ============================================================ */
.sys-banner {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) clamp(16px, 4vw, 32px);
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--c-text);
  border-bottom: 1px solid var(--c-border);
}
.sys-banner--info    { background: color-mix(in oklch, var(--c-accent) 12%, var(--c-bg)); }
.sys-banner--warn    { background: color-mix(in oklch, var(--c-warning) 16%, var(--c-bg)); }
.sys-banner--success { background: color-mix(in oklch, var(--c-success) 14%, var(--c-bg)); }
.sys-banner__dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
}
.sys-banner--info .sys-banner__dot    { background: var(--c-accent); }
.sys-banner--warn .sys-banner__dot    { background: var(--c-warning); }
.sys-banner--success .sys-banner__dot { background: var(--c-success); }
.sys-banner__msg { min-width: 0; }

/* ============================================================
   NAV USER BUTTON - AVATAR
   ============================================================ */
.nav-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
}
.nav-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--c-surface-hi);
  display: inline-grid;
  place-items: center;
}
.nav-user-avatar--initials {
  background: var(--c-accent);
  color: var(--c-accent-fg);
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 14px;
}

/* Household member avatars */
.hh-member { display: flex; align-items: center; gap: 12px; }
.hh-member__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--c-surface-hi);
  display: inline-grid; place-items: center;
}
.hh-member__avatar--initials {
  background: var(--c-accent);
  color: var(--c-accent-fg);
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 14px;
}

/* ============================================================
   RECIPE DETAIL ACTION BAR - primary + "More" dropdown
   ============================================================ */
.recipe-detail__primary {
  /* Make Cook the most prominent action */
  padding-inline: var(--s-8);
  font-weight: 600;
}
.recipe-detail__more .dropdown__menu {
  min-width: 220px;
}
/* The two duplicate entries inside the dropdown (Edit + Share) only appear
   on mobile; hide them on wider screens where Edit + Share already live in
   the visible action bar. */
.recipe-detail__more-mobile { display: none; }
@media (max-width: 560px) {
  .recipe-detail__action--hide-mobile { display: none; }
  .recipe-detail__more-mobile { display: flex; }
  /* "More" label becomes redundant next to the three-dots icon on mobile */
  .recipe-detail__more-label { display: none; }
}

/* ============================================================
   NUTRITION - compact strip (replaces the FDA-label block for
   the primary view; full breakdown behind the expand toggle)
   ============================================================ */
.nutri {
  margin: var(--s-12) 0;
  padding: var(--s-8) var(--s-10);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
}
.nutri__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.nutri__title {
  font-family: var(--f-display);
  font-size: var(--t-base);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-text);
  margin: 0;
}
.nutri__subtitle {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  letter-spacing: 0.04em;
}

/* Primary row: 5 stats. Responsive: 5 wide on desktop, wraps to 3 then 2
   on narrower viewports via auto-fit. */
.nutri__strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--s-4);
}
@media (max-width: 720px) {
  .nutri__strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .nutri__strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.nutri-stat {
  padding: var(--s-4) var(--s-3);
  background: var(--c-surface-hi);
  border-radius: var(--r-md);
  text-align: center;
}
.nutri-stat__num {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.nutri-stat__label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-text-3);
  font-weight: 600;
  margin-top: 2px;
}

/* Expandable detail */
.nutri__more {
  margin-top: var(--s-6);
}
.nutri__more-summary {
  cursor: pointer;
  font-size: var(--t-sm);
  color: var(--c-text-2);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  user-select: none;
}
.nutri__more-summary::-webkit-details-marker { display: none; }
.nutri__more-summary::before {
  content: "";
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--c-text-3);
  transform: rotate(-90deg);
  transition: transform 160ms ease;
}
.nutri__more[open] .nutri__more-summary::before { transform: rotate(0); }
.nutri__more-summary:hover { color: var(--c-text); }
.nutri__more-body {
  margin-top: var(--s-4);
  padding: var(--s-4) 0 0;
  border-top: 1px solid var(--c-border);
}
.nutri__row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: var(--t-sm);
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}
.nutri__row--sub {
  padding-left: var(--s-6);
  color: var(--c-text-2);
}
.nutri__row--totals {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--c-border);
  font-size: var(--t-xs);
  color: var(--c-text-3);
}
.nutri__disclaimer {
  margin: var(--s-4) 0 0;
  font-size: var(--t-xs);
  color: var(--c-text-3);
  line-height: 1.4;
}

/* ============================================================
   COOK MODE - inline "kitchen tip" card
   (No collapsed pill. Always visible; friendly; dismissible.)
   ============================================================ */
.cook-tip {
  position: relative;
  width: min(520px, 100%);
  margin: var(--s-8) auto 0;
  padding: var(--s-8) var(--s-10);
  background: color-mix(in oklch, var(--c-accent) 10%, var(--c-surface));
  border: 1px solid color-mix(in oklch, var(--c-accent) 45%, var(--c-border));
  border-radius: var(--r-lg);
  animation: cook-tip-in 220ms var(--ease-out);
}
@keyframes cook-tip-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cook-tip__dismiss {
  position: absolute;
  top: 8px; right: 8px;
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border: 0;
  background: transparent;
  color: var(--c-text-3);
  border-radius: 50%;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.cook-tip__dismiss:hover {
  background: color-mix(in oklch, var(--c-accent) 20%, transparent);
  color: var(--c-text);
}
.cook-tip__headline {
  font-family: var(--f-display);
  font-size: var(--t-base);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-accent);
  margin-bottom: var(--s-4);
  padding-right: 32px; /* leave room for the × button */
}
.cook-tip__row {
  display: flex;
  align-items: center;
  gap: var(--s-6);
}
.cook-tip__img {
  position: relative;
  width: 48px; height: 48px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex: none;
  background: linear-gradient(135deg,
    color-mix(in oklch, var(--c-accent) 25%, var(--c-surface)) 0%,
    color-mix(in oklch, var(--c-accent) 10%, var(--c-surface-hi)) 100%);
}
.cook-tip__img img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #fff;
}
.cook-tip__img-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 2px 4px;
  font-family: var(--f-display);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-accent);
  text-align: center;
  line-height: 1.1;
}
.cook-tip__body { flex: 1; min-width: 0; }
.cook-tip__title {
  font-size: var(--t-sm);
  color: var(--c-text);
  line-height: 1.35;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cook-tip__cta {
  font-size: var(--t-xs);
  color: var(--c-accent);
  text-decoration: none;
  font-weight: 600;
}
.cook-tip__cta:hover { text-decoration: underline; }
.cook-tip__disclosure {
  margin-top: var(--s-4);
  font-size: 10px;
  color: var(--c-text-3);
  letter-spacing: 0.02em;
}
/* Host div stays empty when no tip is shown */
#cook-step-tool:empty { display: none; }

/* ============================================================
   AMAZON PRODUCT CARD - recipe detail "You might need"
   Wrapper is a <div> now so the action buttons sit inside the
   same card without breaking the card <a> link semantics.
   ============================================================ */
.recipe-amazon__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-6);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  transition: border-color 160ms ease, background 160ms ease;
}
.recipe-amazon__card:hover { border-color: var(--c-accent); background: color-mix(in oklch, var(--c-accent) 6%, var(--c-surface)); }
.recipe-amazon__link {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--s-6);
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.recipe-amazon__social {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--c-accent);
  font-weight: 600;
}
.recipe-amazon__actions {
  display: flex;
  gap: 6px;
  padding-top: var(--s-3);
  border-top: 1px solid var(--c-border);
}
.recipe-amazon__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-2);
  font-size: var(--t-xs);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.recipe-amazon__btn:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
  background: color-mix(in oklch, var(--c-accent) 12%, transparent);
}
.recipe-amazon__icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-3);
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease;
}
.recipe-amazon__icon-btn:hover { color: var(--c-text); border-color: var(--c-text-3); }

/* Cook-mode tip additions: action row + social proof */
.cook-tip__social {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--c-accent);
  font-weight: 600;
}
.cook-tip__actions {
  display: flex;
  gap: 6px;
  margin-top: var(--s-4);
}
.cook-tip__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r-md);
  border: 1px solid color-mix(in oklch, var(--c-accent) 40%, transparent);
  background: transparent;
  color: var(--c-accent);
  font-size: var(--t-xs);
  font-weight: 600;
  cursor: pointer;
}
.cook-tip__btn:hover { background: color-mix(in oklch, var(--c-accent) 18%, transparent); }
.cook-tip__icon-btn {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-md);
  border: 1px solid color-mix(in oklch, var(--c-accent) 30%, transparent);
  background: transparent;
  color: var(--c-accent);
  cursor: pointer;
}
.cook-tip__icon-btn:hover { background: color-mix(in oklch, var(--c-accent) 14%, transparent); }

/* ============================================================
   PROFILE - Nutrition goals grid
   ============================================================ */
.ng-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
  margin-bottom: var(--s-6);
}
.ng-saved {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--c-accent) 18%, transparent);
  color: var(--c-accent);
  font-family: var(--f-display);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.4px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
  pointer-events: none;
}
.ng-saved--visible { opacity: 1; transform: translateY(0); }

.ng-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-6);
}
.ng-field { display: flex; flex-direction: column; gap: 4px; }
.ng-field__label {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.ng-field__row {
  position: relative;
  display: flex;
  align-items: center;
}
.ng-field__row .input {
  padding-right: 40px;
  font-variant-numeric: tabular-nums;
}
.ng-field__unit {
  position: absolute;
  right: 12px;
  color: var(--c-text-3);
  font-size: var(--t-xs);
  pointer-events: none;
}

.nutri__goals {
  margin-top: var(--s-8);
  padding: var(--s-6) var(--s-8);
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.nutri__goals-title {
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--c-text-3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: var(--s-2);
}

/* Per-macro progress bars shown on recipe detail + meal planner day
   columns. Color shifts with percentage: under 30 is cool green,
   30-60 amber (on-target), 60+ deep amber (heavy). */
.macro-bar {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  align-items: center;
  gap: var(--s-6);
  font-size: var(--t-xs);
}
.macro-bar__label { color: var(--c-text-2); letter-spacing: 0.2px; }
.macro-bar__track {
  height: 6px;
  border-radius: 99px;
  background: color-mix(in oklch, var(--c-text-3) 25%, transparent);
  overflow: hidden;
}
.macro-bar__fill {
  height: 100%;
  border-radius: 99px;
  background: var(--c-accent);
  transition: width 250ms ease;
}
.macro-bar__fill--low    { background: var(--c-success); }
.macro-bar__fill--mid    { background: var(--c-accent); }
.macro-bar__fill--high   { background: color-mix(in oklch, var(--c-error) 80%, var(--c-accent)); }
.macro-bar__pct {
  color: var(--c-text-2);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}

/* ============================================================
   PROFILE - "My Kitchen" appliance grid
   ============================================================ */
.kit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--s-3);
}
.kit-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kit-card__toggle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text-2);
  font-family: var(--f-body);
  font-size: var(--t-sm);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.kit-card__toggle:hover {
  border-color: var(--c-text-3);
  color: var(--c-text);
}
.kit-card__icon { font-size: 28px; line-height: 1; }
.kit-card__name { text-align: center; line-height: 1.2; }
.kit-card__check {
  position: absolute;
  top: 6px;
  right: 6px;
  color: var(--c-accent);
}
.kit-card--owned .kit-card__toggle {
  background: color-mix(in oklch, var(--c-accent) 14%, var(--c-surface));
  border-color: var(--c-accent);
  color: var(--c-text);
}
.kit-card--owned .kit-card__name {
  color: var(--c-accent);
  font-weight: 600;
}
.kit-card__brand {
  margin-top: 2px;
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: var(--t-xs);
}
.kit-card__brand:focus { outline: 1px solid var(--c-accent); border-color: var(--c-accent); }

/* ============================================================
   RECIPE EQUIPMENT BADGES
   ============================================================ */
.eq-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--s-4);
}
.eq-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 600;
  border: 1px solid transparent;
}
.eq-badge__icon { line-height: 1; }
.eq-badge--owned {
  background: color-mix(in oklch, var(--c-success) 16%, transparent);
  color: var(--c-success);
  border-color: color-mix(in oklch, var(--c-success) 38%, transparent);
}
.eq-badge--missing {
  background: color-mix(in oklch, var(--c-error) 14%, transparent);
  color: var(--c-error);
  border-color: color-mix(in oklch, var(--c-error) 36%, transparent);
}
.eq-badge--optional {
  background: var(--c-surface-hi);
  color: var(--c-text-3);
  border-color: var(--c-border);
}

/* What's-new banner (on every logged-in page via nav.php). Amber
   slim bar at the top of the page. Dismiss persists via the
   user_release_views table so we don't re-nag on the next load. */
.whats-new-banner {
  background: color-mix(in oklch, var(--c-accent) 14%, var(--c-surface));
  border-bottom: 1px solid color-mix(in oklch, var(--c-accent) 35%, var(--c-border));
  color: var(--c-text);
}
.whats-new-banner.hidden { display: none; }
.whats-new-banner__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: var(--s-6);
}
.whats-new-banner__icon {
  color: var(--c-accent);
  flex: none;
  display: grid;
  place-items: center;
}
.whats-new-banner__text { flex: 1; min-width: 0; display: flex; gap: var(--s-4); align-items: baseline; flex-wrap: wrap; }
.whats-new-banner__text strong { font-size: var(--t-sm); font-weight: 700; color: var(--c-text); }
.whats-new-banner__sub { color: var(--c-text-2); font-size: var(--t-xs); }
.whats-new-banner__link {
  color: var(--c-accent);
  font-weight: 600;
  font-size: var(--t-sm);
  text-decoration: none;
  white-space: nowrap;
}
.whats-new-banner__link:hover { text-decoration: underline; }
.whats-new-banner__close {
  background: transparent;
  border: 0;
  color: var(--c-text-3);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}
.whats-new-banner__close:hover { color: var(--c-text); }

/* ============================================================
   SHOPPING LIST - Previous items (shopping_list_history)
   Collapsible section under the add-item input. Amber header, tidy
   rows, + button on the right to re-add an item in one tap.
   ============================================================ */
.prev-items {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.prev-items__summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-6);
  padding: var(--s-8) var(--s-12);
  cursor: pointer;
  list-style: none;
  color: var(--c-text);
  font-weight: 600;
  font-size: var(--t-sm);
}
.prev-items__summary::-webkit-details-marker { display: none; }
.prev-items__summary::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 2px solid var(--c-text-2);
  border-bottom: 2px solid var(--c-text-2);
  transform: rotate(-45deg);
  transition: transform 180ms var(--ease-out);
  margin-right: 4px;
}
.prev-items[open] .prev-items__summary::after { transform: rotate(45deg); }
.prev-items__count { margin-left: auto; }
.prev-items__body {
  padding: 0 var(--s-12) var(--s-12);
  border-top: 1px solid var(--c-border);
}
.prev-items__filter {
  width: 100%;
  margin: var(--s-8) 0;
  font-size: var(--t-sm);
}
.prev-items__list { display: flex; flex-direction: column; gap: 2px; }
.prev-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-6) var(--s-8);
  border-radius: var(--r-sm);
  transition: background 120ms var(--ease-out);
}
.prev-item:hover { background: var(--c-surface-hi); }
.prev-item__body { display: flex; flex-direction: column; min-width: 0; }
.prev-item__name { color: var(--c-text); font-size: var(--t-sm); font-weight: 500; }
.prev-item__meta { color: var(--c-text-3); font-size: var(--t-xs); margin-top: 2px; }
.prev-item__add {
  flex: none;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--c-accent);
  border: 1px solid var(--c-border);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.prev-item__add:hover {
  background: color-mix(in oklch, var(--c-accent) 18%, transparent);
  border-color: var(--c-accent);
}

/* ============================================================
   CHANGELOG - editorial layout
   Each release is a card with amber version + date header, then
   categorized change lists with meaningful type markers. New =
   amber (brand excitement), Improved = a cooler muted tone,
   Fixed = a quiet green. Cards are freely readable; no side
   stripes, no icons-as-decoration.
   ============================================================ */
.changelog__head { margin-bottom: var(--s-16); }
.changelog__eyebrow {
  display: inline-block;
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-accent);
  margin-bottom: var(--s-6);
}
.changelog__title {
  font-family: var(--f-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.02;
  color: var(--c-text);
  margin: 0 0 var(--s-6);
  letter-spacing: -0.02em;
}
.changelog__deck {
  color: var(--c-text-2);
  font-size: var(--t-base);
  line-height: 1.55;
  max-width: 58ch;
}

.release {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-16);
  margin: 0 0 var(--s-12);
  transition: border-color 180ms var(--ease-out);
}
.release:hover { border-color: var(--c-border-hi); }
.release--latest {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 1px var(--c-accent) inset;
}

.release__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-6);
  margin-bottom: var(--s-6);
}
.release__version-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-6);
  flex-wrap: wrap;
}
.release__version {
  font-family: var(--f-display);
  font-size: var(--t-2xl);
  font-weight: 700;
  color: var(--c-accent);
  margin: 0;
  letter-spacing: -0.01em;
}
.release__date {
  color: var(--c-accent);
  font-size: var(--t-sm);
  font-weight: 500;
  opacity: 0.85;
}
.release__latest-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--c-accent);
  color: var(--c-bg);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: middle;
}
.release__link { color: var(--c-text-3); text-decoration: none; font-size: var(--t-lg); }
.release__link:hover { color: var(--c-accent); }
.release__summary {
  color: var(--c-text);
  font-size: var(--t-base);
  font-weight: 500;
  margin: 0 0 var(--s-12);
  line-height: 1.5;
}

.release__group { margin-bottom: var(--s-10); }
.release__group:last-child { margin-bottom: 0; }
.release__group-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 var(--s-6);
}
.release__group--new      .release__group-title { background: color-mix(in oklch, var(--c-accent) 22%, transparent); color: var(--c-accent); }
.release__group--improved .release__group-title { background: color-mix(in oklch, oklch(0.65 0.09 230) 22%, transparent); color: oklch(0.72 0.1 230); }
.release__group--fixed    .release__group-title { background: color-mix(in oklch, var(--c-success) 20%, transparent); color: var(--c-success); }

.release__items { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s-4); }
.release__item { padding: 4px 0; }
.release__item-title { color: var(--c-text); font-size: var(--t-sm); font-weight: 600; display: block; }
.release__item-desc  { color: var(--c-text-2); font-size: var(--t-sm); line-height: 1.5; margin: 2px 0 0; }

/* Mobile (iPhone SE 375px and up-to-small-phones). Stacks the header
   vertically so the Latest pill never overflows, shrinks the version
   number, and pulls card padding way in so cards read edge-to-edge. */
@media (max-width: 560px) {
  .changelog__head { margin-bottom: var(--s-12); }
  .changelog__title { font-size: clamp(1.8rem, 8vw, 2.2rem); }
  .changelog__deck  { font-size: var(--t-sm); }

  .release {
    padding: var(--s-10);
    margin-bottom: var(--s-10);
    border-radius: var(--r-md);
  }
  .release--latest { box-shadow: none; }

  /* Stack the header: version+date+Latest chip wrap on line 1, the
     permalink (#) drops out of the row and sits inline after. */
  .release__head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-4);
    margin-bottom: var(--s-4);
  }
  .release__version-wrap { gap: 6px; row-gap: 4px; }
  .release__version { font-size: var(--t-xl); }
  .release__date    { font-size: var(--t-xs); }
  .release__latest-chip {
    font-size: 9px;
    padding: 2px 6px;
    letter-spacing: 0.08em;
    max-width: 100%;
  }
  .release__link { display: none; }

  .release__summary {
    font-size: var(--t-sm);
    margin-bottom: var(--s-8);
  }

  /* Type chips shrink slightly and wrap gracefully if someone ever
     adds multiple chips on the same row. */
  .release__group { margin-bottom: var(--s-8); }
  .release__group-title {
    padding: 3px 10px;
    font-size: 10px;
    letter-spacing: 0.06em;
    max-width: 100%;
  }
  .release__item-title,
  .release__item-desc { font-size: var(--t-xs); }
  .release__item-desc { line-height: 1.45; }
}

/* Cook-mode rating sheet - shown after "I made this!" on the complete
   screen. Stars + would-make-again pill row + time + notes. */
.cook-rating-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  display: grid;
  place-items: center;
  padding: var(--s-8);
}
.cook-rating {
  width: min(460px, 100%);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-12);
  max-height: 92vh;
  overflow-y: auto;
}
.cook-rating__title { font-family: var(--f-display); font-size: var(--t-xl); margin: 0 0 var(--s-4); color: var(--c-text); }
.cook-rating__sub   { color: var(--c-text-2); font-size: var(--t-sm); margin: 0 0 var(--s-10); line-height: 1.5; }
.cook-rating__label {
  display: block;
  font-size: var(--t-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-3);
  margin: var(--s-8) 0 var(--s-4);
}
.cook-rating__stars { display: flex; gap: var(--s-4); }
.cook-rating__star {
  background: transparent;
  border: 0;
  color: var(--c-border);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--r-sm);
  line-height: 0;
}
.cook-rating__star:hover { color: color-mix(in oklch, var(--c-accent) 60%, var(--c-border)); }
.cook-rating__star--on { color: var(--c-accent); }

.cook-rating__wma { display: flex; gap: var(--s-4); }
.cook-rating__wma-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--r-full);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  color: var(--c-text-2);
  font-size: var(--t-sm);
  font-weight: 600;
  cursor: pointer;
}
.cook-rating__wma-btn:hover { color: var(--c-text); }
.cook-rating__wma-btn--on {
  background: var(--c-accent);
  color: var(--c-bg);
  border-color: var(--c-accent);
}

.cook-rating__actions {
  display: flex;
  gap: var(--s-4);
  margin-top: var(--s-10);
  justify-content: flex-end;
}

/* Cook history section on recipe detail */
.cook-history { margin-top: var(--s-12); }
.cook-history__head {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--c-text);
}
.cook-history__times {
  padding: 2px 10px;
  border-radius: var(--r-full);
  background: var(--c-accent);
  color: var(--c-bg);
  font-size: var(--t-xs);
  font-weight: 700;
}
.cook-history__stars { display: inline-flex; gap: 2px; color: var(--c-accent); margin-left: var(--s-4); }
.cook-history__entry { padding: var(--s-6) 0; border-bottom: 1px solid var(--c-border); }
.cook-history__entry:last-child { border-bottom: 0; }
.cook-history__date  { color: var(--c-text-3); font-size: var(--t-xs); }
.cook-history__notes { color: var(--c-text-2); font-size: var(--t-sm); margin-top: 4px; font-style: italic; }

/* Pantry expiry badges + Use Soon section */
.pan-use-soon {
  margin-bottom: var(--s-12);
  padding: var(--s-6);
  background: color-mix(in oklch, var(--c-accent) 8%, var(--c-surface));
  border: 1px solid color-mix(in oklch, var(--c-accent) 35%, var(--c-border));
  border-radius: var(--r-md);
}
.pan-use-soon .pan-sec__title { color: var(--c-accent); display: inline-flex; align-items: center; gap: 6px; }
.pan-use-soon .pan-sec__cta {
  margin-left: auto;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--c-accent);
  text-decoration: none;
}
.pan-use-soon .pan-sec__cta:hover { text-decoration: underline; }

.pan-item__pill--expiring { background: color-mix(in oklch, var(--c-accent) 20%, var(--c-surface)); color: var(--c-accent); }
.pan-item__pill--expired  { background: color-mix(in oklch, var(--c-error) 20%, var(--c-surface));  color: var(--c-error); }
.pan-item__pill--soon     { background: var(--c-surface-hi); color: var(--c-text-2); }

.pantry__add-expiry { width: 150px; }

/* Active state for the microphone button while Web Speech Recognition
   is listening. Amber background pulses so the user knows it's live. */
.voice-btn--active {
  background: var(--c-accent) !important;
  color: var(--c-bg) !important;
  animation: voicePulse 1.2s ease-in-out infinite;
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--c-accent) 60%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in oklch, var(--c-accent) 0%, transparent); }
}

/* Seasonal "Perfect for [Season]" badge on trending cards */
.trend-seasonal__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--c-accent);
  color: var(--c-bg);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.trend-seasonal .trend-recent__thumb { position: relative; }

/* Price estimate badges on shopping list items + top-of-list total */
.shopping-item__price {
  display: inline-block;
  margin-left: 8px;
  color: var(--c-text-3);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-xs);
  font-weight: 600;
}
.shopping-total {
  margin-bottom: var(--s-8);
  padding: var(--s-6) var(--s-8);
  background: color-mix(in oklch, var(--c-accent) 8%, var(--c-surface));
  border: 1px solid color-mix(in oklch, var(--c-accent) 35%, var(--c-border));
  border-radius: var(--r-md);
}
.shopping-total__num {
  font-size: var(--t-sm);
  color: var(--c-text-2);
}
.shopping-total__num strong {
  color: var(--c-accent);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-base);
  margin-left: 6px;
}
.shopping-total__note {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  margin-top: 2px;
}

/* Theme toggle button in the nav. Sun shown in dark mode (prompts
   a click = switch to light), moon in light mode, small "auto" chip
   when preference is "system". Amber accent regardless of mode. */
.theme-toggle {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
}
.theme-toggle__sun,
.theme-toggle__moon {
  grid-area: 1 / 1;
  transition: opacity 180ms ease-out, transform 220ms ease-out;
}
/* Effective dark -> show sun (click = switch to light). */
.theme-toggle[data-effective='dark']  .theme-toggle__moon { opacity: 0; transform: rotate(90deg); }
.theme-toggle[data-effective='dark']  .theme-toggle__sun  { opacity: 1; transform: rotate(0deg); }
/* Effective light -> show moon. */
.theme-toggle[data-effective='light'] .theme-toggle__sun  { opacity: 0; transform: rotate(-90deg); }
.theme-toggle[data-effective='light'] .theme-toggle__moon { opacity: 1; transform: rotate(0deg); }

/* ============================================================
   TIPPY - 'forkato' theme
   Keyed off CSS vars so it automatically tracks light + dark.
   ============================================================ */
.tippy-box[data-theme~='forkato'] {
  background-color: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 2px 4px;
}
.tippy-box[data-theme~='forkato'][data-placement^='top']    > .tippy-arrow::before { border-top-color:    var(--c-surface); }
.tippy-box[data-theme~='forkato'][data-placement^='bottom'] > .tippy-arrow::before { border-bottom-color: var(--c-surface); }
.tippy-box[data-theme~='forkato'][data-placement^='left']   > .tippy-arrow::before { border-left-color:   var(--c-surface); }
.tippy-box[data-theme~='forkato'][data-placement^='right']  > .tippy-arrow::before { border-right-color:  var(--c-surface); }
