/*
 * MealGrid — Unified App Stylesheet
 * Version: 3.7.774
 * Single stylesheet for all app pages (replaces mealgrid.css + members.css)
 * Cache-busted via ?v= query param
 * Digitalis Creative — digitaliscreative.com
 *
 * Brand: Deep Terracotta + Forest Green + Cobalt Blue
 * Typography: Plus Jakarta Sans (display) + DM Sans (body)
 * Layout: Mobile-first, bottom nav on mobile, top nav on desktop
 */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Shadows+Into+Light+Two&display=swap');

/* ── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  /* Primary — User's chosen primary colour (via Preferences → Colours)
     Legacy name: historically "Deep Terracotta" — now user-configurable.
     --terra holds whatever the user picks; the name is kept for backward
     compatibility with mealgrid.css and members.css (FileZilla-managed). */
  --terra:              #8aab6a;   /* v3.7.787: default is now the sage brand colour (was terracotta #A1280B). */
  /* v3.7.870 — THE HOVER CONTRACT. Bex: "all the mouse overs have to match each
     other… on the dashboard alone, the Open the Grid mouse over is different
     from the quick launch button mouse overs."

     She was right, and the audit found eight different hover mechanics. The two
     brand ones did not even use the same maths: --terra-hover was the Primary
     with `dd` appended (87% ALPHA, so the page showed through it) while
     --green-hover was the Secondary mixed 88% with WHITE (opaque, lighter). So
     Primary buttons faded and Secondary buttons lightened — two design systems
     sitting side by side on the dashboard.

     One rule now, Bex's choice of the three offered:

         FILL STAYS, SURFACE SHIFTS ONE STEP, TEXT NEVER CHANGES.

     Both tokens shift their own colour by a fixed 12%, AWAY FROM THEIR OWN
     TEXT — see Functions::hoverShiftTarget(), which --off-primary carries. A
     straight darken was tried first and shipped briefly inside this build: it
     drove the sage Primary to 4.40:1 on hover, under the 4.5:1 floor, because a
     light fill carrying dark text was moving toward its own text. Measured with
     a hover probe, not reasoned about — the contrast rig does not hover.

     Shifting away instead means contrast can only ever improve on hover, for any
     colour, and the label never flips. Opaque, identical maths for Primary and
     Secondary. The alpha override in app_header.php was REMOVED in this build —
     while it was there, this definition could never apply on a signed-in page.

     Note this is a FILL token. Text that hovers uses --link-hover-ink below;
     a colour chosen to sit under text is not the same as one chosen to sit
     behind it, and conflating the two is what put #fff on four hovers. */
  --terra-hover:        color-mix(in srgb, var(--terra) 88%, var(--off-primary));
  /* v3.7.827 (backlog B7): the dark and the tint are made from the Primary colour, so badges, ghost buttons and
     the "current" marks follow the member's colour. They were fixed terracotta shades and stayed reddish whatever
     the theme. The strengths keep dark-on-tint text readable (5:1 or better) for any Primary, pale yellow included. */
  --terra-dark:         color-mix(in srgb, var(--terra) 50%, #000);
  --terra-tint:         color-mix(in srgb, var(--terra) 22%, #fff);
  --terra-rgb:          138,171,106;
  /* v3.7.860: the brand colour as INK rather than as a FILL.
     --terra is the member's actual colour and is correct for backgrounds, where
     the text on top auto-contrasts. But 125 places use it as  — titles,
     links, step numbers, tier names — and a pale Primary makes all of them
     invisible on a white card. These are darkened only as far as readable text
     needs; a brand colour that already passes comes through untouched.
     app_header.php overwrites both from the member's own colours. */
  --terra-ink:          var(--terra);
  --green-ink:          var(--green);                                  /* the default Primary as numbers; signed-in pages set it from the member's */
  /* v3.7.870: the TEXT counterpart of the hover contract. --terra-ink is already
     darkened as far as readable text on a card needs; this takes it one step
     further so a hovered link moves in the same direction as a hovered button
     (darker), instead of fading the way the old alpha token did. */
  --link-hover-ink:     color-mix(in srgb, var(--terra-ink) 85%, #000);

  /* Secondary — User's chosen secondary colour (via Preferences → Colours)
     Legacy name: "Forest Green" — now user-configurable via --green. */
  --green:              #2D7A3D;
  /* v3.7.858: derived from the Secondary colour, the same way the --terra family
     was fixed in v3.7.827. These were fixed forest-green hexes, so a member who
     chose a purple Secondary still got green hovers, tints and dark shades —
     --green followed their choice and its whole family did not. */
  /* v3.7.870: was mixed toward #fff — LIGHTER — while --terra-hover faded by
     alpha. Same 12% darken as the Primary now, so the two behave identically.
     See the hover contract above. */
  --green-hover:        color-mix(in srgb, var(--green) 88%, var(--off-secondary));
  --green-dark:         color-mix(in srgb, var(--green) 50%, #000);
  --green-tint:         color-mix(in srgb, var(--green) 22%, #fff);

  /* Accent 2 — Cobalt Blue */
  --cobalt:             #2563A8;
  --cobalt-hover:       #3478C5;
  --cobalt-dark:        #164278;
  --cobalt-tint:        #B0CAEA;

  /* Amber — accents on dark surfaces only */
  --amber:              #f9b54b;
  --amber-deep:         #f5a623;

  /* Neutrals */
  /* v3.7.858: this is the PAGE BACKGROUND, not a cream paint pot.
     app_header.php overwrites it with the member's "Page Background" colour
     (Preferences › Colours), so a card written as `background: var(--page-bg)`
     is painted the same colour as the page behind it — i.e. invisible, and a
     different colour for every member. That is how the app ended up full of
     "cream" cards. Card surfaces belong on --surface-card / --surface-card-solid.
     --cream is kept as an alias: mealgrid.css and members.css are
     FileZilla-managed, are in no package, and still reference it. */
  --page-bg:            #FDF6EE;
  --cream:              var(--page-bg);   /* legacy alias — do not use in new rules */
  /* v3.7.860: these are RECESSED SURFACES — progress tracks, hover states, chips,
     placeholder tiles. They were fixed beige (#F0E6D8 / #E8D8C8) and so ignored the
     member's theme entirely: on a pale green theme every chip and track still came
     out biscuit-coloured, which is the "cream" Bex kept finding after the 858 purge.
     Derived from the page background with a hint of the Primary, so a recessed
     surface stays recessed and still belongs to the member's palette.

     v3.7.880: the base is the CARD, not the page. These surfaces sit ON cards —
     a progress track, a chip, a pull-down inside a panel — so the thing they
     must stay close to is the card under them, and the border does the rest.
     Mixed over --page-bg they were 93% of the page, which is invisible on a
     pale theme (fine) and a solid slab of the member's colour on a saturated
     one (not fine): Bex's electric yellow turned every pull-down, search box
     and tag into a yellow block. 7% of anything cannot separate a surface from
     a 100%-chroma field.

     --surface-floor is the card: --surface-card is rgba(255,255,255,.75), so a
     card over the page reads as 25% page + 75% white. Computing the floor the
     same way keeps the member's hue — the 860 complaint was biscuit-coloured
     chips on a green theme, and that stays fixed — while guaranteeing the step
     away from the page at ANY saturation. Same pale-floor pattern 876 used for
     --card-header-floor.

     The dark-page branch in app_header.php overrides both of these onto
     #ffffff and must keep doing so: on a dark page the card is .94 white, so
     white IS the card there, and a floor mixed from a dark page would be grey. */
  --surface-floor:      color-mix(in srgb, var(--page-bg) 25%, #ffffff);
  --surface:            color-mix(in srgb, var(--terra) 7%,  var(--surface-floor));
  --surface-2:          color-mix(in srgb, var(--terra) 15%, var(--surface-floor));
  --dark:               #3D2314;
  --body-color:         #6B4C3B;
  --muted:              #725648;
  /* Hairlines sit mostly ON cards (which are white-ish since the 858 purge), so
     this mixes into the card rather than the page — a fixed beige rule on a pale
     green theme reads as a stray line from another design. */
  --rule:               color-mix(in srgb, var(--terra) 20%, #ffffff);

  /* Semantic */
  --danger:             #dc2626;
  /* Text on a --danger fill. White measures 4.83:1 against #dc2626, which
     clears the 4.5:1 body floor; the #ef4444 the shopping list used to
     hard-code only managed 3.76:1. These are app constants, not member
     colours, so the pair is fixed rather than auto-contrasted. */
  --on-danger:          #ffffff;
  --on-dark-text:       #ffffff;   /* fallback; app_header.php auto-contrasts it per member */
  /* Danger as INK on the pale danger tint (#fee2e2): --danger itself only
     reaches 3.95:1 there, this reaches 5.30:1. Same distinction as
     --terra / --terra-ink — one variable cannot be both a fill and an ink. */
  --danger-ink:         #b91c1c;
  /* The same fill-vs-ink split for the other two semantic colours. On their own
     12% tints --success reaches only 2.87:1 and --warning 2.79:1; these reach
     6.20:1 and 6.21:1. Used by the pantry's stock and staple pills. */
  --success-ink:        #166534;
  --warning-ink:        #92400e;
  --success:            #16a34a;
  --warning:            #d97706;
  --info:               #2563eb;

  /* Typography */
  --font-display:       'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body:          'DM Sans', system-ui, sans-serif;
  --font-hand:          'Shadows Into Light Two', cursive;

  /* Nav */
  --nav-h:              60px;          /* top nav height (desktop) */
  --mobile-nav-h:       48px;          /* v3.7.910: the fixed mobile top bar. The sticky
                                          sub-nav starts here, so the two cannot drift. */
  /* Where a sticky thing BELOW the top nav parks. The same as the nav's height while the nav is
     itself sticky, which it is on a member page. On a signed-out page .pub-nav is static and
     scrolls away, so public_header.php sets this to 0 - WITHOUT touching --nav-h, which is still
     the bar's own height and is what .pub-nav-inner sizes itself from. v3.7.865: in 864 the two
     were the same token, so zeroing the offset also collapsed the public nav bar to nothing. */
  --nav-sticky-top:     var(--nav-h);
  --bottom-nav-h:       68px;          /* bottom nav height (mobile) */
  --nav-bg:             var(--terra);
  --nav-text:           #ffffff;
  --nav-active:         #fdd79c;
  --nav-hover:          rgba(255,255,255,0.15);

  /* Shadows */
  --shadow-sm:          0 2px 8px rgba(61,35,20,0.06);
  --shadow-md:          0 6px 32px rgba(61,35,20,0.08);
  --shadow-lg:          0 12px 48px rgba(61,35,20,0.12);
  --shadow-accent:      0 4px 14px rgba(161,40,11,0.20);

  /* Radii */
  /* v3.7.858: --radius was referenced in three places (.tier-card and friends)
     but never defined, so `border-radius: var(--radius)` was invalid and those
     corners rendered square. Defined here as the medium step, which is what the
     surrounding cards use. Found by the computed-style diff during the inline-CSS
     lift, not by eye -- square corners on one card is exactly the kind of thing
     that reads as "slightly off" without anyone being able to say why. */
  --radius:             12px;
  --radius-sm:          8px;
  --radius-md:          12px;
  --radius-lg:          20px;
  --radius-xl:          28px;

  /* Transitions */
  --ease:               all 0.2s ease;
  --ease-bounce:        all 0.2s cubic-bezier(0.34,1.56,0.64,1);
  --ease-smooth:        all 0.3s cubic-bezier(0.4,0,0.2,1);

  /* Layout */
  --content-max:        1200px;
  --sidebar-w:          300px;

  /* ── Typography Scale (overridable from Kitchen theme-defaults) ── */
  --fs-page-title:      1.45rem;
  --fs-section:         1.1rem;
  --fs-section-h2:      1.3rem;
  --fs-subtitle:        .95rem;
  --fs-body:            .875rem;
  --fs-small:           .8rem;
  --fs-meta:            .75rem;
  --fs-badge:           .65rem;
  --fs-eyebrow:         .7rem;
  --fs-stat:            2rem;
  /* v3.7.866: the Home dashboard bar's own pair, so it sizes without moving every
     other stat and eyebrow in the app. Kitchen > Theme overrides both. */
  --fs-dashboard-stat:     3.125rem;
  --fs-dashboard-statinfo: .9375rem;

  /* ── Typography role defaults (v3.7.785) ──
     Kitchen → Default Theme overrides these via app_header.php. These defaults
     keep every role readable on pages that load app.css on its own
     (sign-in pages, error pages) and if the header ever fails. */
  --tx-page-title-font: var(--font-display); --tx-page-title-weight: 800; --tx-page-title-style: normal; --tx-page-title-transform: none; --tx-page-title-spacing: normal; --tx-page-title-color: var(--title-color);
  --tx-section-font: var(--font-display); --tx-section-weight: 700; --tx-section-style: normal; --tx-section-transform: none; --tx-section-spacing: normal; --tx-section-color: var(--title-color);
  --tx-section-h2-font: var(--font-display); --tx-section-h2-weight: 800; --tx-section-h2-style: normal; --tx-section-h2-transform: none; --tx-section-h2-spacing: normal; --tx-section-h2-color: var(--dark);
  --tx-subtitle-font: var(--font-display); --tx-subtitle-weight: 600; --tx-subtitle-style: normal; --tx-subtitle-transform: none; --tx-subtitle-spacing: normal; --tx-subtitle-color: var(--subtitle-color);
  --tx-body-font: var(--font-body); --tx-body-weight: 400; --tx-body-style: normal; --tx-body-transform: none; --tx-body-spacing: normal; --tx-body-color: var(--body-color);
  --tx-small-font: var(--font-body); --tx-small-weight: 400; --tx-small-style: normal; --tx-small-transform: none; --tx-small-spacing: normal; --tx-small-color: var(--body-color);
  --tx-meta-font: var(--font-body); --tx-meta-weight: 400; --tx-meta-style: normal; --tx-meta-transform: none; --tx-meta-spacing: normal; --tx-meta-color: var(--muted);
  --tx-badge-font: var(--font-display); --tx-badge-weight: 700; --tx-badge-style: normal; --tx-badge-transform: uppercase; --tx-badge-spacing: .06em;
  --tx-eyebrow-font: var(--font-display); --tx-eyebrow-weight: 700; --tx-eyebrow-style: normal; --tx-eyebrow-transform: uppercase; --tx-eyebrow-spacing: .08em; --tx-eyebrow-color: var(--muted);
  --tx-stat-font: var(--font-display); --tx-stat-weight: 800; --tx-stat-style: normal; --tx-stat-transform: none; --tx-stat-spacing: normal; --tx-stat-color: var(--terra-ink);
  --stat-c1: var(--terra); --stat-c2: var(--terra); --stat-c3: var(--terra); --stat-c4: var(--terra); --stat-c5: var(--terra);

  /* ── Surface System — transparent card backgrounds ── */
  --surface-card:       rgba(255, 255, 255, 0.75);   /* v3.7.859: Bex — 0.88 was still too solid */
  --surface-card-solid: #ffffff;
  --surface-card-hover: rgba(255, 255, 255, 0.86);
  --surface-overlay:    rgba(255, 255, 255, 0.65);
  --surface-header:     var(--terra);
  /* v3.7.859: text that sits ON --surface-header (which is the member's Primary).
     This was a hard-coded #ffffff that nothing ever overrode, so a member with a
     pale Primary got white text on a pale bar — "This Week", the Planner and
     Shopping List buttons, the Grid and Day accents, eleven rules in all. The
     v3.7.858 auto-contrast pass missed them because they say
     `var(--surface-header-text, #fff)` rather than a literal `#fff`.
     It is the same value as --on-primary by definition, so it now IS that. */
  --surface-header-text: var(--on-primary);

  /* v3.7.867 — the card header's own treatment, separate from --surface-header.
     Bex: "I like using the user defined colour for the background but i feel
     like it all might be too much." It was: a solid slab of the member's
     Primary on top of every card, the single largest block of colour on the
     page. These four tokens are treatment A — the colour at 12% as the bar,
     the colour solid in a small marker, dark text.

     Why NOT reuse --surface-header / --surface-header-text: those two still
     mean "the member's Primary, solid, with auto-contrast text on it", and
     nine other things still need exactly that — .hm-day-flag, .nw-new,
     .hdr-news-pill, .fn-btn-solid, .fn-face-brand, --gb-on-accent and
     --dy-on-accent. Repurposing them would have repainted all of those too.

     The tint composes over --surface-card-solid, which is #ffffff and is never
     re-themed, so the bar is the same near-white on a dark page as a light one
     — which is the point: the text never has to be re-measured for contrast,
     because it is always dark on near-white. --dark and --terra-ink are both
     re-measured against the card on a dark page (includes/app_header.php),
     so they are safe here. */
  /* v3.7.876: the 12% used to be mixed straight over the white card, which works
     for most palettes and vanishes for a few: a near-white primary at 12% over
     white is still white. Measured step from the card -- 1.00 means no bar at
     all -- pale yellow 1.012, pale pink 1.020, near-white grey 1.017.

     The first idea was to mix over --surface instead. It does not work:
     --surface is itself color-mix(terra 7%, white), so it is MORE of the same
     pale colour. Near-white grey went 1.017 -> 1.017. Exactly nothing.

     What works is a neutral floor. A trace of the body-text brown under the
     tint means the bar can never sit closer to the card than the floor allows,
     whatever the hue: pale yellow 1.082, pale pink 1.093, near-white grey 1.081.
     The palettes that already worked barely move (sage 1.104 -> 1.184) and keep
     their hue. Text contrast is untouched at 11:1 to 14:1 throughout, so 859's
     "they are hard to read" does not come back.

     Bex, shown both: "do whichever way will make it work... visually there isn't
     much difference" - which is the argument for it. */
  --card-header-floor:  color-mix(in srgb, var(--dark) 4%, var(--surface-card-solid));
  --card-header-bg:     color-mix(in srgb, var(--terra) 12%, var(--card-header-floor));
  /* v3.7.877: the sidebar header bar, built to the SAME recipe as the card
     header above it but in the member's secondary colour. Sidebars and cards
     were speaking two visual languages - a solid secondary slab with white text
     beside a 12% primary tint with dark text - which is why Freezer, Prep &
     Freeze, Autofill and meal-view all came back circled at once.
     Same 12%, same neutral floor, same dark text; only the hue differs, and the
     hue is what tells a sidebar from a card. It inherits the pale-theme floor
     for free, so a near-white secondary cannot make this bar vanish either. */
  --side-header-bg:     color-mix(in srgb, var(--green) 12%, var(--card-header-floor));
  --side-header-text:   var(--dark);
  --card-header-text:   var(--dark);
  --card-header-marker: var(--terra);
  /* v3.7.875: the border weight for white-background buttons (.btn-secondary
     and anything sharing that style). Matches .form-control's 1.5px so a white
     button and the input beside it are drawn with the same line. */
  /* v3.7.877: was 1.5px in 875, matching .form-control. Bex marked "Shop this
     week" as still not done - and she was right in the way that matters: the
     button IS .btn-secondary, so the change did apply, it was just too small to
     see. Half a pixel is below the threshold of noticing. 2px is a border you
     can actually point at, which is what "a little thicker" meant. */
  --btn-border-w:       2px;
  /* v3.7.881: button #1's padding. "Open the Grid" sits tighter than .btn
     (9px 18px), which is the difference Bex spotted on "Back to the Grid" —
     "currently the padding is not the same". A token so the pattern and its
     reference cannot drift apart again. */
  --btn1-pad:           7px 16px;
  /* v3.7.882: button #1's LINE-HEIGHT, which is the other half of its height.
     881 gave .mg-btn-1 the padding and stopped there, so "Back to the Grid"
     still came out 30.8px against button #1's 36.4px — .btn sets line-height
     1.2 while .hm-week-link-head inherits the body's 1.6, and at --fs-body
     (14px) that is a 5.6px difference with identical padding. Bex read it as
     padding, reasonably. A pattern has to carry its whole geometry. */
  --btn1-line:          1.6;
  /* v3.7.875: the ring on a tickable circle. --rule (a 20% tint) was too faint
     to see on a pale theme; 45% of the same colour reads clearly on white and
     still follows the member's palette. */
  --check-ring:         color-mix(in srgb, var(--terra) 45%, transparent);

  /* v3.7.870: the Grid's weekday label row (SUN MON TUE…). Deliberately ONE
     STEP WEAKER than the card header above it — 8% against the header's 12% —
     so the month bar stays the loudest thing on the page and the labels read as
     a quieter band under it rather than a second header of equal weight. */
  /* v3.7.871: 8% was still too faint to register — Bex: "the weekday bar's bg
     colour still needs to stand out a little bit". At 14% it is a hair stronger
     than the 12% month bar above it, which is fine: that bar carries large bold
     type and does not need colour to out-rank a row of small caps. */
  /* v3.7.877: Bex - "the bar with the days of the week... i dont want the
     'header' of the card and the bar with the days of the week the same".
     They were 14% and 12% of the same colour. Two percent apart is the same
     colour as far as an eye is concerned, which is exactly what she was
     reporting. The weekday bar is the stronger of the two now, so the card
     header reads as the lighter band above it and these two stop competing. */
  --gb-week-bg:         color-mix(in srgb, var(--terra) 24%, var(--surface-card-solid));
  /* And a heavier rule under it than the 1px --rule hairline, so the band has a
     defined bottom edge against the first row of cells. Bex picked this pairing
     from four mockups: "I like D!" */
  --gb-week-rule:       color-mix(in srgb, var(--terra) 38%, var(--surface-card-solid));

  /* v3.7.868 — the same treatment for the SIDEBARS, in the member's Secondary.
     Bex: "the filter is a sidebar, so it should be secondary tint colour".
     The rule the app follows from here: a bar in the MAIN column takes the
     Primary tint; a bar inside an <aside> takes the Secondary tint. Two tints
     are what keep "the grid" and "the tray beside it" legible as different
     regions once neither of them is a solid slab any more — with one tint the
     page becomes an undifferentiated pale wash.
     Composed over --surface-card-solid for exactly the reason the Primary pair
     is: it is #ffffff and is never re-themed, so the bar is the same near-white
     on a dark theme as on a light one, and --side-head-text never needs
     re-measuring whatever Secondary the member picks. */
  --side-head-bg:       color-mix(in srgb, var(--green) 12%, var(--surface-card-solid));
  --side-head-text:     var(--dark);
  --side-head-marker:   var(--green);

  /* ── Content area (overridable from user theme) ── */
  /* --page-bg is defined up in Neutrals; redefining it here from --cream
     would be circular now that --cream aliases it. */
  --body-text:          var(--body-color);
  --heading-text:       var(--dark);
  --title-color:        var(--terra-ink);
  --subtitle-color:     #d4760a;

  /* Chip colours (overridable per-install from settings) */
  --chip-meal:          var(--terra);
  --chip-takeout:       var(--cobalt);
  --chip-new:           var(--green);
  --chip-leftovers:     var(--green);
  --chip-out:           var(--cobalt);
  --chip-unplanned:     var(--muted);
  --chip-baking:        #b45309;
  /* The freezer's own colour, from the member's Grid colour key. The Freezer tab
     is deliberately cold-coloured so it agrees with the Freezer chip on the Grid;
     v3.7.860 stopped that being a hard-coded cobalt and made it theirs. */
  --chip-freezer:       #2563eb;
  --freezer-ink:        color-mix(in srgb, var(--chip-freezer) 62%, #000);
  --freezer-tint:       color-mix(in srgb, var(--chip-freezer) 14%, var(--surface-card-solid));

  /* Backward compat aliases — keeps existing PHP working */
  --mg-accent:          var(--terra);
  --mg-accent-hover:    var(--terra-hover);
  --mg-accent-rgb:      var(--terra-rgb);
  --mg-font-display:    var(--font-display);
  --mg-font-body:       var(--font-body);
  --mg-text-primary:    var(--dark);
  --mg-text-secondary:  var(--body-color);
  --mg-text-muted:      var(--muted);
  --mg-border:          var(--rule);
  --mg-surface:         var(--surface);
  --mg-surface-2:       var(--surface-2);
  --mg-bg-start:        var(--page-bg);
  --mg-chip-meal:       var(--chip-meal);
  --mg-chip-takeout:    var(--chip-takeout);
  --mg-chip-new:        var(--chip-new);
  --mg-chip-leftovers:  var(--chip-leftovers);
  --mg-chip-out:        var(--chip-out);
  --mg-chip-unplanned:  var(--chip-unplanned);
  --mg-chip-baking:     var(--chip-baking);
  --mg-radius-sm:       var(--radius-sm);
  --mg-radius-md:       var(--radius-md);
  --mg-radius-lg:       var(--radius-lg);
  --mg-shadow-sm:       var(--shadow-sm);
  --mg-shadow-md:       var(--shadow-md);
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--body-color);
  background: var(--page-bg);
  min-height: 100vh;
  line-height: 1.6;
  /* Bottom padding for mobile nav */
  padding-bottom: var(--bottom-nav-h);
}

/* Warm radial texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 0% 0%, rgba(161,40,11,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 100% 100%, rgba(58,140,74,0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }
/* ── v3.7.889. The line above, undone for #app-main only ──────────────────
   `body > *` exists to lift content above the decorative body::before texture
   (z-index: 0, a few lines up). It does that. It also makes EVERY child of body
   a stacking context at z-index 1 — <main> included.

   Everything that slides over the page lives inside <main>: the meal editor, the
   recipe editor, Import from URL, the community modals. Their z-index of 1100 is
   therefore measured INSIDE main, and against the rest of the page the whole lot
   sits at 1. The nav (.app-topnav, z-index 200) and the footer bar
   (.pub-footer-bar, z-index 1000) are siblings of main at body level, so they
   paint over the top 61px and the bottom 68px of any panel.

   That is what ate the Import panel's title bar and its Cancel / Fetch buttons in
   887 and again in 888 — twice misdiagnosed as the panel's own markup, which was
   correct both times. Measured with a real browser on 24 Oct: header at y=0 h=61,
   visible, opacity 1, and elementFromPoint at its centre returning
   DIV.app-topnav-inner.

   z-index: auto removes the stacking context. main stays position: relative, and
   it still paints above body::before — both sit in the same paint layer and main
   comes later in document order. Scoped to #app-main rather than deleting the
   blanket rule, because other children of body may be relying on the position. */
body > #app-main { z-index: auto; }

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--title-color);
  line-height: 1.25;
}
h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); }
h3 { font-size: var(--fs-section); }
h4 { font-size: var(--fs-body); }

p { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--terra-ink); text-decoration: none; transition: var(--ease); }
/* v3.7.870: was var(--terra-hover), which is a FILL token — and while that token
   carried 87% alpha, a hovered link was a FADED version of the member's Primary,
   i.e. less readable than the link at rest. Exactly backwards. It now darkens
   the ink, which is the value already proven readable as text on a card. */
a:hover { color: var(--link-hover-ink); }

small, .text-sm  { font-size: var(--fs-body); }
.text-xs         { font-size: var(--fs-meta); }
.text-muted      { color: var(--muted); }
.text-dark       { color: var(--dark); }
.text-accent     { color: var(--terra-ink); }
.text-green      { color: var(--green-ink); }
.text-cobalt     { color: var(--cobalt); }
.text-center     { text-align: center; }
.text-right      { text-align: right; }
.font-display    { font-family: var(--font-display); }
.font-hand       { font-family: var(--font-hand); }
.fw-600          { font-weight: 600; }
.fw-700          { font-weight: 700; }

/* ── Layout Utilities ─────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 16px;
}
.page-content {
  padding: 50px 16px 35px;
  max-width: var(--content-max);
  margin: 0 auto;
}
.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm       { gap: 8px; }
.gap-md       { gap: 16px; }
.gap-lg       { gap: 24px; }
.flex-1       { flex: 1; }
.w-100        { width: 100%; }
.mt-1         { margin-top: .5rem; }
.mt-2         { margin-top: 1rem; }
.mt-3         { margin-top: 1.5rem; }
.mb-1         { margin-bottom: .5rem; }
.mb-2         { margin-bottom: 1rem; }
.mb-3         { margin-bottom: 1.5rem; }
.p-1          { padding: .5rem; }
.p-2          { padding: 1rem; }
.p-3          { padding: 1.5rem; }
.hidden       { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   TOP NAV — desktop only (hidden on mobile)
   ═══════════════════════════════════════════════════════════════════════════ */
.app-topnav {
  /* Sizes of the bar's pieces. The two tighter layouts for narrower screens (below) change only these. */
  --nav-pad: 52px;                 /* space at each end of the bar */
  --nav-col-gap: 12px;             /* between the logo, the links and the buttons */
  --nav-logo-h: 34px;
  --nav-logo-min: 72px;            /* the logo may scale down to this width before anything else gives */
  --nav-link-pad: 8px 16px;
  --nav-link-gap: 7px;             /* between a link's icon and its word */
  --nav-links-gap: 2px;            /* between links */
  display: none; /* hidden on mobile — shown at md breakpoint */
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-h);
  background: var(--nav-bg);
  box-shadow: 0 2px 12px rgba(161,40,11,0.18);
}
/* The !important flags were in a style block in includes/app_header.php until v3.7.815: the Community
   pages also load the older stylesheets, which must not win here. */
.app-topnav-inner {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr !important;
  column-gap: var(--nav-col-gap);
  align-items: center;
  height: 100%;
  padding: 0 var(--nav-pad) !important;
  width: 100% !important;
  box-sizing: border-box;
}
.app-topnav-inner > :last-child {
  justify-self: end !important;
}

/* Logo */
.app-topnav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  justify-self: start !important;
}
/* The logo keeps its shape: when the bar is short of room it gets smaller, never squashed (B19, v3.7.815) */
.app-topnav-logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: var(--nav-logo-h);
}
.app-topnav-logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: -.02em;
}

/* Tab links */
.app-topnav-links {
  display: flex;
  align-items: center;
  gap: var(--nav-links-gap);
  list-style: none;
  justify-self: center !important;
}
.app-topnav-link {
  display: flex;
  align-items: center;
  gap: var(--nav-link-gap);
  padding: var(--nav-link-pad);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.82);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-body);
  text-decoration: none;
  transition: var(--ease);
  white-space: nowrap;
}
/* v3.7.870: was `color: #fff`, which overrode --nav-text — a value
   app_header.php computes from the member's choice AND re-checks for contrast
   against their header colour ("unless it fails contrast on their header").
   A member whose header needs dark nav text got it everywhere except on hover.
   Same bug as the four button hovers; the nav had it too. */
.app-topnav-link:hover {
  color: var(--nav-text);
  background: var(--nav-hover);
}
.app-topnav-link.active {
  color: var(--nav-active);
  background: rgba(255,255,255,0.12);
}
.app-topnav-link i {
  font-size: var(--fs-section);
  opacity: .85;
}
/* My Kitchen premium tab */
.app-topnav-link.premium {
  color: var(--green-tint);
}
.app-topnav-link.premium:hover,
.app-topnav-link.premium.active {
  color: #fff;
  background: rgba(45,122,61,0.35);
}
.app-topnav-link.premium .premium-badge {
  font-size: var(--fs-badge);
  background: var(--green);
  color: var(--on-secondary);
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* The bar always fits its screen (B19, v3.7.815). It used to need about 1130px and was shown from 768px,
   so on a tablet it ran off the right-hand edge and squashed the logo.
   Below 1180px: the same bar, closer together. Below 1024px (a tablet held upright): each link is its
   icon over its word, the way the phone's bottom bar shows them. */
/* v3.7.927: the public bar steps its side padding down on the same breakpoints as the
   member bar, from the same token. Two bars, one set of numbers. */
@media (min-width: 768px) and (max-width: 1179px) { .pub-nav { --nav-pad: 20px; } }
@media (max-width: 767px)                        { .pub-nav { --nav-pad: 16px; } }

@media (min-width: 768px) and (max-width: 1179px) {
  .app-topnav { --nav-pad: 20px; --nav-logo-h: 30px; --nav-link-pad: 8px 9px; --nav-link-gap: 5px; --nav-links-gap: 0px; }
  .app-topnav-inner { grid-template-columns: minmax(var(--nav-logo-min), auto) minmax(min-content, 1fr) auto !important; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .app-topnav { --nav-pad: 16px; --nav-col-gap: 8px; --nav-logo-h: 28px; --nav-link-pad: 6px 8px; --nav-link-gap: 3px; }
  .app-topnav-link { position: relative; flex-direction: column; font-size: var(--fs-meta); line-height: 1.1; }
  .app-topnav-link.premium .premium-badge { position: absolute; top: 0; right: 0; }
}

/* Avatar / account button */
.app-topnav-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.35);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body);
  cursor: pointer;
  transition: var(--ease);
  text-decoration: none;
  margin-left: auto;
}
.app-topnav-avatar:hover {
  background: rgba(255,255,255,0.32);
  border-color: rgba(255,255,255,0.6);
  color: var(--nav-text);   /* v3.7.870: see .app-topnav-link:hover */
}
.app-topnav-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTTOM NAV — mobile only
   ═══════════════════════════════════════════════════════════════════════════ */
.app-bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--bottom-nav-h);
  background: var(--nav-bg);
  box-shadow: 0 -2px 16px rgba(161,40,11,0.16);
  /* Safe area for devices with home bars */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.app-bottomnav-inner {
  display: flex;
  align-items: stretch;
  height: 100%;
}
.app-bottomnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-badge);
  letter-spacing: .02em;
  transition: var(--ease);
  position: relative;
  padding: 6px 4px 0;
}
.app-bottomnav-item i {
  font-size: 1.35rem;
  line-height: 1;
  transition: var(--ease-bounce);
}
.app-bottomnav-item:hover,
.app-bottomnav-item.active {
  color: var(--nav-active);
}
.app-bottomnav-item.active i {
  transform: translateY(-2px);
}
/* Active indicator dot */
.app-bottomnav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: var(--nav-active);
  border-radius: 3px 3px 0 0;
}
/* Premium Kitchen tab in bottom nav */
.app-bottomnav-item.premium {
  color: rgba(184,228,192,0.6);
}
.app-bottomnav-item.premium.active,
.app-bottomnav-item.premium:hover {
  color: var(--green-tint);
}
.app-bottomnav-item.premium.active::after {
  background: var(--green-tint);
}
/* Locked premium tab */
.app-bottomnav-item.premium-locked {
  color: rgba(255,255,255,0.3);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCOUNT DROPDOWN MENU
   ═══════════════════════════════════════════════════════════════════════════ */
.account-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(.97);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 300;
}
.account-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.account-dropdown-header {
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.account-dropdown-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body);
  color: var(--dark);
  line-height: 1.2;
}
.account-dropdown-email {
  font-size: var(--fs-meta);
  color: var(--muted);
  margin-top: 2px;
}
.account-dropdown-list {
  list-style: none;
  padding: 6px 0;
}
.account-dropdown-list a,
.account-dropdown-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: var(--fs-body);
  color: var(--body-color);
  text-decoration: none;
  transition: var(--ease);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
}
.account-dropdown-list a:hover,
.account-dropdown-list button:hover {
  background: var(--surface);
  color: var(--dark);
}
.account-dropdown-list a i,
.account-dropdown-list button i {
  width: 18px;
  color: var(--muted);
  font-size: var(--fs-body);
  flex-shrink: 0;
}
.account-dropdown-divider {
  height: 1px;
  background: var(--rule);
  margin: 4px 0;
}
.account-dropdown-list .danger-item a,
.account-dropdown-list .danger-item button {
  color: var(--danger);
}
.account-dropdown-list .danger-item a i,
.account-dropdown-list .danger-item button i {
  color: var(--danger);
}

/* Mobile full-screen account menu */
.account-mobile-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(61,35,20,0.5);
  backdrop-filter: blur(4px);
}
.account-mobile-sheet.open { display: block; }
.account-mobile-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface-card-solid);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 88vh;
  overflow-y: auto;
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(0.4,0,0.2,1);
}
.account-mobile-sheet.open .account-mobile-panel {
  transform: translateY(0);
}
.account-mobile-panel-handle {
  width: 36px;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  margin: 12px auto 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAGE TOOLBAR (page-level: title + actions)
   ═══════════════════════════════════════════════════════════════════════════ */
.page-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 0;
  max-width: var(--content-max);
  margin: 0 auto;
}
.page-toolbar-title {
  font-family: var(--tx-page-title-font);
  font-weight: var(--tx-page-title-weight);
  font-size: var(--fs-page-title);
  color: var(--tx-page-title-color);
  flex: 1;
  font-style: var(--tx-page-title-style);
  text-transform: var(--tx-page-title-transform);
  letter-spacing: var(--tx-page-title-spacing);
}
.page-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FLASH MESSAGES
   ═══════════════════════════════════════════════════════════════════════════ */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: var(--fs-body);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px;
}
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.flash-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.flash-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-body { padding: 16px; }
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 {
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--subtitle-color);
}

/* Hero card — Tonight's dinner */
/* The recipe / meal / community-recipe hero (v3.7.862).

   It used to print the title ON the photo over a dark gradient, which Bex
   found hard to read — and no gradient can be reliable, because the photo
   underneath is whatever the member uploaded. The title now sits in a solid
   bar BENEATH the picture, which is the shape she pointed at: the dashboard's
   "What's for dinner" card (.hm-tonight). The panel recipe is deliberately
   identical to --hm-tonight-panel so the two cards read as siblings; it is
   repeated here rather than shared because those tokens are scoped to
   .hm-page, and a dashboard token leaking onto every page is a worse trade
   than one duplicated line.

   The markup did not change — .hero-card-overlay is simply no longer needed,
   so it is hidden rather than removed from three files. */
.hero-card {
  /* The card is now sized by its contents — picture plus bar — so this is what
     actually sets its height. The three pages used to carry an inline
     min-height:320px from the old overlay layout; that is gone, because a
     column flex container sized only by min-height gives its items no free
     space to grow into, so the picture stayed at its floor and the card
     stretched past it, showing a strip of --terra underneath. */
  --hero-pic-min: 240px;                                  /* least the photo is tall */
  --hero-panel: color-mix(in srgb, var(--dark) 94%, #000); /* same mix as --hm-tonight-panel */
  --hero-on-panel: #fff;                                   /* safe: the panel is 94% of a text colour, mixed to near-black */
  --hero-on-panel-soft: rgba(255, 255, 255, .82);
  background: var(--terra);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  text-decoration: none;
  box-shadow: var(--shadow-accent);
  transition: var(--ease);
}
.hero-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.hero-card-img {
  position: static;
  display: block;
  width: 100%;
  /* height:0 + flex-grow lets the picture take whatever the card has left
     after the bar, and object-fit crops rather than stretches; min-height is
     the floor for a card that is only as tall as its content. */
  height: 0;
  flex: 1 1 auto;
  min-height: var(--hero-pic-min);
  object-fit: cover;
}
.hero-card-overlay { display: none; }
.hero-card-body {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 18px 20px;
  background: var(--hero-panel);
  color: var(--hero-on-panel);
}
.hero-card-eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: var(--tx-eyebrow-weight);
  letter-spacing: var(--tx-eyebrow-spacing);
  text-transform: var(--tx-eyebrow-transform);
  color: var(--amber);
  margin-bottom: 4px;
  font-family: var(--tx-eyebrow-font);
  font-style: var(--tx-eyebrow-style);
}
.hero-card-title {
  font-family: var(--tx-page-title-font);
  font-weight: var(--tx-page-title-weight);
  font-size: var(--fs-page-title);
  line-height: 1.2;
  color: var(--hero-on-panel);
  margin-bottom: 4px;
  font-style: var(--tx-page-title-style);
  text-transform: var(--tx-page-title-transform);
  letter-spacing: var(--tx-page-title-spacing);
}
.hero-card-sub {
  font-size: var(--fs-body);
  color: var(--hero-on-panel-soft);
  font-family: var(--tx-body-font);
  font-weight: var(--tx-body-weight);
  font-style: var(--tx-body-style);
  text-transform: var(--tx-body-transform);
  letter-spacing: var(--tx-body-spacing);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  /* v3.7.859: one button shape across the app. Bex picked the rounded pill that
     "Open the Grid" already wore. A token, not a number, so it is changed once. */
  border-radius: var(--radius-btn);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-body);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: var(--ease);
  white-space: nowrap;
  line-height: 1.2;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--terra); color: var(--on-primary); }
/* v3.7.870: `color: #fff` on these hovers threw away the auto-contrast pair the
   REST state correctly uses. A member with a pale Primary got readable text at
   rest and invisible text on hover — the exact failure the 858 note in
   app_header.php warns about ("Anything filled with --terra or --green should
   use these rather than hard-coding #fff, which only ever worked for dark brand
   colours"). 858 fixed the rest states and missed the hovers.
   Under the hover contract the text does not change at all: only the fill moves. */
.btn-primary:hover { background: var(--terra-hover); color: var(--on-primary); }
/* v3.7.875: Bex, on "Shop this week" - "can we make the border a little
   thicker? (and fix on any buttons with the white background style)". A token
   rather than a number, so the white-button weight is changed in one place and
   every button wearing that style follows. 1.5px is not invented here: it is
   already the border weight .form-control uses, so the white buttons now match
   the inputs they sit beside. */
.btn-secondary { background: var(--surface-card-solid); color: var(--dark); border: var(--btn-border-w) solid var(--rule); }   /* v3.7.859: was --surface (beige) */
.btn-secondary:hover { background: color-mix(in srgb, var(--terra) 8%, var(--surface-card-solid)); border-color: color-mix(in srgb, var(--terra) 35%, var(--rule)); color: var(--dark); }
/* ── Button #3 (v3.7.886) ─────────────────────────────────────────────────
   Bex: "lets make a new button ('button #3) style it like button #2 white but
   with secondary colour border". Button #2 is a white face with --rule, which
   is the Primary at 20%; --green-tint is the Secondary at 22% and is already in
   the file, so button #3 is the same shape in the other hue and needs no new
   token. The two measure 1.18 and 1.19 against their white face, which is the
   point — they are a matched pair — and is also why neither would survive being
   shrunk to an icon button. */
.btn-tertiary { background: var(--surface-card-solid); color: var(--dark); border: var(--btn-border-w) solid var(--green-tint); }
.btn-tertiary:hover { background: color-mix(in srgb, var(--green) 8%, var(--surface-card-solid)); border-color: color-mix(in srgb, var(--green) 35%, var(--green-tint)); color: var(--dark); }
.btn-ghost     { background: transparent; color: var(--terra-ink); border: 1px solid var(--terra-tint); }
.btn-ghost:hover { background: var(--terra-tint); color: var(--terra-dark); }
.btn-green     { background: var(--green); color: var(--on-secondary); }
.btn-green:hover { background: var(--green-hover); color: var(--on-secondary); }
/* ── Button #1 (v3.7.881) ─────────────────────────────────────────────────
   Bex named "Open the Grid" on the dashboard as button #1: a solid Secondary
   fill with auto-contrasted text, button #1's padding, and a small shadow to
   lift it off the bar it sits on.

   A class rather than a patch per button, because the two places that needed it
   wanted it for DIFFERENT reasons: "Autofill" on the Grid was .btn-primary (the
   wrong fill) and "Back to the Grid" was .btn-green (right fill, .btn padding).
   Carrying .btn-primary's fill over to Secondary app-wide was not an option —
   it would have turned every primary button in MealGrid. */
.mg-btn-1 {
  padding: var(--btn1-pad);
  line-height: var(--btn1-line);
  border: 1px solid transparent;
  background: var(--green);
  color: var(--on-secondary);
  box-shadow: var(--shadow-sm);
}
.mg-btn-1:hover { background: var(--green-hover); color: var(--on-secondary); border-color: transparent; }
.btn-danger    { background: #fee2e2; color: var(--danger); border: 1px solid #fca5a5; }
.btn-danger:hover { background: var(--danger); color: #fff; }
/* v3.7.858: small buttons move to Body (role 4) like every other button. Only
   the text grows — the padding stays tight, so they are still compact, just
   legible. Asked for by Bex: button text at the same size as body text. */
.btn-sm { padding: 6px 12px; font-size: var(--fs-body); }
.btn-lg { padding: 12px 24px; font-size: var(--fs-body); }
.btn-icon { padding: 8px; border-radius: 50%; }
.btn-icon.btn-sm { padding: 6px; }
.btn-block { width: 100%; }

/* FAB — floating action button */
.fab {
  position: fixed;
  bottom: calc(68px + 16px); /* 68px bottom nav + 16px gap */
  right: 16px;
  z-index: 1050;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--terra);
  color: var(--on-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: var(--shadow-accent);
  transition: var(--ease-bounce);
  text-decoration: none;
}
/* The FAB keeps its scale: it is a single floating button, not one of a row, so
   motion here cannot make a toolbar look twitchy. Only its text is corrected. */
.fab:hover { background: var(--terra-hover); transform: scale(1.08); color: var(--on-primary); }
.fab-green { background: var(--green); }
.fab-green:hover { background: var(--green-hover); }

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Form controls follow the theme (v3.7.873) ─────────────────────────────────
   Browsers do not let form controls inherit type. The browser's own stylesheet sets
   `font: 400 13.3333px Arial` on every control, and `monospace` on every <textarea>,
   and unless CSS says otherwise that wins. app.css had no global reset, so each
   component had to remember `font-family: inherit` on its own - eight did, and the
   rest shipped Arial. That was 259 pieces of visible text: the pantry quick-add
   chips, every cookbook card button, the meal-view vote buttons, the Prep & Freeze
   list picker, the footer and tour buttons, and every textarea in Help, Preferences
   and Data.

   A rule that every component has to remember is a rule that half of them will forget.

   Slot assignment follows Kitchen > Default Theme, which is the page that promises
   it: the HEADINGS & DISPLAY slot lists "Buttons", the BODY TEXT slot lists "Forms".
   So <button> takes the display slot - the same pairing `.btn` already uses, which
   is why these orphans now match the app's real buttons instead of inventing a
   third look - and the text-entry controls take the body slot.

   Sizes, weight and tracking come from the body role's variables, so the Default
   Theme sliders reach these controls for the first time. 61 of them had no
   font-size at all and were sitting on the browser's 13.3333px - a number that
   exists in no stylesheet, matches no token, and no theme could ever reach.

   Deliberately NOT here: `line-height: inherit`. It moves 110 controls to fix
   nothing. Buttons get `normal` today; handing them the parent's 1.6 changes
   button heights across the app.

   This is a type selector (specificity 0,0,1), so every component rule in this
   file still outranks it - including Kitchen's intentional monospace for error
   logs, table names, PayPal plan IDs and the deploy token, which is set by inline
   styles and class selectors. Nothing below needs to change to keep its own size. */
button,
input,
select,
textarea,
optgroup {
  font-size: var(--fs-body);
  font-weight: var(--tx-body-weight, 400);
  letter-spacing: var(--tx-body-spacing, normal);
}
input,
select,
textarea,
optgroup {
  font-family: var(--font-body);
}
button {
  font-family: var(--font-display);
}

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--dark);
  margin-bottom: 5px;
  letter-spacing: .02em;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  background: #fff;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--dark);
  transition: var(--ease);
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--terra-ink);
  box-shadow: 0 0 0 3px rgba(161,40,11,0.1);
}
.form-control::placeholder { color: var(--muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
/* ── Pull-downs: one arrow, everywhere (v3.7.824) ──────────────────────────────
   .form-control switches the browser's own arrow off, which left about ten pull-downs looking like
   plain boxes; the rest showed whatever arrow the browser draws. Every single-choice pull-down
   on a page that loads this stylesheet now has the same one: a small triangle in the text's own
   colour, drawn here so it needs no picture and follows the theme.
   The four background lines and the padding are !important because many pull-downs carry an
   inline "background:" or "padding:", which would otherwise wipe the arrow out or sit text under it. */
select {                                             /* on their own, low-priority line so a narrow pull-down can set its own (below) */
  --mg-caret: 5px;                                   /* half the arrow's width */
  --mg-caret-gap: 10px;                              /* clear space on each side of the arrow */
  text-overflow: ellipsis;
}
select:not([multiple]):not([size]) {
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%) !important;
  background-position:
    right calc(var(--mg-caret-gap) + var(--mg-caret)) center,
    right var(--mg-caret-gap) center !important;
  background-size: var(--mg-caret) var(--mg-caret) !important;
  background-repeat: no-repeat !important;
  padding-right: calc((var(--mg-caret-gap) + var(--mg-caret)) * 2) !important;
  cursor: pointer;
}
select:disabled { cursor: default; }
/* A unit beside an amount (the recipe and meal editors, the Pantry): these are narrow, a third of a
   phone's width at most, so the arrow is smaller and sits closer to the edge. The unit keeps the room it had. */
.ing-row select, .meal-di-row select, .pantry-unit-input { --mg-caret: 4px; --mg-caret-gap: 3px; text-overflow: clip; }
@media (max-width: 767px) {
  .ing-row select, .meal-di-row select { padding-left: 5px !important; }
}

/* ── Pick a meal or a recipe: a Meals / Recipes switch and a pull-down (v3.7.824) ──
   Markup: includes/cookbook_pick.php · Script: assets/js/cookbook-pick.js
   Used by Prep & Freeze ("Add a meal or a recipe") and In the Freezer ("Add to the freezer").
   The switch is the Grid's (".gb-views"), given the two tokens it reads there. */
.mg-pick {
  --gb-tap: 44px;
  --gb-card: var(--surface-card-solid, #fff);
  min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.mg-pick [hidden] { display: none !important; }
.mg-pick .mg-pick-kinds { display: inline-flex; flex-shrink: 0; }     /* shown on phones too (the Grid hides its own switch there) */
.mg-pick-field { flex: 1 1 200px; min-width: 0; }
.mg-pick-select { width: 100%; min-height: var(--gb-tap); }
.mg-pick-select:disabled { color: var(--muted); }
.form-hint { font-size: var(--fs-meta); color: var(--muted); margin-top: 4px; }
.form-error { font-size: var(--fs-meta); color: var(--danger); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════════════════
   BOTTOM SHEET (mobile slide-up panel)
   ═══════════════════════════════════════════════════════════════════════════ */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61,35,20,0.5);
  backdrop-filter: blur(3px);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.bottom-sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 410;
  background: var(--surface-card-solid);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(0.4,0,0.2,1);
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  margin: 10px auto 14px;
  flex-shrink: 0;
}
.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  flex-shrink: 0;
}
.bottom-sheet-header h3 {
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--subtitle-color);
}
.bottom-sheet-body {
  overflow-y: auto;
  padding: 0 16px 16px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR (desktop edit mode panels)
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(61,35,20,0.3);
  z-index: 190;
}
.app-sidebar {
  position: fixed;
  top: var(--nav-h);
  right: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--nav-h));
  background: var(--surface-card-solid);
  border-left: 1px solid var(--rule);
  box-shadow: -4px 0 24px rgba(61,35,20,0.08);
  display: flex;
  flex-direction: column;
  z-index: 195;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(0.4,0,0.2,1);
}
.app-sidebar.open { transform: translateX(0); }
.app-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.app-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABS (cookbook, etc.)
   ═══════════════════════════════════════════════════════════════════════════ */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--rule);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-body);
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  text-decoration: none;
  transition: var(--ease);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--dark); }
.tab-btn.active {
  color: var(--terra-ink);
  border-bottom-color: var(--terra-ink);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES & CHIPS
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-terra   { background: var(--terra-tint); color: var(--terra-dark); }
.badge-green   { background: var(--green-tint); color: var(--green-dark); }
.badge-cobalt  { background: var(--cobalt-tint); color: var(--cobalt-dark); }
.badge-muted   { background: var(--surface-2); color: var(--muted); }
.badge-premium { background: var(--green); color: var(--on-secondary); }

/* Calendar meal chips */
.chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PREMIUM GATE
   ═══════════════════════════════════════════════════════════════════════════ */
.premium-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}
.premium-gate-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--green-ink);
  margin-bottom: 4px;
}
.premium-gate h2 {
  font-size: var(--fs-section);
  color: var(--tx-section-color);
  font-family: var(--tx-section-font);
  font-weight: var(--tx-section-weight);
  font-style: var(--tx-section-style);
  text-transform: var(--tx-section-transform);
  letter-spacing: var(--tx-section-spacing);
}
.premium-gate p {
  color: var(--muted);
  font-size: var(--fs-body);
  max-width: 280px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 10px;
}
.empty-state-icon {
  font-size: 2.5rem;
  color: var(--muted);
  opacity: .5;
}
.empty-state h3 { font-size: var(--fs-body); color: var(--title-color); }
.empty-state p  { font-size: var(--fs-body); color: var(--muted); max-width: 260px; }

/* ═══════════════════════════════════════════════════════════════════════════
   LOADER
   ═══════════════════════════════════════════════════════════════════════════ */
.loader {
  width: 24px;
  height: 24px;
  border: 3px solid var(--rule);
  border-top-color: var(--terra-ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* md — tablet and up (768px) */
@media (min-width: 768px) {
  body {
    padding-bottom: 0;
    --bottom-nav-h: 0px;
  }
  .app-topnav    { display: flex; }
  .app-bottomnav { display: none; }
  .page-content  { padding: 50px 24px 35px; }
  .page-toolbar  { padding: 24px 24px 0; }
  .bottom-sheet { display: none; }
  .bottom-sheet-overlay { display: none; }
  .fab { bottom: 80px; right: 24px; z-index: 1050; } /* above 56px footer bar with headroom */
}

/* tablet (640-767px): pub-footer-bar visible, no bottom nav */
@media (min-width: 640px) and (max-width: 767px) {
  .fab { bottom: 80px; z-index: 1050; }
}

/* lg — desktop (1024px+) */
@media (min-width: 1024px) {
  .page-content { padding: 50px 32px 35px; }

  .hero-card { min-height: 240px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY / LEGACY COMPAT
   ═══════════════════════════════════════════════════════════════════════════ */
.text-accent-green { color: var(--green-ink); }
.text-accent-cobalt { color: var(--cobalt); }
img { max-width: 100%; height: auto; }
hr { border: none; border-top: 1px solid var(--rule); margin: 16px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL (shared — used by cookbook import, grid, etc.)
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61,35,20,0.5);
  backdrop-filter: blur(3px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--surface-card-solid);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(.95) translateY(8px);
  transition: transform .2s ease;
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-header h3 {
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--subtitle-color);
  margin: 0;
  flex: 1;
}
.modal-body  { padding: 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--rule);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}


/* Modal — backdrop + box variant (used by recipe, mykitchen, help) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(61,35,20,0.45);
  backdrop-filter: blur(3px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--surface, #fff);
  border-radius: 16px;
  box-shadow: 0 12px 60px rgba(0,0,0,0.2);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideUp .2s ease;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface, #f5f5f5);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--rule); }
.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body);
  color: var(--subtitle-color);
  margin: 0;
}

/* ---- APP FOOTER ---- */

/* Mobile: regular footer sits above bottom nav */
.app-footer-bar {
  background: var(--surface);
  border-top: 1px solid var(--rule);
  margin-bottom: var(--bottom-nav-h);
}
.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 10px 16px;
  flex-wrap: wrap;
  font-size: var(--fs-meta);
  color: var(--muted);
}
.app-footer-copy { color: var(--muted); }
.app-footer-version {
  font-size: var(--fs-meta);
  color: var(--rule);
  font-family: var(--font-display);
}
.app-footer-links {
  display: flex;
  gap: 10px;
  align-items: center;
}
.app-footer-links a {
  font-size: var(--fs-meta);
  color: var(--muted);
  text-decoration: none;
  transition: var(--ease);
}
.app-footer-links a:hover { color: var(--terra-ink); }

/* Desktop/tablet: footer sits naturally at bottom of content */
@media (min-width: 768px) {
  .app-footer-bar {
    margin-bottom: 0;
    margin-top: 32px;
  }
}
}


/* ============================================================
   ACCESSIBILITY FONT SIZE WIDGET
   ============================================================ */
/* a11y widget — tab is fixed exactly like pub-tour-btn, panel pops out from it */
#a11y-widget {
  position: static; /* wrapper is not the positioned element */
}
#a11y-tab {
  /* Positioned exactly like pub-tour-btn but stacked above it */
  position: fixed;
  bottom: calc(24px + 32px + 8px); /* tour btn bottom + height + gap = 64px */
  left: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 28px;
  height: 40px;
  background: var(--terra);
  color: var(--on-primary);
  border: none;
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  padding: 4px;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.18);
  transition: background 0.2s;
}
#a11y-tab:hover { background: var(--terra-hover); }
#a11y-tab-label {
  font-size: .55rem;
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: .04em;
  line-height: 1;
}
#a11y-panel {
  position: fixed;
  left: 28px;
  bottom: calc(24px + 32px + 8px); /* same as tab */
  z-index: 8999;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  box-shadow: 4px 4px 16px rgba(0,0,0,0.12);
  min-width: 140px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  transform: translateX(-8px);
}
#a11y-widget.open #a11y-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}
#a11y-panel-label {
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
  font-family: var(--font-display);
}
.a11y-btn-row {
  display: flex;
  gap: 6px;
}
.a11y-size-btn {
  flex: 1;
  padding: 6px 4px;
  border: 2px solid var(--rule);
  background: var(--surface-card-solid);
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--body-color);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-size: var(--fs-small);
}
.a11y-size-btn:hover { border-color: var(--terra-ink); color: var(--terra-ink); }
.a11y-size-btn.active {
  border-color: var(--terra-ink);
  background: var(--terra);
  color: var(--on-primary);
}
/* Mobile: shift both fixed elements up above bottom nav */
@media (max-width: 767px) {
  #a11y-tab   { bottom: calc(68px + 8px + 32px + 8px); } /* nav + gap + tour + gap */
  #a11y-panel { bottom: calc(68px + 8px + 32px + 8px); }
}

/* Tour button */
.pub-tour-btn {
  position: fixed;
  bottom: 24px;
  left: 0;
  z-index: 8999;
  width: 32px; height: 32px;
  border-radius: 0 50% 50% 0;
  border: 1px solid var(--rule);
  border-left: none;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-body);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 6px rgba(0,0,0,.1);
  transition: opacity .15s, color .15s;
}
.pub-tour-btn:hover { color: var(--terra-ink); }
@media (max-width: 767px) {
  .pub-tour-btn { bottom: calc(68px + 8px); } /* above mobile bottom nav */
  #a11y-widget  { bottom: calc(68px + 8px + 32px + 8px); } /* above tour btn */
}

/* ============================================================
   ACCOUNT / PREFERENCES / SUBSCRIPTION PAGES
   ============================================================ */
.page-section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 50px 16px 35px;
}
/* v3.7.872 — Bex: "account -> profile tab - fix the colours. Add a header bar
   with to hold the user name, email etc... (this carries on over all the tans
   in account)".

   It was a bare block with a hairline under it — the name, avatar and email sat
   straight on the page while every other page had gained a bar. Now the same
   Primary tint as .al-head and the card headers.

   Checked rather than assumed: .page-hero is used on exactly ONE page
   (account.php), so this is page styling in all but name. It already sits above
   the tab panels, which is why it "carries on over all the tabs" for free. */
.page-hero {
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--card-header-bg);
  color: var(--card-header-text);
  margin-bottom: 24px;
}
/* The 4px marker, hung off the HEADING — 867's rule: .page-hero's inner row is
   a flex container, so a ::before on the bar becomes a stray flex item. */
.page-hero h1::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1em;
  margin-right: 10px;
  border-radius: 2px;
  background: var(--card-header-marker);
  vertical-align: -.1em;
}
.page-hero h1 {
  font-size: var(--fs-page-title);
  font-weight: var(--tx-page-title-weight);
  color: var(--tx-page-title-color);
  margin: 0 0 4px;
  font-family: var(--tx-page-title-font);
  font-style: var(--tx-page-title-style);
  text-transform: var(--tx-page-title-transform);
  letter-spacing: var(--tx-page-title-spacing);
}
.page-hero p {
  font-size: var(--fs-body);
  color: var(--muted);
  margin: 0;
}
.tab-strip {
  display: flex;
  gap: 6px;
  border-bottom: none;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.tab-strip::-webkit-scrollbar { display: none; }
.tab-strip-btn {
  padding: 8px 20px;
  border: 2px solid var(--muted, #9A7868);
  background: #fff;
  border-radius: 24px;
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--body, #6B4C3B);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-display);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab-strip-btn:hover { color: var(--dark, #3D2314); background: #e8e0d0; border-color: var(--dark, #3D2314); }
.tab-strip-btn.active { color: #fff; background: #3b492d; border-color: #3b492d; }
.tab-strip-btn.active:hover { background: #2f3b24; border-color: #2f3b24; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Sub-nav bar (sticky, below main nav) ─────────────────────────────── */
.mg-subnav { background: linear-gradient(rgba(0,0,0,.18), rgba(0,0,0,.18)), var(--nav-bg); overflow: visible; position: sticky; top: var(--nav-sticky-top, var(--nav-h, 56px)); z-index: 90; animation: mgSubnavSlide .35s cubic-bezier(0.4,0,0.2,1) both; }
/* v3.7.875: the `to` max-height was 60px and the animation has fill-mode `both`,
   so 60px was not just the end of the slide - it was a PERMANENT cap on the
   bar's height. Adding flex-wrap below without touching this would have let the
   buttons wrap onto a second row and then clipped that row clean off, which
   looks like the fix working until you notice the Edit button has vanished
   instead of overlapping. Raised so a wrapped row fits; the slide still reads
   the same because the real content is far shorter than the cap. */
@keyframes mgSubnavSlide { from { max-height: 0; opacity: 0; } to { max-height: 200px; opacity: 1; } }
/* v3.7.875: Bex - "recipe Edit button overlaps the right column", and her own
   read on it, "buttons need to wrap - two rows, or a layout fix". This was a
   no-wrap flex row that is also justify-content:center, so once the tabs plus
   the Edit button were wider than the bar they overflowed BOTH sides - and
   .mg-subnav is overflow:visible, so the spill was painted straight over the
   page content beside it. It wraps now, with a row-gap so two rows do not
   collide. */
.mg-subnav-inner { max-width: var(--nav-max, 1400px); margin: 0 auto; padding: 0 52px; display: flex; flex-wrap: wrap; row-gap: 6px; align-items: flex-end; justify-content: center; }
.mg-subnav-tabs { display: flex; align-items: flex-end; gap: 4px; padding-top: 10px; }
/* v3.7.858: the tabs were never grey on purpose -- they were --nav-text at
   opacity .55, which fades white to grey and takes the icon with it. An
   inactive tab now keeps its full colour and is told apart by its background
   instead, which is what the active tab was already doing. Size follows Body
   (role 4) so tab labels match the rest of the app's button text. */
.mg-subnav-tab { padding: 9px 22px; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-body); color: var(--nav-text, #fff); opacity: 1; background: rgba(255,255,255,.14); border: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; cursor: pointer; transition: all .2s ease; display: flex; align-items: center; gap: 6px; text-decoration: none; }
.mg-subnav-tab:hover { background: rgba(255,255,255,.26); }
.mg-subnav-tab.active { opacity: 1; background: var(--surface-card-solid); color: var(--dark); box-shadow: 0 -2px 8px rgba(0,0,0,.08); }
@media (max-width: 1024px) { .mg-subnav-inner { padding: 0 24px; } }
/* v3.7.910: was `top: 48px`, a literal that had to match .mobile-topbar's height
   in app_header.php with nothing keeping the two in step. If the bar is ever
   taller than the number written here - a different font, a safe-area inset, a
   browser that rounds differently - a transparent band opens between them and
   the page scrolls through it, which is what Bex photographed on an iPhone.
   The -1px overlap is deliberate: it costs nothing visually, both surfaces carry
   the same background, and it means a sub-pixel rounding difference closes the
   seam instead of opening one. */
@media (max-width: 767px) {
  /* v3.7.913 — moved from the selector to the token, because of #3.
     Bex reported this gap twice on 2 November, once on Recipes and once on Meals.
     The 910 fix landed on .mg-subnav, was verified on Recipes, and was credited to
     both. It should not have been: meal view renders .cb-subnav, a SECOND sub-nav
     component (app.css:6955) with its own offset of var(--nav-h) - the 60px
     DESKTOP bar - so it still sat 12px below a 48px mobile bar and the page
     showed through. Only meal-view.php renders one; Recipes and Cookbook borrow
     .cb-subnav-add, a child class, inside their .mg-subnav bars.

     Adding .cb-subnav to the selector list here would NOT have worked, and the
     near miss is worth recording: its base rule is 5,000 lines further down, and
     :where() gives it zero specificity, so at equal specificity source order
     decides and the later rule wins. The same bite as the 910 mobile block that
     had to move to the end of the file.

     Redefining the TOKEN sidesteps that completely - a custom property on :root
     is not competing with either selector - and it means the two bars cannot
     drift apart again, because there is now one number and both read it. */
  :root { --nav-sticky-top: calc(var(--mobile-nav-h, 48px) - 1px); }
}
@media (max-width: 600px) { .mg-subnav-tab span.mg-subnav-label { display: none; } .mg-subnav-tab { padding: 9px 16px; gap: 0; } }
.form-card {
  background: var(--surface-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
/* v3.7.884: the padding is gone from here and comes from .mg-card-header's
   declaration instead — see the shared rule below. 874 merged these two onto
   one surface and one text colour and deliberately left the padding apart
   ("it keeps its own padding"); that was the last thing making a header bar on
   Account or Preferences 2px taller than the identical bar on Cookbook.
   Bex: "i just want everything to be uniform". One declaration now, so they
   cannot drift again. */
.form-card-header {
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 10px;
  /* v3.7.859: this was var(--bg) — the member's PAGE background — so the header
     was painted the same colour as the page behind the card. On the default cream
     that read as a faint band; on a white card it vanished; and on a dark Page
     Background it went dark with dark text on it (Bex: "they are hard to read").
     Same bug --cream had, under a different name.
     A soft wash of the member's Primary over the CARD (not the page) keeps the
     band visible on any theme, light or dark, and follows their colour. */
  /* v3.7.860: was a 10% wash of the Primary, which all but vanished on a pale
     theme — the band Bex asked for has to be visible for ANY brand colour.
     --surface is the recessed-surface token and now follows the theme itself,
     so it is a dependable step away from the white card whatever the Primary. */
  /* v3.7.874: the background and the heading colour now come from the SHARED
     header definition below (search --card-header-bg). This component and
     .mg-card-header.accent were two header bars doing one job, and they had
     drifted into opposites: this one was a neutral --surface band with PRIMARY
     text, the other a 12%-primary band with DARK text. Bex, comparing the
     account pages to the dashboard: "the card headers, text should be dark and
     the icons can stay primary colour".

     The 859 and 860 scars above are kept because they are still the reason this
     band cannot be painted from --bg or from a flat 10% wash. --card-header-bg
     mixes the member's Primary over the CARD (--surface-card-solid), not the
     page, so it answers both of those bugs the same way and survives a dark or
     a pale theme. Verified on both before this shipped.

     Two definitions of one component is how the user menu grew five copies and
     how nineteen card classes drifted apart in 872. One definition. */
}
.form-card-header h3 {
  font-size: var(--fs-section);
  font-weight: var(--tx-section-weight);
  /* v3.7.874: was var(--tx-section-color) - the Section role's colour, which
     defaults to Primary. That is what made these headings read as a different
     size: a primary heading on a neutral band next to a dark heading on a
     tinted one. It inherits the shared bar's --card-header-text now, exactly as
     .mg-card-header.accent's headings do. */
  color: inherit;
  margin: 0;
  font-family: var(--tx-section-font);
  font-style: var(--tx-section-style);
  text-transform: var(--tx-section-transform);
  letter-spacing: var(--tx-section-spacing);
}
.form-card-body { padding: 20px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.form-row.full { grid-template-columns: 1fr; }
/* v3.7.910: for rows that want more air between the columns than the default 16px,
   without reaching for an inline style that a media query cannot override. */
.form-row-wide-gap { gap: 24px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) {
  .form-row, .form-row.three { grid-template-columns: 1fr; }
}
.color-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
/* v3.7.877: Bex, on Preferences > Appearance - "all fonts look small, most of
   that should be 'body'". These labels were on --fs-eyebrow, 11.2px, the
   second-smallest role in the app, and there are fourteen of them on that one
   tab, so they were most of what she was looking at. They are the names of the
   colours someone is choosing, not fine print.
   The class appears in preferences.php and nowhere else, so this reaches the
   Appearance tab and nothing beyond it. */
.color-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-body);
  color: var(--muted);
  font-weight: 600;
  font-family: var(--font-display);
}
.color-swatch input[type="color"] {
  width: 48px; height: 48px;
  border: 2px solid var(--rule);
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: none;
}
/* v3.7.909: Bex, on an iPhone SE with A++ on - the labels were cut off mid-word.
   Measured at 375: .mg-main came out 395px wide inside a 375px viewport, and
   scrollWidth stayed at 375, so the overflow was CLIPPED rather than scrollable.
   Nothing the member could do revealed it: "Header Background" read "Header
   Backgroun" and the paragraph above lost the end of every line.

   The cause is the wrapped flex row. Two swatches sit side by side, each label
   centred under its own picker, so a label can only use half the screen minus
   the gap - about 170px at 375 - and at A++ "Secondary Colour" needs more than
   that. Centred text cannot wrap into space it does not have.

   One per row below 480px, picker left and label beside it, gives the label the
   whole width less 48px of swatch. Desktop is untouched: this is the layout the
   grid already produces above the breakpoint. */
@media (max-width: 480px) {
  .color-swatch-row { flex-direction: column; gap: 10px; }
  .color-swatch {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    text-align: left;
  }
  .color-swatch input[type="color"] { flex: 0 0 48px; }
}
/* v3.7.909: "Save Theme" and "Reset to Defaults" sat in an inline flex row with
   no wrap, so at A++ on a 375px screen the pair needed 401px and the second
   button hung off the edge. Wrapping costs nothing at any other size - above
   the phone widths the two fit on one line exactly as before. */
.form-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

/* v3.7.909: the two smallest touch targets in the whole app were these.
   Measured on an iPhone SE: Text size was 12x18 and Help tour 14x18, against a
   44x44 floor - the control that makes text bigger for people who cannot read
   small text, and the control that launches the guided tours, were the two
   hardest things in the app to hit.

   The icons keep the size they had. What changes is the hit area around them:
   the button becomes a 44x44 box with the glyph centred, and the negative
   margin keeps the row looking as it did, because the extra area is padding
   rather than ink. Nothing moves on screen; there is simply something to press. */
.pub-drawer-legal-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: var(--fs-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  margin: -11px 0;          /* keep the legal row its original height */
  line-height: 1;
}
.pub-drawer-legal-btn:hover,
.pub-drawer-legal-btn:focus-visible { color: #fff; }

/* Avatar display in account */
.account-avatar {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: var(--terra-tint);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--terra-dark);
  flex-shrink: 0;
  overflow: hidden;
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.member-row:last-child { border-bottom: none; }
.member-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--cobalt-tint, #B0CAEA);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body);
  color: var(--cobalt-dark, #164278);
  flex-shrink: 0;
}
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.role-badge.admin    { background: rgba(161,40,11,.1); color: var(--terra-ink); border: 1px solid rgba(161,40,11,.25); }
.role-badge.editor   { background: color-mix(in srgb, var(--green) 10%, transparent); color: var(--green-dark); border: 1px solid color-mix(in srgb, var(--green) 25%, transparent); }   /* v3.7.858: --forest was never defined; the hard-coded greens now follow the member's Secondary too */
.role-badge.viewer   { background: rgba(37,99,168,.1); color: var(--cobalt); border: 1px solid rgba(37,99,168,.25); }
/* Tier cards for subscription */
.tier-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.tier-card {
  background: var(--surface-card);
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}
.tier-card:hover { border-color: var(--terra-ink); box-shadow: 0 4px 20px rgba(161,40,11,.1); }
.tier-card.current { border-color: var(--terra-ink); }
.tier-card-badge {
  position: absolute;
  top: -1px; right: 16px;
  background: var(--terra);
  color: var(--on-primary);
  font-size: var(--fs-badge);
  font-weight: 700;
  font-family: var(--font-display);
  padding: 3px 10px;
  border-radius: 0 0 8px 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.tier-price {
  font-size: var(--fs-stat);
  font-weight: 800;
  color: var(--dark);
  font-family: var(--font-display);
  line-height: 1;
}
.tier-price sup { font-size: var(--fs-body); vertical-align: super; }
.tier-price span { font-size: var(--fs-body); font-weight: 500; color: var(--muted); }
.tier-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; }
.tier-features li { font-size: var(--fs-small); color: var(--body-color); display: flex; align-items: flex-start; gap: 7px; }
.tier-features li i { color: var(--green-dark); margin-top: 2px; flex-shrink: 0; }
.tier-features li.missing i { color: var(--muted); }
.tier-features li.missing { color: var(--muted); }

/* ============================================================
   MEAL VIEW / RECIPE VIEW pages
   ============================================================ */
.meal-hero {
  position: relative;
  height: 280px;
  background: var(--surface);
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}
@media (min-width: 768px) { .meal-hero { height: 360px; } }
.meal-hero img { width: 100%; height: 100%; object-fit: cover; }
.meal-hero-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--terra-tint) 0%, color-mix(in srgb, var(--green) 16%, var(--surface-card-solid)) 100%);
  font-size: 4rem;
}
.meal-hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px 20px 20px;
  background: linear-gradient(to top, rgba(30,10,0,.75) 0%, transparent 100%);
}
.meal-hero-title {
  font-size: var(--fs-page-title);
  font-weight: var(--tx-page-title-weight);
  color: #fff;
  font-family: var(--tx-page-title-font);
  margin: 0 0 6px;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
  font-style: var(--tx-page-title-style);
  text-transform: var(--tx-page-title-transform);
  letter-spacing: var(--tx-page-title-spacing);
}
.meal-detail-body {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 80px;
}
.ingredient-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: var(--fs-small);
  color: var(--body-color);
}
.ingredient-chip .qty { color: var(--terra-ink); font-weight: 700; }
.recipe-step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}
.recipe-step:last-child { border-bottom: none; }
.step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--terra);
  color: var(--on-primary);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-body);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.step-body { flex: 1; }
.step-img {
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
  max-height: 200px;
}
.step-img img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------
   CHECKABLE COOKING STEPS  (v3.7.862)
   Bex asked for the Day page's "click a step to cross it off" on the recipe
   and meal pages. Driven by assets/js/cook-steps.js; the markup contract is
   a container with data-cook-scope and steps with data-cook-step.

   The done state dims the SURFACE and strikes the text, rather than greying
   the ink — a lighter text colour would drop a crossed-off step under the
   4.5:1 body floor, and a step you can no longer read is not the same thing
   as a step you have finished.
   ------------------------------------------------------------ */
[data-cook-step] {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .18s ease, opacity .18s ease;
}
[data-cook-step]:hover {
  /* Translucent wash of the member's Primary, the same hover the Lists tabs
     use, so it tints the card it sits on instead of painting over it. */
  background: color-mix(in srgb, var(--terra) 8%, transparent);
}
[data-cook-step]:focus-visible {
  outline: 2px solid var(--terra-ink);
  outline-offset: 2px;
  border-radius: 8px;
}
[data-cook-step].is-done { opacity: .6; }
[data-cook-step].is-done .step-body,
[data-cook-step].is-done .mv-step-text,
[data-cook-step].is-done .cr-step-text {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
[data-cook-step].is-done .step-num,
[data-cook-step].is-done .mv-step-n,
[data-cook-step].is-done .cr-step-num {
  background: var(--surface-2);
  color: var(--body-color);
}
.cook-hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

/* Meal page steps. These were inline-styled divs; the layout moved here so
   the done state has something to hang off. Deliberately the same metrics as
   .recipe-step, so a meal and a recipe read identically. */
.mv-step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}
.mv-step:last-child { border-bottom: none; }
.mv-step-n {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--terra);
  color: var(--on-primary);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-body);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.mv-step-text {
  flex: 1;
  font-size: var(--fs-body);
  color: var(--body-color);
  line-height: 1.6;
}


/* ============================================================
   EDITOR SLIDE-OUT PANEL (shared across cookbook, meal-view, recipe)
   ============================================================ */
.editor-overlay {
  position: fixed; inset: 0;
  background: rgba(61,35,20,0.4);
  backdrop-filter: blur(3px);
  z-index: 1090;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.editor-overlay.open { opacity: 1; pointer-events: auto; }
.editor-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 100%; max-width: 560px;
  background: var(--surface-card-solid);
  box-shadow: -8px 0 40px rgba(61,35,20,0.12);
  display: flex; flex-direction: column;
  z-index: 1100;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.editor-panel.open { transform: translateX(0); }
.editor-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0; background: var(--surface-card-solid);
}
.editor-header h2 { flex:1; font-size: var(--fs-body); font-weight:800; color:var(--subtitle-color); margin:0; font-family:var(--font-display); }
.editor-body { flex:1; overflow-y:auto; padding:20px; -webkit-overflow-scrolling:touch; }
.editor-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--rule);
  display: flex; gap: 8px; justify-content: flex-end;
  flex-shrink: 0; background: var(--surface-card-solid);
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
.ing-row { display:grid; grid-template-columns:3fr 1fr 1.5fr 2fr auto; gap:6px; margin-bottom:6px; align-items:center; }
.ing-row input, .ing-row select {
  padding:7px 10px; border:1.5px solid var(--rule); border-radius:var(--radius-sm, 6px);
  font-size: var(--fs-body); font-family:var(--font-body); color:var(--dark); background:#fff; width:100%;
}
.ing-row input:focus, .ing-row select:focus { outline:none; border-color:var(--terra-ink); }
.ing-row-del {
  width:28px; height:28px; border-radius:50%;
  border:none; background:var(--surface); color:var(--muted);
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  font-size: var(--fs-meta); transition:var(--ease);
}
.ing-row-del:hover { background:#fee2e2; color:var(--danger, #ef4444); }
.step-row { display:flex; gap:10px; margin-bottom:8px; align-items:flex-start; }
.step-row-num {
  width:26px; height:26px; border-radius:50%;
  background:var(--terra); color: var(--on-primary);
  font-family:var(--font-display); font-weight:800; font-size: var(--fs-meta);
  display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top:8px;
}
.step-row textarea {
  flex:1; padding:8px 10px; border:1.5px solid var(--rule); border-radius:var(--radius-sm, 6px);
  font-size: var(--fs-body); font-family:var(--font-body); color:var(--dark); background:#fff;
  resize:vertical; min-height:60px;
}
.step-row textarea:focus { outline:none; border-color:var(--terra-ink); }

/* ============================================================
   AUTH PAGES (login / register / forgot / reset)
   ============================================================ */
.auth-page {  /* v3.7.859: genuinely the page, so --page-bg is correct here.
     v3.7.923: and that is why the background moved OFF it. This element is
     position:relative z-index:1 and covers the whole viewport, so painting the
     page colour here put an opaque sheet directly on top of the Grid Walker and
     the grid was invisible on every auth page.
     `body` already sets `background: var(--page-bg)` (see the body rule), so the
     page looks identical - the colour is simply painted one layer lower, which
     is where a page background belongs and which leaves the grid room to show.
     Nothing else is changed: this element keeps its own stacking, so the sign-in
     card still sits above the grid. */
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-card-solid);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 8px 40px rgba(61,35,20,.08);
}
@media (max-width: 480px) {
  .auth-card { padding: 28px 20px; border-radius: 12px; }
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--title-color);
  letter-spacing: -.03em;
}
.auth-logo-text em { font-style: normal; color: var(--terra-ink); }
.auth-logo-sub {
  font-size: var(--fs-small);
  color: var(--muted);
  margin-top: 4px;
}
.auth-title {
  font-family: var(--tx-page-title-font);
  font-weight: var(--tx-page-title-weight);
  font-size: var(--fs-page-title);
  color: var(--tx-page-title-color);
  margin: 0 0 6px;
  text-align: center;
  font-style: var(--tx-page-title-style);
  text-transform: var(--tx-page-title-transform);
  letter-spacing: var(--tx-page-title-spacing);
}
.auth-sub {
  font-size: var(--fs-small);
  color: var(--muted);
  text-align: center;
  margin-bottom: 24px;
}
.auth-divider {
  text-align: center;
  font-size: var(--fs-small);
  color: var(--muted);
  margin: 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--rule);
}
.auth-footer {
  text-align: center;
  font-size: var(--fs-small);
  color: var(--muted);
  margin-top: 20px;
}
.auth-footer a { color: var(--terra-ink); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }


/* ═══════════════════════════════════════════════════════════════════════════
   STYLE GUIDE — MealGrid Global Design System
   Version: 1.0 — Phase 1 Foundation
   ─────────────────────────────────────────────────────────────────────────
   All pages should use these classes instead of inline styles.
   This creates visual consistency across the entire app.
   ═══════════════════════════════════════════════════════════════════════════ */


/* ── TYPOGRAPHY SCALE ─────────────────────────────────────────────────────
   Consistent type hierarchy across every page.
   Usage: <h1 class="mg-page-title">, <h2 class="mg-section-title">, etc.
   ───────────────────────────────────────────────────────────────────────── */

/* Typography roles (v3.7.778): every property reads a --tx-* variable set from
   Kitchen → Default Theme; the fallback after the comma is the original look.
   .tx-* classes are the wiring hooks for page-by-page font mapping. */
.mg-page-title,
.tx-page-title {
  font-family: var(--tx-page-title-font, var(--font-display));
  font-weight: var(--tx-page-title-weight, 800);
  font-style: var(--tx-page-title-style, normal);
  font-size: var(--fs-page-title);
  text-transform: var(--tx-page-title-transform, none);
  letter-spacing: var(--tx-page-title-spacing, normal);
  color: var(--tx-page-title-color, var(--title-color));
  line-height: 1.2;
  margin: 0;
}

.mg-section-title,
.tx-section {
  font-family: var(--tx-section-font, var(--font-display));
  font-weight: var(--tx-section-weight, 700);
  font-style: var(--tx-section-style, normal);
  font-size: var(--fs-section);
  text-transform: var(--tx-section-transform, none);
  letter-spacing: var(--tx-section-spacing, normal);
  color: var(--tx-section-color, var(--title-color));
  line-height: 1.3;
  margin: 0;
}

.tx-section-h2 {
  font-family: var(--tx-section-h2-font, var(--font-display));
  font-weight: var(--tx-section-h2-weight, 800);
  font-style: var(--tx-section-h2-style, normal);
  font-size: var(--fs-section-h2);
  text-transform: var(--tx-section-h2-transform, none);
  letter-spacing: var(--tx-section-h2-spacing, normal);
  color: var(--tx-section-h2-color, var(--dark));
  line-height: 1.2;
}

.mg-subtitle,
.tx-subtitle {
  font-family: var(--tx-subtitle-font, var(--font-display));
  font-weight: var(--tx-subtitle-weight, 600);
  font-style: var(--tx-subtitle-style, normal);
  font-size: var(--fs-subtitle);
  text-transform: var(--tx-subtitle-transform, none);
  letter-spacing: var(--tx-subtitle-spacing, normal);
  color: var(--tx-subtitle-color, var(--subtitle-color));
  line-height: 1.35;
  margin: 0;
}

.mg-body,
.tx-body {
  font-family: var(--tx-body-font, var(--font-body));
  font-weight: var(--tx-body-weight, 400);
  font-style: var(--tx-body-style, normal);
  font-size: var(--fs-body);
  text-transform: var(--tx-body-transform, none);
  letter-spacing: var(--tx-body-spacing, normal);
  color: var(--tx-body-color, var(--body-text));
  line-height: 1.6;
}

.mg-small,
.tx-small {
  font-family: var(--tx-small-font, var(--font-body));
  font-weight: var(--tx-small-weight, 400);
  font-style: var(--tx-small-style, normal);
  font-size: var(--fs-small);
  text-transform: var(--tx-small-transform, none);
  letter-spacing: var(--tx-small-spacing, normal);
  color: var(--tx-small-color, var(--body-text));
}

.mg-meta,
.tx-meta {
  font-family: var(--tx-meta-font, var(--font-body));
  font-weight: var(--tx-meta-weight, 400);
  font-style: var(--tx-meta-style, normal);
  font-size: var(--fs-meta);
  text-transform: var(--tx-meta-transform, none);
  letter-spacing: var(--tx-meta-spacing, normal);
  color: var(--tx-meta-color, var(--muted));
  line-height: 1.4;
}

.mg-eyebrow,
.tx-eyebrow {
  font-family: var(--tx-eyebrow-font, var(--font-display));
  font-weight: var(--tx-eyebrow-weight, 700);
  font-style: var(--tx-eyebrow-style, normal);
  font-size: var(--fs-eyebrow);
  text-transform: var(--tx-eyebrow-transform, uppercase);
  letter-spacing: var(--tx-eyebrow-spacing, .08em);
  color: var(--tx-eyebrow-color, var(--muted));
  line-height: 1;
}

.tx-dashboard-stat {
  font-family: var(--tx-dashboard-stat-font, var(--font-display));
  font-weight: var(--tx-dashboard-stat-weight, 800);
  font-style: var(--tx-dashboard-stat-style, normal);
  font-size: var(--fs-dashboard-stat);
  text-transform: var(--tx-dashboard-stat-transform, none);
  letter-spacing: var(--tx-dashboard-stat-spacing, normal);
  color: var(--tx-dashboard-stat-color, var(--terra));
  line-height: 1;
}
.tx-dashboard-statinfo {
  font-family: var(--tx-dashboard-statinfo-font, var(--font-display));
  font-weight: var(--tx-dashboard-statinfo-weight, 700);
  font-style: var(--tx-dashboard-statinfo-style, normal);
  font-size: var(--fs-dashboard-statinfo);
  text-transform: var(--tx-dashboard-statinfo-transform, uppercase);
  letter-spacing: var(--tx-dashboard-statinfo-spacing, .06em);
  color: var(--tx-dashboard-statinfo-color, var(--muted));
  line-height: 1.2;
}

.mg-stat-num,
.tx-stat {
  font-family: var(--tx-stat-font, var(--font-display));
  font-weight: var(--tx-stat-weight, 800);
  font-style: var(--tx-stat-style, normal);
  font-size: var(--fs-stat);
  text-transform: var(--tx-stat-transform, none);
  letter-spacing: var(--tx-stat-spacing, normal);
  color: var(--tx-stat-color, var(--terra));
  line-height: 1;
}

.tx-badge {
  font-family: var(--tx-badge-font, var(--font-display));
  font-weight: var(--tx-badge-weight, 700);
  font-style: var(--tx-badge-style, normal);
  font-size: var(--fs-badge);
  text-transform: var(--tx-badge-transform, uppercase);
  letter-spacing: var(--tx-badge-spacing, .06em);
}
/* On dark/coloured headers, role text follows the header text colour */
.mg-card-header.accent [class^="tx-"], .mg-card-header.accent [class*=" tx-"],
.app-topnav [class^="tx-"], .app-topnav [class*=" tx-"],
.mg-category-header [class^="tx-"], .mg-category-header [class*=" tx-"],
.category-header [class^="tx-"], .category-header [class*=" tx-"],
/* v3.7.862: .gt-head and .ps-head set color:var(--on-secondary) for the bar,
   but .gt-title carries tx-section, whose role colour won — so "Your meals"
   was drawn in the Primary ink on the Secondary bar (4.09:1). They belong on
   this list, which exists for exactly this: role text on a coloured header
   follows the header. */
.gt-head [class^="tx-"], .gt-head [class*=" tx-"],
.ps-head [class^="tx-"], .ps-head [class*=" tx-"] { color: inherit; }

/* v3.7.863: and the same for HEADINGS on a coloured bar. The global
   h1–h6 { color: var(--title-color) } is a type selector on the element
   itself, so it beats any colour the bar sets by inheritance — which is why
   an <h2> sidebar title rendered in the heading green ON the green bar.
   This is the general form of Bex's "card headers are hard to read": it was
   never about one card, it was about every heading that sits on a fill. */
.mg-side-head  :is(h1,h2,h3,h4,h5,h6), .mg-side-head  [class^="tx-"], .mg-side-head  [class*=" tx-"],
.mg-filter-header :is(h1,h2,h3,h4,h5,h6), .mg-filter-header [class^="tx-"], .mg-filter-header [class*=" tx-"],
.pf-side-head  :is(h1,h2,h3,h4,h5,h6),
.gt-head       :is(h1,h2,h3,h4,h5,h6),
.ps-head       :is(h1,h2,h3,h4,h5,h6),
.category-header :is(h1,h2,h3,h4,h5,h6),
.mg-category-header :is(h1,h2,h3,h4,h5,h6),
/* v3.7.881: .form-card-header was missing from this list. 874 merged it into the
   same SURFACE definition as .mg-card-header.accent but not into this one, so on
   Account, Preferences, Data and Help the <h3> kept the heading colour instead of
   taking the bar's. That is Bex's "the card title fonts are the wrong colours in
   places" — one omission, four pages. */
.form-card-header :is(h1,h2,h3,h4,h5,h6),
.form-card-header [class^="tx-"], .form-card-header [class*=" tx-"],
.mg-card-header.accent :is(h1,h2,h3,h4,h5,h6) { color: inherit; }
/* Text that sits on a photo or a solid-colour button takes the role's size,
   font and weight but keeps the colour of whatever it sits on (v3.7.779). */
.tx-keep-color[class] { color: inherit; }
.hero-card-body .hero-card-eyebrow { color: var(--amber); }
.hero-card-body .hero-card-title   { color: var(--hero-on-panel); }
.hero-card-body .hero-card-sub     { color: var(--hero-on-panel-soft); }
/* Stat colour slots — built from the member's Primary + Secondary (Kitchen → Stats → Colour style) */
.stat-c1 { color: var(--stat-c1, var(--terra)); }
.stat-c2 { color: var(--stat-c2, var(--terra)); }
.stat-c3 { color: var(--stat-c3, var(--terra)); }
.stat-c4 { color: var(--stat-c4, var(--terra)); }
.stat-c5 { color: var(--stat-c5, var(--terra)); }
.stat-bg-c1 { background: var(--stat-c1, var(--terra)); }
.stat-bg-c2 { background: var(--stat-c2, var(--terra)); }
.stat-bg-c3 { background: var(--stat-c3, var(--terra)); }
.stat-bg-c4 { background: var(--stat-c4, var(--terra)); }
.stat-bg-c5 { background: var(--stat-c5, var(--terra)); }

.mg-stat-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-meta);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}


/* ── SURFACE / CARD SYSTEM ────────────────────────────────────────────────
   The transparent white card is the signature MealGrid look.
   Wrap content blocks in .mg-card for readability over background images.
   ───────────────────────────────────────────────────────────────────────── */

/* ── THE CARD SURFACE (v3.7.872) ───────────────────────────────────────────
   Bex, repeatedly: "the card bgs are the wrong colour, we changed all the
   others, this page was missed."

   Measured before changing anything, and the background was never the problem —
   .mg-card and .meal-detail-card both paint rgba(255,255,255,.75). What differs
   is everything ELSE:

       .mg-card            blur(2px)   shadow   translucent-white edge
       .meal-detail-card   no blur     none     hard --rule edge

   Without the blur the watercolour behind shows through crisply instead of
   being softened, which is what reads as "a different colour". The hard tinted
   edge finishes the job.

   The audit found NINETEEN card classes on the flat treatment and TWO on the
   full one — so .mg-card was the odd one out, except that it is the one Bex
   treats as correct, because it is what the dashboard uses. Rather than patch
   nineteen rules, the surface is defined once here and shared. Anything that
   should look like a card now says so in one place.

   Controls that merely happen to use --surface-card (.pf-see-freezer,
   .bd-wash-opt, .pt-grid) are deliberately NOT included: they are buttons and
   containers, not cards, and blurring them would be cargo-cult. */
.mg-card,
.form-card,
.mg-side-card,
.mg-stat-card,
.mg-recipe-card,
:where(body.pg-recipe) .recipe-hero-card,
:where(body.pg-recipe) .recipe-detail-card,
:where(body.pg-meal-view) .meal-hero-card,
:where(body.pg-meal-view) .meal-detail-card,
:where(body.pg-community-recipe) .cr-detail-card,
:where(body.pg-mykitchen) .mk-upsell-card,
/* v3.7.875: Prep & Freeze joins the shared card surface. Bex, bracketing the
   header card and the four step cards together: "one card style / card BG
   colour?". .pf-card and .pf-step were each painting their own
   --surface-card-solid with a hard --rule edge and no blur - the exact flat
   treatment 872 found on nineteen other card classes, on the one page it did
   not reach. The Freezer tab shares this component family, so it is fixed in
   the same move. Their own padding is kept below; only the surface is shared. */
.pf-card,
.pf-step,
:where(body.pg-subscription) .tier-card {
  background: var(--surface-card);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  overflow: hidden;
}
.mg-card:hover {
  /* Only apply hover lift when the card is interactive (a, button) */
}
a.mg-card:hover, button.mg-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  transition: var(--ease);
}
.mg-card-solid {
  background: var(--surface-card-solid);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
/* v3.7.884: .form-card-header shares this padding now (see its own rule above),
   so every card header in the app is 12px 16px. */
.mg-card-header,
.form-card-header {
  padding: 12px 16px;
}
.mg-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
/* v3.7.867: treatment A. Was a solid slab of --surface-header with white on
   it; now the member's colour at 12% with dark text, and their colour solid
   in a 4px marker before the title so the hue is still shown undiluted. The
   bottom border comes back, because a near-white bar needs a rule to read as
   a header at all -- --rule is already a 20% tint of the same colour. */
/* v3.7.874: .form-card-header joins this definition rather than keeping its own.
   It is the header bar on Account, Preferences, Subscription and Data - the
   pages reached from the user menu - and it was the last header component in
   the app still painting its own surface. It keeps its own padding (14px 20px);
   only the surface and the text colour are shared. */
.mg-card-header.accent,
.form-card-header {
  background: var(--card-header-bg);
  color: var(--card-header-text);
  border-bottom: 1px solid var(--rule);
}
/* The marker hangs off the HEADING, not the header: .mg-card-header is
   display:flex; justify-content:space-between, so a ::before on the header
   itself would become a third flex item and push the action control out of
   place. On the heading it travels with the title wherever the title goes. */
.mg-card-header.accent :is(h1,h2,h3,h4,h5,h6)::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: .95em;
  margin-right: 10px;
  border-radius: 2px;
  background: var(--card-header-marker);
  vertical-align: -.1em;
}
.mg-card-header.accent .mg-section-title,
.mg-card-header.accent .mg-eyebrow,
.mg-card-header.accent .mg-meta {
  color: inherit;
}
/* ── v3.7.881. The icon IS the marker (Bex: "if there's an icon, no line
   needed at beginning") ──────────────────────────────────────────────────
   The rule already held for .gt-head and .ps-head — "where a bar already has an
   icon in front of its title, the icon IS the marker and a second one would just
   be clutter" — but .mg-card-header.accent added the 4px line unconditionally,
   so meal-view, recipe and community-recipe showed both.
   Scoped with :has() to a heading whose FIRST child is the icon, so a heading
   with an icon somewhere in the middle keeps its marker. */
.mg-card-header.accent :is(h1,h2,h3,h4,h5,h6):has(> .fa-solid:first-child)::before,
.mg-card-header.accent :is(h1,h2,h3,h4,h5,h6):has(> .fa-regular:first-child)::before,
.mg-card-header.accent :is(h1,h2,h3,h4,h5,h6):has(> .fa-brands:first-child)::before {
  content: none;
}
/* Bex, 20 Oct: "if we're going to use icons on the card i want them all the user
   primary colour". The icon takes the marker's colour because it is doing the
   marker's job. Card headers are Primary; the side heads keep Secondary, which is
   the whole point of the two patterns (see --side-head-marker). This replaces 24
   inline style="color:…" attributes across meal-view, recipe, community-recipe
   and help — which is why the colours had drifted in the first place. */
.mg-card-header.accent :is(h1,h2,h3,h4,h5,h6) > :is(.fa-solid,.fa-regular,.fa-brands),
.form-card-header :is(h1,h2,h3,h4,h5,h6) > :is(.fa-solid,.fa-regular,.fa-brands),
.form-card-header > :is(.fa-solid,.fa-regular,.fa-brands),
/* v3.7.883: Shopping List's date bar joins them. Bex: "change the icon colour
   next to the date to the primary user colour". It is a card header in
   everything but its class name — ShoppingListView hands it --card-header-bg
   and --dark as inline styles, the same tint pair as .mg-card-header.accent —
   so its cart icon belongs on the same marker colour as every other card
   header's. It is centred, which is why it carries an icon rather than the 4px
   line: a marker on a centred bar would sit out in the margin. */
.sl-card-header-top > :is(.fa-solid,.fa-regular,.fa-brands) {
  color: var(--card-header-marker);
}
/* ── v3.7.882. A heading in a header bar has no margin ─────────────────────
   Bex, on meal-view: "why is that header bigger then the rest of the pages
   (looks like theres padding under the title)". It was: the base h1–h6 rule
   sets font, weight, colour and line-height but NO margin, so every heading
   keeps the browser's own 0.83em top and bottom. Inside a display:flex bar
   that reads as padding under the title.

   It is worse than the UA default alone. All three detail pages ALSO set
   `.X-detail-card h2 { … margin: 0 0 16px }` — for the bare <h2>s that still
   exist on each — and recipe and community-recipe each then zeroed it again
   inside the bar, by hand, on their own page. meal-view never did. Same
   component, two of three patched, which is exactly what Bex was comparing.

   The CLASS IS DOUBLED on purpose. Those three page rules are (0,1,1) and sit
   later in the file, so a plain `.mg-card-header :is(…)` is also (0,1,1) and
   loses on order — it would read as a global fix and do nothing on the three
   pages that need it. `.mg-card-header.mg-card-header` is (0,2,1) and wins
   wherever it sits, including against any page rule added later.

   With that, the two hand-written page resets are redundant and deleted.
   .hm-week-head keeps its own margin: it uses `auto` on the right to push the
   bar's action button over, which is a different job. */
.mg-card-header.mg-card-header :is(h1,h2,h3,h4,h5,h6),
.form-card-header.form-card-header :is(h1,h2,h3,h4,h5,h6) {
  margin: 0;
}
.mg-card-body {
  padding: 16px;
}
.mg-card-body.compact {
  padding: 12px;
}
.mg-card-body.flush {
  padding: 0;
}
.mg-card-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}


/* ── SECTION HEADERS ──────────────────────────────────────────────────────
   Category headers for lists (shopping list, ingredients, etc.)
   The accent-colored bar with white text that groups items.
   ───────────────────────────────────────────────────────────────────────── */

.mg-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--terra);
  color: var(--on-primary);
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}
.mg-category-header .mg-category-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-eyebrow);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.mg-category-header .mg-category-count {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-meta);
  opacity: .85;
}
/* Muted variant for less emphasis */
.mg-category-header.muted {
  background: var(--surface-2);
  color: var(--muted);
}


/* ── PAGE LAYOUTS ─────────────────────────────────────────────────────────
   Standard page structures used across the app.
   ───────────────────────────────────────────────────────────────────────── */

/* Full-width page — no max-width constraint, content uses all space */
/* ── One page rhythm ─────────────────────────────────────────────────────────
   v3.7.858. Pages disagreed about their own edges: .mg-page-wide (the
   dashboard and most others) used 20/24/35 and stepped up on wider screens,
   while .dy-page and .fn-page used 16/20/40 and never stepped up at all — so
   the Day and Notes pages sat tighter to the edge than everything else on a
   big screen. Bex: "the same padding on the top/bottom/sides, i like the
   spacing on the dashboard".

   The dashboard's values are now the scale, defined once, and every page
   wrapper reads them. Change the rhythm here, not in six places.           */
:root {
  --page-pad-y: 20px;   /* top */
  --page-pad-x: 24px;   /* sides */
  --page-pad-b: 35px;   /* bottom */
}
@media (min-width: 768px)  { :root { --page-pad-y: 28px; --page-pad-x: 32px; } }
@media (min-width: 1200px) { :root { --page-pad-y: 32px; --page-pad-x: 48px; } }

.mg-page-wide {
  padding: var(--page-pad-y) var(--page-pad-x) var(--page-pad-b);
  width: 100%;
  box-sizing: border-box;
  overflow-x: clip;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOME: the stat boxes (the top of Home is the ".hm-" section at the end of this file, v3.7.815)
   ═══════════════════════════════════════════════════════════════════════════ */
.home-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1100px) {
  .home-stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .home-stat-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    padding-bottom: 8px;
    margin: 0 -24px;
    padding-left: 24px;
    padding-right: 24px;
    /* v3.7.912: without this the snap cancels the padding. `scroll-snap-align: start` on
       the first card snaps it to the scrollport edge, so the browser scrolled the track
       by exactly the 24px of padding-left and the card sat flush against the screen -
       measured scrollLeft:24, card left:0. scroll-padding tells the snap where the
       content area really starts. Caught by the gutter probe from v3.7.910. */
    scroll-padding-left: 24px;
  }
  .home-stat-grid > .mg-card {
    flex: 0 0 75vw;
    max-width: 300px;
    scroll-snap-align: start;
  }
  .home-stat-grid::-webkit-scrollbar { display: none; }
  .home-stat-grid { scrollbar-width: none; }
  /* box-sizing: border-box on mg-page-wide prevents overflow — no overflow-x: hidden needed */
}

/* Page with toolbar (title + action buttons) */
.mg-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.mg-page-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Two-column sidebar layout */
.mg-sidebar-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.mg-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--nav-h) + 20px);
}
.mg-sidebar .mg-card {
  padding: 16px;
}
.mg-main {
  flex: 1;
  min-width: 0;
}
@media (max-width: 899px) {
  .mg-sidebar-layout { flex-direction: column; }
  .mg-sidebar {
    width: 100%;
    position: static;
  }
  /* v3.7.909: measured on an iPhone SE at A++ - .mg-main came out 377px wide
     inside a 327px .mg-sidebar-layout, and everything inside it inherited the
     overshoot, which is what clipped the Preferences colour labels.

     Stacked, the layout is a COLUMN flex container, so the horizontal axis is
     the cross axis. min-width:0 governs the main axis and does nothing here: a
     stretched item still refuses to go below its min-content width, and at A++
     the content's minimum is wider than the screen. max-width pins the cross
     axis to the parent, and min-width:0 keeps the main axis honest as before. */
  .mg-sidebar-layout > .mg-main,
  .mg-sidebar-layout > .mg-sidebar { max-width: 100%; min-width: 0; }

  /* v3.7.910: and the cause of all of it — `align-items: flex-start`.
     Bex, 2 Nov: "Account -> password tab, card wrong size". Measured at 375 the
     Change Password card came out 237px while the Profile tab's card, on the
     same page with the same CSS, came out 327px. Walking the chain:

        .form-card           237     <- the card
        .tab-pane            237
        .mg-main             237
        .mg-sidebar-layout   327     <- the parent is the full width
        .mg-page-wide        375

     The card was not too narrow. Its whole column was. Stacked below 899px the
     layout is a COLUMN flex container, so `align-items: flex-start` — set for the
     side-by-side desktop layout, where it stops a short sidebar stretching to the
     height of a long page — sizes children to their CONTENT on the horizontal
     axis. A tab holding a short password form gets a narrow column; a tab holding
     a wide profile card gets a wide one. Same page, same rules, different width,
     which is exactly how it looked: arbitrary.

     `stretch` is the right value once the axis has turned. It also removes the
     cause of the A++ overflow patched in v3.7.909 above — that was this same rule,
     pushing .mg-main out to its min-content width — and of the one-tab-only
     workaround further down the file:
         #tab-sl-list .mg-sidebar-layout > .mg-main { align-self: stretch; }
     which is this fix, found once, applied to a single tab of a single page.
     The max-width above stays as a guard; this is the fix. */
  .mg-sidebar-layout { align-items: stretch; }
}

/* Settings sidebar nav links */
.mg-sidebar-nav { list-style: none; margin: 0; padding: 8px 0; }
.mg-sidebar-nav li { margin: 0; }
.mg-sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: var(--fs-body); font-weight: 500;
  color: var(--muted); text-decoration: none;
  border-radius: 8px; margin: 2px 8px;
  transition: background .2s, color .2s;
}
.mg-sidebar-nav a i { width: 1.25em; text-align: center; font-size: .9rem; color: var(--terra-ink); }
.mg-sidebar-nav a.active i { color: inherit; }
.mg-sidebar-nav a:hover { background: rgba(0,0,0,.05); color: var(--dark); }
.mg-sidebar-nav a.active {
  background: var(--terra); color: var(--on-primary); font-weight: 600;
}
.mg-sidebar-nav a.active:hover { background: var(--terra-dark, #a0522d); }
.mg-sidebar-nav .nav-badge {
  margin-left: auto; font-size: var(--fs-badge); font-weight: 700;
  padding: 1px 7px; border-radius: 99px;
  background: var(--terra); color: var(--on-primary);
}
.mg-sidebar-nav a.active .nav-badge { background: rgba(255,255,255,.3); }
@media (max-width: 899px) {
  .mg-sidebar-nav {
    display: flex; gap: 0; padding: 4px 0; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .mg-sidebar-nav::-webkit-scrollbar { display: none; }
  .mg-sidebar-nav a { white-space: nowrap; margin: 2px 2px; padding: 8px 14px; font-size: var(--fs-small); }
}

/* Three-column card grid (shopping list pattern) */
/* v3.7.863: `align-items: start` was why Bex's three Reset & Close cards were
   three different heights — it opts the row OUT of the stretching a grid does
   by default, so each card stopped at its own content. They stretch now, and
   the cards inside drop their standalone bottom margin, which the grid's own
   gap already provides. (Used only by data.php's Reset & Close row.) */
.mg-col-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: stretch;
}
.mg-col-grid > .form-card { margin-bottom: 0; display: flex; flex-direction: column; }
.mg-col-grid > .form-card > .form-card-body { flex: 1 1 auto; display: flex; flex-direction: column; }
/* The confirm control sits on the bottom edge of every card, so the three
   line up however long each explanation runs. */
.mg-col-grid > .form-card > .form-card-body > :last-child { margin-top: auto; }
@media (max-width: 1100px) {
  .mg-col-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .mg-col-grid { grid-template-columns: 1fr; }
}

/* A lone card in a column grid takes the whole row rather than sitting in a third of one.
   Data > Reset & Close shows only Reset to a super admin, who may not close the account. */
.mg-col-grid > :only-child { grid-column: 1 / -1; }

/* Auto-fill responsive card grid (cookbook, meals) */
.mg-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
@media (min-width: 768px) {
  .mg-card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (min-width: 1200px) {
  .mg-card-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* Dashboard-style multi-column */
.mg-dash-grid {
  display: grid;
  gap: 20px;
}
@media (min-width: 768px) {
  .mg-dash-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1200px) {
  .mg-dash-grid { grid-template-columns: 1fr 1.5fr 1fr; }
}

/* Stat row — 4 equal stat boxes */
.mg-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 768px) {
  .mg-stat-row { grid-template-columns: repeat(2, 1fr); }
}
.mg-stat-card {
  padding: 20px 16px;
  text-align: center;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.mg-stat-card .mg-stat-num { margin-bottom: 4px; }


/* ── LIST PATTERNS ────────────────────────────────────────────────────────
   Clean list items with dividers, used across shopping list, ingredients, etc.
   ───────────────────────────────────────────────────────────────────────── */

.mg-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.mg-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: var(--ease);
}
.mg-list-item:last-child { border-bottom: none; }
.mg-list-item:hover { background: rgba(255, 255, 255, 0.5); }

.mg-list-item-name {
  flex: 1;
  min-width: 0;
}
.mg-list-item-name .name {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--heading-text);
  font-weight: 500;
}
.mg-list-item-name .source {
  font-size: var(--fs-meta);
  color: var(--terra-ink);
  margin-top: 1px;
}
.mg-list-item-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-body);
  color: var(--terra-ink);
  white-space: nowrap;
  flex-shrink: 0;
}
/* Checked-off item (shopping list) */
.mg-list-item.checked .mg-list-item-name .name {
  text-decoration: line-through;
  color: var(--muted);
}
.mg-list-item.checked .mg-list-item-value {
  color: var(--muted);
}
.mg-list-item.staple {
  opacity: .65;
}
.mg-list-item.staple .mg-list-item-name .name {
  text-decoration: line-through;
}


/* ── TOGGLE BUTTON GROUP ──────────────────────────────────────────────────
   View switcher (Grid/List, Cards/List, This Week/Monthly, etc.)
   ───────────────────────────────────────────────────────────────────────── */

.mg-toggle-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.mg-toggle-btn {
  padding: 7px 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--ease);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}
.mg-toggle-btn:hover { color: var(--dark); }
.mg-toggle-btn.active {
  background: var(--terra);
  color: var(--on-primary);
  box-shadow: var(--shadow-sm);
}
.mg-toggle-btn.active:hover { background: var(--terra-hover); color: var(--on-primary); }


/* ── FILTER SIDEBAR ───────────────────────────────────────────────────────
   Left-hand filter panel (cookbook, meals, community).
   On mobile, slides in as a drawer.
   ───────────────────────────────────────────────────────────────────────── */

.mg-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mg-filter-section {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.mg-filter-section:last-child { border-bottom: none; padding-bottom: 0; }
.mg-filter-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-eyebrow);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.mg-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: var(--fs-body);
  color: var(--body-text);
  cursor: pointer;
}
.mg-filter-option input[type="radio"],
.mg-filter-option input[type="checkbox"] {
  accent-color: var(--terra-ink);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.mg-filter-option .count {
  margin-left: auto;
  font-size: var(--fs-meta);
  color: var(--muted);
  font-weight: 500;
}
.mg-filter-option:hover { color: var(--heading-text); }
.mg-filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.mg-filter-tag {
  display: inline-block;
  padding: 3px 9px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 20px;
  font-size: var(--fs-meta);
  color: var(--body-text);
  cursor: pointer;
  transition: var(--ease);
}
.mg-filter-tag:hover { border-color: var(--terra-ink); color: var(--terra-ink); }
.mg-filter-tag.active {
  background: var(--terra);
  border-color: var(--terra-ink);
  color: var(--on-primary);
}
/* Filter sidebar header with accent bar */
/* v3.7.868: the sidebar tint — see the side-panel block below, which also
   defines it. Both are updated so neither reads as the old slab.
   v3.7.881: onto --side-header-bg, the floored token every other side head
   already used. 877 moved the others and left this one behind, which is why
   "CONTROLS" and "FILTERS" sat ~3% lighter than their neighbours. */
.mg-filter-header {
  background: var(--side-header-bg);
  color: var(--side-head-text);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mg-filter-header .mg-filter-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--side-head-text);
  opacity: .72;                 /* v3.7.868: was rgba(255,255,255,.7) — gone on a tint */
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: var(--ease);
  display: none;
}
.mg-filter-header .mg-filter-close:hover {
  color: var(--side-head-text);
  opacity: 1;
  background: color-mix(in srgb, var(--green) 18%, var(--surface-card-solid));
}
.mg-filter-header .mg-filter-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body);
  text-transform: uppercase;
  letter-spacing: .09em;
}
.mg-filter-header .mg-filter-clear {
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--side-head-text);
  opacity: .8;                  /* v3.7.868: was rgba(255,255,255,.8) */
  text-decoration: none;
  margin-left: auto;
}
.mg-filter-header .mg-filter-clear:hover { color: var(--side-head-text); opacity: 1; }

/* Desktop: overlay hidden, sidebar is normal flow */
.mg-filter-overlay { display: none; }

/* Mobile filter drawer — slide from left (matches live app pattern) */
@media (max-width: 899px) {
  .mg-filter-header .mg-filter-close { display: block; }
  .mg-filter-header { border-radius: 0; margin-bottom: 0; }

  /* Overlay: fixed backdrop behind the drawer */
  .mg-filter-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
  }
  .mg-filter-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Panel: centred floating card ("lil window")
     v3.7.914 — the class is repeated deliberately. .filter-drawer.filter-drawer
     selects exactly the same elements but counts as three classes instead of
     two, and that is the whole point.

     Since v3.7.911 a page's own sidebar class rides along on this element so the
     "make 1 card" guards keep matching - .fn-side on Notes, .pt-side on the
     Pantry. Those pages carry rules like `.fn-layout > .fn-side { position:
     sticky }`, which is also two classes, so specificity tied and the later rule
     in the file won. On Notes it did: the drawer computed static, which meant
     left: 50% did nothing and translate(-50%, -50%) dragged the card 177px off
     the left edge, while the still-in-flow panel added 443px of blank page
     above the notes. Both of the things Bex photographed, one cause.

     Excluding the drawer from the page rules was tried first and was worse: a
     :not(.filter-drawer) on the Notes column rule also disabled it on a DESKTOP,
     where the class is present but the drawer styles are not, and the layout only
     still looked right by accident (flex-basis silently fell back to auto).

     Raising the drawer instead fixes every page at once and cannot reach the
     desktop, because this whole block is inside the mobile query. Any page
     sidebar rule up to two classes now loses to it, which is the correct
     outcome: while this element is a floating window, the window rules win. */
  .mg-sidebar.filter-drawer.filter-drawer {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(.92);
    opacity: 0;
    pointer-events: none;
    width: min(340px, 88vw);
    max-height: calc(100vh - var(--nav-h, 60px) - var(--bottom-nav-h, 68px) - 2rem);
    z-index: 10000;
    background: #ffffff;
    transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .25s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    margin: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
    border-radius: 14px;
  }
  .mg-sidebar.filter-drawer.filter-drawer.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
  }

  /* Card inside the floating window — flush edges, inherit radius */
  .mg-sidebar.filter-drawer .mg-card {
    background: #ffffff !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }
  /* Round the header top corners to match the window */
  .mg-sidebar.filter-drawer .mg-filter-header {
    border-radius: 14px 14px 0 0;
  }

  /* Toggle button — fixed vertical tab on left edge, near top */
  .mg-filter-toggle {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: .3rem;
    position: fixed;
    left: 0;
    /* v3.7.911: --mg-panel-slot is the vertical slot, so a page with more than one
       tab down the same edge stacks them instead of printing them on top of each
       other. The Shopping List has Controls and Add an Item; My Kitchen has Your
       Pantry; Family Notes has Write a Note. Slot 0 is the old position exactly,
       so nothing that had one tab moves. */
    top: calc(var(--nav-h, 60px) + 2rem + (var(--mg-panel-slot, 0) * var(--mg-panel-step, 7.5rem)));
    z-index: 9998;
    background: var(--terra);
    color: var(--on-primary) !important;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: .4rem;
    font-size: var(--fs-badge);
    font-weight: 700;
    letter-spacing: .06em;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 2px 0 10px rgba(0,0,0,.25);
    writing-mode: vertical-rl;
    text-transform: uppercase;
    transition: background .2s ease, opacity .2s ease;
    margin: 0;
  }
  /* v3.7.910: the vertical tab takes the member's SECONDARY colour, not the
     primary. Bex asked for it on all three pages that carry one - Controls on the
     Shopping List, Filters on Ingredients, and the Cookbook's - and it is one
     component, so this is one change. --green is the Secondary (set from
     theme_color_secondary in app_header.php) and --on-secondary is its readable
     text colour, worked out per member rather than assumed to be white.
     v3.7.882 did the same thing to the panel HEADER this tab opens; the tab
     itself was left on Primary, so the two halves of one control disagreed. */
  .mg-filter-toggle { background: var(--green); color: var(--on-secondary) !important; }
  .mg-filter-toggle:active { background: var(--green-hover); }
  .mg-filter-toggle i { font-size: .8rem; }

  /* Active-filter indicator dot */
  .mg-filter-active-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #fff;
    display: block;
  }

  /* Hide toggle when drawer is open */
  .mg-filter-overlay.open ~ .mg-filter-toggle {
    opacity: 0;
    pointer-events: none;
  }
}
/* Hidden by default on desktop */
.mg-filter-toggle { display: none; }
/* Active dot hidden on desktop */
.mg-filter-active-dot { display: none; }
@media (min-width: 900px) { .mg-filter-close { display: none !important; } }


/* ── PROGRESS BAR ─────────────────────────────────────────────────────────
   Shopping progress, loading indicators.
   ───────────────────────────────────────────────────────────────────────── */

.mg-progress {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.mg-progress-bar {
  height: 100%;
  background: var(--terra);
  border-radius: 4px;
  transition: width .4s cubic-bezier(0.4,0,0.2,1);
}
.mg-progress-bar.complete { background: var(--green); }


/* ── RECIPE/MEAL CARD ─────────────────────────────────────────────────────
   Standard card for cookbook grid items.
   ───────────────────────────────────────────────────────────────────────── */

.mg-recipe-card {
  overflow: hidden;
  transition: var(--ease);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.mg-recipe-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.mg-recipe-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--surface);
}
.mg-recipe-card-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 2rem;
  opacity: .4;
}
.mg-recipe-card-body {
  padding: 12px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.mg-recipe-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body);
  color: var(--heading-text);
  margin: 0 0 6px;
  line-height: 1.3;
}
.mg-recipe-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
}


/* ── INLINE STYLE REPLACEMENT UTILITIES ───────────────────────────────────
   These replace the most common inline style="" patterns found across pages.
   Usage: swap style="color:var(--muted)" → class="c-muted"
   ───────────────────────────────────────────────────────────────────────── */

/* Colors */
.c-dark      { color: var(--dark); }
.c-muted     { color: var(--muted); }
.c-body      { color: var(--body-text); }
.c-accent    { color: var(--terra-ink); }
.c-title     { color: var(--title-color); }
.c-subtitle  { color: var(--subtitle-color); }
.c-green     { color: var(--green-ink); }
.c-white     { color: #fff; }
.c-danger    { color: var(--danger); }
.c-inherit   { color: inherit; }

/* Background */
.bg-surface  { background: var(--surface); }
.bg-surface2 { background: var(--surface-2); }
.bg-card     { background: var(--surface-card); }
.bg-white    { background: #fff; }
.bg-accent   { background: var(--terra); }
.bg-green    { background: var(--green); }
.bg-none     { background: none; }

/* Display & Flex */
.d-none      { display: none; }
.d-block     { display: block; }
.d-grid      { display: grid; }
.flex-col    { flex-direction: column; }
.flex-wrap   { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.items-start { align-items: flex-start; }
.items-end   { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

/* Spacing */
.mt-0        { margin-top: 0; }
.mb-0        { margin-bottom: 0; }
.mt-auto     { margin-top: auto; }
.ml-auto     { margin-left: auto; }
.p-0         { padding: 0; }
.px-1        { padding-left: .5rem; padding-right: .5rem; }
.px-2        { padding-left: 1rem; padding-right: 1rem; }
.py-1        { padding-top: .5rem; padding-bottom: .5rem; }
.py-2        { padding-top: 1rem; padding-bottom: 1rem; }

/* Borders */
.rounded-sm  { border-radius: var(--radius-sm); }
.rounded-md  { border-radius: var(--radius-md); }
.rounded-lg  { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }
.border-rule { border: 1px solid var(--rule); }
.border-0    { border: none; }
.divider     { border-top: 1px solid var(--rule); }

/* Width */
.w-full      { width: 100%; }
.max-w-none  { max-width: none; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Image utilities */
.img-cover { width: 100%; height: 100%; object-fit: cover; }
.img-contain { width: 100%; height: 100%; object-fit: contain; }

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

/* ── Recipe/Meal hero badges & tags (global) ──────────────────────────────── */
.recipe-hero-badge, .meal-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: var(--fs-meta);
  font-weight: 600;
  background: color-mix(in srgb, var(--terra) 12%, var(--surface));
  /* v3.7.862: was --terra-dark, a FIXED 50% darkening, so a pale Primary gave
     a badge you could not read. --terra-ink is the auto-contrasted one. */
  color: var(--terra-ink);
  border: 1px solid color-mix(in srgb, var(--terra) 25%, transparent);
}
.recipe-hero-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-meta);
  font-weight: 500;
  border: 1px solid var(--rule);
}

/* ── Shopping list view modes ─────────────────────────────────────────────── */
.sl-list-card.view-list {
  column-count: 1 !important;
}
.sl-list-card.view-list .category-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--rule);
}
.sl-list-card.view-list .category-section:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.sl-list-card.view-list .category-section:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  border-bottom: none;
}
.sl-list-card.view-list .category-header {
  grid-column: 1 / -1;
}
@media (max-width: 600px) {
  .sl-list-card.view-list .category-section { grid-template-columns: 1fr; }
}

/* ── My Kitchen → Stats (v3.7.789) ────────────────────────────────────────────
   Layout modelled on the original Meal Statistics page. Colours come from the
   Kitchen stat colour slots (--stat-c1 … --stat-c5), which are built from the
   member's Primary and Secondary colours. Text uses the Kitchen text roles.
   Markup: mykitchen.php · Data: classes/KitchenStats.php                      */
.ks {
  --ks-gap: 16px;
  --ks-tint: 12%;                    /* strength of icon tiles and count pills */
  --ks-thumb: 38px;                  /* meal thumbnail in the ranking lists */
  --ks-fav-min: 180px;               /* narrowest a Family Favourites card may get */
  --ks-lift: -2px;                   /* hover lift */
  --ks-legend-col: 160px;            /* narrowest a legend column may get before it falls back to one column */
  --ks-ctl: 28px;                    /* month switcher buttons; also keeps every card header the same height */
  --ks-scrim: rgba(0, 0, 0, .55);    /* vote badges that sit on top of photos */
  --ks-scrim-text: #fff;
  --ks-accent: var(--stat-c1, var(--terra));
}
.ks-c1 { --ks-accent: var(--stat-c1, var(--terra)); }
.ks-c2 { --ks-accent: var(--stat-c2, var(--terra)); }
.ks-c3 { --ks-accent: var(--stat-c3, var(--terra)); }
.ks-c4 { --ks-accent: var(--stat-c4, var(--terra)); }
.ks-c5 { --ks-accent: var(--stat-c5, var(--terra)); }

/* Headline numbers */
.ks-hero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ks-gap); margin-bottom: var(--ks-gap); }
.ks-hero-card,
.ks-callout {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
  min-width: 0;
}
.ks-hero-card:hover,
.ks-callout:hover,
.ks-fav:hover { transform: translateY(var(--ks-lift)); box-shadow: var(--shadow-md); }
.ks-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--fs-section);
  color: var(--ks-accent);
  background: color-mix(in srgb, var(--ks-accent) var(--ks-tint), transparent);
}
.ks-hero-text,
.ks-callout-text { min-width: 0; }
.ks-hero-text .tx-eyebrow { margin-top: 4px; }

/* Callouts */
.ks-callout {
  background: linear-gradient(135deg, color-mix(in srgb, var(--ks-accent) 8%, var(--surface)), var(--surface));
  border-color: color-mix(in srgb, var(--ks-accent) 25%, var(--rule));
}
.ks-callout-emoji { font-size: var(--fs-stat); line-height: 1; flex-shrink: 0; }
.ks-callout-title { margin-top: 2px; }

/* Card grids */
.ks-grid { display: grid; gap: var(--ks-gap); margin-bottom: var(--ks-gap); }
.ks-grid > .form-card { margin-bottom: 0; min-width: 0; }
.ks-grid-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ks-grid-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
/* Three cards in a row (v3.7.790). Tablets: two up, the third takes the full row. */
.ks-grid-cards3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ks > .form-card { margin-bottom: var(--ks-gap); }

.ks-card > .form-card-header { min-height: calc(var(--ks-ctl) + 28px); }
.ks-head-icon { color: var(--ks-accent); }
.ks-head-aside { margin-left: auto; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ks-pill { border: 1px solid var(--rule); background: var(--surface-2); border-radius: 99px; padding: 2px 10px; }

/* Charts */
.ks-chart { position: relative; width: 100%; height: 220px; }
.ks-chart-sm { height: 180px; }
/* A chart that grows to fill its card when the card beside it is taller */
.ks-card-fill { display: flex; flex-direction: column; }
.ks-card-fill > .form-card-body { flex: 1; display: flex; flex-direction: column; }
.ks-chart-fill { flex: 1 1 auto; height: auto; min-height: 220px; }
.ks-chart-fill.ks-chart-sm { min-height: 180px; }
.ks-chart-fill > canvas { position: absolute; inset: 0; }
.ks-donut { height: 160px; max-width: 200px; margin: 0 auto 14px; }
/* Legend in two columns, filled top-to-bottom then across (v3.7.791). Drops to one
   column by itself when the card is too narrow for two. */
.ks-legend { columns: var(--ks-legend-col) 2; column-gap: 24px; }
.ks-legend-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; break-inside: avoid; }
.ks-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.ks-legend-val { margin-left: auto; white-space: nowrap; }
.ks-nav-btn {
  width: var(--ks-ctl);
  height: var(--ks-ctl);
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ks-accent);
  font-size: var(--fs-meta);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--ease);
}
.ks-nav-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--ks-accent) var(--ks-tint), var(--surface)); }
.ks-nav-btn:disabled { opacity: .35; cursor: default; }
.ks-nav-label { min-width: 72px; text-align: center; }

/* Ranking lists */
.ks-rank {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
  transition: background .15s ease;
}
.ks-rank:last-child { border-bottom: none; }
a.ks-rank:hover { background: var(--surface-2); }
.ks-rank-num { min-width: 22px; text-align: center; flex-shrink: 0; }
.ks-rank-medal { font-size: var(--fs-section); line-height: 1; }
.ks-rank-thumb { width: var(--ks-thumb); height: var(--ks-thumb); border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.ks-rank-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--ks-accent) 10%, var(--surface-2));
}
.ks-rank-main { flex: 1; min-width: 0; display: block; }
.ks-rank-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ks-rank-side { flex-shrink: 0; white-space: nowrap; }
.ks-track { display: block; height: 4px; margin-top: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.ks-bar { display: block; height: 100%; width: var(--w, 0%); border-radius: 99px; background: var(--ks-accent); }
.ks-count {
  flex-shrink: 0;
  padding: 2px 9px;
  border-radius: 99px;
  white-space: nowrap;
  color: var(--ks-accent);
  background: color-mix(in srgb, var(--ks-accent) var(--ks-tint), transparent);
}

/* Family favourites */
.ks-favs { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--ks-fav-min), 1fr)); gap: var(--ks-gap); }
.ks-fav {
  display: block;
  color: inherit;
  text-decoration: none;
  background: var(--surface-card-solid);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
  min-width: 0;
}
.ks-fav-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  background: var(--surface-2);
  font-size: 3rem;                   /* placeholder emoji (decorative) */
}
.ks-fav-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ks-fav-votes { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; }
.ks-fav-vote {
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--ks-scrim);
  color: var(--ks-scrim-text);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
/* Keep emoji in colour inside role-styled text, whatever display font the Kitchen picks */
.ks-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-style: normal; }
.ks-fav-body { display: block; padding: 12px 14px; }
.ks-fav-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ks-fav-note { display: block; margin-top: 2px; }

/* Empty states */
.ks-empty { text-align: center; padding: 28px 16px; }
.ks-empty-icon { display: block; font-size: var(--fs-stat); line-height: 1; margin-bottom: 8px; opacity: .7; }

/* Entrance + bar animation. Only switched on by the page script, and never
   when the visitor has asked for reduced motion. */
@keyframes ks-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ks-anim .ks-reveal:not(.ks-in) { opacity: 0; }
.ks-anim .ks-reveal.ks-in { animation: ks-rise .45s ease backwards; animation-delay: var(--d, 0ms); }
.ks-anim .ks-bar { width: 0; transition: width 1.1s cubic-bezier(.4, 0, .2, 1) .15s; }
.ks-anim .ks-in .ks-bar { width: var(--w, 0%); }

@media (max-width: 1100px) {
  .ks-grid-cards3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ks-grid-cards3 > .form-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .ks-hero    { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ks-grid-21 { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .ks { --ks-gap: 12px; --ks-fav-min: 140px; }
  .ks-grid-3, .ks-grid-cards3 { grid-template-columns: 1fr; }
  .ks-hero-card { padding: 14px; gap: 10px; }
  .ks-hero-icon { width: 40px; height: 40px; border-radius: 12px; }
  .ks-rank { padding: 9px 14px; gap: 10px; }
}

/* ── List › Autofill Lists tab (v3.7.792) ─────────────────────────────────────
   Markup and script: shopping-list.php · Data: classes/AutofillLists.php
   Text uses the Kitchen text roles; colours come from the member's palette.   */
.al-page {
  --al-gap: var(--side-gap, 16px);
  /* v3.7.860: the shared sidebar width and page rhythm, so this tab lines up with
     the three beside it instead of keeping its own 320px and its own padding. */
  --al-side: var(--side-w);
  --al-tap: 44px;                    /* smallest comfortable touch target */
  --al-tint: 14%;                    /* strength of the selected-row tint */
  padding-top: var(--page-pad-y);
  padding-bottom: var(--page-pad-b);
  /* ── v3.7.882. The sidebar starts level with the header bar ──────────────
     Bex: "the sidebar still isn't level with the autofill lists card".
     It could not be. .al-head is a SIBLING of .al-layout and the sidebar lives
     INSIDE .al-layout, so the sidebar's row begins where the header bar ends.
     872 worked around it by reserving the sidebar's width on .al-head with a
     margin-right — the design already saying where the sidebar belongs.

     The page is a two-column grid now and .al-layout is display:contents, so
     its children become grid items directly. Nothing moves in the markup: the
     sidebar simply spans both rows of column 2 and reaches the top. The
     margin-right hack is withdrawn with it. */
  /* v3.7.886: back to a plain two-column flex. 882 had to make this a grid
     with .al-layout as display:contents, because the header bar was a sibling
     of the row the sidebar lived in and could not otherwise reach the top. The
     aside is a direct child of .al-page now, so the sidebar is simply the
     second column and all of that machinery comes out. */
  display: flex;
  align-items: flex-start;
  gap: var(--al-gap);
}
/* The card that holds the bar and the main column. */
.al-wrap { flex: 1 1 auto; min-width: 0; overflow: hidden; }
/* v3.7.871 — Bex: "the top header bar, should not be full width, it should be on
   the left side not covering the siebar on the right".
   .al-head is a SIBLING of .al-layout, not inside it, so it spanned the whole
   page while the sidebar sat in the row beneath — the bar ran on past the main
   column and over the sidebar's width. Reserving the sidebar's width (plus the
   column gap) on the right lines it up with the main column exactly, without
   moving the markup into the flex row, where it would have become a third
   column and fought the layout. */
/* v3.7.875: Bex, arrow pointing at the space under the Autofill header card -
   "remove space between cards", and beside the sidebar - "align top". The
   margin-bottom is what held the header card off the one below it; the sidebar
   sat lower because the header reserved its own bottom margin above it. Both
   come from --al-gap, so it is one change, not two. The right-hand margin is
   untouched: that is what keeps the bar left of the sidebar rather than running
   under it, which was the 872 fix. */
/* v3.7.882: the margin-right is gone. It reserved the sidebar's width on a row
   the sidebar was not in — 872's workaround for .al-head being a sibling of the
   layout row. The grid on .al-page and .fn-page puts the sidebar in its own
   column, so there is nothing left to reserve. Only those two pages use this
   bar (checked), so it goes rather than being overridden twice. */
.al-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 24px; margin-bottom: 0; }
/* v3.7.872: fallbacks because .al-head is now a reusable bar — Notes borrows it
   for "Family Notes". Without them the calc() references an undefined variable
   off its own page, the whole declaration is invalid, and the bar silently runs
   full width under that page's sidebar. Notes reserves its own sidebar instead. */
.al-head-text { flex: 1 1 320px; min-width: 0; }
.al-intro { margin: 6px 0 0; max-width: 640px; }
/* .al-layout is display:contents on this page (see .al-page). These flex
   declarations are kept because the block is reused, and are harmless on a
   box that is not generating one. The grid placement below is what positions
   the children. */
/* v3.7.886: .al-layout is the card body now, not a row. The flex that used to
   sit the sidebar beside the editor is gone with the restructure. */
.al-layout { display: block; }
.al-side { flex: 0 0 var(--al-side); width: var(--al-side); overflow: hidden; }
.al-editor, .al-empty { flex: 1 1 auto; min-width: 0; }
/* v3.7.882: column 2, both rows — this is what puts the sidebar level with the
   header bar. The main column takes row 2 by auto-placement. */
/* v3.7.886: .al-layout is the card's body now — the two sections stack in it,
   so it needs no row of its own. The aside is placed by .al-page's flex. */
.al-page > .al-side { flex: 0 0 var(--side-w); }
.al-editor { animation: al-rise .2s ease-out; }
@keyframes al-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* v3.7.891 — Bex marked "add padding" on the no-list state: the dashed box was
   drawn tight around its text because .pf-empty only ever carried the dashes, and
   the card's own block padding is outside the box, not inside it. .al-empty is the
   same component one page over, so it is shared rather than measured again. */
.al-empty,
.pf-empty { padding: 48px 24px; text-align: center; border-style: dashed; }
.al-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Your lists */
.al-lists { display: flex; flex-direction: column; gap: 2px; padding: 6px; }
.al-lists-empty { padding: 18px 10px; text-align: center; margin: 0; }
.al-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  min-height: 56px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.al-list:hover { background: color-mix(in srgb, var(--terra) 12%, transparent); }
.al-list.is-on {
  background: color-mix(in srgb, var(--terra) var(--al-tint), transparent);
  box-shadow: inset 0 0 0 2px var(--terra);
}
.al-list-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.al-side-foot { padding: 10px 12px 14px; border-top: 1px solid var(--rule); }
.al-new {
  width: 100%;
  min-height: var(--al-tap);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  /* v3.7.886: was 1.5px dashed var(--muted) on a transparent face — a
     placeholder slot rather than a control. Button #2 now, so it reads as the
     real button it is. The width and tap target below are unchanged. */
  border: var(--btn-border-w) solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface-card-solid);
  color: var(--dark);
  font-weight: 700;
  cursor: pointer;
  transition: var(--ease);
}
/* The old hover's tell was border-style: solid, which says nothing now that the
   border is solid at rest. Button #2's own hover instead. */
.al-new:hover { background: color-mix(in srgb, var(--terra) 8%, var(--surface-card-solid)); border-color: color-mix(in srgb, var(--terra) 35%, var(--rule)); }

/* Editor */
/* v3.7.890: .pf-block joins this rather than restating it. Prep & Freeze is one
   card with ruled sections now, the same arrangement as Autofill Lists, so it is
   the same component. One declaration, two pages. */
.al-block,
.pf-block { padding: 18px 20px; border-bottom: 1px solid var(--rule); }
.pf-block:last-child { border-bottom: none; }
.pf-block-label { display: block; margin-bottom: 10px; }
.al-label { display: block; margin-bottom: 8px; }
/* v3.7.891: .pf-name-input joins this. The --al-tap FALLBACK is load-bearing and
   not decoration: --al-tap is declared on .al-page (app.css:3911) and Prep & Freeze
   is not that page, so without it the variable is undefined, the whole declaration
   is invalid, and the field silently loses its touch target. This is 872's lesson
   about borrowing .al-head off its own page, arriving a second time. */
.al-name,
.pf-name-input { max-width: 420px; min-height: var(--al-tap, 44px); font-weight: 600; }
.al-search { max-width: 420px; min-height: var(--al-tap); margin-bottom: 8px; }
.al-hint { margin: 8px 0 0; color: var(--muted); }
.al-overlap { margin: 10px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.al-days { display: flex; flex-wrap: wrap; gap: 8px; }
.al-day {
  min-width: 64px;
  min-height: var(--al-tap);
  padding: 0 12px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface-card-solid);
  font-weight: 700;
  cursor: pointer;
  transition: var(--ease);
}
.al-day:hover:not(:disabled) { border-color: var(--terra-ink); }
.al-day.is-on {
  border-color: var(--terra-ink);
  background: color-mix(in srgb, var(--terra) 24%, var(--surface-card-solid));
  box-shadow: inset 0 0 0 1px var(--terra);
}
.al-day:disabled { cursor: default; opacity: .75; }
.al-meals-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.al-meals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; }
.al-meal {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--al-tap);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s ease;
}
.al-meal:hover { background: color-mix(in srgb, var(--terra) 12%, transparent); }
.al-meal input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--terra-ink); }
.al-meal-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-foot, .al-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 20px 18px; }
/* .btn and the flex rows above set their own display, which would beat the hidden attribute */
.al-page [hidden] { display: none !important; }
.al-spacer { flex: 1 1 auto; }
.al-confirm { background: var(--surface-2); border-radius: 0 0 var(--radius-md) var(--radius-md); }
.al-confirm-text { flex: 1 1 240px; font-weight: 600; }

@media (max-width: 900px) {
  .al-layout { flex-direction: column; }
  /* The sidebar stacks under the content here, so there is no column to avoid. */
  .al-side { flex: 0 0 auto; width: 100%; }
  .al-editor, .al-empty { width: 100%; }
  /* v3.7.886: one column here. A flex column needs only the direction. */
  .al-page { flex-direction: column; }
  .al-page > .al-side { flex: 0 0 auto; width: 100%; }
}
@media (max-width: 600px) {
  .al-meals { grid-template-columns: minmax(0, 1fr); }
  .al-block { padding: 16px 14px; }
  .al-foot, .al-confirm { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { .al-editor { animation: none; } }

/* ── Grid › Autofill panel and Undo bar (v3.7.793) ────────────────────────────
   Markup: includes/autofill_panel.php · Script: assets/js/autofill.js
   Engine: classes/Autofill.php. Text uses the Kitchen text roles.             */
.afp-anchor { position: relative; height: 0; z-index: 60; }
.afp {
  --afp-w: 380px;
  --afp-tap: 44px;                   /* smallest comfortable touch target */
  --afp-tint: 14%;                   /* strength of the selected-state tint */
  position: absolute;
  top: 8px;
  right: 8px;
  width: var(--afp-w);
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  background: var(--surface-card-solid);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: afp-rise .16s ease-out;
}
.afp[hidden], .afp [hidden], .afp-undo[hidden] { display: none !important; }
@keyframes afp-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.afp-head { display: flex; align-items: center; gap: 8px; padding: 8px 6px 6px 18px; }
.afp-title { flex: 1 1 auto; margin: 0; }
.afp-icon-btn {
  width: var(--afp-tap, 44px);
  height: var(--afp-tap, 44px);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: var(--ease);
}
.afp-icon-btn:hover { background: var(--surface-2); color: var(--dark); }

/* Use my lists / Surprise me */
.afp-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin: 0 16px; padding: 4px; border-radius: var(--radius-md); background: var(--surface-2); }
.afp-mode {
  min-height: var(--afp-tap);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  transition: var(--ease);
}
.afp-mode.is-on { background: var(--surface-card-solid); box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--terra); }

.afp-section { display: flex; flex-direction: column; padding: 10px 10px 4px; }
.afp-section-range { gap: 8px; padding: 12px 16px 10px; border-top: 1px solid var(--rule); }
.afp-note { margin: 6px 8px 8px; color: var(--muted); }
.afp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s ease;
}
.afp-row:hover { background: var(--surface-2); }
.afp-row input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--terra-ink); }
.afp-row-text { display: flex; flex-direction: column; min-width: 0; }
.afp-row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afp-row-rest { margin-top: 6px; border-top: 1px solid var(--rule); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.afp-link { align-self: flex-start; display: inline-flex; align-items: center; min-height: var(--afp-tap); padding: 0 8px; font-weight: 600; }

.afp-ranges { display: flex; flex-wrap: wrap; gap: 6px; }
.afp-range {
  min-height: var(--afp-tap);
  padding: 0 14px;
  border: 1.5px solid var(--rule);
  border-radius: 99px;
  background: var(--surface-card-solid);
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease);
}
.afp-range:hover { border-color: var(--terra-ink); }
.afp-range.is-on { border-color: var(--terra-ink); background: color-mix(in srgb, var(--terra) var(--afp-tint), var(--surface-card-solid)); box-shadow: inset 0 0 0 1px var(--terra); }
.afp-summary { margin: 0; min-height: 2.6em; }
.afp-foot { display: flex; gap: 8px; padding: 4px 16px 16px; }
.afp-run { flex: 1 1 auto; justify-content: center; min-height: 46px; }
.afp-run:disabled { opacity: .5; cursor: default; }
.afp-foot .btn-secondary { min-height: 46px; }

/* Undo bar, shown above the calendar after a run */
.afp-undo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 4px 4px 4px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--terra) 35%, var(--rule));
  background: color-mix(in srgb, var(--terra) var(--afp-tint, 14%), var(--surface-card-solid));
  animation: afp-rise .25s ease-out;
}
.afp-undo-icon { color: var(--terra-ink); }
.afp-undo-text { flex: 1 1 auto; font-weight: 600; }

@media (max-width: 767px) {
  /* Phones: the panel slides up from the bottom */
  .afp { position: fixed; top: auto; right: 0; bottom: var(--bottom-nav-h, 68px); left: 0; width: auto; max-width: none; max-height: calc(100vh - var(--bottom-nav-h, 68px) - 56px); overflow-y: auto; border-radius: var(--radius-md) var(--radius-md) 0 0; }
}
@media (prefers-reduced-motion: reduce) { .afp, .afp-undo { animation: none; } }

/* ── Grid page (v3.7.794) ─────────────────────────────────────────────────────
   Page: grid.php · Calendar markup: includes/grid_board.php · Script: assets/js/grid.js
   .gb- toolbar and calendar · .gl- List view · .gp- quick picker · .gk- colour key · .gt- meal tray
   Text uses the Kitchen text roles; colours come from the member's palette.
   --chip is the member's colour for an entry type, set inline per chip.        */
.gb-page {
  --gb-gap: 20px;
  --gb-tray-w: 264px;                /* width of the meal tray */
  --gb-tap: 44px;                    /* smallest comfortable touch target */
  --gb-cell-h: clamp(104px, 14vh, 132px);
  --gb-tint: 12%;                    /* strength of a chip's colour wash */
  --gb-tint-hover: 22%;
  --gb-accent-tint: 14%;             /* today, and a day being dragged over */
  --gb-past: .6;                     /* how far past days are dimmed */
  --gb-card: var(--surface-card-solid, #fff);
  --gb-on-accent: var(--surface-header-text, #fff);
  --gb-scrim: rgba(0, 0, 0, .45);    /* behind the picker on phones */
  --gp-w: 320px;                     /* quick picker width */
  --gp-list-h: clamp(132px, 30vh, 236px);
  --gp-chip-h: 40px;
  --gl-day-w: 52px;
  --gb-eye: 26px;                    /* the "view the day" eye */
  --gb-eye-inset: 4px;               /* how far the eye tucks into the day's bottom right corner */
  --gl-thumb: 40px;                  /* the photo square: list view, calendar days, tray (v3.7.800) */
  --gb-thumb: 36px;
  --gt-thumb: 32px;
  --chip: var(--chip-meal, var(--terra));
  --gb-foot: 56px;                   /* the fixed footer bar: sticky and floating parts stay clear of it */
  /* v3.7.859: on the shared page rhythm. It was 16px 20px 32px, which made the
     Grid sit noticeably tighter to the edge than every other page on a wide
     screen — the inconsistency Bex caught with the inspector. */
  --gb-pad: var(--page-pad-y) var(--page-pad-x) var(--page-pad-b);
  width: 100%;
  box-sizing: border-box;
  padding: var(--gb-pad);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--gb-tray-w);
  gap: var(--gb-gap);
  align-items: start;
}
.gb-page.is-viewer { grid-template-columns: minmax(0, 1fr); }
.gb-page [hidden] { display: none !important; }
.gb-page :focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; }
.gb-main { min-width: 0; }

/* Toolbar */
.gb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 14px; }
.gb-month { display: flex; align-items: center; gap: 8px; }
.gb-month-title { white-space: nowrap; }
.gb-arrow {
  width: var(--gb-tap);
  height: var(--gb-tap);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* v3.7.881: Bex — "can we add a small border around the </> buttons (button #2
     style)". Button #2 is --btn-border-w of --rule on a white face, so both come
     from the same tokens here rather than a 1px literal.
     v3.7.882: --rule is the Primary at 20%, which measures 1.18 against a white
     face. That is fine on "Shop this week", a wide button with text, and
     invisible on a 44px circle — Bex, looking at 881: "the </> buttons need the
     border added". Copying button #2 faithfully was never going to show here.
     The colour is now the 40% mix the view toggle uses (1.42), which is the
     same decision 867 made for the same reason: a small control needs more. */
  border: var(--btn-border-w) solid color-mix(in srgb, var(--terra) 40%, var(--surface-card-solid));
  border-radius: 50%;
  background: var(--gb-card);
  color: var(--dark);
  text-decoration: none;
  transition: var(--ease);
}
.gb-arrow:hover { border-color: var(--terra-ink); color: var(--dark); background: color-mix(in srgb, var(--terra) var(--gb-accent-tint), var(--gb-card)); }
.gb-progress { flex: 1 1 160px; min-width: 150px; display: flex; flex-direction: column; gap: 6px; }
.gb-progress-text strong { font-weight: 700; color: var(--dark); }
.gb-progress-track { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.gb-progress-fill { height: 100%; border-radius: 99px; background: var(--terra); transition: width .35s ease; }
.gb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.gb-btn { min-height: var(--gb-tap); }
.gb-views { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--dark); }
.gb-view {
  min-height: calc(var(--gb-tap) - 6px);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease);
}
.gb-view.is-on { background: var(--gb-card); box-shadow: var(--shadow-sm); }
.gb-note { margin: 0 0 14px; }

/* Calendar card */
.gb-wrap { position: relative; }
.gb { background: var(--gb-card); border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; transition: opacity .15s ease; }
.gb-page.is-busy .gb { opacity: .7; pointer-events: none; }
.gb[data-view="list"] .gb-grid, .gb[data-view="grid"] .gl { display: none; }
/* v3.7.870 — Bex: "make the BG on the weekdays a little less transparent."
   It was never transparent: --surface is color-mix(--terra 7%, --page-bg), fully
   opaque, but at 7% it lands around 96% white and simply does not register as a
   band against the card. Measured in the browser before changing it rather than
   reasoning from the cascade — every layer here turned out opaque, so adding
   alpha would have been fixing the wrong thing.

   It now composes over --surface-card-solid like the rest of the 868/869 tint
   family, so it behaves the same whatever Primary and page colour the member
   picks, instead of drifting with --page-bg. Its own token so it can be nudged
   without dragging --surface (progress tracks, chips, hovers) along with it. */
.gb-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--gb-week-bg); border-bottom: 2px solid var(--gb-week-rule); }
.gb-wd { padding: 10px 4px; text-align: center; }
.gb-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--rule); container: gb-cal / inline-size; }
.gb-blank { min-height: var(--gb-cell-h); background: color-mix(in srgb, var(--surface) 55%, var(--gb-card)); }
.gb-cell {
  min-height: var(--gb-cell-h);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--gb-card);
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.gb-page.is-viewer .gb-cell { cursor: default; }
.gb-cell.is-past { background: color-mix(in srgb, var(--surface) 35%, var(--gb-card)); }
.gb-cell.is-past .gb-cell-top, .gb-cell.is-past .gb-chip, .gb-cell.is-past .gb-cell-foot { opacity: var(--gb-past); }
.gb-cell.is-today {
  background: color-mix(in srgb, var(--terra) 7%, var(--gb-card));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--terra) 65%, var(--gb-card));
}
.gb-cell.is-open, .gb-cell.is-over { box-shadow: inset 0 0 0 2px var(--terra); }
.gb-cell.is-over { background: color-mix(in srgb, var(--terra) var(--gb-accent-tint), var(--gb-card)); }
.gb-cell-top { display: flex; align-items: center; gap: 6px; flex-shrink: 0; min-height: 26px; color: var(--dark); }
.gb-num {
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  font-weight: 700;
}
.gb-cell.is-today .gb-num { background: var(--terra); color: var(--gb-on-accent); }
.gb-extra {
  width: 24px;
  height: 24px;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--surface);
  color: var(--dark);
}
button.gb-extra { cursor: pointer; transition: var(--ease); }
button.gb-extra:hover { border-color: var(--terra-ink); }
.gb-num + .gb-extra, .gb-tonight + .gb-extra { margin-left: auto; }

/* "View the day": an eye on any day with something planned (v3.7.795). On the calendar it closes
   the day, bottom right, so a day reads number, dinner, full day (v3.7.809); in List view it ends the row. */
.gb-cell-foot { margin: auto calc(var(--gb-eye-inset) * -1) calc(var(--gb-eye-inset) * -1) 0; flex-shrink: 0; display: flex; justify-content: flex-end; }
.gb-cell-foot .gb-eye { margin-top: calc(var(--gb-eye-inset) * -1); }      /* tucked up too, so the eye costs a week as little height as it can */
.gb-eye {
  width: var(--gb-eye);
  height: var(--gb-eye);
  flex-shrink: 0;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: var(--fs-small);
  text-decoration: none;
  transition: var(--ease);
}
.gb-eye:hover { background: color-mix(in srgb, var(--terra) var(--gb-accent-tint), var(--gb-card)); color: var(--dark); }
.gl-row .gb-eye { align-self: center; }

/* A planned dinner */
.gb-dot { width: 9px; height: 9px; flex-shrink: 0; margin-top: 5px; border-radius: 50%; background: var(--chip); }
.gb-chip {
  width: 100%;
  min-height: var(--gb-tap);
  padding: 8px 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--chip) var(--gb-tint), var(--gb-card));
  color: var(--dark);
  text-decoration: none;
  transition: background .15s ease, opacity .15s ease;
}
.gb-chip:hover { background: color-mix(in srgb, var(--chip) var(--gb-tint-hover), var(--gb-card)); color: var(--dark); }
.gb-chip[draggable="true"], .gl-pill[draggable="true"] { cursor: grab; }
.gb-chip[draggable="true"]:active, .gl-pill[draggable="true"]:active { cursor: grabbing; }
.gb-chip-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gb-chip-kind, .gl-kind { opacity: .75; }
.gb-chip-title {
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: break-word;
}
/* The day's note, on the dinner itself (v3.7.809). After a bare type it reads on inside the title and is
   cut short with it (Take-out: "Pizza"); under a meal's name it gets one line of its own. */
.gb-quote { font-weight: 400; }
.gb-chip-note { margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-chip.is-new, .gl-pill.is-new { animation: gb-pop .22s ease-out; }
.is-dragging { opacity: .45; }
@keyframes gb-pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

/* An open day */
.gb-plan {
  flex: 1 1 auto;
  width: 100%;
  min-height: var(--gb-tap);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px dashed color-mix(in srgb, var(--muted) 45%, var(--gb-card));
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, border-color .15s ease, color .15s ease;
}
.gb-cell:hover .gb-plan, .gb-plan:focus-visible, .is-open .gb-plan, .gb-page.is-dragging-on .gb-plan { opacity: 1; }
.gb-plan:hover { border-color: var(--terra-ink); color: var(--dark); }
@media (hover: none) { .gb-plan { opacity: 1; } }

/* List view: two columns that read down, then across */
.gl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(var(--gl-half, 16), auto);
  grid-auto-flow: column;
  gap: 1px;
  background: var(--rule);
}
.gl-fill { background: var(--gb-card); }
.gl-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: var(--gb-card);
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.gb-page.is-viewer .gl-row { cursor: default; }
.gl-row.is-past { background: color-mix(in srgb, var(--surface) 35%, var(--gb-card)); }
.gl-row.is-past .gl-day, .gl-row.is-past .gl-pill { opacity: var(--gb-past); }
.gl-row.is-today { background: color-mix(in srgb, var(--terra) 7%, var(--gb-card)); box-shadow: inset 3px 0 0 var(--terra); }
.gl-row.is-open, .gl-row.is-over { box-shadow: inset 0 0 0 2px var(--terra); }
.gl-row.is-over { background: color-mix(in srgb, var(--terra) var(--gb-accent-tint), var(--gb-card)); }
.gl-day { width: var(--gl-day-w); flex-shrink: 0; padding-top: 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--dark); }
.gl-num { line-height: 1; }
.gl-entries { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.gl-pill {
  min-height: var(--gb-tap);
  padding: 6px 10px 6px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--chip) var(--gb-tint), var(--gb-card));
  color: var(--dark);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
}
.gl-pill:hover { background: color-mix(in srgb, var(--chip) var(--gb-tint-hover), var(--gb-card)); color: var(--dark); }
/* The photo square (markup: Thumbnail::tag). A photo when the meal has one, otherwise the icon of its type. */
.gl-thumb, .gb-thumb, .gt-thumb { flex-shrink: 0; border-radius: calc(var(--radius-sm) - 2px); object-fit: cover; }
.gl-thumb { width: var(--gl-thumb); height: var(--gl-thumb); }
.gb-thumb { width: var(--gb-thumb); height: var(--gb-thumb); margin-top: 1px; }
.gt-thumb { width: var(--gt-thumb); height: var(--gt-thumb); }
.gl-thumb-icon, .gb-thumb-icon, .gt-thumb-icon { display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--chip) var(--gb-tint-hover), var(--gb-card)); color: var(--chip); }
.gb-thumb-icon, .gt-thumb-icon { font-size: var(--fs-meta); }
/* Calendar narrower than 1100px (days under about 157px): the square steps aside so the meal's name keeps
   its room, and the dinner carries its colour as an edge instead. The calendar's own width, not the screen's. */
@container gb-cal (max-width: 1099px) {
  .gb-chip { border-left: 3px solid var(--chip); }
  .gb-thumb { display: none; }
}
.gl-text { min-width: 0; display: flex; flex-direction: column; }
.gl-title, .gl-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-none { padding: 12px 0; color: var(--muted); }
.gl-row .gb-plan { flex: 0 0 auto; opacity: 1; }

/* Quick picker */
.gp-scrim { display: none; }
.gp {
  position: absolute;
  z-index: 70;
  top: 0;
  left: 0;
  width: var(--gp-w);
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - var(--nav-h) - var(--gb-foot) - 32px);   /* a short window scrolls the picker, never hides part of it */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--gb-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--dark);
  animation: afp-rise .16s ease-out;
}
.gp > * { flex-shrink: 0; }
.gp-head { display: flex; align-items: center; gap: 8px; padding: 8px 6px 4px 16px; }
.gp-title { flex: 1 1 auto; margin: 0; }
.gp-times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0 12px 8px; padding: 4px; border-radius: var(--radius-sm); background: var(--surface-2); }
.gp-time { min-height: 36px; border: 0; border-radius: calc(var(--radius-sm) - 2px); background: transparent; font-weight: 600; cursor: pointer; transition: var(--ease); }
.gp-time.is-on { background: var(--gb-card); box-shadow: var(--shadow-sm); }
.gp-current {
  margin: 0 12px 8px;
  padding: 4px 4px 4px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--chip) var(--gb-tint), var(--gb-card));
}
.gp .gb-dot, .gk .gb-dot { margin-top: 0; }
.gp-current-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gp-current-kind { opacity: .75; }
.gp-current-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-remove { min-height: var(--gb-tap); padding: 0 12px; flex-shrink: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--danger); font-weight: 700; cursor: pointer; transition: var(--ease); }
.gp-remove:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.gp-search { padding: 0 12px 8px; }
.gp-search .form-control, .gt-head .form-control { min-height: var(--gb-tap); }
.gp-list { max-height: var(--gp-list-h); padding: 0 6px; display: flex; flex-direction: column; overflow-y: auto; }
.gp-row {
  min-height: var(--gb-tap);
  padding: 4px 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.gp-row:hover { background: var(--surface); }
.gp-row.is-current { background: color-mix(in srgb, var(--chip) var(--gb-tint), var(--gb-card)); }
.gp-row-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.gp-row-meta { flex-shrink: 0; }
.gp-row-check { flex-shrink: 0; color: var(--chip); }
.gp-none { margin: 0; padding: 12px 10px; color: var(--muted); }
.gp-types { margin-top: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--rule); }
.gp-type-row { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-type {
  min-height: var(--gp-chip-h);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 99px;
  background: color-mix(in srgb, var(--chip) var(--gb-tint), var(--gb-card));
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease);
}
.gp-type:hover { background: color-mix(in srgb, var(--chip) var(--gb-tint-hover), var(--gb-card)); }
.gp-noteform { padding: 0 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.gp-noteform-row { display: flex; gap: 6px; }
.gp-noteform-row .form-control { min-width: 0; }
.gp-links { padding: 0 8px 8px; display: flex; flex-wrap: wrap; gap: 0 4px; }
.gp-link, .gp-back {
  min-height: var(--gb-tap);
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--dark);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.gp-link:hover, .gp-back:hover { color: var(--dark); background: var(--surface); }
.gp-back { margin: 0 8px; text-decoration: none; }
.gp-sub-label { padding: 4px 16px 8px; }
.gp-sub-empty { margin: 0; padding: 4px 16px 16px; color: var(--muted); }
.gp-subnote-hint { margin: 0; color: var(--muted); }
#gpStepSub .gp-list { padding-bottom: 8px; }

/* Colour key */
.gk {
  margin-top: 14px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  background: var(--gb-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  color: var(--dark);
}
.gk-label { margin-right: 4px; }
.gk-item { padding: 6px 12px; display: inline-flex; align-items: center; gap: 7px; border-radius: 99px; background: color-mix(in srgb, var(--chip) var(--gb-tint), var(--gb-card)); font-weight: 600; }
/* v3.7.858: was an underlined text link, which gave a destructive action the
   same weight as a footnote. Now a real button in the caution style, matching
   the Autofill list delete. It still asks before clearing. */
.gk-clear { margin-left: auto; min-height: var(--gb-tap); padding: 0 14px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #fca5a5; border-radius: var(--radius-sm); background: #fee2e2; color: var(--danger-ink);
  font-family: var(--font-display); font-size: var(--fs-body); font-weight: 600; text-decoration: none; cursor: pointer; transition: var(--ease); }
.gk-clear:hover { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.gk-clear:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }
.gk-confirm { flex: 1 1 100%; padding-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; border-top: 1px solid var(--rule); }
.gk-confirm .tx-body { flex: 1 1 260px; }

/* Meal tray */
.gt {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  max-height: calc(100vh - var(--nav-h) - var(--gb-foot) - 32px);
  display: flex;
  flex-direction: column;
  background: var(--gb-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
  color: var(--dark);
}
.gt-head { padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--rule); }
.gt-title, .gt-hint { margin: 0; }
.gt-hint { color: var(--muted); }
.gt-list { min-height: 0; padding: 6px; display: flex; flex-direction: column; overflow-y: auto; }
.gt-meal { min-height: var(--gb-tap); padding: 6px 10px; flex-shrink: 0; display: flex; align-items: center; gap: 10px; border-radius: var(--radius-sm); cursor: grab; transition: background .15s ease, opacity .15s ease; }
.gt-meal:hover { background: var(--surface); }
.gt-meal:active { cursor: grabbing; }
.gt-grip { flex-shrink: 0; font-size: var(--fs-meta); color: color-mix(in srgb, var(--muted) 60%, transparent); }
.gt-meal-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.gt-count { flex-shrink: 0; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--terra) 16%, var(--gb-card)); }
.gt-empty { margin: 0; padding: 16px; color: var(--muted); }

@media (pointer: coarse) { .gb-page { --gp-chip-h: 44px; --gb-eye: 32px; } .gl-row .gb-eye { --gb-eye: var(--gb-tap); } }
@media (max-width: 1199px) {
  /* Narrower screens: the tray steps aside so the days keep their width; the picker still plans every day */
  .gb-page { grid-template-columns: minmax(0, 1fr); }
  .gt { display: none; }
}
@media (max-width: 1023px) {
  /* Tablets: days are narrow, so a dinner carries its colour as an edge and drops the photo square */
  .gb-cell { padding: 6px; }
  .gb-cell-top { flex-wrap: wrap; gap: 2px 4px; }
  .gb-cal .gb-chip { padding: 6px 8px; border-left: 3px solid var(--chip); }
  .gb-cal .gb-dot, .gb-cal .gb-thumb { display: none; }
  .gb-tonight { display: none; }
}
@media (max-width: 899px) {
  .gl { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; }
  .gl-fill { display: none; }
}
@media (max-width: 767px) {
  /* Phones: List view, and the picker slides up from the bottom */
  .gb .gb-grid { display: none !important; }
  .gb .gl { display: grid !important; }
  /* Phones are List view always, so the switch has nothing to offer. Both the
     old segmented control and the 871 toggle that replaced it are hidden. */
  .gb-views { display: none; }
  .gb-bar .mg-view-toggle { display: none; }
  .gb-bar { gap: 10px 12px; }
  /* v3.7.910: the month arrows move under the month name. Bex, 2 Nov: "the
     arrows to change the month might need to be moved to under the month name -
     currently not lines up right." They were pinned to the two ends of the row
     by `space-between`, so on a phone they sat in the far corners with the month
     floating between them, and at A++ the right-hand one was clipped by the
     screen edge (the 5px overflow fixed in v3.7.909).
     Title on its own line, the two arrows centred beneath it as a pair. They
     now read as one control rather than two pieces of furniture. */
  .gb-month { flex: 1 1 100%; flex-wrap: wrap; justify-content: center; row-gap: 6px; column-gap: 24px; }
  .gb-month .gb-month-title { flex: 1 1 100%; order: -1; text-align: center; }
  .gb-progress { flex-basis: 100%; }
  .gb-actions { flex: 1 1 100%; }
  .gb-actions .gb-btn { flex: 1 1 0; }
  .gk-clear { margin-left: 0; }
  .gp-scrim { display: block; position: fixed; inset: 0; z-index: 69; background: var(--gb-scrim); }
  .gp {
    position: fixed;
    top: auto !important;
    right: 0;
    bottom: var(--bottom-nav-h, 68px);
    left: 0 !important;
    width: auto;
    max-width: none;
    max-height: calc(100vh - var(--bottom-nav-h, 68px) - 56px);
    overflow-y: auto;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .gb-chip.is-new, .gl-pill.is-new, .gp { animation: none; }
  .gb-progress-fill, .gb, .gb-cell, .gl-row, .gb-plan { transition: none; }
}

/* ── Day page (v3.7.797) ──────────────────────────────────────────────────────
   Page: day.php · Markup: includes/day_view.php · Script: assets/js/day.js
   Text uses the Kitchen text roles; colours come from the member's palette.
   Reuses two Grid pieces as they are: .gb-arrow (round arrow) and .gb-dot (type dot).   */
.dy-page {
  --dy-gap: 20px;
  /* v3.7.884: value removed — :5319 sets --dy-side-w to --side-w and this 340px
     never applied. A stale number that reads as authoritative is worse than none. */
  --dy-side-w: var(--side-w);        /* the "Also today" and shopping column */
  --dy-photo-h: clamp(160px, 26vh, 260px);   /* photo height when it sits on top (narrow cards) */
  --dy-photo-w: clamp(280px, 42%, 520px);    /* photo width when it sits on the left (v3.7.799) */
  --dy-photo-ratio: 4 / 3;                   /* its shape on the left; it grows taller if the details are taller */
  --dy-done-h: 46px;                         /* "We made it" and "Not made after all" */
  --dy-box: 22px;                            /* the tick-box on a shopping item */
  --dy-tint: 12%;                    /* strength of a meal's colour wash */
  --dy-tint-hover: 22%;
  --dy-on-accent: var(--surface-header-text, #fff);
  --dy-pad: var(--page-pad-y) var(--page-pad-x) var(--page-pad-b);   /* v3.7.858: the shared page rhythm, was 16px 20px 40px */
  --gb-tap: 44px;                    /* the three tokens the reused Grid pieces read */
  --gb-card: var(--surface-card-solid, #fff);
  --gb-accent-tint: 14%;
  --chip: var(--chip-meal, var(--terra));
  width: 100%;                       /* full width, like the Grid (v3.7.798) */
  box-sizing: border-box;
  padding: var(--dy-pad);
}
.dy-page [hidden] { display: none !important; }
.dy-page :focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; }
.dy-page .gb-dot { margin-top: 0; }

/* Day bar */
.dy-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 16px; }
.dy-bar-day { display: flex; align-items: center; gap: 8px; }
.dy-date { text-align: center; }
.dy-page .dy-tonight { padding: 4px 12px; border-radius: 99px; background: var(--terra); color: var(--dy-on-accent); }
.dy-bar-grid { margin-left: auto; min-height: var(--gb-tap); }
.dy-link { display: inline-flex; align-items: center; min-height: var(--gb-tap); color: var(--dark); font-weight: 600; text-decoration: underline; }
.dy-link:hover { color: var(--dark); }
button.dy-link { padding: 0; border: 0; background: transparent; font-family: inherit; cursor: pointer; }
.dy-msg { margin: 0 0 14px; }                  /* message bar: same piece as the Grid's (.afp-undo) */
.dy-msg .afp-undo-text { font-weight: 500; }   /* it can run to a few lines here (what was taken off the pantry) */

/* Layout */
.dy { transition: opacity .15s ease; }
.dy-page.is-busy .dy { opacity: .7; pointer-events: none; }
.dy-cols { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--dy-gap); }
.dy-main { flex: 999 1 560px; min-width: 0; }
.dy-side { flex: 1 1 var(--dy-side-w); min-width: 0; display: flex; flex-direction: column; gap: var(--dy-gap); }
.dy-meal { display: flex; flex-direction: column; gap: 16px; animation: afp-rise .2s ease-out; }
.dy-card { background: var(--gb-card); border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; color: var(--dark); }

/* The meal. The photo sits on the left with the details beside it when the card is wide
   enough (v3.7.799); on a narrow card (phones, small tablets) it stays on top.
   A card without a photo shows a scene in the very same box (v3.7.814), so every day lines up:
   the two share these rules on purpose. Change the size in one place, --dy-photo-w / -h / -ratio. */
.dy-meal, .dy-frame { container: dy-meal / inline-size; }
.dy-photo-wrap, .dy-scene { height: var(--dy-photo-h); overflow: hidden; }
.dy-photo { display: block; width: 100%; height: 100%; object-fit: cover; }
.dy-hero-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
@container dy-meal (min-width: 680px) {      /* the card's own width, not the screen's */
  .dy-hero.has-photo, .dy-hero.has-scene { display: flex; align-items: stretch; }
  .dy-hero.has-photo .dy-photo-wrap, .dy-hero.has-scene .dy-scene { position: relative; flex: 0 0 var(--dy-photo-w); height: auto; aspect-ratio: var(--dy-photo-ratio); }
  .dy-hero.has-photo .dy-photo, .dy-hero.has-scene .dy-scene-img { position: absolute; inset: 0; }
  .dy-hero.has-photo .dy-hero-body, .dy-hero.has-scene .dy-hero-body { flex: 1 1 0; min-width: 0; }
}
.dy-eyebrow { display: flex; align-items: center; gap: 8px; }
.dy-title, .dy-sub, .dy-note, .dy-desc, .dy-voters { margin: 0; }
/* The dinner's own note: a small yellow sticky note, like the ones on the fridge door (v3.7.810) */
.dy-page .dy-note { align-self: flex-start; max-width: min(100%, 460px); padding: 10px 14px 12px; border-radius: 3px 3px 12px 3px; background: var(--fn-paper-note); color: var(--fn-ink); font-weight: 500; overflow-wrap: anywhere; box-shadow: 0 6px 10px -6px rgba(43, 33, 18, .45); transform: rotate(-.6deg); }
.dy-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
/* We made it (v3.7.801) */
.dy-page .dy-made { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; background: var(--terra); color: var(--dy-on-accent); }
.dy-done { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.dy-done .btn { min-height: var(--dy-done-h); }
.dy-made-by { margin: 0; }
/* ── G4-b: four sizes that were written into the HTML (v3.7.865) ──────────────────────────
   They are OFF the --fs- scale, so they are not tokens; snapping them to the nearest one would
   have moved pixels, which was Bex's call to make and she said move them, not change them. The
   values are exactly what was inline. Colours that come from PHP stay inline as custom
   properties - they are data, not styling.
   ──────────────────────────────────────────────────────────────────────────────────────── */

/* Cookbook: the little B / L / D pill on a meal card saying which slots it fills. */
.cb-slot-pill {
  /* Set inline, per pill, from PHP - so each carries a fallback for when it is not. */
  background: var(--slot-bg, var(--surface));
  color: var(--slot-fg, var(--body-text));
  border: 1px solid var(--slot-br, var(--rule));
  border-radius: 5px;
  padding: 2px 6px;
  /* v3.7.873: was .58rem = 9.28px, below every token in the scale including badge.
     Now on --fs-badge (.65rem), so the Default Theme's Badges slider reaches it. */
  font-size: var(--fs-badge);
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: .02em;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.cb-slot-pill-icon { font-size: .45rem; }

/* Cookbook: the scroll standing in for a community recipe with no picture.
   ONE class, not two, on purpose: the other copy of this is built inside an onerror attribute
   whose HTML cannot carry quotes, so it can only name a single class. */
.comm-card-img-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

/* My Kitchen: the icon on a feature card in the upgrade panel. */
.ks-feature-icon { font-size: 1rem; }

/* The pantry hint beside "We made it" (v3.7.865, D13). Same treatment as .dy-made-by. */
.dy-made-hint { margin: 0; }
.dy-else { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.dy-else-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dy-else-btn {
  min-height: var(--gb-tap);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--chip) var(--dy-tint), var(--gb-card));
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease);
}
.dy-else-btn:hover { border-color: var(--chip); background: color-mix(in srgb, var(--chip) var(--dy-tint-hover), var(--gb-card)); }
.dy-scale-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dy-scales { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--dark); }
.dy-scale {
  min-width: var(--gb-tap);
  min-height: calc(var(--gb-tap) - 6px);
  padding: 0 8px;
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  transition: var(--ease);
}
.dy-scale.is-on { background: var(--terra); color: var(--dy-on-accent); }
.dy-votes { padding-top: 14px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 8px; }
.dy-vote-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dy-vote {
  min-height: 46px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--gb-card);
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease);
}
.dy-vote:hover { border-color: var(--terra-ink); }
.dy-vote.is-on { border-color: var(--terra-ink); background: color-mix(in srgb, var(--terra) var(--gb-accent-tint), var(--gb-card)); box-shadow: inset 0 0 0 1px var(--terra); }
.dy-vote-count { min-width: 22px; padding: 1px 7px; border: 1px solid var(--rule); border-radius: 99px; background: var(--gb-card); font-weight: 700; text-align: center; }

/* Cook it */
.dy-cook { display: flex; flex-direction: column; gap: 12px; }
.dy-cook-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.dy-cook-title, .dy-recipe-title, .dy-side-title { margin: 0; }
.dy-recipe-head { padding: 12px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; background: var(--surface-card); border-bottom: 1px solid var(--rule); }
.dy-page .dy-order { width: 28px; height: 28px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--terra); color: var(--dy-on-accent); font-weight: 700; }
.dy-recipe-title { flex: 1 1 auto; }
.dy-recipe-body { display: flex; flex-wrap: wrap; }
.dy-ings { flex: 1 1 250px; min-width: 0; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.dy-ing-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.dy-ing { display: flex; align-items: baseline; gap: 10px; }
.dy-qty { min-width: 76px; flex-shrink: 0; font-weight: 700; }
.dy-ing-name { min-width: 0; }
.dy-steps { flex: 2 1 340px; min-width: 0; padding: 16px 14px 14px; display: flex; flex-direction: column; gap: 4px; border-left: 1px solid var(--rule); }
.dy-steps-full { border-left: 0; }
.dy-steps-label { padding: 0 6px 4px; }
.dy-step {
  min-height: var(--gb-tap);
  padding: 8px 6px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--dark);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.dy-step:hover { background: var(--surface); }
.dy-step-n { width: 26px; height: 26px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--terra); border-radius: 50%; background: var(--gb-card); font-weight: 700; transition: var(--ease); }
.dy-step-text { padding-top: 3px; }
.dy-step.is-done .dy-step-n { background: var(--terra); color: var(--dy-on-accent); }
.dy-step.is-done .dy-step-text { color: var(--muted); text-decoration: line-through; }
.dy-steps-none, .dy-recipe-notes { margin: 0; color: var(--muted); }
.dy-steps-none { padding: 0 6px; }
.dy-recipe-notes { padding: 12px 20px; border-top: 1px solid var(--rule); }

/* Also today */
.dy-also { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.dy-also-btn {
  min-height: 56px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--chip) var(--dy-tint), var(--gb-card));
  color: var(--dark);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.dy-also-btn:hover { background: color-mix(in srgb, var(--chip) var(--dy-tint-hover), var(--gb-card)); }
.dy-also-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.dy-also-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dy-also-go { flex-shrink: 0; color: var(--muted); font-size: var(--fs-meta); }

/* Shopping for this day */
.dy-shop-head { padding: 16px 16px 12px; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--rule); }
.dy-shop-count { margin: 0; }
.dy-shop-count strong { font-weight: 700; color: var(--dark); }
.dy-shop-list { padding: 4px 16px 10px; display: flex; flex-direction: column; }
.dy-shop-cat { padding: 12px 0 4px; }
/* An item is a tick-box the size of the whole row (v3.7.802): saved for the household, shared with the Shopping List */
.dy-shop-item {
  width: 100%;
  min-height: var(--gb-tap);
  padding: 7px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
  background: transparent;
  color: var(--dark);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.dy-shop-box { width: var(--dy-box); height: var(--dy-box); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--terra); border-radius: 6px; background: var(--gb-card); color: transparent; font-size: var(--fs-meta); transition: var(--ease); }
.dy-shop-item:hover .dy-shop-box { background: color-mix(in srgb, var(--terra) var(--gb-accent-tint), var(--gb-card)); }
.dy-shop-item.is-ticked .dy-shop-box { background: var(--terra); color: var(--dy-on-accent); }
.dy-shop-item.is-ticked .dy-shop-name { color: var(--muted); text-decoration: line-through; }
.dy-shop-item.is-ticked .dy-shop-qty { color: var(--muted); }
.dy-shop-name { flex: 1 1 auto; min-width: 0; }
.dy-shop-item.is-covered .dy-shop-name { color: var(--muted); }
.dy-shop-none { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.dy-shop-badge { flex-shrink: 0; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--terra) 16%, var(--gb-card)); }
.dy-shop-badge.is-out { background: color-mix(in srgb, var(--danger) 14%, var(--gb-card)); }
.dy-shop-qty { flex-shrink: 0; font-weight: 700; }
.dy-shop-foot { padding: 2px 16px 6px; border-top: 1px solid var(--rule); }

/* A day with nothing to cook (v3.7.812): Take-out, Eating Out and the like, or nothing planned at all.
   A scene stands where a meal's photo would be: Pip when his picture has been uploaded
   (assets/img/pip-<type>.png), otherwise the type's icon. A meal with no photo yet gets the same scene (v3.7.813).
   The scene is exactly the size and place of a photo (v3.7.814): its box is set with the photo's, above;
   here is only what it looks like inside. */
.dy-page { --dy-scene-pad: 16px; --dy-scene-icon: clamp(56px, 9cqi, 112px); }   /* room around Pip; the icon grows with the card */
.dy-scene { display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--chip) var(--dy-tint), var(--gb-card)); }
.dy-scene-img { width: 100%; height: 100%; padding: var(--dy-scene-pad); box-sizing: border-box; object-fit: contain; }
.dy-scene-icon { font-size: var(--dy-scene-icon); color: var(--chip); }
.dy-quiet-line { margin: 0; }
.dy-empty { --chip: var(--muted); }

/* Coming up: the next dinners, where the day's shopping would be */
.dy-coming { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.dy-coming-item { min-height: 56px; padding: 6px 12px 6px 6px; display: flex; align-items: center; gap: 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--chip) var(--dy-tint), var(--gb-card)); color: var(--dark); text-decoration: none; transition: background .15s ease; }
.dy-coming-item:hover { background: color-mix(in srgb, var(--chip) var(--dy-tint-hover), var(--gb-card)); color: var(--dark); }
.dy-coming-thumb { width: var(--gb-tap); height: var(--gb-tap); flex-shrink: 0; border-radius: calc(var(--radius-sm) - 2px); object-fit: cover; }
.dy-coming-thumb-icon { display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--chip) var(--dy-tint-hover), var(--gb-card)); color: var(--chip); }
.dy-coming-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.dy-coming-title, .dy-coming-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dy-coming-title { font-weight: 600; }
.dy-coming-none { margin: 0; color: var(--muted); }
.dy-coming-buy { gap: 6px; }

@media (max-width: 767px) {
  .dy-page { --dy-pad: 12px 10px 24px; }   /* narrow screens keep their own tighter edge */
  /* Phones: the switch to breakfast or lunch comes first, then the meal, then the shopping */
  .dy-cols { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .dy-side { display: contents; }
  .dy-also { order: -1; }
  .dy-main, .dy-shop, .dy-coming { flex: 0 0 auto; }
  .dy-bar-day { flex: 1 1 100%; justify-content: space-between; }
  .dy-bar-grid { margin-left: auto; }
  .dy-hero-body { padding: 16px; }
  /* A long message gets the full width; Undo and the cross sit under it */
  .dy-msg { flex-wrap: wrap; padding: 10px 6px 4px 12px; }
  .dy-msg .afp-undo-text { flex-basis: calc(100% - 34px); }
  .dy-msg #dyMsgDismiss { margin-left: auto; }
  .dy-msg #dyMsgUndo:not([hidden]) { margin-left: auto; }
  .dy-msg #dyMsgUndo:not([hidden]) + #dyMsgDismiss { margin-left: 0; }
  .dy-ings, .dy-recipe-head, .dy-recipe-notes { padding-left: 16px; padding-right: 16px; }
  .dy-steps { border-left: 0; border-top: 1px solid var(--rule); }
  .dy-steps-full { border-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dy-meal { animation: none; }
  .dy, .dy-step, .dy-step-n, .dy-also-btn, .dy-else-btn, .dy-shop-box, .dy-coming-item { transition: none; }
}

/* ── Shopping List: shared ticks (v3.7.802) ───────────────────────────────────
   The page's own rules are in shopping-list.php; this is the one new piece.     */
.shop-item-days { font-size: var(--fs-meta); font-weight: 600; color: var(--muted); white-space: nowrap; }

/* ── Family Notes (v3.7.804) ──────────────────────────────────────────────────
   Page: notes.php · Markup: includes/notes_board.php · Script: assets/js/notes.js
   The page is a fridge door with sticky notes on it. The door and the paper are objects,
   so their colours are fixed here and do not follow the member's palette; the page
   around them (title, buttons, focus rings) does.                                        */
/* The papers and their ink are also used where a note shows outside the door: the Day page and the Grid (v3.7.805).
   So is the note itself, with its magnet and face, on the Day page (v3.7.810). */
:root {
  --fn-ink: #2b2112;                    /* writing on paper */
  --fn-ink-soft: #4a3f31;
  --fn-paper-note: #ffe27a;
  --fn-paper-suggest: #c7ecae;
  --fn-paper-day: #bcdcff;
  --fn-paper-mmg: #ffffff;              /* a note from MyMealGrid (v3.7.825): white paper… */
  --fn-mmg-band: #3b492d;               /* …with a green band across the top */
  --fn-mmg-band-h: 10px;
  --fn-pip: 48px;                       /* a Pip magnet: its picture, or the plain magnet standing in for it (v3.7.826: was 40px, and the stand-in 20px) */
  --fn-note-min: 250px;
  --fn-note-max: 330px;
  --fn-face: 28px;
  --fn-magnet: 20px;
}
.fn-page {
  --fn-pad: var(--page-pad-y) var(--page-pad-x) var(--page-pad-b);   /* v3.7.858: the shared page rhythm, was 16px 20px 40px */
  --fn-gap: 18px;
  --fn-tap: 44px;                       /* smallest comfortable touch target */
  --fn-door: #f1eee7;                   /* enamel */
  --fn-door-inner: #f8f6f1;
  --fn-door-edge: #d3ccbd;
  --fn-handle: #b7b0a2;
  --fn-handle-shadow: #9a9385;
  --fn-new: #c8372d;
  width: 100%;
  box-sizing: border-box;
  padding: var(--fn-pad);
  /* ── v3.7.882. Same fix as .al-page ──────────────────────────────────────
     Bex: "notes - still the same issue with the sidebar not being level with
     the family notes card". Identical cause: .fn-bar.al-head is a SIBLING of
     .fn-layout and "Write a note" lives inside .fn-layout, so it could never
     reach above the bar. Two-column grid, .fn-layout is display:contents, the
     sidebar spans both rows of column 2. The margin-right hack on
     .fn-bar.al-head goes with it.
     NOTE: .fn-side is position:sticky. Its containing block is this grid now
     rather than the old flex row — behaviour should be the same, but it is the
     one thing here worth looking at on the live page rather than assuming. */
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--fn-pad-w);
  column-gap: 22px;
  row-gap: var(--fn-gap);
  align-items: start;
}
.fn-page > .fn-bar.al-head { grid-column: 1; }
.fn-page > .fn-layout { display: contents; }
.fn-page > .fn-layout > .fn-door { grid-column: 1; grid-row: 2; }
.fn-page > .fn-layout > .fn-side { grid-column: 2; grid-row: 1 / span 2; }
.fn-page [hidden] { display: none !important; }
.fn-page :focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; }
.fn-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.fn-title, .fn-lead, .fn-pad-title, .fn-hint, .fn-text, .fn-empty, .fn-done-title { margin: 0; }
.fn-lead { color: var(--muted); }

/* The door */
.fn-door {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border: 1px solid var(--fn-door-edge);
  border-radius: 28px;
  background: var(--fn-door);
  box-shadow: inset 0 0 0 6px var(--fn-door-inner);
  color: var(--fn-ink);
  transition: opacity .15s ease;
}
.fn-page.is-busy .fn-door { opacity: .75; pointer-events: none; }
.fn-door-top { display: flex; align-items: center; gap: 12px; color: var(--fn-ink-soft); }
.fn-handle { margin-left: auto; width: 150px; max-width: 40%; height: 12px; border-radius: 99px; background: var(--fn-handle); box-shadow: 0 2px 0 var(--fn-handle-shadow); }

/* Paper colours, shared by notes, swatches and the writing area */
.fn-paper-note    { background: var(--fn-paper-note); }
.fn-paper-suggest { background: var(--fn-paper-suggest); }
.fn-paper-day     { background: var(--fn-paper-day); }
.fn-paper-mmg     { background: var(--fn-paper-mmg); }
.fn-swatch { width: 14px; height: 14px; flex-shrink: 0; border: 1px solid rgba(0, 0, 0, .35); border-radius: 3px; }

/* The pad */
.fn-pad { padding: 18px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--fn-door-edge); border-radius: 16px; background: #fff; color: var(--fn-ink); }
.fn-kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.fn-kind {
  min-height: var(--fn-tap);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--fn-door-edge);
  border-radius: 10px;
  background: #fff;
  color: var(--fn-ink);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease);
}
.fn-kind:hover { border-color: var(--fn-ink-soft); }
.fn-kind.is-on { border-color: var(--terra-ink); background: var(--fn-door); }
.fn-label { font-weight: 600; }
.fn-text-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--fn-handle);
  border-radius: 10px;
  color: var(--fn-ink);
  font-family: inherit;
  font-size: var(--fs-body);
  line-height: 1.45;
  resize: vertical;
}
.fn-text-input::placeholder { color: var(--fn-ink-soft); opacity: .8; }
.fn-pad-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.fn-extra { flex: 1 1 240px; min-width: 0; max-width: 420px; display: flex; flex-direction: column; gap: 4px; }
.fn-select, .fn-date { min-height: var(--fn-tap); }
.fn-pad-send { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.fn-count { color: var(--fn-ink-soft); }
.fn-stick { min-height: 46px; }
.fn-hint { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 12%, #fff); color: var(--fn-ink); font-weight: 500; }

/* The notes */
.fn-board { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 26px 22px; padding: 8px 4px 4px; }
.fn-note {
  flex: 1 1 var(--fn-note-min);
  max-width: var(--fn-note-max);
  min-width: 0;
  position: relative;
  padding: 22px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 3px 3px 14px 3px;
  box-shadow: 0 8px 14px -6px rgba(43, 33, 18, .45);
  color: var(--fn-ink);
  animation: fn-stick .22s ease-out;
}
@keyframes fn-stick { from { opacity: 0; transform: translateY(-8px) scale(.97); } }
.fn-tilt-0 { transform: rotate(-1.4deg); }
.fn-tilt-1 { transform: rotate(1.1deg); }
.fn-tilt-2 { transform: rotate(-.6deg); }
.fn-tilt-3 { transform: rotate(1.8deg); }
.fn-tilt-4 { transform: rotate(-1deg); }
.fn-tilt-5 { transform: rotate(.7deg); }
.fn-magnet { position: absolute; top: calc(var(--fn-magnet) / -2 + 1px); left: 50%; width: var(--fn-magnet); height: var(--fn-magnet); margin-left: calc(var(--fn-magnet) / -2); border-radius: 50%; box-shadow: 0 2px 3px rgba(0, 0, 0, .35); }
.fn-mag-0 { background: #c8372d; }
.fn-mag-1 { background: #1f3a5f; }
.fn-mag-2 { background: #3b492d; }
.fn-mag-3 { background: #d98c1f; }

/* ── Notes from MyMealGrid (v3.7.825) ──────────────────────────────────────────
   Markup: includes/notes_board.php · Rules: classes/DoorNotes.php
   White paper with a green band, hanging straight (no .fn-tilt-N), held by one of five Pip magnets.
   The app's own welcome note wears the same. Until a magnet's picture is uploaded
   (assets/img/pip-magnet-N.png) a plain round magnet in that magnet's colour stands in. */
.fn-official { border: 1px solid var(--fn-door-edge, #d3ccbd); border-top: var(--fn-mmg-band-h) solid var(--fn-mmg-band); }
/* A Pip magnet is one size whether its picture is there or not, centred on the green band (v3.7.826) */
.fn-official .fn-pip {
  top: calc(var(--fn-pip) / -2 - var(--fn-mmg-band-h) / 2);
  width: var(--fn-pip); height: var(--fn-pip); margin-left: calc(var(--fn-pip) / -2);
  background: var(--fn-pip-colour, var(--fn-mmg-band));      /* the stand-in's colour comes from DoorNotes::MAGNET_COLOURS, set on the element */
}
.fn-official .fn-pip.has-img { border-radius: 0; background: none; box-shadow: none; }
.fn-pip img { width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.fn-door-link { gap: 6px; max-width: 100%; overflow-wrap: anywhere; }
.fn-door-link i { font-size: .8em; }
/* Undo, for a few seconds after the account holder hides one */
.fn-notes { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.fn-undo { padding: 8px 8px 8px 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; border: 1px solid var(--fn-door-edge); border-radius: 12px; background: #fff; color: var(--fn-ink); animation: fn-stick .22s ease-out; }
.fn-note-head { display: flex; align-items: center; gap: 8px; min-height: var(--fn-face); }
.fn-face { width: var(--fn-face); height: var(--fn-face); flex-shrink: 0; border-radius: 50%; object-fit: cover; }
.fn-face-initial { display: inline-flex; align-items: center; justify-content: center; background: rgba(43, 33, 18, .82); color: #fff; font-size: var(--fs-meta); font-weight: 700; }
.fn-who { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.fn-author { font-weight: 700; overflow-wrap: anywhere; }
.fn-when { color: var(--fn-ink-soft); font-size: var(--fs-meta); }
.fn-new { padding: 1px 8px; border-radius: 99px; background: var(--fn-new); color: #fff; font-size: var(--fs-badge); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.fn-chip { align-self: flex-start; max-width: 100%; min-height: 30px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(0, 0, 0, .3); border-radius: 99px; background: rgba(255, 255, 255, .75); color: var(--fn-ink); font-size: var(--fs-meta); font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
a.fn-chip:hover { background: #fff; color: var(--fn-ink); }
.fn-text { font-size: var(--fs-subtitle, 1.05rem); line-height: 1.4; font-weight: 500; overflow-wrap: anywhere; }
.fn-replies { margin: 0; padding: 8px 10px; list-style: none; display: flex; flex-direction: column; gap: 6px; border-radius: 8px; background: rgba(255, 255, 255, .55); }
.fn-reply-line { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-small); }
.fn-reply-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.fn-reply-box { display: flex; gap: 6px; }
.fn-reply-input { flex: 1 1 auto; min-width: 0; min-height: var(--fn-tap); padding: 0 10px; border: 1px solid rgba(0, 0, 0, .4); border-radius: 8px; background: #fff; color: var(--fn-ink); font-family: inherit; font-size: var(--fs-body); }
.fn-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.fn-btn { min-height: var(--fn-tap); padding: 0 12px; border: 1px solid rgba(0, 0, 0, .35); border-radius: 8px; background: rgba(255, 255, 255, .7); color: var(--fn-ink); font-family: inherit; font-size: var(--fs-small); font-weight: 600; cursor: pointer; transition: var(--ease); }
.fn-btn:hover { background: #fff; }
.fn-btn-solid { border-color: var(--terra-ink); background: var(--terra); color: var(--surface-header-text, #fff); }
.fn-btn-solid:hover { background: var(--terra-hover); }   /* v3.7.870: was brightness(1.08) — brighter, i.e. the opposite direction to every other button */

/* Remove: the cross, then "Remove?" for a few seconds */
.fn-del { margin-left: auto; min-width: var(--fn-tap); min-height: var(--fn-tap); margin-top: -10px; margin-right: -10px; margin-bottom: -10px; padding: 0 8px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 8px; background: transparent; color: var(--fn-ink); font-family: inherit; font-size: var(--fs-meta); font-weight: 700; cursor: pointer; }
.fn-del-ask { display: none; }
.fn-del.is-armed { background: var(--fn-new); color: #fff; }
.fn-del.is-armed .fn-del-ask { display: inline; }
.fn-reply-line .fn-del { margin: -6px -6px -6px 0; min-width: 32px; min-height: 32px; }
.fn-empty { flex: 1 1 100%; padding: 28px; text-align: center; color: var(--fn-ink-soft); }

/* Done */
.fn-done { padding-top: 16px; display: flex; flex-direction: column; gap: 10px; border-top: 1px dashed var(--fn-handle); color: var(--fn-ink); }
.fn-done-title { color: var(--fn-ink-soft); }
.fn-done-row { padding: 6px 6px 6px 12px; min-height: var(--fn-tap); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; border: 1px solid var(--fn-door-edge); border-radius: 10px; background: #fff; }
.fn-done-text { color: var(--fn-ink-soft); text-decoration: line-through; overflow-wrap: anywhere; }
.fn-done-outcome { font-size: var(--fs-small); font-weight: 600; }
.fn-done-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.fn-done-actions .fn-del { margin: 0; }
.fn-link { min-height: var(--fn-tap); padding: 0 10px; border: 0; background: transparent; color: var(--fn-ink); font-family: inherit; font-size: var(--fs-small); font-weight: 600; text-decoration: underline; cursor: pointer; }

/* The Family Notes icon in the top bar (includes/app_header.php), on every member page */
.hdr-notes { position: relative; width: 36px; height: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 1px solid var(--rule); border-radius: 50%; background: var(--surface); color: var(--muted); text-decoration: none; transition: var(--ease); }
.hdr-notes:hover, .hdr-notes.active { color: var(--dark); border-color: var(--terra-ink); }
.hdr-notes-dot { position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; border: 2px solid var(--surface); border-radius: 50%; background: var(--news-new); }
.mobile-topbar-icon.hdr-notes-m { position: relative; }
.mobile-topbar-icon .hdr-notes-dot { top: 4px; right: 4px; border-color: transparent; }
/* A note from MyMealGrid this member has not seen (v3.7.825): the dot pulses until they open the door */
.hdr-notes-dot.is-pulse { animation: hdr-notes-pulse 1.6s ease-out infinite; }
@keyframes hdr-notes-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(228, 87, 46, .75); transform: scale(1); }
  40%  { transform: scale(1.18); }
  70%  { box-shadow: 0 0 0 10px rgba(228, 87, 46, 0); transform: scale(1); }
  100% { box-shadow: 0 0 0 0 rgba(228, 87, 46, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .hdr-notes-dot.is-pulse { animation: none; box-shadow: 0 0 0 3px rgba(228, 87, 46, .35); }   /* still marked, without moving */
}

@media (max-width: 767px) {
  .fn-page { --fn-pad: 12px 10px 24px; }
  .fn-door { padding: 14px; border-radius: 20px; gap: 18px; }
  .fn-pad { padding: 14px; }
  .fn-note { max-width: none; }
  .fn-pad-send { flex: 1 1 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  .fn-note { animation: none; }
  .fn-door, .fn-kind, .fn-btn, .hdr-notes { transition: none; }
}

/* ── Family Notes, stage 2 (v3.7.805) ─────────────────────────────────────────
   "Plan it" on the fridge door (includes/notes_board.php), the Grid's "ready to place" bar
   (grid.php, assets/js/grid.js) and the notes for a day on the Day page (day.php).          */
a.fn-btn { display: inline-flex; align-items: center; text-decoration: none; }
a.fn-btn-solid:hover { color: var(--surface-header-text, #fff); }
.fn-note:target { outline: 3px solid var(--fn-ink); outline-offset: 4px; }     /* arrived from the Day page */

/* Grid: a suggestion ready to place */
.gb-place {
  margin: 0 0 14px;
  padding: 8px 8px 8px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  border: 1px dashed var(--fn-ink-soft);
  border-radius: var(--radius-sm);
  background: var(--fn-paper-suggest);
  color: var(--fn-ink);
  animation: afp-rise .25s ease-out;
}
.gb-place-chip { max-width: 100%; min-height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(0, 0, 0, .35); border-radius: 99px; background: #fff; font-weight: 700; overflow-wrap: anywhere; }
.gb-place-chip[draggable="true"] { cursor: grab; }
.gb-place-chip.is-dragging { opacity: .5; }
.gb-place-text { flex: 1 1 260px; min-width: 0; }
.gb-place-text a { color: inherit; font-weight: 600; text-decoration: underline; }
.gb-place-cancel { margin-left: auto; min-height: var(--gb-tap); }
.gb-page.is-placing .gb-cell, .gb-page.is-placing .gl-row { cursor: copy; }
.gb-page.is-placing .gb-cell:hover, .gb-page.is-placing .gl-row:hover { outline: 2px dashed var(--fn-ink-soft); outline-offset: -2px; }
.gb-page.is-placing .gb-plan { opacity: 1; }

/* Day page: the link to add a note, and the notes written for this day */
.dy-note-add { gap: 6px; }
.dy-daynotes { margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.dy-daynotes-title { margin: 0; }
/* Each one is the fridge door's sticky note (.fn-note: paper, tilt, magnet, face), here as a link back to the door (v3.7.810) */
.dy-daynotes-list { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 26px 22px; padding: 10px 4px 6px; }
.dy-daynote { flex: 0 1 var(--fn-note-min); text-decoration: none; transition: box-shadow .15s ease; }
.dy-daynote:hover, .dy-daynote:focus-visible { color: var(--fn-ink); box-shadow: 0 12px 18px -6px rgba(43, 33, 18, .55); }
.dy-daynote .fn-text { display: block; }
.dy-daynote-replies { color: var(--fn-ink-soft); font-size: var(--fs-meta); font-weight: 600; }

@media (max-width: 767px) {
  .gb-place-cancel { margin-left: 0; }
  .dy-daynote { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .gb-place { animation: none; }
  .dy-daynote { transition: none; }
}

/* ── v3.7.806 ─────────────────────────────────────────────────────────────────
   Family Notes in two columns (notes left, pad right; on a phone the pad is on top),
   the brand mark on the welcome note, and every shared sidebar moved to the right. */
/* v3.7.884: was 360px, overridden below by --side-w and never applied. */
.fn-page { --fn-pad-w: var(--side-w); }
/* v3.7.863: the pad used to be a second column INSIDE the fridge door
   (.fn-cols). It is a standard .mg-side sidebar beside the door now, so the
   layout lives on .fn-layout and the pad's own rules follow it there. */
.fn-layout { display: flex; align-items: flex-start; gap: 22px; }
.fn-layout > .fn-door { flex: 1 1 auto; min-width: 0; }
/* v3.7.872: gap:0 for the same reason .pt-side has it — .mg-side spaces its
   children by --side-gap, which would show as a strip of card between the
   tinted head and the body now that this aside is one card. The head's own
   rule is the divider. */
.fn-layout > .fn-side { flex: 0 0 var(--fn-pad-w); position: sticky; top: calc(var(--nav-h) + 16px); gap: 0; }
/* Inside the sidebar the pad is plain: the panel around it already supplies
   the card, the border and the title bar. */
.fn-side .fn-pad { padding: 0; border: 0; border-radius: 0; background: transparent; }
.fn-side .fn-pad-row { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.fn-side .fn-extra { flex: 0 0 auto; max-width: none; }
.fn-side .fn-pad-send { flex: 0 0 auto; margin-left: 0; justify-content: space-between; }
.fn-face-brand { display: inline-flex; align-items: center; justify-content: center; background: var(--terra); color: var(--surface-header-text, #fff); font-size: var(--fs-meta); }
@media (max-width: 899px) {
  /* On a phone the pad comes first — you open this page to write, not to read. */
  .fn-layout { flex-direction: column; }
  /* This is the in-page pad as a full-width column. It no longer reaches the
     floating panel: v3.7.914 raised .filter-drawer.filter-drawer to three
     classes so the window rules outrank any page sidebar rule. Left as it was
     on purpose - one mechanism, stated in one place. */
  .fn-layout > .fn-side { order: -1; flex: 1 1 auto; width: 100%; position: static; }
  /* v3.7.882: one column here, and the pad still comes first. order:-1 above
     keeps doing that job — it applies to a grid item exactly as it did to a
     flex item, so long as the placement is automatic, which it is below. */
  .fn-page { grid-template-columns: minmax(0, 1fr); }
  .fn-page > .fn-layout > .fn-door { grid-column: 1; grid-row: auto; }
  .fn-page > .fn-layout > .fn-side { grid-column: 1; grid-row: auto; }
}

/* Shared sidebars (Account, Preferences, Help, Cookbook, Shopping List, What's New, Bug Report)
   sit on the right, like the meal tray on the Grid. Stacked on small screens, the sidebar stays on top. */
@media (min-width: 900px) {
  .mg-sidebar-layout > .mg-sidebar { order: 2; }
}

/* ── v3.7.807: one width for every side column ────────────────────────────────
   The shared sidebars, the Grid's meal tray, the Day page's side column, the Family Notes pad
   and the Autofill Lists panel all use --side-w. It is the meal tray's width: any wider and
   the Grid's calendar loses its thumbnails on a 1440px screen. Change it here, once.        */
:root { --side-w: 264px; }
.gb-page  { --gb-tray-w: var(--side-w); }
.fn-page  { --fn-pad-w: var(--side-w); }
.fn-side .fn-pad-send { flex-direction: column-reverse; align-items: stretch; gap: 6px; }   /* the button, then the count under it */
.fn-side .fn-count { text-align: right; white-space: nowrap; }
.dy-page  { --dy-side-w: var(--side-w); }
@media (min-width: 900px) {                   /* below this they are stacked and take the full width */
  .mg-sidebar { width: var(--side-w); }
  .al-layout { --al-side: var(--side-w); }
  .al-layout > .al-side { order: 2; }        /* on the right, like the rest (v3.7.806) */
}

/* ── What's New: posts from MyMealGrid (v3.7.834) ──────────────────────────
   Page: whats-new.php · Markup: includes/news_posts.php · Rules: classes/NewsPosts.php
   A small blog: each post is a card with an optional picture across the top, its title and date,
   the text in paragraphs, and an optional link button. The newest is first.                       */
.nw-list {
  --nw-photo-max: 340px;           /* the tallest a post's picture is shown */
  --nw-pad: 20px;
  --nw-measure: 68ch;              /* the widest a line of text runs, so it stays easy to read */
  display: flex; flex-direction: column; gap: 20px;
}
.nw-post { overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface-card-solid); box-shadow: var(--shadow-sm); animation: afp-rise .25s ease-out; }
.nw-post.is-new { border-color: var(--terra-ink); }
.nw-photo { background: var(--surface); }
.nw-photo img { display: block; width: 100%; max-height: var(--nw-photo-max); object-fit: cover; }
.nw-body { padding: var(--nw-pad); }
.nw-head { margin-bottom: 12px; }
.nw-title { margin: 0 0 4px; overflow-wrap: anywhere; }
.nw-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); }
.nw-new { padding: 2px 8px; border-radius: 99px; background: var(--terra); color: var(--surface-header-text); }
.nw-text { max-width: var(--nw-measure); }
.nw-text p { margin: 0 0 12px; line-height: 1.7; color: var(--body-color); overflow-wrap: anywhere; }
.nw-text p:last-child { margin-bottom: 0; }
.nw-link { margin-top: 16px; }
.nw-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.nw-pager .btn { border-color: var(--rule); color: var(--muted); }
.nw-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.nw-empty-icon { margin-bottom: 8px; font-size: 2rem; color: var(--terra-ink); }
/* The dot on the member's picture in the top bar, and the word beside What's New in the menus */
:root { --news-new: #e4572e; }      /* the one colour that says "there is something new" (the fridge notes' dot uses it too) */
.app-topnav-avatar, .mobile-topbar-burger { position: relative; }
.mobile-topbar-burger .hdr-news-dot { top: 4px; right: 4px; border-color: transparent; }
.hdr-news-dot { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border: 2px solid var(--surface); border-radius: 50%; background: var(--news-new); }
.hdr-news-pill { margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--news-new); color: var(--surface-header-text); font-size: var(--fs-badge); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: middle; }
@media (max-width: 767px) { .nw-list { --nw-pad: 14px; --nw-photo-max: 220px; } }
@media (prefers-reduced-motion: reduce) { .nw-post { animation: none; } }

/* ── Shopping List: the date range (v3.7.831) ───────────────────────────────
   Page: shopping-list.php · Markup: includes/shopping_list_panel.php · Script: assets/js/shopping-range.js
   Week / Month / Custom in the Controls card. Changing it swaps the list in place; while the new
   list is on its way the old one is dimmed, so a tap is seen to have been taken.                    */
#tab-sl-list {
  --sl-swap-time: .18s;            /* how long the dimming takes */
  --sl-loading-opacity: .45;       /* how far the old list is dimmed */
  --sl-date-radius: 6px;           /* corners of the two date boxes */
}
.sl-range-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.sl-range-btn { flex: 1; text-align: center; font-size: var(--fs-meta); }
/* v3.7.886: button #2 for the ranges that are NOT selected. The old rule set
   border-color on .btn, which declares `border: none` — colouring a border that
   does not exist — so these have rendered borderless since the day it was
   written. .btn-secondary brings the width with the colour.

   The SELECTED range keeps its solid fill. Bex asked for button #2 here, but
   button #2 has no "on" state: make all three white-with-a-border and Week,
   Month and Custom become indistinguishable. The fill is the only thing saying
   which range you are looking at, so it stays until she says otherwise. */
.sl-range-btn:not(.btn-primary) {
  background: var(--surface-card-solid);
  color: var(--dark);
  border: var(--btn-border-w) solid var(--rule);
}
.sl-range-btn:not(.btn-primary):hover {
  background: color-mix(in srgb, var(--terra) 8%, var(--surface-card-solid));
  border-color: color-mix(in srgb, var(--terra) 35%, var(--rule));
}
.sl-range-custom { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sl-range-custom[hidden] { display: none; }
.sl-range-date { padding: 5px 8px; border: 1px solid var(--rule); border-radius: var(--sl-date-radius); font-size: var(--fs-meta); }
.sl-range-date:focus { outline: none; border-color: var(--terra-ink); }
.sl-range-apply { font-size: var(--fs-meta); }
.sl-note { margin: 0 0 12px; }                          /* "14 checks cleared. Undo" (v3.7.832): the Grid's message bar, reused */
.sl-note [hidden] { display: none !important; }         /* a .btn would otherwise stay in view */
#slHead, #slActions, #slBody { transition: opacity var(--sl-swap-time) ease; }
#slHead.is-loading, #slActions.is-loading, #slBody.is-loading { opacity: var(--sl-loading-opacity); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { #slHead, #slActions, #slBody { transition: none; } }

/* ── Shopping List: Extras (v3.7.811) ─────────────────────────────────────────
   Page: shopping-list.php · Markup: includes/shopping_extras.php · Script: assets/js/shopping-extras.js
   Things that are not from a meal. The section and the "Add an item" card wear sticky-note yellow
   (the Family Notes paper), so they read as "ours" beside the meal categories in the member's colour.
   .sx-side is the list tab's side column: the add card stays in view (on top on small screens),
   and the Controls card under it is the usual drawer there.                                        */
.sx-side {
  order: 2;
  width: var(--side-w);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  max-height: calc(100vh - var(--nav-h) - var(--sx-foot) - 36px);     /* a short window scrolls the column, never hides part of it */
  overflow-y: auto;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  gap: 16px;
  --sx-foot: 56px;                    /* the fixed footer bar */
}
@media (min-width: 900px) { .sx-side > .mg-sidebar { position: static; width: auto; } }     /* the column is the sticky part, not the card in it */
/* v3.7.875: Bex numbered the two sidebar cards 1 and 2 on her screenshot -
   Controls on top, Add an item beneath. Done with flex `order` rather than by
   moving the markup, because the markup order is deliberate: on a small screen
   "Add an item" has to stay in view at the top and Controls becomes a drawer
   (see the comment on .sx-side in shopping-list.php). Re-ordering the HTML
   would have fixed the desktop and broken the phone. Scoped to the breakpoint
   where the sidebar is actually a column. */
@media (min-width: 900px) {
  .sx-side > .mg-sidebar { order: 1; }
  .sx-side > .sx-add     { order: 2; }
}
.sx-card {
  --sx-paper: color-mix(in srgb, var(--fn-paper-note) 42%, var(--surface-card-solid, #fff));
  --sx-edge: color-mix(in srgb, var(--fn-paper-note) 55%, var(--rule));
  --sx-tap: 44px;                     /* smallest comfortable touch target */
  border: 1px solid var(--sx-edge);
  border-radius: var(--radius-md);
  background: var(--surface-card-solid, #fff);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  color: var(--dark);
}
.sx-list { margin-bottom: 16px; }
.sx-head { min-height: 38px; padding: 6px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; background: var(--sx-paper); color: var(--fn-ink); }
.sx-title, .sx-none, .sx-hint, .sx-usuals-hint { margin: 0; }
.sx-count { margin-left: auto; font-weight: 700; white-space: nowrap; }
.sx-item { padding: 0 4px 0 14px; gap: 4px; }
.sx-tick { flex: 1 1 auto; min-width: 0; min-height: var(--sx-tap); padding: 4px 0; display: flex; align-items: center; gap: 10px; border-radius: var(--radius-sm); cursor: pointer; }
.sx-tick:focus-visible { outline: 2px solid var(--terra); outline-offset: -2px; }
.sx-text { min-width: 0; display: flex; flex-direction: column; }
.sx-text .shop-item-name { overflow-wrap: anywhere; }
.sx-meta, .sx-none, .sx-usuals-hint { color: var(--muted); }
.sx-remove { width: var(--sx-tap); height: var(--sx-tap); flex-shrink: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; transition: var(--ease); }
.sx-remove:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.sx-none { padding: 18px 16px; text-align: center; }
.sx-item.is-new { animation: gb-pop .22s ease-out; }
.sx-note { margin: 0 0 12px; }
.sx-add-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.sx-label { font-weight: 600; }
.sx-add-row { display: flex; flex-direction: column; gap: 8px; }
.sx-input, .sx-add-btn { width: 100%; min-height: var(--sx-tap); }
.sx-add-btn { justify-content: center; }
.sx-hint { padding: 8px 10px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--danger) 12%, var(--surface-card-solid, #fff)); color: var(--dark); font-weight: 600; overflow-wrap: anywhere; }
.sx-usuals { margin-top: 2px; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--rule); }
#sxUsuals { display: flex; flex-direction: column; gap: 8px; }
.sx-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sx-usual { max-width: 100%; min-height: 40px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--sx-edge); border-radius: 99px; background: color-mix(in srgb, var(--fn-paper-note) 16%, var(--surface-card-solid, #fff)); color: var(--dark); font-weight: 600; cursor: pointer; transition: var(--ease); }
.sx-usual:hover { background: var(--sx-paper); }
.sx-usual.is-on { border-color: color-mix(in srgb, var(--terra) 60%, var(--rule)); background: color-mix(in srgb, var(--terra) 14%, var(--surface-card-solid, #fff)); cursor: default; }
.sx-usual-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-card [hidden], .sx-note [hidden] { display: none !important; }     /* a .btn would otherwise stay in view */
@media (pointer: coarse) { .sx-usual { min-height: var(--sx-tap); } }
@media (max-width: 899px) {
  /* Small screens: the add card sits on top of the list; the box and its button share a row */
  .sx-side { order: 0; width: 100%; position: static; max-height: none; overflow: visible; }
  /* The list keeps to the screen's width. (It used to take the width of its widest line, which on a
     phone pushed the right-hand end of every row, and the cross on an extra, off the screen.) */
  #tab-sl-list .mg-sidebar-layout > .mg-main { align-self: stretch; }
  /* v3.7.913 — these two lines are deleted, not changed. Bex: "Move the button
     under the input field making the field bigger".

     They were correct when written: the add card sat ON TOP of the list at full
     page width, so a row was the natural shape and the input still had plenty.
     v3.7.911 moved the card into a side panel and the override did not follow.
     In a 375px panel the row left the input about 150px - enough for "Dish soap,"
     and nothing after it, while the placeholder promises "Dish soap, the blue one".

     Removing them falls back to the BASE rule a few lines up, which already does
     exactly what Bex asked: flex-direction column, both children width 100%. No
     new rule, no new breakpoint - just stopping a stale override from undoing a
     default that was right all along. Desktop is unaffected; it never matched
     this query.                                                                */
}
@media (prefers-reduced-motion: reduce) {
  .sx-item.is-new { animation: none; }
  .sx-remove, .sx-usual { transition: none; }
}
@media print {
  .sx-list { border: 0; box-shadow: none; }
  .sx-head { background: none; border-bottom: 1pt solid #ddd; padding: 6pt 0 3pt; }
  .sx-head-hint, .sx-meta { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOME (v3.7.815)
   Page: index.php · Data: classes/HomeView.php · Markup: includes/home_view.php and
   includes/home_backyard.php · Script: assets/js/home.js
   .hm-hero the backyard and greeting · .hm-tonight tonight's dinner · .hm-week / .hm-day this week
   .hm-glance At a Glance and the quick links
   Text uses the Kitchen text roles; page colours come from the member's palette.
   --chip is the member's colour for an entry type, set inline per card.
   The backyard has a palette of its own (a sky is not a theme colour): one set per time of day.
   ═══════════════════════════════════════════════════════════════════════════ */
.hm-page {
  --hm-gap: 20px;
  --hm-radius: var(--radius-lg);             /* the hero and the tonight card */
  --hm-card: var(--surface-card-solid, #fff);
  --hm-tap: 44px;                            /* smallest comfortable touch target */
  --hm-tint: 12%;                            /* strength of an entry colour's wash */
  --hm-tint-strong: 22%;
  --hm-on-dark: #fff;                        /* text on the tonight card's panel */
  --hm-on-dark-soft: rgba(255, 255, 255, .82);
  --hm-sky-h: 176px;                         /* the sky, above the strip of ground */
  --hm-tonight-w: clamp(300px, 26%, 420px);  /* the tonight card beside the week */
  --hm-tonight-min: 420px;
  --hm-tonight-pic-min: 132px;
  --hm-tonight-icon: 72px;
  --hm-tonight-panel: color-mix(in srgb, var(--dark) 94%, #000);
  --hm-day-w: 118px;                         /* narrowest a day tile gets before the row scrolls */
  --hm-day-min-h: 178px;
  --hm-day-pic-h: 64px;                      /* the least a day's picture is tall; it grows with a wide tile */
  --hm-day-icon: 24px;
  --hm-list-pic: 44px;                       /* a day's picture in the phone's list */
  /* v3.7.871 — Bex: "add a little more padding to the top and bottom of the
     buttons". Raised here rather than on .hm-quick-btn's padding: the tile sets
     min-height from this token and centres its content, so with box-sizing:
     border-box extra padding is swallowed by the min-height and changes nothing
     on screen. The height is the knob; the padding is not. */
  --hm-quick-h: 76px;
  display: flex;
  flex-direction: column;
  gap: var(--hm-gap);
}
.hm-page :focus-visible { outline: 2px solid var(--terra); outline-offset: 2px; }

/* ── The backyard ─────────────────────────────────────────────────────────── */
.hm-hero {
  /* things that keep their colour at every hour */
  --hm-acorn: #b9783a; --hm-acorn-dark: #a8672c; --hm-acorn-light: #c58a4a; --hm-acorn-cap: #6b4423;
  --hm-star: #fff; --hm-cloud: #fff; --hm-firefly: #ffe680; --hm-owl-eye: #ffd966; --hm-zzz: #dfe6ff;
  --hm-ground-text: #fff; --hm-ground-sub: #e9eee2;
  /* night is also what shows if the time is ever missing */
  --hm-sky-top: #0c1638; --hm-sky-low: #2a3a72; --hm-ground: #0a1024; --hm-far: #1a2550; --hm-mid: #121c40;
  --hm-orb: #f4f1de; --hm-orb-glow: rgba(244, 241, 222, .18); --hm-orb-left: 40%; --hm-orb-top: 20px;
  position: relative;
  border-radius: var(--hm-radius);
  overflow: hidden;
  background: linear-gradient(180deg, var(--hm-sky-top) 0%, var(--hm-sky-low) 100%);
  box-shadow: var(--shadow-sm);
  container: hm-hero / inline-size;
}
.hm-hero[data-time="morning"] {
  --hm-sky-top: #8ec7f2; --hm-sky-low: #fde3bd; --hm-ground: #2f3d27; --hm-far: #6f8f62; --hm-mid: #4f6b45;
  --hm-orb: #ffd56b; --hm-orb-glow: rgba(255, 213, 107, .35); --hm-orb-left: 36%; --hm-orb-top: 64px;
}
.hm-hero[data-time="midday"] {
  --hm-sky-top: #4f9fe3; --hm-sky-low: #cfe9ff; --hm-ground: #2f3d27; --hm-far: #7fa56f; --hm-mid: #55774a;
  --hm-orb: #fff3b0; --hm-orb-glow: rgba(255, 243, 176, .4); --hm-orb-left: 50%; --hm-orb-top: 16px;
}
.hm-hero[data-time="evening"] {
  --hm-sky-top: #4a4e8f; --hm-sky-low: #f6a36b; --hm-ground: #2b2633; --hm-far: #7a5a6e; --hm-mid: #4c3d52;
  --hm-orb: #ff8a4c; --hm-orb-glow: rgba(255, 138, 76, .35); --hm-orb-left: 70%; --hm-orb-top: 84px;
}

.hm-sky {
  /* where things stand on a wide hero; a narrow one moves them, below */
  --hm-run-from: 30%;                        /* the acorn pile end of the squirrel's run */
  --hm-run-to: calc(88% - 100px);            /* the foot of the tree */
  --hm-climb: 92px;                          /* how far up the trunk it goes */
  --hm-run-time: 18s;
  --hm-tree-right: 12%;
  --hm-pile-left: calc(30% - 34px);
  --hm-critter-left: 46%;
  --hm-tree-a-left: 17%; --hm-tree-a-w: 120px;
  --hm-pine-a-left: 58%; --hm-pine-a-w: 70px;
  --hm-bush-w: 150px;
  --hm-orb-size: 56px; --hm-orb-ring: 12px;
  position: relative;
  height: var(--hm-sky-h);
}
.hm-sky svg { position: absolute; display: block; }
.hm-fill { fill: var(--hm-ground); }
.hm-mid  { fill: var(--hm-mid); }
.hm-far  { fill: var(--hm-far); }
.hm-line { fill: none; stroke: var(--hm-ground); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hm-branch { stroke-width: 8; }
.hm-tail { stroke-width: 10; }
.hm-sleeper .hm-tail { stroke-width: 9; }
.hm-legs { stroke-width: 1.6; }
.hm-acorn { fill: var(--hm-acorn); }
.hm-acorn-dark { fill: var(--hm-acorn-dark); }
.hm-acorn-light { fill: var(--hm-acorn-light); }
.hm-acorn-cap { fill: var(--hm-acorn-cap); }
.hm-eye { fill: var(--hm-owl-eye); }

/* who is out at which hour */
.hm-hero .hm-at-night, .hm-hero .hm-at-dusk, .hm-hero .hm-by-day { display: none; }
.hm-hero[data-time="night"] .hm-at-night,
.hm-hero[data-time="evening"] .hm-at-dusk,
.hm-hero[data-time="morning"] .hm-by-day,
.hm-hero[data-time="midday"] .hm-by-day { display: block; }
.hm-hero[data-time="night"] .hm-not-night { display: none; }

.hm-orb { position: absolute; left: var(--hm-orb-left); top: var(--hm-orb-top); width: var(--hm-orb-size); height: var(--hm-orb-size); border-radius: 50%; background: var(--hm-orb); box-shadow: 0 0 0 var(--hm-orb-ring) var(--hm-orb-glow); }
.hm-star { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--hm-star); animation: hm-twinkle 2.6s ease-in-out infinite; }
.hm-star:nth-child(1) { left: 12%; top: 26px; width: 4px; height: 4px; }
.hm-star:nth-child(2) { left: 24%; top: 58px; animation-delay: .8s; }
.hm-star:nth-child(3) { left: 33%; top: 18px; animation-delay: 1.4s; }
.hm-star:nth-child(4) { left: 52%; top: 44px; width: 4px; height: 4px; animation-delay: .3s; }
.hm-star:nth-child(5) { left: 63%; top: 20px; animation-delay: 1.9s; }
.hm-star:nth-child(6) { left: 92%; top: 36px; width: 4px; height: 4px; animation-delay: 1.1s; }
.hm-cloud { position: absolute; border-radius: 99px; background: var(--hm-cloud); animation: hm-drift 60s linear infinite alternate; }
.hm-cloud:nth-child(1) { left: 14%; top: 30px; width: 120px; height: 26px; opacity: .7; }
.hm-cloud:nth-child(2) { left: 58%; top: 56px; width: 90px; height: 20px; opacity: .55; animation-duration: 80s; }

.hm-hills { left: 0; bottom: 0; width: 100%; height: 64px; }
.hm-tree-a { left: var(--hm-tree-a-left); bottom: 0; width: var(--hm-tree-a-w); aspect-ratio: 120 / 150; }
.hm-pine-a { left: var(--hm-pine-a-left); bottom: 0; width: var(--hm-pine-a-w); aspect-ratio: 70 / 132; }
.hm-pine-b { left: 64%; bottom: 0; width: 54px; aspect-ratio: 70 / 132; }
.hm-tree-b { left: 1%; bottom: 0; width: 104px; aspect-ratio: 120 / 150; }
.hm-bush-mid { left: 52%; bottom: 0; width: 130px; aspect-ratio: 130 / 30; }
.hm-bush { right: 0; bottom: 0; width: var(--hm-bush-w); aspect-ratio: 150 / 36; }

.hm-fly { position: absolute; left: -6%; top: 30px; width: 22px; animation: hm-fly 26s linear infinite; }
.hm-fly:nth-child(2) { top: 54px; width: 18px; animation-duration: 34s; animation-delay: -9s; }
.hm-fly:nth-child(3) { top: 18px; width: 20px; animation-duration: 30s; animation-delay: -19s; }
.hm-sky .hm-flap { position: static; width: 100%; aspect-ratio: 22 / 12; transform-origin: 50% 100%; animation: hm-flap .5s ease-in-out infinite alternate; }
.hm-fly:nth-child(2) .hm-flap { animation-delay: .2s; }
.hm-fly:nth-child(3) .hm-flap { animation-delay: .35s; }

.hm-fence { position: absolute; left: 5%; bottom: 0; width: 240px; height: 84px; }
.hm-fence-rails { left: 0; bottom: 0; width: 240px; height: 50px; z-index: 1; }
.hm-fence-bird { left: 150px; bottom: 48px; width: 30px; height: 24px; z-index: 2; }
.hm-owl { left: 101px; bottom: 48px; width: 28px; height: 34px; z-index: 2; }
.hm-blink { transform-box: fill-box; transform-origin: 50% 50%; animation: hm-blink 5s linear infinite; }

.hm-tree { position: absolute; right: var(--hm-tree-right); bottom: 0; width: 150px; height: 176px; }
.hm-tree-trunk, .hm-tree-leaves { left: 0; top: 0; width: 150px; height: 176px; }
.hm-tree-trunk { z-index: 1; }
.hm-tree-leaves { z-index: 3; }
.hm-sleeper { left: 2px; top: 92px; width: 46px; height: 30px; z-index: 2; }
.hm-zzz { position: absolute; left: 46px; top: 84px; z-index: 4; font-family: var(--font-display); font-weight: 800; font-size: 14px; line-height: 1; color: var(--hm-zzz); animation: hm-zzz 3.2s ease-in infinite; }
.hm-zzz:nth-of-type(2) { left: 52px; top: 76px; font-size: 18px; animation-delay: 1.05s; }
.hm-zzz:nth-of-type(3) { left: 58px; top: 66px; font-size: 22px; animation-delay: 2.1s; }

.hm-pile { left: var(--hm-pile-left); bottom: 0; width: 34px; height: 16px; z-index: 2; }
.hm-runner { position: absolute; left: var(--hm-run-from); bottom: 0; width: 56px; height: 40px; z-index: 2; animation: hm-run var(--hm-run-time) linear infinite; }
.hm-hop { width: 56px; height: 40px; animation: hm-hop .42s ease-in-out infinite; }
.hm-sky .hm-squirrel { position: static; width: 56px; height: 40px; }
.hm-nut { animation: hm-nut var(--hm-run-time) steps(1, end) infinite; }
.hm-critter { left: var(--hm-critter-left); bottom: 0; z-index: 2; }
.hm-bird { width: 30px; height: 24px; transform-origin: 50% 100%; animation: hm-peck 2.6s ease-in-out infinite; }
.hm-rabbit { width: 40px; height: 38px; }
.hm-firefly { position: absolute; z-index: 2; width: 5px; height: 5px; border-radius: 50%; background: var(--hm-firefly); animation: hm-twinkle 2.6s ease-in-out infinite; }
.hm-firefly:nth-child(1) { left: 38%; bottom: 34px; }
.hm-firefly:nth-child(2) { left: 47%; bottom: 58px; width: 4px; height: 4px; animation-delay: 1.2s; }
.hm-firefly:nth-child(3) { left: 56%; bottom: 26px; animation-delay: .5s; }

@keyframes hm-run {
  0%   { left: var(--hm-run-from); bottom: 0; transform: scaleX(1); }
  38%  { left: var(--hm-run-to);   bottom: 0; transform: scaleX(1); }
  50%  { left: var(--hm-run-to);   bottom: var(--hm-climb); transform: scaleX(1); }
  58%  { left: var(--hm-run-to);   bottom: var(--hm-climb); transform: scaleX(-1); }
  68%  { left: var(--hm-run-to);   bottom: 0; transform: scaleX(-1); }
  96%  { left: var(--hm-run-from); bottom: 0; transform: scaleX(-1); }
  100% { left: var(--hm-run-from); bottom: 0; transform: scaleX(1); }
}
@keyframes hm-hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes hm-nut { 0% { opacity: 1; } 50%, 100% { opacity: 0; } }      /* a nut on the way to the tree, none on the way back */
@keyframes hm-drift { from { transform: translateX(0); } to { transform: translateX(90px); } }
@keyframes hm-twinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes hm-zzz { 0% { opacity: 0; transform: translate(0, 0) scale(.7); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -34px) scale(1.2); } }
@keyframes hm-peck { 0%, 60%, 100% { transform: rotate(0deg); } 70%, 80% { transform: rotate(16deg); } 75% { transform: rotate(4deg); } }
@keyframes hm-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes hm-fly { from { left: -6%; } to { left: 106%; } }
@keyframes hm-flap { from { transform: scaleY(1); } to { transform: scaleY(.35); } }

/* The ground: the greeting is written on it, so it reads the same at every hour */
.hm-ground { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding: 14px 24px 16px; background: var(--hm-ground); color: var(--hm-ground-text); }
.hm-ground .hm-greeting, .hm-ground .hm-clock { margin: 0; line-height: 1.2; color: var(--hm-ground-text); }
.hm-ground .hm-date { margin: 0; color: var(--hm-ground-text); }   /* v3.7.866: was --hm-ground-sub (#e9eee2), half a step behind the clock it is sized to match */
.hm-ground .hm-clock { margin-left: auto; white-space: nowrap; }

/* A narrow hero (phones, a tablet held upright): fewer trees, a shorter run, everything closer in */
@container hm-hero (max-width: 760px) {
  .hm-hero .hm-wide { display: none; }
  .hm-sky {
    --hm-run-from: 10%; --hm-run-to: calc(96% - 100px); --hm-run-time: 14s;
    --hm-tree-right: 4%;
    --hm-pile-left: calc(10% - 30px);
    --hm-critter-left: 34%;
    --hm-tree-a-left: 20%; --hm-tree-a-w: 96px;
    --hm-pine-a-left: 46%; --hm-pine-a-w: 54px;
    --hm-bush-w: 120px;
    --hm-orb-size: 48px; --hm-orb-ring: 10px;
  }
  .hm-hero[data-time="morning"] .hm-orb { left: 44%; top: 18px; }
  .hm-hero[data-time="midday"] .hm-orb  { left: 38%; top: 14px; }
  .hm-hero[data-time="evening"] .hm-orb { left: 8%;  top: 84px; }
  .hm-hero[data-time="night"] .hm-orb   { left: 40%; top: 20px; }
  .hm-cloud:nth-child(1) { left: 8%; top: 26px; width: 84px; height: 20px; }
  .hm-cloud:nth-child(2) { display: none; }
  .hm-fly { animation-duration: 16s; }
  .hm-fly:nth-child(2) { animation-duration: 21s; animation-delay: -8s; }
  /* the greeting takes the first line; the date and the clock share the second */
  .hm-ground { align-items: baseline; gap: 2px 12px; padding: 12px 16px 14px; }
  .hm-ground .hm-greeting { flex: 1 1 100%; }

  /* v3.7.910: centre it. Bex, 2 Nov: "Center the text in the welcome box on
     mobile." The greeting was left-aligned and the clock carried `margin-left:
     auto` from the desktop layout, which on one shared line pushed the time hard
     to the right edge while the date stayed left - the two halves of the same
     sentence at opposite ends of the screen.
     Centring the row and dropping the auto margin puts the date and time
     together under the greeting, which is what they are: one line that reads
     "Monday, November 2, 2026 · 7:59 am". */
  .hm-ground { justify-content: center; text-align: center; }
  .hm-ground .hm-clock { margin-left: 0; }
}

/* ── Tonight, and the column beside it ────────────────────────────────────── */
.hm-main { display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--hm-gap); }
.hm-side { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: var(--hm-gap); }

.hm-tonight {
  --chip: var(--terra);
  flex: 1 1 var(--hm-tonight-w);
  min-width: 0;
  min-height: var(--hm-tonight-min);
  display: flex;
  flex-direction: column;
  border-radius: var(--hm-radius);
  overflow: hidden;
  background: var(--hm-card);
  color: var(--hm-on-dark);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.hm-tonight:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--hm-on-dark); }
.hm-tonight.is-empty { --chip: var(--muted); }
/* The picture: the meal's photo, or the same stand-in the Day page shows (Pip, or the type's icon on its colour) */
.hm-tonight-pic { position: relative; flex: 1 1 auto; min-height: var(--hm-tonight-pic-min); display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--chip) var(--hm-tint), var(--hm-card)); }
.hm-tonight-photo, .hm-tonight-pip { position: absolute; inset: 0; width: 100%; height: 100%; }
.hm-tonight-photo { object-fit: cover; }
.hm-tonight-pip { padding: 16px; box-sizing: border-box; object-fit: contain; }
.hm-tonight-icon { font-size: var(--hm-tonight-icon); color: var(--chip); }
/* The words sit on a solid panel, never on the photo, so they read whatever the picture is */
/* v3.7.884: Bex — "on the whats for dinner card, can you center all the text?"
   text-align alone would not have done it: this is a flex column, so each span
   is only as wide as its content and stays packed to the left edge. The
   eyebrow and the hint both lead with an icon, so they would have read as
   half-centred. align-items does the box, text-align does the wrapped lines. */
.hm-tonight-body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 20px; background: var(--hm-tonight-panel); }
.hm-tonight .hm-tonight-eyebrow { color: var(--amber); }
.hm-tonight .hm-tonight-title { line-height: 1.2; color: var(--hm-on-dark); overflow-wrap: anywhere; }
.hm-tonight .hm-tonight-line, .hm-tonight .hm-tonight-hint { color: var(--hm-on-dark-soft); overflow-wrap: anywhere; }
.hm-tonight .hm-tonight-hint { margin-top: 2px; }

/* ── This Week ────────────────────────────────────────────────────────────── */
.hm-week { display: flex; flex-direction: column; }
.hm-week-head { flex-wrap: wrap; gap: 4px 12px; }
.hm-week-head h2 { margin: 0 auto 0 0; }
/* v3.7.858: "Open the Grid" sat in the This Week card header as an underlined
   link. It is the card's main action, so it now looks like one. On the coloured
   header it uses a translucent white fill rather than a solid colour, so it
   works whatever Primary the member picked.
   NOTE: the fill, border and hover below are dead -- the "hard to notice" rule
   further down replaces all three with a solid Secondary button. Left as-is in
   v3.7.867 rather than widening that build; see the running list. */
.hm-week-link { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.hm-week-link:hover { color: inherit; text-decoration-thickness: 2px; }
.hm-week-link-head { padding: var(--btn1-pad); line-height: var(--btn1-line); display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid rgba(255,255,255,.45); border-radius: 99px; background: rgba(255,255,255,.18);
  font-family: var(--font-display); font-size: var(--fs-body); font-weight: 600;
  text-decoration: none; transition: var(--ease); }
.hm-week-link-head:hover { background: rgba(255,255,255,.34); border-color: rgba(255,255,255,.7); text-decoration: none; }
/* v3.7.867: this one is NOT overridden further down, and it is the only part
   that the tint actually broke -- a white ring between a solid Secondary button
   and a near-white bar is a ring you cannot see. */
.hm-week-link-head:focus-visible { outline: 2px solid var(--terra-ink); outline-offset: 2px; }
.hm-week-link-foot, .hm-seg { display: none; }
.hm-days { position: relative; display: flex; gap: 10px; padding: 14px; overflow-x: auto; }
.hm-day {
  --chip: var(--terra);
  flex: 1 0 var(--hm-day-w);
  min-width: 0;
  min-height: var(--hm-day-min-h);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 2px solid var(--rule);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--chip) var(--hm-tint), var(--hm-card));
  color: var(--dark);
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.hm-day.is-meal { background: var(--hm-card); }
.hm-day.is-empty { --chip: var(--muted); border-style: dashed; background: color-mix(in srgb, var(--surface) 45%, var(--hm-card)); }
.hm-day.is-today { border-color: var(--terra-ink); }
.hm-day:hover { transform: translateY(-2px); border-color: var(--chip); box-shadow: var(--shadow-sm); color: var(--dark); }
.hm-day-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.hm-day .hm-day-num { line-height: 1; }
.hm-day .hm-day-flag { margin-left: auto; padding: 2px 8px; border-radius: 99px; background: var(--terra); color: var(--surface-header-text, #fff); }
.hm-day-flag-list { display: none; }
.hm-day-pic { position: relative; min-height: var(--hm-day-pic-h); aspect-ratio: 16 / 9; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); overflow: hidden; background: color-mix(in srgb, var(--chip) var(--hm-tint-strong), var(--hm-card)); }
.hm-day-photo, .hm-day-pip { position: absolute; inset: 0; width: 100%; height: 100%; }
.hm-day-photo { object-fit: cover; }
.hm-day-pip { padding: 4px; box-sizing: border-box; object-fit: contain; }
.hm-day-icon { font-size: var(--hm-day-icon); color: var(--chip); }
.hm-day-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hm-day .hm-day-name { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hm-day .hm-day-kind, .hm-day .hm-day-note { line-height: 1.25; color: var(--muted); overflow-wrap: anywhere; }
.hm-day .hm-day-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Row or List, on a phone */
/* v3.7.867: the track was 22% black, which was right on a solid colour bar and
   a grey smudge on the tint. It is now a tint of the member's colour, the same
   way the pill above is. */
.hm-seg { padding: 3px; border-radius: 99px; background: color-mix(in srgb, var(--terra) 22%, var(--surface-card-solid)); }
.hm-seg .hm-seg-btn { min-width: 64px; min-height: 38px; padding: 0 14px; border: 0; border-radius: 99px; background: transparent; color: inherit; font-weight: 700; cursor: pointer; }
.hm-seg .hm-seg-btn.is-on { background: var(--hm-card); color: var(--dark); }

/* ── At a Glance and the quick links ──────────────────────────────────────── */
/* The layout itself is the v3.7.866 block further down; these are the pieces. */
.hm-stat { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.hm-stat-of { font-size: .42em; font-weight: 400; color: var(--muted); }
/* v3.7.875: Bex - "quick launch buttons need more top and bottom padding".
   8px all round was tight against the icon and label stacked inside it. The
   horizontal padding is unchanged; these tiles sit in a tight grid and widening
   them would squeeze the labels. min-height still governs, so short labels do
   not shrink the tile. */
.hm-quick-btn { min-height: var(--hm-quick-h); padding: 16px 8px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: var(--radius-btn); text-align: center; text-decoration: none; transition: background-color .15s ease; }   /* v3.7.870: was filter + transform; the contract moves the fill, not the tile */
/* v3.7.870 — THE BUTTONS BEX POINTED AT. These are the dashboard's quick-launch
   tiles, and their hover was `filter: brightness(.94)` plus a 1px lift, while
   "Open the Grid" right above them swapped background colour and did not move.
   Bex: "on the dashboard alone, the Open the Grid mouse over is different from
   the quick launch button mouse overs."

   Both now darken by the same 12% and neither moves. A filter was also the one
   mechanic that dimmed the TEXT along with the fill, which is why it could never
   be reconciled with the auto-contrast pairs the rest of the app uses. */
.hm-quick-make:hover { background: var(--green-hover); color: var(--on-secondary); }
.hm-quick-plan:hover { background: var(--terra-hover); color: var(--on-primary); }
.hm-quick-make { background: var(--green); color: var(--on-secondary); }    /* v3.7.859: the colour was on .hm-quick-btn and the background here, so neither rule looked wrong on its own */
.hm-quick-plan { background: var(--terra); color: var(--on-primary); }

/* Tonight sits above the week, full width, on a tablet held upright: it need not be as tall there */
@media (max-width: 1023px) {
  .hm-page { --hm-tonight-min: 300px; }
}
@media (max-width: 767px) {
  .hm-page { --hm-gap: 14px; --hm-tonight-min: 236px; --hm-day-w: 128px; --hm-day-min-h: 172px; --hm-day-pic-h: 60px; --hm-quick-h: 66px; }   /* v3.7.871: phones get the same lift, scaled */
  .hm-tonight-body { padding: 16px; }
  /* This Week: a row to swipe, or a list. The switch is in the header; the link to the Grid moves under the days. */
  .hm-seg { display: flex; }
  .hm-week-link-head { display: none; }
  .hm-week-link-foot { min-height: var(--hm-tap); padding: 8px 14px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 6px; border-top: 1px solid var(--rule); color: var(--dark); font-weight: 700; text-decoration: none; }
  .hm-day { flex: 0 0 var(--hm-day-w); }
  .hm-week.is-list .hm-days { flex-direction: column; gap: 0; padding: 0; overflow: visible; }
  .hm-week.is-list .hm-day { flex: 0 0 auto; min-height: 60px; flex-direction: row; align-items: center; gap: 12px; padding: 8px 14px; border: 0; border-top: 1px solid var(--rule); border-radius: 0; }
  .hm-week.is-list .hm-day:first-child { border-top: 0; }
  .hm-week.is-list .hm-day:hover { transform: none; box-shadow: none; }
  .hm-week.is-list .hm-day-top { width: 34px; flex-shrink: 0; flex-direction: column; flex-wrap: nowrap; align-items: center; gap: 2px; }
  .hm-week.is-list .hm-day-pic { width: var(--hm-list-pic); height: var(--hm-list-pic); min-height: 0; aspect-ratio: auto; }
  .hm-week.is-list .hm-day-text { flex: 1 1 auto; }
  .hm-week.is-list .hm-day .hm-day-name { -webkit-line-clamp: 2; }
  .hm-week.is-list .hm-day-flag-row { display: none; }
  .hm-week.is-list .hm-day .hm-day-flag-list { display: inline-block; flex-shrink: 0; margin-left: 0; }
  .hm-glance { padding: 14px 16px; }
  .hm-stat { min-width: 0; }
}

/* Nothing in the backyard moves when the device asks for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hm-hero *, .hm-tonight, .hm-day, .hm-quick-btn { animation: none !important; transition: none !important; }
  .hm-tonight:hover, .hm-day:hover, .hm-quick-btn:hover { transform: none; }
  .hm-fly:nth-child(1) { left: 22%; }
  .hm-fly:nth-child(2) { left: 61%; }
  .hm-fly:nth-child(3) { left: 78%; }
}
@media print {
  .hm-sky, .hm-seg { display: none; }
  .hm-ground { background: none; color: #000; }
}

/* ── Prep & Freeze page (v3.7.817) ─────────────────────────────────────────────
   One page under My Kitchen: the list being worked on (".pf-main"), "Your lists" and the
   freezer (".pf-side"). Mirrors the Grid's message bar (.afp-undo, reused as-is) and the same
   card/section language as the rest of My Kitchen. */
.pf-page { display: flex; flex-direction: column; gap: 16px; }
/* The message bar stays in view under the page's own tabs (v3.7.821): what Cooked took off the pantry is
   said here, and the card that was pressed can be a long way down the page. prep-freeze.js sets the offset. */
.pf-note { margin-bottom: 0; position: sticky; top: var(--pf-note-top, calc(var(--nav-h) + 56px)); z-index: 80; box-shadow: var(--shadow-md); }
.pf-page [hidden] { display: none !important; }     /* a .btn would otherwise stay in view: the bar's Undo showed on every message (fixed v3.7.820) */
.pf-wrap { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
/* ── v3.7.890. One card, like Autofill Lists ──────────────────────────────
   .pf-wrap-card is .al-wrap's twin: it clips the bar's corners so the bar sits
   flush at the top of the card. The bar itself is .al-head, borrowed (872 made
   it reusable; Notes was the second borrower, this is the third). */
.pf-wrap-card { overflow: hidden; padding: 0; }
.pf-wrap-card > .pf-bar.al-head { border: none; border-radius: 0; border-bottom: 1px solid var(--rule); }
/* Autofill's bar carries one action; this one carries three, so they get a group
   that wraps as a unit instead of three flex items breaking up independently. */
.pf-bar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* The steps keep their own cards INSIDE the block -- they are four small panels,
   not a section, and that reads the same as the freezer's item cards sitting
   inside its one card. */
.pf-items-block { display: flex; flex-direction: column; gap: 12px; }
.pf-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
/* v3.7.884: was flex: 1 1 280px — the only sidebar in the app not reading
   --side-w, and wrong twice over: hard-coded at 280px rather than 264px, and
   `1 1` rather than `0 0`, so it stretched and shrank with its content instead
   of holding a fixed column. On a wide screen it was not 280px either; it was
   whatever was left. Bex spotted it as the one sidebar that did not match. */
.pf-side { flex: 0 0 var(--side-w); min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.pf-muted { color: var(--muted); }

/* v3.7.875: background, border and radius stripped - they come from the shared
   card surface above now. While a later rule re-declared them, the shared
   definition was decoration that never applied: that is exactly why twelve
   rules had to be stripped in 872. Padding stays; it is this card's own. */
.pf-card {
  padding: 16px 18px;
}
.pf-empty, .pf-empty-items { text-align: center; border-style: dashed; color: var(--muted); }
.pf-empty h2 { margin: 0 0 6px; }
.pf-empty h1 { margin: 0 0 6px; }
.pf-empty p { margin: 0 0 14px; }
.pf-upsell-mini { text-align: center; }
.pf-upsell-mini .tx-section { margin: 0 0 6px; }
.pf-upsell-mini p { margin: 0 0 14px; color: var(--muted); }

/* v3.7.890: the three list buttons moved up into the bar, so this is a field and
   its caption, not a row of controls. */
.pf-head { display: block; }
.pf-head-name { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
/* v3.7.891 — Bex: "the font size on prep and freeze 'list name' is way too big,
   use the same size as the autofill lists". It was --fs-page-title at weight 800 in
   the display font: a page title living inside an input, on a page whose title is
   now in the bar above it. The field is .form-control in the markup now and takes
   .al-name's treatment below, so the two pages cannot drift apart again. */
.pf-shop-toggle { border: 2px solid var(--green); background: #fff; color: var(--green-dark); font-weight: 700; }
.pf-shop-toggle.is-on { background: var(--green); color: var(--on-secondary); }

.pf-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pf-step { padding: 10px 12px; }   /* v3.7.875: surface now shared (see the .mg-card group) */
.pf-step-n { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-subtitle); }   /* v3.7.873: was inheriting 16px */
@media (max-width: 640px) { .pf-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.pf-finished {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  border: 2px solid var(--green); background: var(--green-tint);
}
.pf-finished-text { flex: 1 1 260px; min-width: 0; color: var(--dark); }

.pf-add { display: flex; flex-direction: column; gap: 10px; }
.pf-add-title { margin: 0; }
/* The pull-down (".mg-pick", shared) and its button, side by side (v3.7.823) */
.pf-pick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pf-pick-row > .mg-pick { flex: 1 1 320px; }
.pf-pick-add { flex-shrink: 0; min-height: 44px; }
.pf-add-or { margin-top: 4px; }
.pf-add-results { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-add-result {
  min-height: 44px; padding: 4px 14px; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--rule); border-radius: 99px; background: var(--surface); color: var(--dark);
  font-size: var(--fs-body); cursor: pointer;
}
.pf-add-result:hover { background: var(--surface-2); }

.pf-item { border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface-card-solid); overflow: hidden; }
.pf-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; }
.pf-item-title { flex: 1 1 200px; min-width: 0; }
.pf-pill { padding: 4px 12px; border-radius: 99px; font-weight: 700; font-size: var(--fs-small); }
.pf-pill-pending { background: var(--surface); color: var(--dark); }
.pf-pill-cooked  { background: var(--green-tint); color: var(--green-dark); }
.pf-pill-frozen  { background: var(--freezer-tint); color: var(--freezer-ink); }
.pf-open-toggle[aria-expanded="true"] { background: var(--surface-2); }

.pf-stepper { display: flex; align-items: center; gap: 6px; }
.pf-step-btn {
  width: 40px; height: 40px; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: #fff; color: var(--dark); font-size: 1.2rem; font-weight: 700; cursor: pointer;
}
.pf-step-btn:hover { background: var(--surface); }
.pf-step-val { min-width: 76px; text-align: center; font-weight: 700; font-size: var(--fs-body); }   /* v3.7.873: was inheriting 16px */

.pf-icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer;
}
.pf-icon-btn:hover { background: var(--surface); color: var(--dark); }

.pf-item-recipe { display: flex; flex-wrap: wrap; gap: 16px 24px; padding: 16px; border-top: 1px solid var(--rule); }
.pf-item-recipe[hidden] { display: none; }
.pf-ingredients { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pf-ingredient { display: flex; gap: 10px; font-size: var(--fs-body); }
.pf-ing-amt { width: 72px; flex-shrink: 0; font-weight: 700; }
.pf-steps-list { flex: 2 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pf-steps-group { display: flex; flex-direction: column; gap: 6px; }
.pf-cook-step {
  min-height: 44px; padding: 6px 10px; display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--rule); border-radius: var(--radius-sm); background: #fff; color: var(--dark);
  text-align: left; font-size: var(--fs-body); cursor: pointer; width: 100%;
}
.pf-cook-step-n {
  width: 24px; height: 24px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--green); color: var(--on-secondary); font-weight: 700; font-size: var(--fs-small);
}
.pf-cook-step.is-done { background: var(--surface); color: var(--muted); text-decoration: line-through; }
.pf-cook-step.is-done .pf-cook-step-n { background: var(--muted); }

.pf-item-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px;
  border-top: 1px solid var(--rule); background: var(--surface);
}
.pf-btn-freezer { background: var(--chip-freezer) !important; border-color: var(--chip-freezer) !important; color: var(--on-freezer, #fff) !important; }
/* v3.7.887: this button had NO :hover rule at all, so it was inert on mouseover.
   Bex: "we need the same mouse over effect as button #1 ... (i believe the
   transparency dips?!)". It is not a transparency dip — button #1 darkens:
   --green-hover is color-mix(--green 88%, #000). Same recipe applied to the
   freezer blue rather than the same colour, so the button keeps the Grid's
   freezer hue and gains button #1's behaviour. !important to match the
   declaration above, which already carries it. */
.pf-btn-freezer:hover { background: color-mix(in srgb, var(--chip-freezer) 88%, #000) !important; border-color: color-mix(in srgb, var(--chip-freezer) 88%, #000) !important; }
.pf-frozen-line { font-weight: 700; color: var(--freezer-ink); }
.pf-link { border: 0; background: transparent; color: var(--dark); font-size: var(--fs-small); text-decoration: underline; cursor: pointer; padding: 0 4px; min-height: 44px; }

/* v3.7.875: .mg-side-head is an exact alias added to all four places
   .pf-side-head is declared - this one, and three more further down the file.
   It changes nothing for Prep & Freeze; it gives the sidebar header bar a name
   that is not tied to one page, so meal-view can use the same component instead
   of hand-rolling a third one. Bex: "the sidebar colours are wrong, remember
   headers should be secondary colour" - var(--green) IS the member's secondary
   (app_header.php sets it from $_hdr_colorSecondary), with --on-secondary
   picked for contrast against it. */
/* v3.7.877: tinted, not solid. Font size deliberately untouched - Bex is
   auditing every font she has an issue with separately, and changing sizes
   underneath that audit would make her re-check work she had already done. */
.pf-side-head,
.mg-side-head {
  padding: 12px 14px; background: var(--side-header-bg); color: var(--side-header-text);
  font-family: var(--font-display); font-weight: 800; font-size: var(--fs-section);
}
/* Cobalt is a fixed accent rather than a member colour, but it is the same
   component, so it takes the same treatment. One solid bar left among tinted
   ones is the inconsistency this change exists to remove. */
.pf-side-head-cobalt { background: color-mix(in srgb, var(--chip-freezer) 14%, var(--card-header-floor)); color: var(--side-header-text); }
.pf-lists, .pf-freezer,
/* v3.7.890: .pf-shop joins them -- it leads with .pf-side-head now, and a bar
   inset by the card's own 16px padding is not a bar. */
.pf-shop { overflow: hidden; padding: 0; }
.pf-lists-body { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.pf-list-pick {
  min-height: 52px; padding: 8px 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  border: 2px solid var(--rule); border-radius: var(--radius-sm); background: #fff; color: var(--dark);
  text-align: left; cursor: pointer; width: 100%; box-sizing: border-box;
}
.pf-list-pick.is-current { border-color: var(--terra-dark); background: var(--terra-tint); }
.pf-list-pick-name { font-weight: 700; }
.pf-list-new {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  /* v3.7.875: Bex - "I don't like the + New List button, it really doesn't fit
     with everything else". It was a dashed box with a square-ish radius, while
     859 settled on ONE button shape for the whole app: the pill, var(--radius-btn).
     It is the white-button treatment now, on the same --btn-border-w the rest of
     them got this build, so it reads as a button rather than a drop zone. */
  border: var(--btn-border-w) solid var(--rule); border-radius: var(--radius-btn); background: var(--surface-card-solid); color: var(--terra-ink);
  font-weight: 700; font-size: var(--fs-small); cursor: pointer;
}

.pf-old-badge { margin-top: 2px; display: inline-block; padding: 1px 8px; border-radius: 99px; background: #fbeed3; color: #6b4200; font-weight: 700; font-size: var(--fs-badge); }
/* v3.7.886: the blue is gone. --freezer-tint is --chip-freezer (the Grid's
   freezer-meal chip) at 14%, so this card was the only sidebar wearing a hue of
   its own. Bex: "lets make it match all the others, i'm ok with the button
   being blue" — .pf-btn-freezer keeps the solid chip colour, which is what ties
   the card to the Grid without painting the whole panel. */
/* v3.7.887: centred. Bex's screenshot circles the Meals/Recipes switch and the
   Dinners stepper — the two children narrower than the column, which hugged the
   left while the select and the Freeze button ran full width, and that is what
   read as ragged. align-items centres the narrow boxes, text-align centres the
   labels above them, and the two full-width controls are pinned at 100% so
   centring cannot shrink them to their content. */
.pf-freezer-add { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 12px 14px; }
.pf-freezer-add > .mg-pick,
.pf-freezer-add > .btn,
.pf-freezer-add > .tx-eyebrow { width: 100%; }
/* v3.7.888 — Bex: "either center or make full width of sidebar". Full width, so
   the switch, the pull-down and Freeze share one column edge. .mg-pick is already
   100% above; this is the kinds group INSIDE it, which sized to its two buttons.
   Scoped to .pf-freezer-add on purpose: the picker is shared with Prep & Freeze
   (includes/cookbook_pick.php) and only this sidebar was asked for. */
.pf-freezer-add .mg-pick-kinds { display: flex; width: 100%; }
.pf-freezer-add .mg-pick-kinds > .gb-view { flex: 1 1 0; justify-content: center; }

.pf-see-freezer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--surface-card); border: 1px solid var(--rule);
  min-height: auto; text-decoration: none; font-weight: 600;
}
.pf-see-freezer:hover { border-color: var(--chip-freezer); color: var(--freezer-ink); }

@media (max-width: 767px) {
  .pf-wrap { flex-direction: column; }
}

/* ── In the Freezer tab (Lists page) — v3.7.819; photo cards v3.7.822 ─────────
   Markup: includes/freezer_tab_panel.php · Script: assets/js/freezer-tab.js
   .ift-items is one markup with two looks: data-view="cards" (a photo card per dinner, the
   Cookbook's proportions) or "list" (a compact row each). The switch is the Grid's (".gb-views"),
   given the two tokens it reads there. */
.ift-layout {
  --gb-tap: 44px;
  --gb-card: var(--surface-card-solid, #fff);
  --ift-card-min: 210px;              /* narrowest a card gets before a column is dropped */
  --ift-photo-h: 130px;               /* the Cookbook card's photo height */
  --ift-thumb: 56px;                  /* the photo in the List view */
  /* v3.7.860: the page wrapper owns the padding and the width now, like every
     other page. This had its own 16px and its own max-width, so the Freezer sat
     to a different rhythm than the three tabs beside it — Bex: "need to change
     to the full width layout, colours/styles need to be uniform with everything
     else (not sure why they are different)". */
  display: flex; gap: var(--side-gap, 16px); align-items: flex-start; flex-wrap: wrap;
}
.ift-layout [hidden] { display: none !important; }     /* a card is display:flex, which would otherwise beat the search filter */
.ift-list { flex: 2 1 420px; min-width: 280px; }
.ift-add  { flex: 0 1 var(--side-w); min-width: 240px; padding: 0; overflow: hidden; }   /* v3.7.860: the shared sidebar width, so it lines up with the other tabs */
.ift-tools { padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border-bottom: 1px solid var(--rule); }
.ift-search { flex: 1 1 200px; min-width: 0; min-height: var(--gb-tap); }
.ift-layout .ift-views { display: inline-flex; flex-shrink: 0; }     /* shown on phones too: the Grid hides its own switch there, the freezer keeps both views */
.ift-msg { padding: 14px 16px; }

.ift-items { padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--ift-card-min), 1fr)); gap: 16px; }
.ift-items > .ift-msg { grid-column: 1 / -1; padding: 0; }
.ift-item {
  min-width: 0; display: flex; flex-direction: column;
  border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface-card-solid, #fff);
  overflow: hidden; color: var(--dark);
  animation: afp-rise .2s ease-out; transition: var(--ease);
}
.ift-item:hover { box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--terra) 45%, var(--rule)); }   /* v3.7.860: was a fixed cobalt tint */
.ift-photo {
  height: var(--ift-photo-h); flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cobalt-tint) 55%, var(--surface-card-solid, #fff)) 0%, var(--cobalt-tint) 100%);
  color: var(--cobalt); font-size: 2.2rem;
}
.ift-photo-img { width: 100%; height: 100%; display: block; object-fit: cover; }
.ift-photo-pip { max-width: 80%; height: 88%; display: block; object-fit: contain; }
.ift-body { flex: 1 1 auto; min-width: 0; padding: 12px 14px 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ift-title { margin: 0; overflow-wrap: anywhere; }
.ift-count strong { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-section); color: var(--freezer-ink); }
.ift-old { margin-top: 4px; }
.ift-use { margin: 0 14px 14px; min-height: var(--gb-tap); justify-content: center; }

/* List view: the same pieces in a row, the photo as a small square */
.ift-items[data-view="list"] { padding: 0; display: flex; flex-direction: column; gap: 0; }
.ift-items[data-view="list"] > .ift-msg { padding: 14px 16px; }
.ift-items[data-view="list"] .ift-item {
  flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px;
  border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; animation: none;
}
.ift-items[data-view="list"] .ift-item:hover { box-shadow: none; background: var(--surface); }
.ift-items[data-view="list"] .ift-photo { width: var(--ift-thumb); height: var(--ift-thumb); border-radius: var(--radius-sm); overflow: hidden; font-size: 1.2rem; }
.ift-items[data-view="list"] .ift-body { padding: 0; }
.ift-items[data-view="list"] .ift-body .tx-eyebrow { display: none; }
.ift-items[data-view="list"] .ift-use { margin: 0; flex-shrink: 0; }
@media (prefers-reduced-motion: reduce) { .ift-item { animation: none; transition: none; } }

/* ── Shopping for a Prep & Freeze list (v3.7.820) ────────────────────────────
   Rules: classes/PrepShopping.php · Markup: includes/prep_shopping.php
   .pf-shop  "Shopping for this list" on the Prep & Freeze page. It is the Day page's shopping card
             (".dy-shop-"), given the tokens those pieces read on the Day page.
   .ps-card  the "For prep" cards on the Shopping List, one per list that is switched on. Rows are
             that page's own (".shop-item"); the frame is the Extras card (".sx-card") in amber. */
.pf-shop {
  --dy-box: 22px;
  --dy-on-accent: var(--surface-header-text, #fff);
  --gb-tap: 44px;
  --gb-card: var(--surface-card-solid, #fff);
  --gb-accent-tint: 14%;
  --ps-list-max: 640px;               /* a month of batch cooking is a long list: it scrolls in its card */
  padding: 0;
  overflow: hidden;
}
.pf-shop .dy-shop-item:focus-visible { outline: 2px solid var(--terra); outline-offset: -2px; }
.pf-shop .dy-shop-item:last-child { border-bottom: 0; }
.ps-foot { padding: 10px 16px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
@media (min-width: 768px) {
  .pf-shop .dy-shop-list { max-height: min(70vh, var(--ps-list-max)); overflow-y: auto; scrollbar-width: thin; }
}

.ps-card {
  --ps-edge: color-mix(in srgb, var(--amber-deep) 55%, var(--dark));
  --ps-ink: color-mix(in srgb, var(--amber-deep) 40%, var(--dark));
  --ps-paper: color-mix(in srgb, var(--amber) 18%, var(--surface-card-solid, #fff));
  margin-bottom: 16px;
  border: 2px solid var(--ps-edge);
  animation: afp-rise .2s ease-out;
}
.ps-head { padding: 8px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; background: var(--ps-paper); color: var(--dark); }
.ps-head > .fa-solid { color: var(--ps-ink); }
.ps-head-text { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.ps-eyebrow { color: var(--ps-ink); }
.ps-title { margin: 0; overflow-wrap: anywhere; }
.ps-count { margin-left: 0; }
.ps-open { min-height: var(--sx-tap); display: inline-flex; align-items: center; color: var(--dark); font-weight: 700; text-decoration: underline; }
.ps-open:hover { color: var(--dark); }
.ps-hint { margin: 0; padding: 8px 14px 0; color: var(--muted); }
.ps-rows { padding: 2px 0 6px; column-count: 3; column-gap: 0; }   /* v3.7.860: 3 on desktop, per Bex */
.ps-cat { break-inside: avoid; }
.ps-cat-name { padding: 10px 14px 2px; }
.ps-item { padding: 0 14px; }
.ps-item .shop-item-info { flex: 1 1 auto; }
.ps-item .shop-item-qty { margin-left: auto; }
.ps-item .sx-tick:focus-visible { outline: 2px solid var(--terra); outline-offset: -2px; }
@media (max-width: 1100px) { .ps-rows { column-count: 2; } }
@media (max-width: 640px)  { .ps-rows { column-count: 1; } }
@media (prefers-reduced-motion: reduce) { .ps-card { animation: none; } }
@media print {
  .ps-card { border: 0; box-shadow: none; }
  .ps-head { background: none; border-bottom: 1pt solid #ddd; padding: 6pt 0 3pt; }
  .ps-head > .fa-solid, .ps-count { display: none; }
  .ps-rows { column-gap: 16pt; }           /* rows lose their side padding in print: keep the two columns apart */
}


/* ── Data › Backup & Share: the three choices (v3.7.845) ──────────────────
   Three equal columns on a desktop, stacked on a phone. Equal height by
   design, and each button's label sits at the top with its explanation
   underneath, so the three read as a row of siblings rather than three
   buttons that happen to be near each other. */
.mg-backup-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: stretch;
}
.mg-backup-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 12px 14px;
  height: 100%;
  line-height: 1.4;
  white-space: normal;
}
.mg-backup-btn > .fa-solid { margin-top: 2px; flex: 0 0 auto; }
.mg-backup-btn > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mg-backup-btn strong { font-weight: 700; }
.mg-backup-btn small { font-size: var(--fs-meta); opacity: .75; font-weight: 500; }
.mg-backup-btn[disabled] { opacity: .6; cursor: default; }

@media (max-width: 860px) {
  .mg-backup-choices { grid-template-columns: 1fr; }
}

/* ── Backdrop wash control (Preferences › Colours) ───────────────────────────
   v3.7.858. Lets the member override the strength measured from their image.
   Classes, not inline styles, per the single-CSS rule.                       */
.bd-wash { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--rule); }
.bd-wash-note { margin: 0 0 10px; color: var(--muted); }
.bd-wash-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bd-wash-opt {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 12px; cursor: pointer;
  border: 2px solid var(--rule); border-radius: var(--radius-md);
  background: var(--surface-card); transition: var(--ease);
}
.bd-wash-opt:hover { border-color: color-mix(in srgb, var(--terra) 45%, var(--rule)); }
.bd-wash-opt.is-on { border-color: var(--terra-ink); background: var(--terra-tint); }
.bd-wash-opt input { position: absolute; opacity: 0; pointer-events: none; }
.bd-wash-opt:focus-within { outline: 2px solid var(--terra); outline-offset: 2px; }
.bd-wash-name { font-family: var(--font-display); font-weight: 700; color: var(--dark); }
.bd-wash-hint { font-size: var(--fs-meta); color: var(--muted); line-height: 1.35; }
@media (max-width: 720px) { .bd-wash-opts { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════════════════════════════════
   PAGE STYLES — lifted out of inline <style> blocks in v3.7.858

   These used to live in <style> tags inside the page files, which is how the
   app ended up with fourteen pages that disagreed about cards, sidebars and
   font sizes, and why the single-CSS rule kept quietly breaking.

   Each block is scoped to body.pg-<page>, the slug app_header.php puts on
   <body>, so a rule still applies only to its own page -- cookbook.php's
   4-column .ing-row must NOT reach recipe.php or meal-view.php, which use
   the shared 5-column one.

   New page-specific rules belong here, scoped the same way. Do not add a
   <style> block to a page file -- a test now fails on it.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Shared print rules (were duplicated across pages) ── */
@media print {
  .app-topnav, .app-footer, .sl-tab-strip, button, a.btn, .no-print, #tab-sl-ingredients { display: none !important; } #tab-sl-list { display: block !important; } body { background: #fff !important; color: #333 !important; font-size: 11pt !important; } .mg-page-wide { padding: 0 8px !important; } .page-hero { padding: 0 0 8pt !important; border-bottom: 2pt solid #A1280B !important; margin-bottom: 8pt !important; } .page-hero h1 { font-size: 14pt !important; margin: 0 !important; color: #A1280B !important; } .page-hero h1 i { display: none !important; } .page-hero p { display: block !important; font-size: 8pt !important; color: #999 !important; margin: 2pt 0 0 !important; } .list-toolbar { padding: 0 !important; margin-bottom: 6pt !important; } .list-toolbar-title { font-size: 11pt !important; color: #666 !important; } .category-header { font-size: 9pt !important; color: #A1280B !important; background: none !important; border-bottom: 1pt solid #ddd !important; padding: 6pt 0 3pt !important; margin-top: 8pt !important; page-break-after: avoid !important; } .sl-card-header { background: none !important; color: #A1280B !important; padding: 0 0 6pt !important; border-bottom: 2pt solid #A1280B !important; box-shadow: none !important; } .sl-card-header-top { font-size: 12pt !important; } .sl-card-header-stats { font-size: 8pt !important; color: #666 !important; } .sl-card-actions { display: none !important; } .sl-list-card { border: none !important; border-radius: 0 !important; background: none !important; } .shop-item { padding: 3pt 0 !important; } .shop-item-source { margin-left: 0 !important; max-width: 100% !important; text-align: left !important; } .category-section { page-break-inside: avoid !important; } .shop-item { padding: 3pt 0 !important; gap: 6pt !important; border-bottom: 0.5pt solid #eee !important; } .shop-item-name { font-size: 10pt !important; } .shop-item-qty { font-size: 8.5pt !important; color: #666 !important; } .shop-item-recipes { font-size: 7pt !important; color: #999 !important; } .shop-check { border: 1.5pt solid #999 !important; background: #fff !important; width: 12pt !important; height: 12pt !important; border-radius: 2pt !important; } .shop-check.checked { background: #ddd !important; } .shop-check::after { display: none !important; } .shop-item.checked .shop-item-name { opacity: .4 !important; text-decoration: line-through !important; } @page { margin: 1.5cm; }
  .app-topnav, .app-footer, button, a.btn, .btn, form, #share-btn, .recipe-hero-badges, [onclick], .no-print { display: none !important; } body { background: #fff !important; font-size: 11pt !important; } .page-content { padding: 0 !important; max-width: 100% !important; } .recipe-hero-card { } .recipe-hero-grid { height: auto !important; grid-template-columns: 180pt 1fr !important; } .recipe-hero-img { height: 180pt !important; } .recipe-hero-meta { border: none !important; padding: 12pt !important; } .recipe-hero-meta h1 { font-size: 16pt !important; color: #A1280B !important; } .recipe-hero-tag { font-size: 7pt !important; } .recipe-hero-placeholder { display: none !important; } .recipe-detail-card { padding: 10pt !important; margin-bottom: 8pt !important; page-break-inside: avoid !important; } .recipe-detail-card h2 { font-size: 11pt !important; color: #A1280B !important; border-bottom: 1pt solid #eee !important; padding-bottom: 4pt !important; margin-bottom: 8pt !important; } div[style*="action"] { display: none !important; } @page { margin: 1.5cm; }
}

/* ── index.php ── */
:where(body.pg-index) .review-overlay { position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:9999;display:flex;align-items:center;justify-content:center;animation:reviewFadeIn .3s ease }
@keyframes reviewFadeIn { from{opacity:0} to{opacity:1} }
:where(body.pg-index) .review-modal { background:var(--surface,#fff);border-radius:20px;padding:32px 28px 24px;max-width:420px;width:90%;box-shadow:0 20px 60px rgba(0,0,0,.2);text-align:center;position:relative;animation:reviewSlideUp .35s cubic-bezier(.4,0,.2,1) }
@keyframes reviewSlideUp { from{transform:translateY(30px);opacity:0} to{transform:translateY(0);opacity:1} }
:where(body.pg-index) .review-close { position:absolute;top:12px;right:14px;background:none;border:none;font-size:1.1rem;color:var(--muted);cursor:pointer;padding:4px;border-radius:50%;transition:all .15s }
:where(body.pg-index) .review-close:hover { background:var(--rule);color:var(--dark) }
:where(body.pg-index) .review-stars { display:flex;justify-content:center;gap:6px;margin:16px 0 }
:where(body.pg-index) .review-stars i { font-size:1.6rem;color:var(--rule);cursor:pointer;transition:all .15s }
:where(body.pg-index) .review-stars i:hover, :where(body.pg-index) .review-stars i.active { color:#f59e0b;transform:scale(1.15) }
:where(body.pg-index) .review-textarea { width:100%;padding:10px 14px;border:1.5px solid var(--rule);border-radius:12px;font-size:.85rem;font-family:var(--font-body);resize:vertical;min-height:70px;margin:12px 0;background:var(--surface);color:var(--dark) }
:where(body.pg-index) .review-textarea:focus { border-color:var(--terra-ink);outline:none }
:where(body.pg-index) .review-submit { width:100%;padding:10px;border:none;border-radius:12px;background:var(--terra);color: var(--on-primary);font-family:var(--font-display);font-weight:700;font-size:var(--fs-body);cursor:pointer;transition:all .15s }   /* v3.7.873: .88rem missed --fs-body (.875rem) by a hair */
:where(body.pg-index) .review-submit:hover { background: var(--terra-hover) }   /* v3.7.870: was #8a2009, the pre-787 terracotta hard-coded */
:where(body.pg-index) .review-submit:disabled { opacity:.5;cursor:default }
:where(body.pg-index) .review-skip { margin-top:10px;font-size:var(--fs-small);   /* v3.7.873: .78rem missed --fs-small (.8rem) */color:var(--muted);cursor:pointer;border:none;background:none;font-family:var(--font-body) }
:where(body.pg-index) .review-skip:hover { color:var(--dark) }

/* ── shopping-list.php ── */
/* ── Shopping list styles ──────────────────────────────────────────────────── */
:where(body.pg-shopping-list) .list-toolbar { display: flex; align-items: center; gap: 8px; padding: 14px 16px 0; max-width: var(--content-max); margin: 0 auto; flex-wrap: wrap; }
:where(body.pg-shopping-list) .list-toolbar-title { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-section); color: var(--dark); flex: 1; }
/* ── Shopping list header bar ──────────────────────────────────────────── */
/* v3.7.869 — Bex: "add to same bar". The dates, the counts and the two action
   buttons are now one bar instead of a bar with two buttons loose underneath.

   Done in CSS rather than by moving the markup, DELIBERATELY: #slHead and
   #slActions are separate slots that assets/js/shopping-range.js swaps
   independently when the date range changes (shopping-list.php:686-687). Merging
   them into one node would have broken the range swap, which no CSS guard would
   have caught. The two keep their own slots and simply share a surface. */
/* v3.7.885: the date bar is the header of the one big card now, so it stops
   being a card in its own right — no radius of its own (the wrapper clips it)
   and no shadow (it is not floating above anything any more). .sl-wrap below. */
:where(body.pg-shopping-list) .sl-card-header { padding: 16px 20px; text-align: center; margin-bottom: 0; }

/* ── v3.7.885. One card for the whole list ────────────────────────────────
   Bex: "can we make it 1 giant card with the date header and then the other
   list cards in the main big one? (we did this on cookbook)". Same shape as
   Cookbook's "All Meals": one .mg-card, a header bar flush to its top edge,
   everything else in the body.

   overflow:hidden is what lets the header bar meet the rounded corners.
   The inner cards stay translucent for now — Bex: "can we try option number 2
   - if i dont like it we'll make it solid". Cookbook's equivalent inner cards
   are solid white, so if the stacked translucency reads muddy, the fix is
   --surface-card-solid on .category-section and .sx-card and nothing else. */
:where(body.pg-shopping-list) .sl-wrap { overflow: hidden; }
:where(body.pg-shopping-list) .sl-wrap-body { display: flex; flex-direction: column; gap: 16px; }
/* The masonry columns keep their own 16px rhythm, so the body gap must not add
   a second one under the last row of category cards. */
/* v3.7.886: the -16px is gone. 885 added it to stop the masonry's last-row
   margin doubling with the card's own bottom padding, and cancelled the padding
   exactly — the card ended flush against its last row of cards. The two spaces
   are meant to add up; 16px of card padding under 16px of row rhythm is the
   32px gap the bottom of this card wanted all along. */
:where(body.pg-shopping-list) .sl-card-header-top { display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: var(--fs-section); letter-spacing: .01em; }
:where(body.pg-shopping-list) .sl-card-header-stats { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; font-size: var(--fs-meta); opacity: .85; }
:where(body.pg-shopping-list) .sl-card-header-stat strong { font-weight: 700; }
:where(body.pg-shopping-list) .sl-card-header-dot { opacity: .5; }
/* Action buttons bar */
/* v3.7.869: the bottom half of that same bar. It takes the tint from the token
   rather than from the inline style the header carries, which is only possible
   because 868 moved the header off a raw hex — while the colour was a hex
   printed into a style attribute there was nothing for this to match against.
   The 12px that used to sit between the two is now inside the bar. */
/* v3.7.884: these two buttons live in the Controls sidebar now, not under the
   date card. Everything that made them read as the bottom of that card — the
   tint, the bottom-only radius, the shadow and the 20px side padding that lined
   them up with it — is gone, because there is no card above them any more. They
   are a stacked pair in a sidebar group, matching Export CSV and Print directly
   below them. */
:where(body.pg-shopping-list) .sl-card-actions { display: flex; flex-direction: column; gap: 6px; }
/* v3.7.886: Export CSV and Print are real buttons now, so the width and the
   centring that used to be inline on each of them live here instead. */
:where(body.pg-shopping-list) .sl-sidebar-btn { width: 100%; text-align: center; text-decoration: none; }
/* An EMPTY range that still has a "For prep" card renders these buttons with no
   header above them — the head part bails out entirely when the list is empty.
   They then have to be a bar in their own right rather than the bottom half of
   one. PHP sets .is-alone, because only PHP knows; the first attempt at this
   tested `#slActions:empty` from the CSS side, which was the wrong way round
   AND would never have matched, since the include emits whitespace regardless.

   (D14 lives in that same condition — Bex has reported these buttons going
   missing when only a prep card is in range. Still open, not this.) */
/* .is-alone marked the empty-range case where these buttons had no bar above
   them to continue. In a sidebar every case is that case, so the modifier has
   nothing left to say — kept as a no-op selector because the PHP still emits
   the class, and removing it there is a separate change. */
:where(body.pg-shopping-list) .sl-card-actions.is-alone { }
/* v3.7.858: these were <button>s painted to look like footnotes -- meta-sized,
   muted, no fill -- so nobody read them as the tools they are. Now filled in the
   member's Secondary colour at Body size, with the text auto-picked for contrast
   so a pale Secondary still reads. */
/* v3.7.884: full width, to sit in the sidebar column with Export CSV and Print
   rather than side by side under a card. The solid Secondary fill stays — these
   are the list's two real actions and the other two are links out. */
:where(body.pg-shopping-list) .sl-action-btn { font-size: var(--fs-body) !important; font-weight: 600;
  width: 100%;
  background: var(--green) !important; border: 1px solid var(--green) !important;
  color: var(--on-secondary, #fff) !important; transition: var(--ease); }
:where(body.pg-shopping-list) .sl-action-btn:hover { background: var(--green-hover) !important; border-color: var(--green-hover) !important; }
:where(body.pg-shopping-list) .sl-action-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
/* Category section — individual cards */
:where(body.pg-shopping-list) .category-section { margin-bottom: 0; background: var(--surface-card); border: 1px solid rgba(255, 255, 255, 0.5); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); overflow: hidden; }
/* Card wrapper — masonry columns */
:where(body.pg-shopping-list) .sl-list-card { column-count: 3; column-gap: 16px; }
:where(body.pg-shopping-list) .sl-list-card .category-section { break-inside: avoid; margin-bottom: 16px; }
@media (max-width: 1100px) {
  :where(body.pg-shopping-list) .sl-list-card { column-count: 2; }
}
@media (max-width: 700px) {
  :where(body.pg-shopping-list) .sl-list-card { column-count: 1; }
}
/* Keep tab strip, toolbar and both lists on the same gutter as .page-content */
@media (min-width: 768px) {
  :where(body.pg-shopping-list) .sl-tab-strip, :where(body.pg-shopping-list) .list-toolbar { padding-left: 24px !important; padding-right: 24px !important; }
}
:where(body.pg-shopping-list) .category-header { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: var(--fs-eyebrow); font-weight: var(--tx-eyebrow-weight); letter-spacing: var(--tx-eyebrow-spacing); text-transform: var(--tx-eyebrow-transform); color: var(--sl-cat-text, var(--card-header-text)); background: var(--sl-cat-bg, var(--card-header-bg)); border-bottom: 1px solid var(--rule); margin-bottom: 0; font-family: var(--tx-eyebrow-font); font-style: var(--tx-eyebrow-style); }
/* Shopping item row */
:where(body.pg-shopping-list) .shop-item { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--rule); transition: background .15s; }
:where(body.pg-shopping-list) .shop-item:hover {
  /* v3.7.860: Bex — "i hate the cream hover, can we use a different colour?
     maybe one of the user defined colours but a little transparent".
     A translucent wash of their Primary, so it tints whatever card it is over
     rather than painting a flat colour on top of it. */
  background: color-mix(in srgb, var(--terra) 12%, transparent);
}
:where(body.pg-shopping-list) .shop-item:last-child { border-bottom: none; }
/* Custom checkbox */
/* v3.7.875: Bex - "can we make the little circles next to the items more
   visible?". They were 2px of --rule, and --rule is only a 20% tint of the
   member's colour, so on a pale theme the ring all but disappeared against the
   white card. --check-ring is a stronger mix of the same colour, so it still
   follows the theme but is actually visible. A token because the Prep & Freeze
   list and the pantry draw the same control. */
:where(body.pg-shopping-list) .shop-check { flex-shrink: 0; width: 19px; height: 19px; border-radius: 50%; border: 2px solid var(--check-ring); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--ease-bounce); margin-top: 2px; }
:where(body.pg-shopping-list) .shop-check:hover { border-color: var(--terra-ink); }
:where(body.pg-shopping-list) .shop-check.checked { background: #64748b; border-color: #64748b; }
:where(body.pg-shopping-list) .shop-check.checked::after { content: ''; width: 10px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translateY(-1px); display: block; }
:where(body.pg-shopping-list) .shop-item-info { flex: 1; min-width: 0; }
:where(body.pg-shopping-list) .shop-item-info { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
:where(body.pg-shopping-list) .shop-item-name { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-body); color: var(--dark); transition: var(--ease); }
:where(body.pg-shopping-list) .shop-item.checked .shop-item-name { color: var(--dark); opacity: 1; text-decoration: line-through; text-decoration-color: #64748b; text-decoration-thickness: 2px; }
/* Badges sit inside the name - don't inherit the strike-through */
:where(body.pg-shopping-list) .shop-item.checked .shop-item-name .pantry-badge { text-decoration: none; display: inline-block; }
/* Completed rows sit back in neutral grey so they read as 'done'
   and don't compete with the themed category bars */
:where(body.pg-shopping-list) .shop-item.checked { background: #f8fafc; }
:where(body.pg-shopping-list) .shop-item.checked:hover { background: #f1f5f9; }
:where(body.pg-shopping-list) .shop-item.checked .shop-item-qty { color: #94a3b8 !important; opacity: 1; }
:where(body.pg-shopping-list) .shop-item.checked .shop-item-source { color: #94a3b8; }
:where(body.pg-shopping-list) .shop-item-qty {
  /* v3.7.860: the measurement moves to the right of the row and takes Body (role 4),
     the same size as the item itself — Bex: "move the measurement to the right and
     make the same size as the item (i believe its font size setting 4)". */
  margin-left: auto;
  font-size: var(--fs-body);
  color: var(--terra-ink);
  font-weight: 600;
  margin-top: 0;
  white-space: nowrap;
}
:where(body.pg-shopping-list) .shop-item.checked .shop-item-qty { color: var(--muted); opacity: .5; }
:where(body.pg-shopping-list) .shop-item-source { font-size: var(--fs-meta); color: var(--muted); margin-top: 0; margin-left: auto; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
@media (max-width: 640px) {
  :where(body.pg-shopping-list) .shop-item-source { margin-left: 0; text-align: left; max-width: 100%; }
  :where(body.pg-shopping-list) .shop-item-info { gap: 6px; }
}
/* Pantry badge */
:where(body.pg-shopping-list) .pantry-badge { font-size: var(--fs-badge); font-weight: 700; padding: 1px 6px; border-radius: 8px; margin-left: 6px; vertical-align: middle; }
:where(body.pg-shopping-list) .pantry-badge-covered { background: #e2e8f0; color: #475569; }
:where(body.pg-shopping-list) .pantry-badge-partial { background: #fef3c7; color: #92400e; }
:where(body.pg-shopping-list) .pantry-badge-out { background: #fee2e2; color: var(--danger); }
/* Tab panes */
:where(body.pg-shopping-list) .tab-pane { display: none; }
:where(body.pg-shopping-list) .tab-pane.active { display: block; }
/* Print styles */
:where(body.pg-shopping-list) .ing-col-grid { column-count: 3; column-gap: 16px; }   /* v3.7.860: Bex — "the long width boxes suck, can we make the categories look more like the shopping list (3 columns, each category a smaller card)". Same masonry as .sl-list-card. */
:where(body.pg-shopping-list) .ing-col-grid .category-section { break-inside: avoid; margin-bottom: 16px; display: block; border-radius: var(--radius-md); overflow: hidden; background: var(--surface-card); border: 1px solid rgba(255,255,255,.5); box-shadow: var(--shadow-sm); }
:where(body.pg-shopping-list) .ing-col-grid .category-section:last-child { margin-bottom: 0; }
:where(body.pg-shopping-list) .ing-col-grid .category-header { }
/* v3.7.862: was a hard-coded #ef4444 with #fff on it — 3.76:1. Same token pair
   as the Shopping tab's banner, which measures 4.83:1. */
:where(body.pg-shopping-list) .ing-col-grid .category-section.ing-cat-uncategorized .category-header { background: var(--danger) !important; color: var(--on-danger) !important; }
@media (max-width: 1100px) {
  :where(body.pg-shopping-list) .ing-col-grid { column-count: 2; }
}
@media (max-width: 768px) {
  :where(body.pg-shopping-list) .ing-col-grid { column-count: 1; }
}

/* ── cookbook.php ── */
/* ── Cookbook styles ───────────────────────────────────────────────────────── */
/* Toolbar */
:where(body.pg-cookbook) .cb-toolbar { max-width: var(--content-max); margin: 0 auto; padding: 14px 16px 0; }
/* Tab bar */
:where(body.pg-cookbook) .cb-tabs { display: flex; border-bottom: none; gap: 6px; max-width: var(--content-max); margin: 0 auto; padding: 0 16px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
:where(body.pg-cookbook) .cb-tabs::-webkit-scrollbar { display: none; }
:where(body.pg-cookbook) .cb-tab { flex-shrink: 0; padding: 8px 20px; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-body); color: var(--body, #6B4C3B); background: #fff; border: 2px solid var(--muted, #9A7868); border-radius: 24px; cursor: pointer; text-decoration: none; display: flex; align-items: center; gap: 7px; transition: all 0.2s ease; white-space: nowrap; }
:where(body.pg-cookbook) .cb-tab:hover { color: var(--dark, #3D2314); background: #e8e0d0; border-color: var(--dark, #3D2314); }
:where(body.pg-cookbook) .cb-tab.active { color: #fff; background: #3b492d; border-color: #3b492d; }
:where(body.pg-cookbook) .cb-tab-count { font-size: var(--fs-meta); background: var(--surface-2); color: var(--muted); padding: 1px 6px; border-radius: 8px; font-weight: 700; }
:where(body.pg-cookbook) .cb-tab.active .cb-tab-count { background: rgba(255,255,255,0.25); color: #fff; }
/* Content area */
:where(body.pg-cookbook) .cb-panel { display: none; }
:where(body.pg-cookbook) .cb-panel.active { display: block; }
/* Card grid */
:where(body.pg-cookbook) .item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
@media (min-width: 768px) {
  :where(body.pg-cookbook) .item-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
}
/* Item card */
:where(body.pg-cookbook) .item-card { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; transition: var(--ease); position: relative; }
:where(body.pg-cookbook) .item-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--terra-tint); }
:where(body.pg-cookbook) .item-card-img { width: 100%; height: 130px; object-fit: cover; display: block; background: var(--surface); }
:where(body.pg-cookbook) .item-card-img-placeholder { width: 100%; height: 130px; background: linear-gradient(135deg, color-mix(in srgb, var(--terra) 10%, var(--surface-card-solid)) 0%, color-mix(in srgb, var(--green) 14%, var(--surface-card-solid)) 100%); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
/* Pip standing in for a photo (v3.7.827), sized as on the freezer cards (".ift-photo-pip") */
:where(body.pg-cookbook) .item-card-img-pip { max-width: 80%; height: 88%; display: block; object-fit: contain; }
:where(body.pg-cookbook) .item-card-body { padding: 12px; }
:where(body.pg-cookbook) .item-card-title {
  /* v3.7.862: Bex — "I think the meal/recipe titles are too big, i believe they are
     font setting 3, lets change to 4 (keep the colour as the user defined secondary
     colour, just change the size)". So Body (4) for the SIZE, and the Subtitle role's
     colour and weight are kept, which is where the Secondary comes from. */
  font-family: var(--tx-subtitle-font);
  font-weight: var(--tx-subtitle-weight);
  font-style: var(--tx-subtitle-style);
  font-size: var(--fs-body);
  text-transform: var(--tx-subtitle-transform);
  letter-spacing: var(--tx-subtitle-spacing);
  color: var(--tx-subtitle-color);
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 4px;
}
:where(body.pg-cookbook) .item-card-meta { font-size: var(--fs-meta); color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
:where(body.pg-cookbook) .item-card-badge { display: inline-block; padding: 1px 6px; border-radius: 8px; font-size: var(--fs-badge); font-weight: 700; background: var(--surface-2); color: var(--muted); }
:where(body.pg-cookbook) .item-card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: var(--ease); }
:where(body.pg-cookbook) .item-card:hover .item-card-actions { opacity: 1; }
:where(body.pg-cookbook) .item-card-action-btn { width: 28px; height: 28px; border-radius: 50%; border: none; background: rgba(255,255,255,0.9); color: var(--dark); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: var(--fs-meta); box-shadow: var(--shadow-sm); transition: var(--ease); }
:where(body.pg-cookbook) .item-card-action-btn:hover { background: var(--danger); color: #fff; }
:where(body.pg-cookbook) .item-card-action-btn.edit-btn:hover { background: var(--terra); color: var(--on-primary); }
/* ── Category group headers (both card + list view) ───────────────────────── */
:where(body.pg-cookbook) .cb-cat-header { grid-column: 1 / -1; /* span full width in card grid */ font-size: var(--fs-eyebrow); font-weight: var(--tx-eyebrow-weight); text-transform: var(--tx-eyebrow-transform); letter-spacing: var(--tx-eyebrow-spacing); color: var(--tx-eyebrow-color); padding: 14px 4px 4px; margin: 0; border-bottom: 1px solid var(--rule); font-family: var(--tx-eyebrow-font); font-style: var(--tx-eyebrow-style); }
:where(body.pg-cookbook) .cb-cat-header:first-child { padding-top: 2px; }
/* In list view the cards butt together — give headers breathing room */
:where(body.pg-cookbook) .item-grid.list-view .cb-cat-header { padding: 16px 12px 6px; border-bottom: none; }
/* First card after a header = top of a new block: add top border + round top */
:where(body.pg-cookbook) .item-grid.list-view .cb-cat-header + .item-card { border-top: 1px solid var(--rule); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
/* Last card before the next header = bottom of a block: round the bottom */
:where(body.pg-cookbook) .item-grid.list-view .item-card:has(+ .cb-cat-header) { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
/* A single-card block (header, one card, header/end): round all four corners */
:where(body.pg-cookbook) .item-grid.list-view .cb-cat-header + .item-card:has(+ .cb-cat-header), :where(body.pg-cookbook) .item-grid.list-view .cb-cat-header + .item-card:last-child { border-radius: var(--radius-lg); }
/* ── List view ────────────────────────────────────────────────────────────── */
:where(body.pg-cookbook) .item-grid.list-view { grid-template-columns: 1fr !important; gap: 0 !important; }
:where(body.pg-cookbook) .item-grid.list-view .item-card { display: grid; grid-template-columns: 60px 1fr auto; align-items: center; border: 1px solid var(--rule); border-top: none; /* divider is the bottom border of the card above */ border-radius: 0; }
:where(body.pg-cookbook) .item-grid.list-view .item-card:first-child { border-top: 1px solid var(--rule); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
:where(body.pg-cookbook) .item-grid.list-view .item-card:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
:where(body.pg-cookbook) .item-grid.list-view .item-card:only-child { border-top: 1px solid var(--rule); border-radius: var(--radius-lg); }
:where(body.pg-cookbook) .item-grid.list-view .item-card:hover { transform: none; box-shadow: none; background: color-mix(in srgb, var(--terra) 4%, transparent); }
:where(body.pg-cookbook) .item-grid.list-view .item-card-img, :where(body.pg-cookbook) .item-grid.list-view .item-card-img-placeholder { width: 60px; height: 60px; border-radius: 0; }
:where(body.pg-cookbook) .item-grid.list-view .item-card-body { padding: 8px 12px; }
:where(body.pg-cookbook) .item-grid.list-view .item-card-title { -webkit-line-clamp: 1; margin-bottom: 2px; }
:where(body.pg-cookbook) .item-grid.list-view .item-card-actions { position: static; opacity: 1; padding-right: 12px; }
:where(body.pg-cookbook) .item-grid.list-view .vote-wrap { display: none; }
:where(body.pg-cookbook) .item-grid.list-view .comm-card { display: grid; grid-template-columns: 60px 1fr; align-items: center; border-radius: 0; }
/* ── Autocomplete ─────────────────────────────────────────────────────────── */
:where(body.pg-cookbook) .ac-item { padding: 8px 12px; font-size: var(--fs-small); color: var(--dark); cursor: pointer; border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: 8px; }
:where(body.pg-cookbook) .ac-item:hover { background: color-mix(in srgb, var(--terra) 6%, transparent); }
:where(body.pg-cookbook) .ac-item:last-child { border-bottom: none; }
:where(body.pg-cookbook) .ac-tag { font-size: var(--fs-badge); padding: 1px 6px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-weight: 600; }
:where(body.pg-cookbook) .ac-tag.cuisine { background: var(--terra-tint); color: var(--terra-ink); }
/* ── EDITOR PANEL (slide in from right) ────────────────────────────────────── */
:where(body.pg-cookbook) .editor-overlay { position: fixed; inset: 0; background: rgba(61,35,20,0.4); backdrop-filter: blur(3px); z-index: 1090; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
:where(body.pg-cookbook) .editor-overlay.open { opacity: 1; pointer-events: auto; }
:where(body.pg-cookbook) .editor-panel { position: fixed; top: 0; right: 0; width: 100%; max-width: 560px; height: 100vh; height: 100dvh; background: var(--surface-card-solid); box-shadow: -8px 0 40px rgba(61,35,20,0.12); display: flex; flex-direction: column; z-index: 1100; /* above footer bar (1000) and FAB (1050) */ transform: translateX(100%); transition: transform .3s cubic-bezier(0.4,0,0.2,1); overflow: hidden; }
:where(body.pg-cookbook) .editor-panel.open { transform: translateX(0); }
/* ── v3.7.888. Import from URL, as a panel ────────────────────────────────
   887 gave this panel its own .import-panel-body / -foot shell. It shipped, and
   the title bar and the footer buttons did not appear — Bex: "need a button to
   actually import?! maybe a title as well?". The markup was present and correct,
   and no amount of reading the source explained it, so the bespoke shell is gone
   and the panel now uses .editor-header / .editor-body / .editor-footer: the
   exact three classes the meal and recipe editors use a few hundred lines up
   this same page, on this same page, working. Two rules deleted, none added.
   The odd one out was the part that kept breaking, so there is no odd one out. */
:where(body.pg-cookbook) .import-preview {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-md); padding: 12px 14px; margin-top: 12px;
}
:where(body.pg-cookbook) .import-preview-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--fs-subtitle); color: var(--dark); margin-bottom: 4px;
}
:where(body.pg-cookbook) .editor-header { padding: 16px 20px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: 12px; flex-shrink: 0; background: var(--surface-card-solid); }
:where(body.pg-cookbook) .editor-header h2 { flex: 1; font-size: var(--fs-section); font-weight: var(--tx-section-weight); color: var(--tx-section-color); font-family: var(--tx-section-font); font-style: var(--tx-section-style); text-transform: var(--tx-section-transform); letter-spacing: var(--tx-section-spacing); }
:where(body.pg-cookbook) .editor-body { flex: 1; overflow-y: auto; padding: 20px; -webkit-overflow-scrolling: touch; }
:where(body.pg-cookbook) .editor-footer { padding: 14px 20px; border-top: 1px solid var(--rule); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; background: var(--surface-card-solid); }
/* Ingredient rows */
:where(body.pg-cookbook) .ing-row { display: grid; grid-template-columns: 3fr 1fr 1.5fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
:where(body.pg-cookbook) .ing-row input { padding: 7px 10px; border: 1.5px solid var(--rule); border-radius: var(--radius-sm); font-size: var(--fs-body); font-family: var(--font-body); color: var(--dark); background: #fff; transition: var(--ease); width: 100%; }
:where(body.pg-cookbook) .ing-row input:focus { outline: none; border-color: var(--terra-ink); }
:where(body.pg-cookbook) .ing-row-del { width: 28px; height: 28px; border-radius: 50%; border: none; background: var(--surface); color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: var(--fs-meta); flex-shrink: 0; transition: var(--ease); }
:where(body.pg-cookbook) .ing-row-del:hover { background: #fee2e2; color: var(--danger); }
/* Step rows */
:where(body.pg-cookbook) .step-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-start; }
:where(body.pg-cookbook) .step-row-num { width: 24px; height: 24px; border-radius: 50%; background: var(--terra-tint); color: var(--terra-dark); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-meta); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 8px; }
:where(body.pg-cookbook) .step-row textarea { flex: 1; padding: 8px 10px; border: 1.5px solid var(--rule); border-radius: var(--radius-sm); font-size: var(--fs-body); font-family: var(--font-body); color: var(--dark); background: #fff; resize: vertical; min-height: 60px; transition: var(--ease); }
:where(body.pg-cookbook) .step-row textarea:focus { outline: none; border-color: var(--terra-ink); }
/* Community cards */
:where(body.pg-cookbook) .comm-card { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; transition: var(--ease); }
:where(body.pg-cookbook) .comm-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
:where(body.pg-cookbook) .comm-card-img { width: 100%; height: 130px; object-fit: cover; display: block; background: var(--surface); }
:where(body.pg-cookbook) .comm-save-btn { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(255,255,255,0.9); color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: var(--fs-body); box-shadow: var(--shadow-sm); transition: var(--ease-bounce); }
:where(body.pg-cookbook) .comm-save-btn.saved { color: var(--terra-ink); }
:where(body.pg-cookbook) .comm-save-btn:hover { transform: scale(1.15); }
/* Search bar */
:where(body.pg-cookbook) .cb-search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
:where(body.pg-cookbook) .cb-search-input { flex: 1; padding: 9px 12px; border: 1.5px solid var(--rule); border-radius: var(--radius-sm); font-size: var(--fs-body); font-family: var(--font-body); color: var(--dark); background: #fff; transition: var(--ease); }
:where(body.pg-cookbook) .cb-search-input:focus { outline: none; border-color: var(--terra-ink); }
/* Filter toggle now handled globally by .mg-filter-toggle in app.css */
/* FAB offset on cookbook — stays above bottom nav */
/* FAB removed - add button now in page-hero */
/* Tag / Cuisine suggestion styles now come with includes/editor_include.php (v3.7.853) */
:where(body.pg-cookbook) .cb-subnav-add { padding-bottom: 9px; margin-left: 30px; }
@media (max-width: 600px) {
  :where(body.pg-cookbook) .cb-subnav-add .btn span.cb-add-label { display: none; }
}

/* ── recipe.php ── */
/* Recipe Hero Card */
/* ── v3.7.886. The recipe sidebar's actions ───────────────────────────────
   A column, not a row. Three buttons in one flex row inside a 264px sidebar
   overflowed it — .btn is white-space: nowrap and "Share to Community" cannot
   shrink below its text, so Edit was pushed out under the main card. A column
   makes that structurally impossible: nothing here can be pushed sideways.
   The pair below shares its row and both labels are short enough to fit. */
:where(body.pg-recipe) .rv-actions { display: flex; flex-direction: column; gap: 8px; }
:where(body.pg-recipe) .rv-actions-wide { width: 100%; }
:where(body.pg-recipe) .rv-actions-pair { display: flex; gap: 8px; }
:where(body.pg-recipe) .rv-actions-pair > * { flex: 1; min-width: 0; }
:where(body.pg-recipe) .recipe-hero-card { border-bottom: none; }
:where(body.pg-recipe) .recipe-hero-grid { display: grid; grid-template-columns: 340px 1fr; height: 280px; overflow: hidden; border-radius: 12px; }
:where(body.pg-recipe) .recipe-hero-img { width: 100%; height: 100%; object-fit: cover; display: block; }
:where(body.pg-recipe) .recipe-hero-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--terra-tint) 0%, color-mix(in srgb, var(--green) 16%, var(--surface-card-solid)) 100%); font-size: 4rem; }
:where(body.pg-recipe) .recipe-hero-meta { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; justify-content: flex-start; gap: .4rem; border-left: 1px solid var(--rule); min-height: 0; overflow: visible; }
:where(body.pg-recipe) .recipe-hero-badges { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
:where(body.pg-recipe) .recipe-hero-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: var(--fs-meta); font-weight: 600; background: color-mix(in srgb, var(--terra) 12%, var(--surface)); color: var(--terra-ink); border: 1px solid color-mix(in srgb, var(--terra) 25%, transparent); }
:where(body.pg-recipe) .recipe-hero-tags { display: flex; gap: .3rem; flex-wrap: wrap; }
:where(body.pg-recipe) .recipe-hero-tag { padding: 2px 8px; border-radius: 20px; background: var(--surface-2); color: var(--muted); font-size: var(--fs-meta); font-weight: 500; border: 1px solid var(--rule); }
/* Recipe detail card (shared style for description, ingredients, instructions, notes) */
/* v3.7.882: padding dropped, the third and last copy of this declaration.
   881 did .meal-detail-card and .cr-detail-card and missed this one, so the
   white frame Bex circled on meal-view was still on recipe.php. */
:where(body.pg-recipe) .recipe-detail-card { margin-bottom: 16px; }
/* v3.7.872: the Instructions card carries a flush .mg-card-header accent now, so
   its padding moves to the body wrapper — a header bar inset by the card's own
   20px would read as a floating panel rather than the card's head. */
:where(body.pg-recipe) .recipe-detail-card.rv-steps-card { padding: 0; }
:where(body.pg-recipe) .rv-steps-body { padding: 20px; }
/* The bar supplies the heading treatment; the in-card h2 margin would push the
   title off-centre inside it. */
:where(body.pg-recipe) .recipe-detail-card h2 { font-size: var(--fs-section); font-weight: var(--tx-section-weight); font-family: var(--tx-section-font); color: var(--tx-section-color); margin: 0 0 16px; font-style: var(--tx-section-style); text-transform: var(--tx-section-transform); letter-spacing: var(--tx-section-spacing); }
:where(body.pg-recipe) .recipe-detail-card a { word-break: break-all; }
@media (max-width: 768px) {
  :where(body.pg-recipe) .recipe-hero-grid { grid-template-columns: 1fr; height: auto; }
  :where(body.pg-recipe) .recipe-hero-img, :where(body.pg-recipe) .recipe-hero-placeholder { height: 220px; }
  :where(body.pg-recipe) .recipe-hero-meta { border-left: none; border-top: 1px solid var(--rule); padding: 1rem; }
}
/* v3.7.875: the 30px was a hard gap that pushed this button out of the centred
   group whether or not there was room for it. A margin that collapses when the
   row wraps keeps the spacing on a wide screen and stops it forcing an overflow
   on a narrow one. */
:where(body.pg-recipe) .cb-subnav-add { padding-bottom: 9px; margin-left: min(30px, 4vw); }
@media (max-width: 600px) {
  :where(body.pg-recipe) .cb-subnav-add .btn span.cb-add-label { display: none; }
}
:where(body.pg-recipe) .rv-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
:where(body.pg-recipe) .rv-layout > div:first-child { position: sticky; top: calc(var(--nav-h, 56px) + 50px); }
@media (max-width: 768px) {
  :where(body.pg-recipe) .rv-layout { grid-template-columns: 1fr; gap: 16px; }
  :where(body.pg-recipe) .rv-layout > div:first-child { position: static; }
  :where(body.pg-recipe) .rv-layout, :where(body.pg-recipe) .rv-layout > div { max-width: 100%; overflow-x: hidden; box-sizing: border-box; }
}

/* ── meal-view.php ── */
/* Meal Hero Card */
:where(body.pg-meal-view) .meal-hero-card { border-bottom: none; }
:where(body.pg-meal-view) .meal-hero-grid { display: grid; grid-template-columns: 340px 1fr; height: 280px; overflow: hidden; border-radius: 12px; }
:where(body.pg-meal-view) .meal-hero-img { width: 100%; height: 100%; object-fit: cover; display: block; }
:where(body.pg-meal-view) .meal-hero-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--terra-tint) 0%, color-mix(in srgb, var(--green) 16%, var(--surface-card-solid)) 100%); font-size: 4rem; }
:where(body.pg-meal-view) .meal-hero-meta { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; justify-content: flex-start; gap: .4rem; border-left: 1px solid var(--rule); min-height: 0; overflow: visible; }
:where(body.pg-meal-view) .meal-hero-badges { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
:where(body.pg-meal-view) .meal-hero-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: var(--fs-meta); font-weight: 600; background: color-mix(in srgb, var(--terra) 12%, var(--surface)); color: var(--terra-ink); border: 1px solid color-mix(in srgb, var(--terra) 25%, transparent); }
/* v3.7.881: the padding is gone. Bex: "there is a white border on everything?"
   The card padded itself by 20px, so the .mg-card-header bar sat inset on all
   four sides instead of running edge to edge — a white frame around every
   header on the page. Every other card in the app has no padding of its own
   and lets .mg-card-header and .mg-card-body supply it. */
:where(body.pg-meal-view) .meal-detail-card { margin-bottom: 16px; }
/* v3.7.881: Serving Size moved inside the Shopping List card. It is a
   sub-section under the bar, not a second header bar — 875 already found that
   "one card with two header bars would have been worse than the problem". The
   rule underneath separates it from the first ingredient category. */
:where(body.pg-meal-view) .mv-scaler-in-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
}
:where(body.pg-meal-view) .meal-detail-card h2 { font-size: var(--fs-section); font-weight: var(--tx-section-weight); font-family: var(--tx-section-font); color: var(--tx-section-color); margin: 0 0 16px; font-style: var(--tx-section-style); text-transform: var(--tx-section-transform); letter-spacing: var(--tx-section-spacing); }
/* Voting card */
:where(body.pg-meal-view) .mv-vote-btn { width: 56px; height: 56px; border-radius: 12px; border: 2px solid var(--rule); background: var(--surface-card-solid); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: all .2s; }
:where(body.pg-meal-view) .mv-vote-btn:hover { border-color: var(--terra-ink); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
:where(body.pg-meal-view) .mv-vote-btn.active-love { border-color: #e53e3e; background: #fff5f5; }
:where(body.pg-meal-view) .mv-vote-btn.active-like { border-color: #38a169; background: #f0fff4; }
:where(body.pg-meal-view) .mv-vote-btn.active-nope { border-color: #a0aec0; background: #f7fafc; }
:where(body.pg-meal-view) .mv-vote-btn span.vote-emoji { font-size: var(--fs-section-h2); line-height: 1; }
:where(body.pg-meal-view) .mv-vote-btn span.vote-count { font-size: var(--fs-badge); font-weight: 700; font-family: var(--font-display); color: var(--muted); }
:where(body.pg-meal-view) .mv-voter-list { font-size: var(--fs-meta); color: var(--muted); line-height: 1.5; }
:where(body.pg-meal-view) .mv-voter-label { font-weight: 700; margin-right: 4px; }
@media (max-width: 768px) {
  :where(body.pg-meal-view) .meal-hero-grid { grid-template-columns: 1fr; height: auto; }
  :where(body.pg-meal-view) .meal-hero-img, :where(body.pg-meal-view) .meal-hero-placeholder { height: 220px; }
  :where(body.pg-meal-view) .meal-hero-meta { border-left: none; border-top: 1px solid var(--rule); padding: 1rem; }
}
/* v3.7.913: reads --nav-sticky-top, exactly as .mg-subnav does (app.css:1965).
   It was pinned to the raw --nav-h, the DESKTOP bar height, so on a phone it
   stuck 12px below a bar that had already ended and the page scrolled through
   the gap. The fallback chain is kept identical to .mg-subnav's on purpose:
   two bars doing one job, now reading one number. See the token's mobile
   redefinition and the full story at the @media block around line 2000. */
:where(body.pg-meal-view) .cb-subnav { background: linear-gradient(rgba(0,0,0,.18), rgba(0,0,0,.18)), var(--nav-bg); overflow: hidden; position: sticky; top: var(--nav-sticky-top, var(--nav-h, 56px)); z-index: 90; }
:where(body.pg-meal-view) .cb-subnav-inner { max-width: var(--nav-max, 1400px); margin: 0 auto; padding: 0 52px; display: flex; align-items: flex-end; justify-content: center; }
:where(body.pg-meal-view) .cb-subnav-tabs { display: flex; align-items: flex-end; gap: 4px; padding-top: 10px; }
:where(body.pg-meal-view) .cb-subnav-tab { padding: 9px 22px; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-body); color: var(--nav-text, #fff); opacity: 1; background: rgba(255,255,255,.14); border: none; border-radius: var(--radius-sm) var(--radius-sm) 0 0; cursor: pointer; transition: all .2s ease; display: flex; align-items: center; gap: 6px; text-decoration: none; }
:where(body.pg-meal-view) .cb-subnav-tab:hover { background: rgba(255,255,255,.26); }
:where(body.pg-meal-view) .cb-subnav-tab.active { opacity: 1; background: var(--surface-card-solid); color: var(--dark); box-shadow: 0 -2px 8px rgba(0,0,0,.08); }
:where(body.pg-meal-view) .cb-subnav-add { padding-bottom: 9px; margin-left: 30px; }
@media (max-width: 1024px) {
  :where(body.pg-meal-view) .cb-subnav-inner { padding: 0 24px; }
}
@media (max-width: 600px) {
  :where(body.pg-meal-view) .cb-subnav-tab span.cb-tab-label { display: none; }
  :where(body.pg-meal-view) .cb-subnav-tab { padding: 9px 16px; gap: 0; }
  :where(body.pg-meal-view) .cb-subnav-add .btn span.cb-add-label { display: none; }
}
:where(body.pg-meal-view) .mv-layout { display: grid; grid-template-columns: 280px 1.8fr 0.8fr; gap: 24px; align-items: start; }
:where(body.pg-meal-view) .mv-layout > div:first-child { position: sticky; top: calc(var(--nav-h, 56px) + 50px); }
@media (max-width: 1100px) {
  :where(body.pg-meal-view) .mv-layout { grid-template-columns: 260px 1fr; }
  :where(body.pg-meal-view) .mv-col-right { grid-column: 1 / -1; }
  :where(body.pg-meal-view) .mv-layout > div:first-child { position: static; }
}
@media (max-width: 768px) {
  :where(body.pg-meal-view) .mv-layout { grid-template-columns: 1fr; }
}
@media (min-width: 900px) {
  :where(body.pg-meal-view) .mv-col-right { position: sticky; top: calc(var(--nav-h, 56px) + 50px); }
}
/* ── v3.7.886. The recipe name needs its own surface ──────────────────────
   Bex: "the header for the recipe name needs a different colour bg then the
   main card header, i think the easiest would be to ease of the transparency".

   Measured: the card header is rgb(234,237,229) and this bar was
   color-mix(--terra 8%, --surface) = rgb(237,241,230). dE 2.0 — at the
   threshold where two colours stop being distinguishable, so they read as one
   surface and the recipe names had nothing separating them from the card they
   sit in. Solid white is dE 7.9 from the card header and, unlike a stronger
   Primary tint, does not put two tints of the same hue in one card competing
   for the same job. It also holds at any member Primary.

   Declared here rather than inline on meal-view.php:515, with the rest of that
   style attribute, which is what 881-884 were about. */
:where(body.pg-meal-view) .pub-recipe-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--surface-card-solid);
}
:where(body.pg-meal-view) .pub-recipe.open .pub-recipe-body { display: block !important; }
:where(body.pg-meal-view) .pub-recipe.open .fa-chevron-down { transform: rotate(180deg); }
:where(body.pg-meal-view) .meal-shop-item.checked .shop-checkbox { background: var(--terra); border-color: var(--terra-ink); }
:where(body.pg-meal-view) .meal-shop-item.checked .shop-checkbox .fa-check { opacity: 1; }
:where(body.pg-meal-view) .meal-shop-item.checked .shop-name { text-decoration: line-through; color: var(--muted); }

/* ── mykitchen.php ── */
:where(body.pg-mykitchen) .mk-upsell { max-width: 800px; margin: 0 auto; padding: 48px 24px; text-align: center; }
:where(body.pg-mykitchen) .mk-upsell-icon { font-size: 3.5rem; margin-bottom: 16px; display: block; }
:where(body.pg-mykitchen) .mk-upsell h1 { font-family: var(--tx-page-title-font); font-size: var(--fs-page-title); font-weight: var(--tx-page-title-weight); color: var(--tx-page-title-color); margin: 0 0 8px; font-style: var(--tx-page-title-style); text-transform: var(--tx-page-title-transform); letter-spacing: var(--tx-page-title-spacing); }
:where(body.pg-mykitchen) .mk-upsell .mk-upsell-sub { font-size: var(--fs-subtitle); color: var(--muted); margin: 0 0 32px; line-height: 1.6; }
:where(body.pg-mykitchen) .mk-upsell-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; text-align: left; margin-bottom: 36px; }
@media (max-width: 600px) {
  :where(body.pg-mykitchen) .mk-upsell-grid { grid-template-columns: 1fr; }
}
:where(body.pg-mykitchen) .mk-upsell-card { padding: 20px; display: flex; gap: 14px; align-items: flex-start; transition: transform .2s, box-shadow .2s; }
:where(body.pg-mykitchen) .mk-upsell-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
:where(body.pg-mykitchen) .mk-upsell-card-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: var(--fs-section); flex-shrink: 0; }
:where(body.pg-mykitchen) .mk-upsell-card h3 { font-family: var(--tx-subtitle-font); font-size: var(--fs-subtitle); font-weight: var(--tx-subtitle-weight); color: var(--tx-subtitle-color); margin: 0 0 4px; font-style: var(--tx-subtitle-style); text-transform: var(--tx-subtitle-transform); letter-spacing: var(--tx-subtitle-spacing); }
:where(body.pg-mykitchen) .mk-upsell-card p { font-size: var(--fs-small); color: var(--muted); margin: 0; line-height: 1.45; }
:where(body.pg-mykitchen) .mk-upsell-cta { display: inline-flex; align-items: center; gap: 8px; padding: 14px 36px; border-radius: 99px; background: var(--terra); color: var(--on-primary); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-subtitle); text-decoration: none; transition: all .2s; box-shadow: 0 4px 16px rgba(161,40,11,.25); }
/* v3.7.870: was #8a2009 with a terracotta-tinted shadow — both pre-787 brand
   colours hard-coded, so this button hovered orange-red whatever the member
   picked. The shadow follows --terra-rgb, which app_header.php sets. */
:where(body.pg-mykitchen) .mk-upsell-cta:hover { background: var(--terra-hover); box-shadow: 0 6px 20px rgba(var(--terra-rgb), .35); }
:where(body.pg-mykitchen) .mk-upsell-skip { display: block; margin-top: 14px; font-size: var(--fs-meta); color: var(--muted); }
@media(max-width:600px) {.pantry-updated-col{display:none}}

/* ── community.php ── */
/* === Community Page Styles === */
/* Filter bar in subnav */
:where(body.pg-community) .c-subnav-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; flex: 1; padding: 10px 0; }
:where(body.pg-community) .c-search-wrap { min-width: 160px; max-width: 260px; position: relative; }
:where(body.pg-community) .c-search-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.5); font-size: var(--fs-meta); pointer-events: none; }
:where(body.pg-community) .c-search-wrap input { width: 100%; padding: 7px 12px 7px 34px; border: 1.5px solid rgba(255,255,255,.2); border-radius: 99px; font-size: var(--fs-body); font-family: var(--font-body, 'DM Sans', sans-serif); background: rgba(255,255,255,.1); color: #fff; outline: none; transition: border-color .15s; }   /* v3.7.863: Meta (6) -> Body (4), matching the selects beside it */
:where(body.pg-community) .c-search-wrap input::placeholder { color: rgba(255,255,255,.45); }
:where(body.pg-community) .c-search-wrap input:focus { border-color: rgba(255,255,255,.5); background: rgba(255,255,255,.15); }
:where(body.pg-community) .c-autocomplete { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: var(--surface, #fff); border: 1.5px solid var(--rule, #E8D8C8); border-radius: 12px; box-shadow: 0 8px 24px rgba(61,35,20,.1); z-index: 150; display: none; overflow: hidden; }
:where(body.pg-community) .c-ac-item { display: flex; align-items: center; gap: 8px; padding: 8px 14px; cursor: pointer; transition: background .1s; font-size: var(--fs-small); color: var(--dark, #3D2314); }
:where(body.pg-community) .c-ac-item:hover { background: #F0C4B5; }
:where(body.pg-community) .c-ac-type { font-size: var(--fs-badge); font-weight: var(--tx-badge-weight); text-transform: var(--tx-badge-transform); letter-spacing: var(--tx-badge-spacing); padding: 1px 6px; border-radius: 4px; white-space: nowrap; font-family: var(--tx-badge-font); font-style: var(--tx-badge-style); }
:where(body.pg-community) .c-ac-type[data-t="recipe"] { background: var(--terra); color: var(--on-primary); }   /* v3.7.870: was #A1280B */
:where(body.pg-community) .c-ac-type[data-t="cuisine"] { background: #2563A8; color: #fff; }
:where(body.pg-community) .c-ac-type[data-t="tag"] { background: #3A8C4A; color: #fff; }
:where(body.pg-community) .c-subnav-select { padding: 7px 28px 7px 12px; border: 1.5px solid rgba(255,255,255,.2); border-radius: 99px; font-size: var(--fs-body); font-family: var(--font-body, 'DM Sans', sans-serif); background: rgba(255,255,255,.1); color: #fff; cursor: pointer; outline: none; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,.6)' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6.5 6 6.5-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
:where(body.pg-community) .c-subnav-select option { color: var(--dark, #3D2314); background: #fff; }
:where(body.pg-community) .c-clear-btn { font-size: var(--fs-body); font-weight: 600; color: rgba(255,255,255,.7); cursor: pointer; text-decoration: none; }
:where(body.pg-community) .c-clear-btn:hover { color: #fff; }
/* Masonry Grid */
:where(body.pg-community) .c-masonry { columns: 6 200px; column-gap: 16px; margin-bottom: 32px; }
@media (max-width: 1400px) {
  :where(body.pg-community) .c-masonry { columns: 5 200px; }
}
@media (max-width: 1100px) {
  :where(body.pg-community) .c-masonry { columns: 3 200px; }
}
@media (max-width: 768px) {
  :where(body.pg-community) .c-masonry { columns: 2 160px; }
}
@media (max-width: 480px) {
  :where(body.pg-community) .c-masonry { columns: 1; }
}
/* Pin Card */
:where(body.pg-community) .c-pin { break-inside: avoid; margin-bottom: 16px; background: var(--surface-card); border-radius: 16px; overflow: hidden; cursor: pointer; transition: transform .2s, box-shadow .2s; position: relative; }
:where(body.pg-community) .c-pin:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(61,35,20,.1); }
:where(body.pg-community) .c-pin-img { width: 100%; display: block; object-fit: cover; min-height: 140px; max-height: 340px; background: #E8D8C8; }
:where(body.pg-community) .c-pin-noimg { width: 100%; height: 180px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--terra-tint) 0%, color-mix(in srgb, var(--green) 16%, var(--surface-card-solid)) 100%); color: var(--terra-ink); font-size: 2.5rem; }   /* v3.7.870: was a fixed terracotta/beige gradient; now the same placeholder treatment as .recipe-hero-placeholder and .meal-hero-placeholder */
:where(body.pg-community) .c-pin-body { padding: 12px 14px 14px; }
:where(body.pg-community) .c-pin-title { font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif); font-weight: 700; font-size: var(--fs-body); color: var(--dark, #3D2314); line-height: 1.35; margin-bottom: 6px; }
:where(body.pg-community) .c-pin-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
:where(body.pg-community) .c-pin-badge { font-size: var(--fs-badge); font-weight: var(--tx-badge-weight); padding: 2px 8px; border-radius: 6px; background: var(--terra); color: var(--on-primary); text-transform: var(--tx-badge-transform); letter-spacing: var(--tx-badge-spacing); font-family: var(--tx-badge-font); font-style: var(--tx-badge-style); }
:where(body.pg-community) .c-pin-cuisine { font-size: var(--fs-meta); color: var(--muted, #9A7868); }
:where(body.pg-community) .c-pin-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid #f0e6d8; }
:where(body.pg-community) .c-pin-author { font-size: var(--fs-meta); color: var(--muted, #9A7868); display: flex; align-items: center; gap: 4px; }
:where(body.pg-community) .c-pin-stats { display: flex; align-items: center; gap: 10px; font-size: var(--fs-meta); color: var(--muted, #9A7868); }
:where(body.pg-community) .c-pin-stars { color: #f9b54b; font-size: var(--fs-badge); }
:where(body.pg-community) .c-pin-stars .empty { color: #E8D8C8; }
:where(body.pg-community) .c-save-btn { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.35); backdrop-filter: blur(4px); border: none; color: #fff; font-size: var(--fs-body); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .2s; opacity: 0; z-index: 2; }
:where(body.pg-community) .c-pin:hover .c-save-btn { opacity: 1; }
:where(body.pg-community) .c-save-btn.saved { opacity: 1; background: var(--terra); }   /* v3.7.870: was #A1280B hard-coded */
:where(body.pg-community) .c-save-btn:hover { background: var(--terra-hover); transform: scale(1.1); opacity: 1; }   /* v3.7.870: was #A1280B */
:where(body.pg-community) .c-cta-pin { break-inside: avoid; margin-bottom: 16px; background: linear-gradient(135deg, var(--terra), color-mix(in srgb, var(--terra) 55%, #000)); border-radius: 16px; padding: 28px 20px; color: var(--on-primary); text-align: center; }
:where(body.pg-community) .c-cta-pin h3 { font-family: var(--tx-section-font); font-weight: var(--tx-section-weight); font-size: var(--fs-section); margin-bottom: 8px; font-style: var(--tx-section-style); text-transform: var(--tx-section-transform); letter-spacing: var(--tx-section-spacing); color: inherit; }
:where(body.pg-community) .c-cta-pin p { font-size: var(--fs-small); opacity: .85; margin-bottom: 14px; line-height: 1.5; }
:where(body.pg-community) .c-cta-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; border-radius: 99px; background: #fff; color: var(--terra-ink); font-size: var(--fs-small); font-weight: 700; transition: all .15s; }   /* v3.7.870: was #A1280B as ink */
/* v3.7.870: was #F0C4B5, a pale terracotta. This button is white-on-brand, so it
   is the one place the contract's "darken the fill" would be wrong — darkening
   white gives grey. It tints toward the member's Primary instead, which is the
   same move the white .btn-secondary makes on hover. */
:where(body.pg-community) .c-cta-btn:hover { background: color-mix(in srgb, var(--terra) 18%, #fff); }
:where(body.pg-community) .c-empty { text-align: center; padding: 64px 24px; max-width: 400px; margin: 0 auto; }
:where(body.pg-community) .c-empty i { font-size: 2.5rem; color: #E8D8C8; margin-bottom: 16px; display: block; }
:where(body.pg-community) .c-pagination { display: flex; justify-content: center; gap: 6px; padding: 16px 0 32px; }
:where(body.pg-community) .c-pagination a, :where(body.pg-community) .c-pagination span { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; font-size: var(--fs-small); font-weight: 600; border: 1.5px solid var(--rule, #E8D8C8); color: var(--dark, #3D2314); transition: all .15s; }
/* v3.7.870: hard-coded #A1280B — the pre-787 terracotta — so Community
   pagination hovered orange-red no matter what colours the member had chosen.
   One of three hard-coded brand hovers this build found; the others were
   .review-submit and .mk-upsell-cta, both #8a2009. */
:where(body.pg-community) .c-pagination a:hover { background: var(--terra); color: var(--on-primary); border-color: var(--terra); }
:where(body.pg-community) .c-pagination .current { background: var(--terra); color: var(--on-primary); border-color: var(--terra); }   /* v3.7.870: was #A1280B */
:where(body.pg-community) .c-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: #3D2314; color: #fff; padding: 10px 24px; border-radius: 99px; font-size: var(--fs-small); font-weight: 600; transition: transform .3s ease; z-index: 999; pointer-events: none; }
:where(body.pg-community) .c-toast.show { transform: translateX(-50%) translateY(0); }
@media (max-width: 768px) {
  :where(body.pg-community) .c-subnav-filters { gap: 6px; }
  :where(body.pg-community) .c-search-wrap { max-width: none; min-width: 120px; }
  :where(body.pg-community) .c-subnav-select { font-size: var(--fs-meta); padding: 6px 24px 6px 10px; }
  /* Let subnav expand to fit filter bar */
  :where(body.pg-community) .mg-subnav { animation: none; max-height: none; }
}

/* ── account.php ── */
:where(body.pg-account) .account-avatar-wrap { position: relative; display: inline-block; }
:where(body.pg-account) .account-avatar { transition: opacity .2s; }
:where(body.pg-account) .account-avatar:hover { opacity: .8; }
:where(body.pg-account) .avatar-overlay { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; display: flex; align-items: center; justify-content: center; font-size: var(--fs-section); opacity: 0; transition: opacity .25s; pointer-events: none; }
:where(body.pg-account) .account-avatar:hover .avatar-overlay { opacity: 1; }
:where(body.pg-account) .avatar-remove-btn { position: absolute; top: -4px; right: -4px; z-index: 2; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--bg, #fff); background: var(--terra, #8aab6a); color: #fff; display: flex; align-items: center; justify-content: center; font-size: var(--fs-badge); cursor: pointer; padding: 0; line-height: 1; opacity: 0; transition: opacity .2s; }
:where(body.pg-account) .account-avatar-wrap:hover .avatar-remove-btn { opacity: 1; }
:where(body.pg-account) .avatar-remove-btn:hover { background: var(--terra-dark, #751E0B); }

/* ── preferences.php ── */
:where(body.pg-preferences) .taxo-list { border: 1px solid var(--rule); border-radius: var(--radius-md); max-height: 420px; overflow-y: auto; background: var(--surface); }
:where(body.pg-preferences) .taxo-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--rule); }
:where(body.pg-preferences) .taxo-row:last-child { border-bottom: none; }
:where(body.pg-preferences) .taxo-row-name { flex: 1; font-size: var(--fs-body); color: var(--dark); word-break: break-word; }
:where(body.pg-preferences) .taxo-row-count { font-size: var(--fs-meta); color: var(--muted); background: color-mix(in srgb, var(--muted) 14%, transparent); border-radius: 10px; padding: 1px 8px; min-width: 20px; text-align: center; }
:where(body.pg-preferences) .taxo-row-btn { background: none; border: 1px solid var(--rule); border-radius: var(--radius-sm); width: 30px; height: 30px; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; transition: var(--ease); }
:where(body.pg-preferences) .taxo-row-btn:hover { color: var(--terra-ink); border-color: var(--terra-ink); }
:where(body.pg-preferences) .taxo-row-btn.del:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
:where(body.pg-preferences) .taxo-empty, :where(body.pg-preferences) .taxo-loading { padding: 20px; text-align: center; font-size: var(--fs-small); color: var(--muted); }
:where(body.pg-preferences) .mg-contrast-warn { margin-top:14px; padding:10px 14px; border-radius:var(--radius-sm); background:#fff7e6; border:1px solid #f5d49a; color:#6b4a0b; font-size:var(--fs-small); animation:mg-page-enter .25s ease-out; }
:where(body.pg-preferences) .mg-contrast-warn ul { margin:.35rem 0 0 1.1rem; padding:0; }
:where(body.pg-preferences) .mg-textsize-group { display:flex; gap:8px; flex-wrap:wrap; }
:where(body.pg-preferences) .mg-textsize-opt input { position:absolute; opacity:0; width:0; height:0; }
:where(body.pg-preferences) .mg-textsize-opt span { display:inline-flex; align-items:center; min-height:40px; padding:0 14px; border:1px solid var(--rule); border-radius:var(--radius-sm); background:var(--surface-card-solid); color:var(--body-text); cursor:pointer; transition:var(--ease); }
:where(body.pg-preferences) .mg-textsize-opt input:checked + span { background:var(--terra); border-color:var(--terra-ink); color: var(--on-primary); }
:where(body.pg-preferences) .mg-textsize-opt input:focus-visible + span { outline:2px solid var(--terra); outline-offset:2px; }

/* ── subscription.php ── */
/* v3.7.899: the 1100px cap is gone. .mg-page-wide sets this family's edges (858) and this page
   was quietly overriding it, so Subscription sat in a narrow column while Account, Data,
   Preferences and Help all ran the full width of the window. */
:where(body.pg-subscription) .sub-page { }
:where(body.pg-subscription) .sub-head { margin: 8px 0 20px; }
:where(body.pg-subscription) .sub-head .tx-body { margin-top: 4px; color: var(--muted); }
:where(body.pg-subscription) .sub-gate { display: flex; gap: 24px; align-items: flex-start; padding: 24px; margin-bottom: 20px; animation: mg-page-enter .35s ease-out; }
:where(body.pg-subscription) .sub-gate-icon { flex-shrink: 0; width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--terra) 14%, transparent); color: var(--terra-ink); font-size: 1.8rem; }
:where(body.pg-subscription) .sub-gate-body .tx-page-title { margin: 4px 0 6px; }
:where(body.pg-subscription) .sub-gate-perks { margin-top: 12px; }
:where(body.pg-subscription) .sub-note { display: flex; gap: 10px; align-items: center; padding: 12px 16px; margin-bottom: 16px; color: var(--muted); }
/* v3.7.899: the flex row moved onto the card BODY. The card gained a proper header bar to match
   its siblings, and with the row still on the outer card the header became a flex child - it drew
   as a small chip floating on the left instead of a bar across the top. The card keeps its left
   edge marker; the row inside keeps the layout it always had. */
:where(body.pg-subscription) .sub-current { margin-bottom: 20px; border-left: 4px solid var(--terra); }
:where(body.pg-subscription) .sub-current-body { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
:where(body.pg-subscription) .sub-plans { margin-bottom: 20px; }
:where(body.pg-subscription) .sub-pay,
:where(body.pg-subscription) .sub-history { margin-bottom: 20px; padding: 0; }
:where(body.pg-subscription) .sub-current-meta { margin-top: 2px; color: var(--muted); }
:where(body.pg-subscription) .sub-status-trial { color: var(--green-ink); font-weight: 600; }
:where(body.pg-subscription) .sub-status-active { color: var(--terra-ink); font-weight: 600; }
:where(body.pg-subscription) .sub-tiers { margin-top: 4px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
:where(body.pg-subscription) .tier-card { transition: border-color .2s, box-shadow .2s, transform .2s; }
:where(body.pg-subscription) .tier-card:hover { border-color: var(--terra-ink); box-shadow: 0 6px 22px color-mix(in srgb, var(--terra) 18%, transparent); transform: translateY(-2px); }
:where(body.pg-subscription) .tier-card.highlighted { border-color: color-mix(in srgb, var(--terra) 55%, var(--rule)); }
:where(body.pg-subscription) .tier-card.unlocks { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 35%, transparent); }
:where(body.pg-subscription) .sub-tier-desc { color: var(--muted); margin: -4px 0 0; }
:where(body.pg-subscription) .sub-feature-hit { font-weight: 700; }
:where(body.pg-subscription) .sub-cta { margin-top: auto; padding-top: 6px; }
:where(body.pg-subscription) .sub-cta .btn { width: 100%; justify-content: center; }
:where(body.pg-subscription) .sub-btn-muted { background: var(--surface); border: 1px solid var(--rule); color: var(--muted); cursor: default; }
:where(body.pg-subscription) a.sub-btn-muted { cursor: pointer; }
:where(body.pg-subscription) .sub-footnote { text-align: center; margin: 8px 0 28px; }
:where(body.pg-subscription) .sub-footnote a { color: var(--muted); }
@media (max-width: 640px) {
  :where(body.pg-subscription) .sub-gate { flex-direction: column; align-items: center; text-align: center; }
  :where(body.pg-subscription) .sub-gate-perks { display: inline-flex; text-align: left; }
}


/* ── Side panels: one pattern ────────────────────────────────────────────────
   v3.7.858. Bex: "all the lil side bars throughout the app need to be formatted
   to match, font sizes, colours... remember loose the cream, i like the coloured
   bg on the 'title bar'".

   There were three of these, each invented separately:
     .mg-filter-header  Primary bg, white, UPPERCASE, Body size      (Shopping "Controls")
     .pf-side-head      Secondary bg, white, Section size, no caps   (Prep & Freeze)
     .sx-card           sticky-note yellow                           (Extras — kept, see below)

   They are unified here by SELECTOR rather than by rewriting markup on eleven
   pages: one rule, three names, no churn and no chance of missing a template.
   .mg-side-* is the name to use in new markup; the other two are kept working so
   nothing has to change at once.

   Two things this fixes beyond matching:
   - Both hard-coded `color: #fff`, so a member with a pale Primary got white text
     on a pale bar. They now use --on-primary / --on-secondary, which are picked
     by luminance in app_header.php.
   - Titles disagreed on size. Bex's reference is "Controls", so Body (role 4)
     wins and Prep & Freeze comes down to match.

   .sx-card keeps its yellow deliberately: it is the Family-Notes paper, and the
   point is that Extras read as "ours" beside the meal categories. Matching it to
   the others would remove information, not tidy it.                             */

:root {
  /* Fallbacks for pages that app_header.php does not dress (logged-out, error
     pages). Signed-in pages overwrite both from the member's own colours. */
  --on-primary:   #ffffff;
  --on-secondary: #ffffff;
  /* v3.7.870: the matching hover-shift direction. These fallbacks assume white
     text, i.e. a dark fill, so the step goes darker. app_header.php computes
     both pairs together from the member's own colours. */
  --off-primary:   #000000;
  --off-secondary: #000000;
  --side-gap:     16px;
}

/* The column itself */
.mg-side {
  width: var(--side-w);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: var(--side-gap);
}

/* A panel in it */
.mg-side-card {
  overflow: hidden;
}

/* The coloured title bar — the bit Bex likes. Shape and type are shared; only
   the colour pair differs, so each panel is assigned a background exactly once. */
.mg-side-head,
.mg-filter-header,
.pf-side-head,
.mg-side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body);
}
/* v3.7.868 — every one of these is inside an <aside>, so by the new rule they
   all take the SECONDARY tint. Checked rather than assumed: .mg-side-head is in
   an <aside> on notes.php:162, mykitchen.php:703 and shopping-list.php:879, and
   .mg-filter-header is the filter drawer on cookbook.php and shopping-list.php.
   .is-secondary is now what every side head already is. It is kept listed so
   that markup carrying it does not change meaning — it is in no template. */
/* v3.7.881: all three on the floored token. This block used to set the
   floorless one and a later line re-set .mg-side-head to the floored one, so
   the bars only looked right because that later line came further down the
   file — and .mg-filter-header, which that line did not name, stayed light.
   One assignment now, so there is nothing left for the cascade to decide. */
.mg-side-head,
.mg-side-head.is-secondary,
.mg-filter-header {
  background: var(--side-header-bg);
  color: var(--side-header-text);
  border-bottom: 1px solid var(--rule);
}
/* The leading icon plays the marker's part, as on .gt-head. */
/* v3.7.881: .pf-side-head joins this — Prep & Freeze's "Your lists" and the
   Freezer's "Add to the freezer" gained icons and had nothing colouring them.
   Side-head icons stay on --side-head-marker (Secondary); card-header icons take
   Primary. That difference IS the difference between the two patterns. */
.mg-side-head > :is(.fa-solid,.fa-regular,.fa-brands),
.pf-side-head > :is(.fa-solid,.fa-regular,.fa-brands),
.mg-filter-header > :is(.fa-solid,.fa-regular,.fa-brands) { color: var(--side-head-marker); }
/* v3.7.881 added an .is-primary-icon modifier here so Shopping List's centred
   "Controls" bar could take a Primary icon. v3.7.882 removes it: Bex ruled that
   Controls is plain card header #2, Secondary tint and Secondary icon. The
   side-head pattern has no exceptions again. */
/* .mg-side-head has no icon in any template, so it gets the 4px marker itself.
   867's lesson applies exactly: the marker hangs off the HEADING. These bars are
   display:flex, so a ::before on the bar becomes a third flex item and shoves
   the trailing control (.mg-filter-close, margin-left:auto) out of place. */
.mg-side-head .mg-side-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1em;
  margin-right: 10px;
  border-radius: 2px;
  background: var(--side-head-marker);
  vertical-align: -.1em;
}
/* v3.7.881: Bex asked for an icon instead of the line on every .mg-side-head
   bar ("change the little line to an icon"). The icon goes in as a direct child
   of the bar, the way .mg-filter-header and .gt-head already do it, and the bar
   drops its marker — the same "the icon IS the marker" rule, now applied here
   too. Written as :has() on the BAR rather than as a flat removal, so a bar
   without an icon keeps its line and nothing has to be kept in sync by hand. */
.mg-side-head:has(> :is(.fa-solid,.fa-regular,.fa-brands)) .mg-side-title::before {
  content: none;
}
/* v3.7.877: these two rules used to re-assert the solid secondary bar, with the
   note "Prep & Freeze keeps its solid bars for now - Bex: skip this one, we'll
   come back to it". We have come back to it: she has ruled for the tinted bar
   with dark text, so the exception is over and these would now simply be a later
   rule overriding the shared definition.

   That is precisely the 872 trap. The surface was set correctly further up the
   file and these, coming later, would have won - the change would have been
   decoration that never applied, and it would have come back reported as "still
   not done" for a second time. Found by checking for later overrides before
   shipping, which is the only reason it is not in the package.

   Both now defer to the shared --side-header-* tokens. */
/* v3.7.881: .mg-side-head dropped from this line — the shared block above now
   assigns it, and two assignments were the duplicate 875 left behind. */
.pf-side-head    { background: var(--side-header-bg); color: var(--side-header-text); }
.pf-side-head-cobalt { background: color-mix(in srgb, var(--chip-freezer) 14%, var(--card-header-floor)); color: var(--side-header-text); }

/* Title: Body (4), uppercase — "the same size as Controls" */
.mg-side-title,
.mg-side-head .mg-side-title,
.mg-filter-header .mg-filter-title,
.pf-side-head,
.mg-side-head {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body);
  text-transform: uppercase;
  letter-spacing: .09em;
}

/* Panel contents */
.mg-side-body { padding: 14px 16px; font-size: var(--fs-body); color: var(--body-color); }
.mg-side-body > * + * { margin-top: 10px; }

/* "the lil subtitles lets try them as font setting 5" */
.mg-side-note { font-size: var(--fs-small); color: var(--muted); line-height: 1.45; }

/* Actions sitting on the bar read on any Primary, pale ones included */
.mg-side-head a,
.mg-side-head .mg-side-action,
.mg-filter-header .mg-filter-clear {
  margin-left: auto;
  color: inherit;
  opacity: .82;
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
}
.mg-side-head a:hover,
.mg-side-head .mg-side-action:hover,
.mg-filter-header .mg-filter-clear:hover { opacity: 1; text-decoration: underline; }

@media (max-width: 899px) {
  .mg-side { width: 100%; position: static; }
}


/* ── review.php ──────────────────────────────────────────────────────────────
   v3.7.858. The last inline <style> on a member page. Lifted and scoped like
   the rest; the two hard-coded hexes become tokens (var(--surface-2) was --surface-2 by
   hand, var(--amber-deep) was the amber accent) so a member's theme reaches the stars.  */
:where(body.pg-review) .star-picker { display:flex; gap:.25rem; flex-direction:row-reverse; justify-content:flex-end; }
:where(body.pg-review) .star-picker input { display:none; }
:where(body.pg-review) .star-picker label { font-size:2rem; cursor:pointer; color:var(--surface-2); transition:color .15s,transform .15s; padding:.1rem .15rem; }
.star-picker label:hover,
.star-picker label:hover ~ label,
:where(body.pg-review) .star-picker input:checked ~ label { color:var(--amber-deep); }
:where(body.pg-review) .star-picker label:hover { transform:scale(1.15); }

/* ── Side panels, round two (v3.7.859) ───────────────────────────────────────
   Bex, on 858: "sidebars still need a lil work".

   Two panels never had the coloured title bar at all, so they sat next to ones
   that did and looked unfinished:
     .gt-head  "Your meals"            (Grid tray)      — no background
     .ps-head  "Shopping for this list" (Prep & Freeze) — a near-white amber tint

   And three titles disagreed on size. "Add an item" and the rest were built on
   the Eyebrow role (0.7rem); "Controls" is Body (0.875rem). Bex's reference is
   Controls, so they all come up to Body.

   .sx-head keeps its sticky-note yellow — Bex: "love that the colour matches
   the card on the left" — it is only the TITLE SIZE that was wrong there.      */

/* v3.7.881: onto the floored token with every other side head. The comment
   above still describes .ps-head as "a near-white amber tint" — it has not been
   amber since 877 unified these bars, and this is not restoring it; .sx-head is
   the one that keeps its sticky-note yellow, as Bex asked. */
.gt-head,
.ps-head {
  background: var(--side-header-bg);
  color: var(--side-header-text);
  /* v3.7.868: was border-bottom:0. A near-white bar with no rule under it does
     not read as a header at all — the same thing 867 found on the card. */
  border-bottom: 1px solid var(--rule);
}
/* v3.7.868: the leading icon takes the member's Secondary. On the card header
   that job is done by a 4px marker; where a bar already has an icon in front of
   its title, the icon IS the marker and a second one would just be clutter. */
/* v3.7.881: .gt-head's icon sits INSIDE the heading, because .gt-head is
   flex-direction:column and a direct child would stack above the title rather
   than lead it. So it needs the descendant form, not the child form. */
.gt-head .gt-title > :is(.fa-solid,.fa-regular,.fa-brands),
.gt-head > .fa-solid,
.ps-head > .fa-solid,
.ps-head > .fa-solid.fa-fw { color: var(--side-head-marker); }
.ps-head-text, .gt-hint { color: inherit; }
/* The hint under "Your meals" and the sub-line under the prep title sit on the
   bar now, so they step back from the title rather than going muted-on-colour. */
.gt-head .gt-hint,
.ps-head .ps-sub { opacity: .85; }

/* One title size across every side panel — Body (role 4), to match Controls. */
.sx-title,
.ps-title,
.gt-title,
.mg-side-title,
.mg-filter-header .mg-filter-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-body);
}

/* Caps belong on FIXED labels only. .ps-title is the member's own list name
   ("Winter Freezer Fill"), and shouting someone's own words back at them is
   both rude and lossy — it throws away the capitalisation they chose.
   e820a caught this: it reads the rendered text, and text-transform turned
   "E820 Winter batch" into "E820 WINTER BATCH". The test was right. */
.sx-title,
.gt-title,
.mg-side-title,
.mg-filter-header .mg-filter-title {
  text-transform: uppercase;
  letter-spacing: .09em;
}

/* ── One button shape, and "Open the Grid" (v3.7.859) ────────────────────────
   Bex: "can we make them all the same shape (this goes for all buttons
   throughout the app, the rounded one like 'open the grid'".

   .btn already reads --radius-btn. These are the buttons that were NOT built on
   .btn and had rolled their own corner, so they are brought onto the same token
   rather than being left as the odd ones out.                                  */

:root { --radius-btn: 99px; }

.btn-sm, .btn-lg,
.mg-toggle-btn,
.mg-filter-tag,
.a11y-size-btn,
.pf-list-pick,
.pf-shop-toggle,
.sx-add-btn,
.gb-views .gb-view,
.mg-backup-btn,
.hm-week-link-head,
.hm-quick-btn,
.mv-vote-btn,
.al-confirm,
.afp-mode,
.afp-range { border-radius: var(--radius-btn); }

/* Round things stay round; pills must not flatten a circular icon button. */
.fab, .ks-nav-btn, .afp-icon-btn, .mg-filter-close { border-radius: 50%; }

/* "Open the Grid" — Bex: "it's hard to notice".
   It was white at 18% opacity on the Primary bar, which is barely a button at
   all. A solid fill in the member's Secondary separates it from the bar it sits
   on, follows their theme, and auto-contrasts its own text. */
.hm-week-link-head {
  border: 1px solid transparent;
  background: var(--green);
  color: var(--on-secondary);
  box-shadow: var(--shadow-sm);
}
.hm-week-link-head:hover {
  background: var(--green-hover);
  border-color: transparent;
  color: var(--on-secondary);
  text-decoration: none;
}

/* ── Day: the "Cook it" heading (v3.7.859) ───────────────────────────────────
   Bex: "cant read needs BG". The heading and its hint sat straight on the
   watercolour page background with nothing behind them, so on a busy backdrop
   they disappeared. Everything else on that page is on a card; this was the
   one bare thing. Given the same treatment as a side panel head, full width. */
.dy-cook-head {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--terra) 12%, var(--surface-card-solid));
  border: 1px solid color-mix(in srgb, var(--terra) 22%, var(--rule));
}
.dy-cook-head .tx-small { color: var(--muted); }

/* v3.7.859: the "clear" link in a filter header went white on hover, which is
   invisible once the bar is a pale Primary. It follows the bar's own text. */
.mg-filter-header .mg-filter-clear:hover { color: inherit; }

/* ── Dashboard: Meals This Month breakdown (v3.7.860) ───────────────────────
   Two columns, counts, no percentages. Replaces a hard-coded "Home-cooked" row
   that showed the month total beside a bar fixed at 60px — it looked like a
   breakdown and was not one.                                                  */
.hm-types {
  padding: 0 16px 12px;
  display: grid;
  /* v3.7.866: one column, capped at five lines in index.php, so this card matches the three
     beside it. Was repeat(2, …) since v3.7.860, when eight types in one column made it too tall. */
  grid-template-columns: 1fr;
  gap: 2px 14px;
}
.hm-type { display: flex; align-items: center; gap: 7px; padding: 3px 0; min-width: 0; }
.hm-type-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.hm-type-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* v3.7.910: the dashboard's top-five rows. Lifted out of index.php, where they
   were five inline style attributes, so that a phone can be given different
   rules from a desktop. Desktop behaviour is unchanged. */
.hm-rank-row  { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.hm-rank-n    { width: 14px; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.hm-rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-rank-bar  { width: 50px; height: 3px; border-radius: 2px; background: var(--rule); overflow: hidden; flex-shrink: 0; }
.hm-rank-bar > div { height: 100%; border-radius: 2px; }
.hm-rank-cnt  { color: var(--muted); flex-shrink: 0; }
.hm-type-cnt { font-weight: 700; color: var(--dark); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.hm-type-more { color: var(--muted); padding: 4px 0 0; }

/* ── Dashboard layout (v3.7.860) ─────────────────────────────────────────────
   Bex's notes on the At a Glance card and the hero.                          */

/* v3.7.866: one row of eight — four stats, then the four quick links, every column the same
   width. Replaces the v3.7.860 title/stats/quick grid, which left a band of empty space across
   the middle once the "Make it again?" card was dropped.
   Bex chose the reflow: 8 across on desktop, 4 at tablet, 2x2 + 2x2 on a phone. Eight columns at
   phone width would be 44px each, which is unusable. The stats keep their row at every size
   because the numbers are short; "Planned for Oct" is the longest label and is what decides how
   narrow a column can safely get. */
.hm-glance {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
  padding: 16px 18px;
}
.hm-quick-label { font-weight: 700; font-size: var(--fs-subtitle); }   /* v3.7.873: had no size at all, so it inherited 16px and sat off the scale */

@media (max-width: 1100px) {
  .hm-glance { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 12px; }
}
@media (max-width: 600px) {
  .hm-glance { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
}

/* "move the date over to the right, make same size as the time" */
.hm-ground .hm-date {
  margin-left: auto;
  font-size: var(--fs-section-h2);
  font-family: var(--tx-section-h2-font, var(--font-display));
  align-self: baseline;
}
.hm-ground .hm-clock { margin-left: 12px; }
@media (max-width: 700px) {
  /* On a phone the greeting takes the first line and the date and clock share
     the second. At 390px the enlarged date cannot fit beside the clock and wraps
     onto a line of its own, so it keeps its smaller size here — the "same size
     as the time" note was about the desktop hero. s24test asserts the pairing. */
  .hm-ground .hm-date { margin-left: 0; font-size: var(--fs-body); }
  .hm-ground .hm-clock { margin-left: auto; }
}

/* "the icons on the bottom stat cards make a little bigger, currently can
   hardly see them (try 2.5rem)" */
.hm-statcard-icon { font-size: 2.5rem; color: var(--rule); opacity: .85; line-height: 1; }

/* "line up the 'line' and link to the bottom to match up with the others" —
   the four cards hold different amounts, so the footer link is pushed down to
   a common baseline instead of floating wherever the content ends. */
/* v3.7.912: scoped to desktop. This was unconditional, and it sits LATER in the file
   than the `@media (max-width: 767px)` block that turns .home-stat-grid into a snap
   carousel - so `display: grid` quietly won on a phone and that carousel had not worked
   since this line was added. The swipe Bex asked for on 2 Nov ("1 box with a swipe to
   see other stats") was already written; it was simply being overridden.
   Found when the arrows added in this release had nothing to page: the track's
   scrollWidth equalled its clientWidth, because it was still a grid. */
@media (min-width: 768px) {
  .hm-statcards { display: grid; align-items: stretch; }
}
.hm-statcard { display: flex; flex-direction: column; }
.hm-statcard > .hm-statcard-foot { margin-top: auto; }

/* ── Grid and Day (v3.7.860) ─────────────────────────────────────────────────
   Bex: "we need to get rid of the beige on the calendar, i would like the
   'month name bar' to have a background so it's easier to read... maybe make
   the background the primary custom colour".                                  */

/* The month bar: the member's Primary, with its text auto-contrasted so a pale
   Primary gets dark type rather than invisible white. Their colours are not
   altered — only the text on top is chosen to suit them. */
.gb-bar {
  padding: 10px 14px;
  background: var(--card-header-bg);
  color: var(--card-header-text);
  border: 1px solid var(--rule);
  /* v3.7.869 — Bex: "remove spacing". The bar and the calendar are now ONE
     card: the bar is its header. It keeps its own 1px border, and that border's
     BOTTOM edge becomes the divider between the two — .gb drops its top border
     below so the seam is a single hairline, not two stacked ones.
     The 14px margin-bottom from line 3737 is what is actually being removed. */
  margin-bottom: 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.gb {
  border-top: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
/* The undo/status bar sits BETWEEN the two when it is shown, which legitimately
   breaks the seam open. It already had 14px beneath it; it now gets the same
   above, so it reads as a panel pushed into the join rather than as the card
   having come apart. It is `hidden` by default, so normally none of this
   applies and the two are flush. */
.gb-note:not([hidden]) { margin-top: 14px; }
.gb-bar .gb-month-title,
.gb-bar .tx-page-title { color: var(--card-header-text); }
/* The "N of 31 planned" line rides on the bar too.
   v3.7.868, two dead rules removed from here:
   - `.gb-bar .gb-nav` and its hover styled a class that is in NO markup. The
     arrows are .gb-arrow (grid.php:328). .gb-arrow brings its own tinted hover
     from line 3731 — correct on the tint, and it was being overridden by a
     translucent white that is invisible on one.
   - `.gb-bar .gb-progress` painted the flex WRAPPER holding the text and the
     track, not the track. That is the pale block behind "22 of 31 dinners
     planned" in Bex's screenshot. The track is .gb-progress-track and carries
     its own --surface-2 fill (line 3734), which reads on the tint unaided. */
.gb-bar .gb-progress-text, .gb-bar .tx-small { color: var(--card-header-text); }

/* Day: the title bar gets the same treatment, and "Change it on the Grid"
   takes the Secondary so it separates from the bar it sits on.
   The classes are .dy-bar / .dy-bar-grid — checked against day.php rather than
   guessed, after an earlier pass styled two selectors that did not exist. */
.dy-bar {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--card-header-bg);
  color: var(--card-header-text);
  border: 1px solid var(--rule);
}
.dy-bar .dy-date,
.dy-bar .dy-link,
.dy-bar .gb-arrow { color: var(--card-header-text); }
/* v3.7.868 — three overrides removed, all drawn on the promise of a dark slab:
   - the arrow hover was white at 18%, invisible on a near-white bar.
     .gb-arrow's own tinted hover (3731) is right and now applies.
   - "Tonight" was a translucent white pill, which disappears on the tint.
     .dy-page .dy-tonight (4188) already paints it solid Primary with its own
     auto-contrasted --dy-on-accent text; that is correct on the tint and is
     what the pill looks like everywhere else on the page.
   Same shape as 867's six inline overrides: the token could never govern while
   a more specific rule repainted it. */
/* v3.7.868: a .btn-secondary is white with a 20%-tint edge — a clear affordance
   on a solid bar, very nearly edgeless on a 12% tint of the same colour. On the
   two toolbars it takes the 40% edge the view toggle was given in 867, so one
   control reads the same way on every tinted bar.
   a.btn.dy-bar-grid is (0,3,1) and keeps its transparent edge: it is a SOLID
   Secondary button and does not need one. */
.gb-bar .btn-secondary,
.dy-bar .btn-secondary,
.al-head .btn-secondary {
  border-color: color-mix(in srgb, var(--terra) 40%, var(--surface-card-solid));
}

/* v3.7.869 — Autofill Lists gets the same bar as the other two main-column
   toolbars. Bex: "autofill lists - needs a header bar with the page title,
   little blurb thats there and the back to grid button."

   No markup change was needed: .al-head already wrapped exactly those three
   things (shopping-list.php:881) and simply had no background, so the title,
   the blurb and the button were floating on the page watercolour while every
   other page had a bar. This is the main column, so by the 868 rule it is the
   PRIMARY tint — the same pair as .gb-bar and .dy-bar.

   align-items moves flex-end -> center: with no bar there was nothing to sit
   inside and the button lined up with the baseline of the blurb. Inside a
   padded bar that reads as the button having slipped down. */
.al-head {
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--card-header-bg);
  color: var(--card-header-text);
  border: 1px solid var(--rule);
}
/* v3.7.884: keyed to the HEADING, not to a role class. These two rules used to
   say .tx-page-title, so moving the title to Section size — which is what the
   other 18 card-header titles wear — would have silently taken the bar's text
   colour and its 4px marker with it. A role class is a size, not an identity;
   the thing that makes this a header bar is that it is the bar's heading. */
.al-head :is(h1,h2,h3,h4,h5,h6) { color: var(--card-header-text); }
/* The bar carries no leading icon, so it takes the 4px marker — and the marker
   hangs off the HEADING, never the bar. 867's reason, which cost a build: these
   bars are display:flex, so a ::before on the bar becomes an extra flex item
   and pushes "Back to the Grid" out of place. */
.al-head :is(h1,h2,h3,h4,h5,h6)::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1em;
  margin-right: 10px;
  border-radius: 2px;
  background: var(--card-header-marker);
  vertical-align: -.1em;
}
/* The blurb steps back from the title rather than going muted-on-colour — the
   same treatment .gt-head's hint gets, for the same reason: a fixed muted grey
   stops being a deliberate choice once the surface is tinted. */
/* v3.7.871: the 640px cap was breaking the sentence mid-phrase — Bex: "it looks
   like there is a line break there after 'lists to....'". The bar is its own
   measure now, so the cap only fights it. */
.al-head .al-intro { color: inherit; opacity: .85; max-width: none; }
a.btn.dy-bar-grid {
  background: var(--green);
  color: var(--on-secondary);
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}
a.btn.dy-bar-grid:hover { background: var(--green-hover); color: var(--on-secondary); }
/* The family-vote faces on the Day page, matching meal-view.php (v3.7.860). */
.dy-vote-face { font-size: 1.05em; margin-right: 5px; line-height: 1; }

/* ── Lists › Shopping: the header bar (v3.7.860) ─────────────────────────────
   Bex: "month/date range -> font setting 1, counts text underneath change to
   font setting 4".                                                           */
:where(body.pg-shopping-list) .sl-card-header-range {
  font-family: var(--tx-page-title-font, var(--font-display));
  font-size: var(--fs-page-title);
  font-weight: var(--tx-page-title-weight, 800);
  line-height: 1.15;
}
:where(body.pg-shopping-list) .sl-card-header-stats {
  font-size: var(--fs-body);
  opacity: .9;
}

/* ── The view toggle (v3.7.862) ──────────────────────────────────────────────
   Bex: "make the 'list/card' icon bigger and white, it's really hard to see (or
   make the bg of the icon white and the actual icon a different colour)".
   Her second option: a solid chip so it reads as a button on any coloured bar,
   with the icon in the member's Primary. It was previously white at 10% opacity
   with a 0.75rem icon, which on a pale Primary was close to invisible.          */
.mg-view-toggle {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-btn);
  /* v3.7.867: a white chip was a clear affordance on a solid colour bar and
     invisible on the tinted one, so it gains a border from the member's
     colour. Same component, same places, now legible on both.
     v3.7.881: Bex — "please add more border (button #2 style)". The width now
     comes from --btn-border-w, the same token button #2 uses, rather than a
     literal. The 40% mix stays: button #2's own --rule is 20%, and dropping to
     it would make this chip thicker but paler, undoing what 867 fixed. */
  background: var(--surface-card-solid);
  border: var(--btn-border-w) solid color-mix(in srgb, var(--terra) 40%, var(--surface-card-solid));
  color: var(--terra-ink);
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--ease);
}
/* v3.7.871: the "showing the other view" state. It was set with INLINE STYLES
   from cookbook.php's toggleView(), which meant the Grid could not reuse the
   component without copying that JS too — and an inline style outranks any
   stylesheet, so the state could never be re-themed. Now a class, set by both
   pages, so the two really are one button rather than two that look alike. */
/* v3.7.871 — the back-to-top arrow (includes/app_footer.php). Was an inline style
   block hard-coding #8aab6a and #fff; it now follows the member's colours and
   obeys the hover contract like every other filled button. */
.mg-btt {
  position: fixed;
  bottom: 70px;
  right: 16px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--terra);
  color: var(--on-primary);
  border: none;
  cursor: pointer;
  font-size: var(--fs-section);
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  transition: background-color .15s ease, opacity .2s, transform .2s;
}
/* v3.7.871: 34px is a comfortable size with a mouse and under the 38px floor for
   a finger. The .gb-view buttons this toggle replaced were 44px, so the Freezer
   tab would have regressed — caught by e822a's "buttons are a finger tall".
   Worth noting the Cookbook has carried the same 34px target since this component
   was written; no suite covered it there, so nobody found out. */
@media (max-width: 767px), (pointer: coarse) {
  .mg-view-toggle { width: var(--gb-tap, 44px); height: var(--gb-tap, 44px); }
}
.mg-btt:hover { background: var(--terra-hover); color: var(--on-primary); }
.mg-btt:focus-visible { outline: 2px solid var(--terra-ink); outline-offset: 2px; }

.mg-view-toggle.is-on {
  background: color-mix(in srgb, var(--terra) 14%, var(--surface-card-solid));
  border-color: var(--terra);
}
.mg-view-toggle:hover { background: color-mix(in srgb, var(--terra) 12%, var(--surface-card-solid)); }
.mg-view-toggle:focus-visible { outline: 2px solid var(--terra-ink); outline-offset: 2px; }

/* The Grid and Freezer switchers are SEGMENTED controls, not toggles: two
   buttons that show which view you are in. Converting them to a single icon
   would match the Cookbook's look but lose that, so they keep their shape and
   borrow the chip styling instead — consistent without going mute.            */
.gb-views { border-radius: var(--radius-btn); overflow: hidden; }
.gb-view {
  /* v3.7.862 fix: this was a flat 34px, which overrode the base rule's
     calc(var(--gb-tap) - 6px) and shrank the Freezer's Cards/List buttons
     below a comfortable tap. The Freezer scopes --gb-tap to 44px for exactly
     that reason, so the token is read here too; the fallback covers any
     scope that does not set it. */
  min-height: calc(var(--gb-tap, 44px) - 6px);
  border: 0;
  background: color-mix(in srgb, var(--terra) 8%, var(--surface-card-solid));
  color: var(--terra-ink);
  font-size: var(--fs-body);
}
.gb-view.is-on {
  /* v3.7.867: a white chip was a clear affordance on a solid colour bar and
     invisible on the tinted one, so it gains a border from the member's
     colour. Same component, same places, now legible on both. */
  background: var(--surface-card-solid);
  border: 1px solid color-mix(in srgb, var(--terra) 40%, var(--surface-card-solid));
  color: var(--terra-ink);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* SERVING SCALER (½ ×1 ×2 ×3 ×4) — v3.7.862.

   The recipe page and the meal page each had their own, both inline-styled,
   both with a hard-coded #fff on the selected pill and a one-off corner
   radius (6px on one, 50px on the other). They are one control now, on
   --radius-btn like every other button, borrowing .gb-view's colours from the
   Grid and Freezer switchers — which is the same kind of control: several
   buttons, one of them current.

   Two sizes: compact on its own (recipe, in a card header beside "Serves 4"),
   and stretched inside .mg-scale-row (meal, filling a sidebar card). */
.mg-scale {
  padding: 4px 10px;
  min-height: 30px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-btn);
  background: color-mix(in srgb, var(--terra) 8%, var(--surface-card-solid));
  color: var(--terra-ink);
  font-family: var(--font-display);
  font-size: var(--fs-meta);
  font-weight: 700;
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.mg-scale:hover { background: color-mix(in srgb, var(--terra) 16%, var(--surface-card-solid)); }
.mg-scale:focus-visible { outline: 2px solid var(--terra-ink); outline-offset: 2px; }
/* A scaler picks a VALUE, so the chosen one is filled rather than merely
   raised — .gb-view's recessed/raised metaphor suits a view switcher, but here
   it left the selection almost invisible on a white card. This is the fill the
   two pages always had; what was wrong was the hard-coded #fff on it, which
   --on-primary (auto-contrasted against the member's Primary) replaces. */
.mg-scale.is-on {
  background: var(--terra);
  border-color: var(--terra);
  color: var(--on-primary);
  box-shadow: var(--shadow-sm);
}
.mg-scale.is-on:hover { background: var(--terra); }
.mg-scale-row { display: flex; gap: 6px; }
.mg-scale-row .mg-scale {
  flex: 1;
  padding: 6px 4px;
  min-height: 34px;
  font-size: var(--fs-body);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PUBLIC NAV  (.pub-)  — v3.7.863
   The signed-out header on community.php and community-recipe.php, the only
   two pages a stranger sees. Its LAYOUT used to live in mealgrid.css, which is
   FileZilla-managed and has never shipped in a package — so on a fresh install
   the nav had colours (set inline by public_header.php) and no geometry at all.
   The colours stay inline, because they are member settings; the geometry is
   here, where every other component's is.
   ═══════════════════════════════════════════════════════════════════════════ */
.pub-nav {
  position: relative;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.pub-nav-inner {
  /* v3.7.927: was max-width 1200px with 20px padding, while the member app's
     .app-topnav-inner is full width with --nav-pad (52px), and page content is full
     width with --page-pad-x. The public bar was therefore the narrowest thing on the
     page and the content ran past it on both sides. Bex: "the topnav should be the
     same width as the app (there is less r/l padding on the app)."
     It now mirrors .app-topnav-inner rather than inventing a fourth width, and takes
     --nav-pad from the same token, so the two bars cannot drift apart again. */
  max-width: none;
  margin: 0;
  width: 100%;
  /* Vertical padding as well as min-height: the height alone centres a 38px logo in a 60px bar,
     but leaves nothing if the logo is ever replaced with a taller one. v3.7.865 */
  padding: 11px var(--nav-pad, 52px);
  min-height: var(--nav-h, 56px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 20px;
}
.pub-nav-logo-text { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.pub-nav-links {
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.pub-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: var(--gb-tap, 44px);
  padding: 0 12px;
  border-radius: var(--radius-btn);
  font-family: var(--font-display);
  font-size: var(--fs-body);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--ease);
}
.pub-nav-link:hover,
.pub-nav-link.pub-nav-active { background: rgba(255, 255, 255, .16); }
.pub-nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-btn);
  background: var(--green);
  color: var(--on-secondary);
  font-family: var(--font-display);
  font-size: var(--fs-body);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--ease);
}
.pub-nav-cta:hover { background: var(--green-hover); }   /* v3.7.870: was brightness(1.06) */

/* Hamburger — hidden until the links no longer fit. */
.pub-nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: var(--gb-tap, 44px);
  height: var(--gb-tap, 44px);
  margin-left: auto;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.pub-nav-hamburger span {
  display: block;
  height: 2px;
  width: 22px;
  border-radius: 2px;
  background: currentColor;
  transition: var(--ease);
}
.pub-nav-mobile-menu { display: none; }
.pub-nav-mobile-menu.is-open { display: block; }
.pub-nav-mobile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--gb-tap, 44px);
  padding: 0 20px;
  font-family: var(--font-display);
  font-size: var(--fs-body);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

@media (max-width: 860px) {
  .pub-nav-links { display: none; }
  .pub-nav-hamburger { display: flex; }
}

/* The skip link: off-screen until it is focused, then it must be visible —
   it is the first thing a keyboard user lands on. It was being rendered as
   ordinary text at the top of both public pages. */
.a11y-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  background: var(--terra);
  color: var(--on-primary);
  font-family: var(--font-display);
  font-weight: 700;
  text-decoration: none;
}
.a11y-skip-link:focus { left: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   COMMUNITY RECIPE  (.cr-)  — lifted from community-recipe.php in v3.7.863.
   The last member page carrying its own <style> block. Faults fixed on the
   way across: #fff on the member's Primary, a comment card painted the PAGE
   background, cards off the shared token, a second hard-coded green in the
   CTA gradient, and a CTA heading that took --tx-section-color and so drew
   itself dark green ON that green gradient.
   ═══════════════════════════════════════════════════════════════════════════ */
/* Layout — matches recipe.php */
:where(body.pg-community-recipe) .cr-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
:where(body.pg-community-recipe) .cr-layout > div:first-child { position: sticky; top: calc(var(--nav-h, 56px) + 50px); }
@media (max-width: 768px) { :where(body.pg-community-recipe) .cr-layout { grid-template-columns: 1fr; } :where(body.pg-community-recipe) .cr-layout > div:first-child { position: static; } }

/* Stars */
:where(body.pg-community-recipe) .cr-stars { display: inline-flex; gap: 2px; }
:where(body.pg-community-recipe) .cr-stars i { font-size: var(--fs-body); color: var(--amber); cursor: default; }
:where(body.pg-community-recipe) .cr-stars i.empty { color: var(--rule); }
:where(body.pg-community-recipe) .cr-stars.interactive i { cursor: pointer; transition: transform .15s; }
:where(body.pg-community-recipe) .cr-stars.interactive i:hover { transform: scale(1.2); }

/* Detail card */
/* v3.7.881: padding dropped, same as meal-view's .meal-detail-card. These cards
   now carry a .mg-card-header bar, and a card that pads itself leaves that bar
   inset on all four sides — the white frame Bex circled on meal-view. The body
   padding comes from .mg-card-body, as everywhere else. */
:where(body.pg-community-recipe) .cr-detail-card { margin-bottom: 16px; }
:where(body.pg-community-recipe) .cr-detail-card h2 { font-size: var(--fs-section); font-weight: var(--tx-section-weight); font-family: var(--tx-section-font); color: var(--tx-section-color); margin: 0 0 16px; font-style: var(--tx-section-style); text-transform: var(--tx-section-transform); letter-spacing: var(--tx-section-spacing); }

/* Social share */
:where(body.pg-community-recipe) .cr-share-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface); color: var(--muted); font-size: var(--fs-small); text-decoration: none; cursor: pointer; transition: all .2s; }
:where(body.pg-community-recipe) .cr-share-btn:hover { transform: scale(1.1); box-shadow: 0 2px 8px rgba(0,0,0,.1); }

/* Ingredients */
:where(body.pg-community-recipe) .cr-ing-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--rule); }
:where(body.pg-community-recipe) .cr-ing-qty { color: var(--terra-ink); font-weight: 700; font-size: var(--fs-body); white-space: nowrap; font-family: var(--font-display); }

/* Steps */
:where(body.pg-community-recipe) .cr-step { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
:where(body.pg-community-recipe) .cr-step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--terra); color: var(--on-primary); font-family: var(--font-display); font-weight: 800; font-size: var(--fs-meta); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
:where(body.pg-community-recipe) .cr-step-img { margin-top: .5rem; border-radius: 10px; max-width: 300px; box-shadow: 0 2px 8px rgba(0,0,0,.1); }

/* Comments */
:where(body.pg-community-recipe) .cr-comment { background: var(--surface-2); border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: .5rem; border: 1px solid var(--rule); }
:where(body.pg-community-recipe) .cr-comment-form textarea { width: 100%; padding: .6rem; border: 1px solid var(--rule); border-radius: 10px; font-size: var(--fs-body); font-family: var(--font-body); resize: vertical; min-height: 80px; background: var(--surface); color: var(--dark); }

/* Report modal */
:where(body.pg-community-recipe) .cr-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9999; display: none; align-items: center; justify-content: center; }
:where(body.pg-community-recipe) .cr-modal-overlay.active { display: flex; }
:where(body.pg-community-recipe) .cr-modal { background: var(--surface-card-solid); border-radius: 16px; padding: 1.5rem; max-width: 440px; width: 90%; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
:where(body.pg-community-recipe) .cr-modal textarea { width: 100%; padding: .6rem; border: 1px solid var(--rule); border-radius: 8px; font-size: var(--fs-body); font-family: var(--font-body); min-height: 80px; resize: vertical; }

/* Toast */
:where(body.pg-community-recipe) .cr-toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--dark); color: var(--on-dark-text); padding: .65rem 1.5rem; border-radius: var(--radius); font-size: var(--fs-body); font-weight: 600; z-index: 9999; opacity: 0; transition: transform .3s ease, opacity .3s ease; box-shadow: 0 8px 24px rgba(0,0,0,.25); pointer-events: none; }
:where(body.pg-community-recipe) .cr-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* CTA banner */
:where(body.pg-community-recipe) .cr-cta-banner { background: linear-gradient(135deg, var(--green), color-mix(in srgb, var(--green) 55%, #000)); border-radius: var(--radius); padding: 1.75rem 2rem; text-align: center; color: var(--on-secondary); }
:where(body.pg-community-recipe) .cr-cta-banner h3 { margin: 0 0 .4rem; font-size: var(--fs-section); font-weight: var(--tx-section-weight); font-family: var(--tx-section-font); font-style: var(--tx-section-style); text-transform: var(--tx-section-transform); letter-spacing: var(--tx-section-spacing); color: inherit; }
:where(body.pg-community-recipe) .cr-cta-banner p { margin: 0 0 1rem; font-size: var(--fs-body); opacity: .9; }

/* ═══════════════════════════════════════════════════════════════════════════
   MY KITCHEN › PANTRY  (.pt-)  — v3.7.863
   Was a 7-column table with every colour and dimension written inline.

   Bex: a card grid, "2 columns ONLY IF THINGS WILL FIT", with the stats and
   the add control in a right sidebar.

   The column count is NOT hard-coded. --pt-card-min is the narrowest a card
   can be and still hold its whole control row on one line, so auto-fill gives
   two columns exactly when two fit and one when they do not — at any window
   size, any font scale, any length of ingredient name. Hard-coding "2" would
   have been a guess about a pantry we cannot see.
   ═══════════════════════════════════════════════════════════════════════════ */
.pt-layout {
  display: flex;
  align-items: flex-start;
  gap: var(--gap, 20px);
}
.pt-main { flex: 1 1 auto; min-width: 0; }
/* v3.7.869: .mg-side spaces its children by --side-gap (16px), which is right
   when they are separate panels stacked in a column. Now that this aside IS one
   card, that gap would show as a strip of card background between the tinted
   head and the body — the head's own 1px rule is the divider instead. */
.pt-side { flex: 0 0 var(--side-w, 264px); gap: 0; }

.pt-section { margin-bottom: 18px; }
.pt-section .category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  /* v3.7.869: the colour pair arrives inline from mykitchen.php (it always did —
     see there for why), but the bar needs the same edge the tinted bars got in
     868, since a near-white bar with no rule under it stops reading as a bar. */
  border-bottom: 1px solid var(--rule);
}
/* "Uncategorised" keeps the semantic red — the Pantry's twin of the shopping
   list's "needs sorting". Deliberately NOT tinted. */
.pt-section .category-header.is-attn { background: var(--danger); color: var(--on-danger); border-bottom-color: transparent; }
/* The leading tag icon plays the marker's part, as on every other tinted bar. */
.pt-section .category-header:not(.is-attn) > .fa-solid { color: var(--card-header-marker); }

.pt-grid {
  /* v3.7.913 — #21, "pantry cards flush against the right edge".
     Was a bare 340px. The reasoning above still holds on a desktop and is left
     intact: 340 is the narrowest a card can be and still hold its control row on
     one line, which is what lets auto-fill give two columns exactly when two fit.

     What it never said is what happens when the container is NARROWER than the
     floor. A grid track does not shrink below its minimum - it keeps 340 and
     hangs off the right edge. At 375 the column has 327 to give, so the card
     took 340 and 13px went off-screen. The left edge stayed pinned, which is why
     it reads as missing RIGHT padding rather than as a card that is too wide.

     min(340px, 100%) asks for 340 only when 340 exists. Where it fits, nothing
     changes: same floor, same auto-fill, same column count. Where it does not,
     the card takes the container instead of overrunning it. One token, no new
     breakpoint, and the desktop promise is untouched. */
  --pt-card-min: min(340px, 100%);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--pt-card-min), 1fr));
  gap: 10px;
  padding: 12px;
  background: var(--surface-card);
  border: 1px solid var(--rule);
  border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.pt-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface-card-solid);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.pt-card:hover { box-shadow: var(--shadow-sm); border-color: color-mix(in srgb, var(--terra) 35%, var(--rule)); }
.pt-card-top { display: flex; align-items: center; gap: 6px; }
.pt-name {
  font-family: var(--font-display);
  font-size: var(--fs-body);
  font-weight: 700;
  color: var(--dark);
  overflow-wrap: anywhere;
}
.pt-star { font-size: var(--fs-meta); line-height: 1; }

.pt-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pt-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: var(--fs-meta);
  font-weight: 700;
  cursor: pointer;
  transition: var(--ease);
}
/* The three stock states read as three ideas, not three decorations:
   in stock (success), always stocked (a staple — warning/amber, the same
   amber the star uses), and out (danger). */
/* v3.7.887: the stock pill is an indicator, not a control. .pt-pill gives every
   pill a pointer cursor and a hover, which on something unclickable is a lie. */
.pt-pill.is-readonly { cursor: default; }
.pt-stock.is-in     { border-color: color-mix(in srgb, var(--success) 35%, transparent); background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success-ink); }
.pt-stock.is-always { border-color: color-mix(in srgb, var(--warning) 35%, transparent); background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--warning-ink); }
.pt-stock.is-out    { border-color: color-mix(in srgb, var(--danger) 35%, transparent);  background: color-mix(in srgb, var(--danger) 12%, transparent);  color: var(--danger-ink); }
.pt-staple.is-on    { border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning-ink); }
.pt-pill:focus-visible { outline: 2px solid var(--terra-ink); outline-offset: 2px; }

.pt-qty input, .pt-unit select {
  min-height: 30px;
  padding: 2px 6px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface-card-solid);
  color: var(--dark);
  font-size: var(--fs-small);
  text-align: center;
}
.pt-qty input { width: 56px; }
.pt-unit select { width: 78px; cursor: pointer; text-align: left; }
/* ── v3.7.887. The four controls on one line ──────────────────────────────
   Bex: "can we make it so the 'in stick/always' , staple, quantity and unit
   pull down be on the same line on desktop?"

   Measured: the row needs about 327px and the card is --pt-card-min 340px, so
   it was wrapping by roughly 15px — the two pills' 11px side padding and the
   unit select's 78px are where that 15px lives.

   NOT by raising --pt-card-min. The comment above that token is explicit that
   the column count is deliberately not hard-coded and auto-fill gives two
   columns exactly when two fit; widening the card to save a wrap could cost a
   whole column on the same screen. Trimming the controls keeps the grid's
   promise intact.

   Only from 900px up. Below that the cards are single-column and wide, the
   wrap is harmless, and the larger tap targets are worth more than one line. */
@media (min-width: 900px) {
  .pt-controls { flex-wrap: nowrap; }
  .pt-controls .pt-pill { padding: 0 8px; }
  .pt-unit select { width: 70px; }
  .pt-qty input { width: 50px; }
}

.pt-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pt-updated { color: var(--muted); }
.pt-actions { display: inline-flex; gap: 2px; }
.pt-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border: 0;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: var(--ease);
}
.pt-act:hover { background: var(--surface-2); color: var(--dark); }
.pt-act-cart:hover { color: var(--terra-ink); }
.pt-act-del:hover  { color: var(--danger-ink); }
.pt-act.is-done    { color: var(--green-ink); }
.pt-act:focus-visible { outline: 2px solid var(--terra-ink); outline-offset: 2px; }

.pt-empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: var(--fs-body); }   /* v3.7.873: was inheriting 16px */
.pt-empty-icon { font-size: 2rem; margin-bottom: 8px; }

/* Sidebar */
.pt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pt-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  text-align: center;
}
.pt-stat-out { color: var(--danger-ink); }
/* v3.7.871 — Bex: "add some space after the stats before the add to pantry
   button". .mg-side-body spaces its children by 10px, which is right for a list
   of related rows and too tight where the stats end and an action begins. */
.pt-side .pt-add { margin-top: 28px; }   /* v3.7.875: Bex asked for space after the stats, before the Add to pantry button */
.pt-add-toggle { width: 100%; justify-content: center; }
.pt-add-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 0 5px;
  border-radius: var(--radius-btn);
  background: rgba(255, 255, 255, .22);
  font-size: var(--fs-meta);
}
.pt-add-panel {
  margin-top: 10px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.pt-add-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pt-add-head h3 { margin: 0; }
.pt-add-chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 320px; overflow-y: auto; }
.pt-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-btn);
  background: var(--surface-card-solid);
  color: var(--dark);
  font-size: var(--fs-meta);
  cursor: pointer;
  transition: var(--ease);
}
.pt-chip:hover { background: color-mix(in srgb, var(--terra) 10%, var(--surface-card-solid)); }
.pt-chip.is-tracked { background: var(--green); border-color: var(--green); color: var(--on-secondary); cursor: default; }
.pt-chip:focus-visible { outline: 2px solid var(--terra-ink); outline-offset: 2px; }

@media (max-width: 900px) {
  /* v3.7.913 — the same fault v3.7.910 fixed on .mg-sidebar-layout, in a second
     layout nobody had connected to it.

     .pt-layout carries align-items: flex-start. On a desktop that is a ROW, so
     flex-start is vertical and means "do not stretch the columns to equal
     height" - correct and intended. Turn the direction to column here and the
     cross axis becomes HORIZONTAL, so the very same declaration now means "size
     every child to its own content". .pt-main then sized itself to the widest
     thing inside it rather than to the page.

     Restoring stretch is what the 910 fix did, and it is the general form: the
     card floor above was the thing that happened to be too wide this time, but
     any wide child would have done it. Belt and braces, deliberately - the token
     fixes this bug, this line fixes the class. */
  .pt-layout { flex-direction: column; align-items: stretch; }
  .pt-side { flex: 1 1 auto; width: 100%; }
  .pt-stats { grid-template-columns: repeat(4, 1fr); }
}

/* The tier badge in the account hero (v3.7.863). It carried an inline
   color:var(--terra-ink), which on a dark page is the CARD-safe ink — so it
   drew itself dark on the dark background. As a class, the dark-page block
   can reach it. */
.page-hero-tier { color: var(--terra-ink); font-weight: 700; }

/* A line of prose that sits on the PAGE rather than on a card (v3.7.863).
   Marked as such so the dark-page block can light it up; on a light page it
   reads exactly as the muted text it replaced. */
.mg-page-note { text-align: center; padding: 24px; color: var(--muted); }
.mg-page-note-link { color: var(--terra-ink); font-weight: 600; }

/* The community recipe's step text — was an inline style; it moves here so the
   crossed-off state has something to hang off, like .recipe-step and .mv-step. */
:where(body.pg-community-recipe) .cr-step-text { font-size: var(--fs-body); line-height: 1.7; color: var(--body-color); padding-top: 2px; }

/* ═══════════════════════════════════════════════════════════════════════════
   help.php  (v3.7.876)
   The Help tab was three centred quick-link blocks across the top with Getting
   Started pushed beneath them. Bex's screenshot: "make main card" on Getting
   Started, arrows taking the three links to the right. It uses
   .mg-sidebar-layout now, so everything below is the small amount that layout
   does not already give.
   ═══════════════════════════════════════════════════════════════════════════ */

/* The three destinations. They are real cards with the shared header bar, so
   they need nothing but a hover and a working focus ring - the surface, the
   radius and the bar all come from components that already exist. */
:where(body.pg-help) .hlp-link { transition: var(--ease); }
:where(body.pg-help) .hlp-link:hover { transform: translateY(-1px); box-shadow: var(--shadow-md, 0 4px 14px rgba(0,0,0,.1)); }
:where(body.pg-help) .hlp-link:focus-visible { outline: 2px solid var(--terra-ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  :where(body.pg-help) .hlp-link:hover { transform: none; }
}

/* "x new" beside Support Tickets when a ticket is sitting at status 'replied'.
   --green is the member's secondary colour, so this follows their palette
   rather than introducing a fourth accent. */
:where(body.pg-help) .hlp-flag {
  margin-left: auto; flex: none;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  background: var(--green); color: var(--on-secondary);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-badge);
  letter-spacing: .03em; white-space: nowrap;
}

/* The address is shown as text, not only as a mailto: - a mail link does
   nothing on plenty of setups and a visible address always works. */
:where(body.pg-help) .hlp-mail {
  display: inline-block; word-break: break-all;
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-body);
  color: var(--terra-ink); text-decoration: none;
  border-bottom: var(--btn-border-w) solid var(--terra-tint);
}
:where(body.pg-help) .hlp-mail:hover { color: var(--terra-dark); border-bottom-color: var(--terra-ink); }

/* v3.7.876: .nav-badge was only ever styled inside .mg-sidebar-nav, so in the
   tab strip it rendered as a bare number with no shape - which is the "2"
   Bex ringed on her screenshot. .is-reply is the one that means something is
   waiting, so it takes the secondary colour; a plain count stays quiet. */
.mg-subnav-tab .nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 99px; background: rgba(255, 255, 255, .22);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-badge);
  line-height: 1; vertical-align: middle;
}
.mg-subnav-tab .nav-badge.is-reply { background: var(--green); color: var(--on-secondary); }
.mg-subnav-tab.active .nav-badge { background: var(--terra-tint); color: var(--terra-dark); }
.mg-subnav-tab.active .nav-badge.is-reply { background: var(--green); color: var(--on-secondary); }

/* v3.7.877: the explanatory paragraphs on Preferences > Appearance - the lines
   describing what each colour group does - were on .mg-meta, 12px. Bex: "most
   of that should be 'body'". They are prose someone reads to decide, not fine
   print, so they read at Body like prose elsewhere. Scoped to that tab: .mg-meta
   is a shared role class and must keep meaning Meta everywhere else. */
:where(body.pg-preferences) #tab-colours .mg-meta { font-size: var(--fs-body); }


/* ── v3.7.895 — Billing history on the Subscription page ──────────────────── */
.sub-history { margin-top: 16px; }
.sub-history-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.sub-history-table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
.sub-history-table th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: var(--fs-small); padding: 6px 10px;
}
.sub-history-table td { padding: 10px; border-top: 1px solid var(--rule); }
.sub-history-amount { font-variant-numeric: tabular-nums; }
.sub-pay-status {
  display: inline-block; font-size: var(--fs-small); font-weight: 600;
  padding: 2px 10px; border-radius: var(--radius-md);
}
.sub-pay-status.is-completed { background: color-mix(in srgb, var(--green) 16%, var(--surface-card-solid)); color: var(--dark); }
.sub-pay-status.is-denied    { background: color-mix(in srgb, #d14 14%, var(--surface-card-solid));       color: var(--dark); }
.sub-pay-status.is-refunded  { background: color-mix(in srgb, var(--muted) 18%, var(--surface-card-solid)); color: var(--dark); }
.sub-pay-status.is-pending   { background: color-mix(in srgb, var(--terra) 14%, var(--surface-card-solid)); color: var(--dark); }

/* ── v3.7.898 — Subscription: payment information, failed payment, pause/close ──────────────
   Scoped to the page slug like the rest of this file. That scoping is only trustworthy as of
   897, which fixed <body> keeping the previous page's slug across an in-place tab move — this
   page carries more slug-scoped rules than any other, so it was the one most exposed to it. */

/* The failed-payment notice. Loud enough to be read, not so loud it reads as an error page -
   the plan is still working and the member can fix it. */
:where(body.pg-subscription) .sub-alert { display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; margin-bottom: 20px; border-color: color-mix(in srgb, var(--warning) 42%, transparent); background: color-mix(in srgb, var(--warning) 6%, var(--surface-card-solid)); }
:where(body.pg-subscription) .sub-alert-icon { flex: 0 0 auto; font-size: 1.5rem; color: var(--warning); line-height: 1.2; }
:where(body.pg-subscription) .sub-alert-body { flex: 1 1 auto; min-width: 0; }
:where(body.pg-subscription) .sub-alert-title { margin: 0 0 6px; color: var(--warning); }
:where(body.pg-subscription) .sub-alert .btn { margin-top: 12px; }

/* Payment information. A description list, so the labels are labels to a screen reader and not
   just small grey text that happens to sit on the left. */
:where(body.pg-subscription) .sub-pay { padding: 20px 22px; margin-bottom: 20px; }
:where(body.pg-subscription) .sub-pay-title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
/* v3.7.899: 300px, not 240. On a wide screen 240 gave six narrow columns and the masked payer
   email wrapped mid-address; the cap keeps the row to four roomy columns on a 1900px window. */
:where(body.pg-subscription) .sub-pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2px 28px; margin: 0; max-width: 1500px; }
:where(body.pg-subscription) .sub-pay-row { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--rule); min-width: 0; }
:where(body.pg-subscription) .sub-pay-row dt { margin: 0; text-transform: uppercase; letter-spacing: .04em; }
:where(body.pg-subscription) .sub-pay-row dd { margin: 0; word-break: break-word; }
:where(body.pg-subscription) .sub-pay-ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Pause or close. Collapsed by default: findable, not shouting. */
:where(body.pg-subscription) .sub-close { margin-top: 28px; padding: 0; overflow: hidden; }
:where(body.pg-subscription) .sub-close-summary { display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; list-style: none; transition: background .2s; }
:where(body.pg-subscription) .sub-close-summary::-webkit-details-marker { display: none; }
:where(body.pg-subscription) .sub-close-summary:hover { background: color-mix(in srgb, var(--muted) 6%, transparent); }
:where(body.pg-subscription) .sub-close-summary:focus-visible { outline: 2px solid var(--terra-ink); outline-offset: -2px; }
:where(body.pg-subscription) .sub-close-hint { margin-left: auto; }
:where(body.pg-subscription) .sub-close-chev { transition: transform .25s ease; color: var(--muted); }
:where(body.pg-subscription) .sub-close[open] .sub-close-chev { transform: rotate(180deg); }
:where(body.pg-subscription) .sub-close-body { padding: 4px 20px 20px; border-top: 1px solid var(--rule); }
:where(body.pg-subscription) .sub-close-intro { margin: 14px 0 18px; color: var(--muted); }
:where(body.pg-subscription) .sub-close-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
:where(body.pg-subscription) .sub-close-copy { color: var(--muted); margin-bottom: 18px; }
:where(body.pg-subscription) .sub-close-field { margin-bottom: 12px; }
:where(body.pg-subscription) .sub-close-field .form-control { max-width: 200px; }
/* Amber for pause, red for delete - the same severity pair data.php used, on the same tokens
   (874 put these on --muted/--danger rather than the raw hex they started life as). */
:where(body.pg-subscription) .sub-close-card.is-disable { border-color: color-mix(in srgb, var(--muted) 27%, transparent); }
:where(body.pg-subscription) .sub-close-card.is-disable .form-card-header { background: color-mix(in srgb, var(--muted) 4%, var(--surface-card-solid)); color: var(--muted); }
:where(body.pg-subscription) .sub-close-card.is-disable .form-card-header h3 { color: var(--muted); }
:where(body.pg-subscription) .sub-close-card.is-delete { border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
:where(body.pg-subscription) .sub-close-card.is-delete .form-card-header { background: color-mix(in srgb, var(--danger) 4%, var(--surface-card-solid)); color: var(--danger); }
:where(body.pg-subscription) .sub-close-card.is-delete .form-card-header h3 { color: var(--danger); }
:where(body.pg-subscription) .sub-close-btn.is-disable { background: var(--muted); color: #fff; border-color: var(--muted); }
:where(body.pg-subscription) .sub-close-btn.is-delete { background: var(--danger); color: var(--on-danger, #fff); border-color: var(--danger); }

/* The signposts left where these used to live. */
:where(body.pg-data) .dt-close-signpost { border-color: color-mix(in srgb, var(--muted) 22%, transparent); }
:where(body.pg-data) .dt-signpost-copy { color: var(--muted); margin-bottom: 16px; }
:where(body.pg-account) .acct-close-signpost { margin-top: 18px; border-color: color-mix(in srgb, var(--muted) 22%, transparent); }
:where(body.pg-account) .acct-signpost-body { display: flex; align-items: flex-start; gap: 12px; }
:where(body.pg-account) .acct-signpost-icon { color: var(--cobalt, var(--muted)); margin-top: 2px; }
:where(body.pg-account) .acct-signpost-copy { margin: 0; color: var(--muted); }

/* On a phone the summary has room for a title and a chevron and nothing else - the hint wrapped
   onto three lines and pushed the title onto two. The sentence inside the panel says the same
   thing, so the hint is a desktop convenience, not information only it carries. */
@media (max-width: 700px) {
  :where(body.pg-subscription) .sub-close-hint { display: none; }
  :where(body.pg-subscription) .sub-close-summary { padding: 14px 16px; }
  :where(body.pg-subscription) .sub-close-body { padding: 4px 16px 16px; }
  :where(body.pg-subscription) .sub-pay { padding: 18px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  :where(body.pg-subscription) .sub-close-chev,
  :where(body.pg-subscription) .sub-close-summary { transition: none; }
}
/* v3.7.899: the switch button sits in the same slot a PayPal button would, so the tier cards keep
   one footprint whichever state they are in. */
:where(body.pg-subscription) .sub-switch-form { margin: 0; }
:where(body.pg-subscription) .sub-switch-btn { width: 100%; }
/* v3.7.899: the action under "Payment method". It is a second <dd> on the same row, so it keeps
   the label it belongs to rather than floating free of it. */
:where(body.pg-subscription) .sub-pay-action { margin: 6px 0 0; display: flex; flex-direction: column; gap: 2px; }
:where(body.pg-subscription) .sub-pay-action a { font-weight: 600; }
:where(body.pg-subscription) .sub-pay-hint { line-height: 1.5; }

/* ── v3.7.900 — Subscription: the three-tab layout ─────────────────────────────────────────
   Tab 1 puts "what I have" and "what I pay" beside each other rather than one scrolling past
   the other. The side column is on the RIGHT, as every sidebar in the app now is, and it drops
   beneath the main column before it gets too narrow to read. */
:where(body.pg-subscription) .sub-cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
:where(body.pg-subscription) .sub-col-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
:where(body.pg-subscription) .sub-col-side { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* What your plan includes. Two columns of ticks on a wide screen, one on a phone. */
/* Two columns, not auto-fit. On a 1600px window auto-fit gave FOUR columns, which made this card
   short and wide while the payment sidebar beside it ran long - a big empty gap under one and a
   tall column next to it. Two keeps the two sides roughly level, as the mockup had them. */
:where(body.pg-subscription) .sub-includes-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 28px; }
@media (max-width: 560px) {
  :where(body.pg-subscription) .sub-includes-list { grid-template-columns: 1fr; }
}
:where(body.pg-subscription) .sub-includes-list li { display: flex; align-items: center; gap: 10px; font-size: var(--fs-body); color: var(--dark); }
:where(body.pg-subscription) .sub-includes-list li .fa-check { color: var(--green-ink); }
:where(body.pg-subscription) .sub-includes-foot { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--rule); color: var(--muted); }

/* The plan a payment was for. Quieter than the amount: it is context, not the number you came
   to read. */
:where(body.pg-subscription) .sub-history-plan { color: var(--muted); }

@media (max-width: 700px) {
  :where(body.pg-subscription) .sub-cols { gap: 16px; }
}
/* v3.7.903: the note naming a plan that is not on the list below it. */
:where(body.pg-subscription) .sub-offlist { margin-bottom: 18px; }
/* v3.7.903: billing history with nothing in it yet. Centred and quiet - it is a normal state for a
   new account, not a problem to flag. */
:where(body.pg-subscription) .sub-history-empty { text-align: center; padding: 34px 20px 38px; color: var(--muted); }
:where(body.pg-subscription) .sub-history-empty .fa-receipt { font-size: 1.9rem; color: color-mix(in srgb, var(--muted) 45%, transparent); margin-bottom: 14px; }
:where(body.pg-subscription) .sub-history-empty p { margin: 0 0 6px; }
:where(body.pg-subscription) .sub-history-empty p:last-child { margin: 0; }
/* v3.7.903: the Receipt column. Right-aligned and quiet, like the mockup - it is a link to a
   document, not a number to read down. */
:where(body.pg-subscription) .sub-history-receipt-col,
:where(body.pg-subscription) .sub-history-receipt { text-align: right; color: var(--muted); }

/* ===================================================================
   v3.7.910 — names you can actually read on a phone
   ===================================================================
   Bex walked the app on an iPhone SE on 2 Nov and reported the same fault on
   four pages in different words: "You really can't read them how they are."

   Every one was a name on `white-space: nowrap` in a column narrower than the
   name. The app has eighteen separate single-line ellipsis rules, written for a
   desktop where a row is 900px wide and one line is plenty. At 375 the same rule
   gives a meal name a third of a row.

   THIS BLOCK LIVES AT THE END OF THE FILE ON PURPOSE. The first attempt sat
   mid-file, above the component rules it was overriding. Same specificity, so
   the later rule won and nothing changed - the computed display came back
   `flow-root` instead of `-webkit-box` and the clamp never applied. Anything
   added here must stay after the components it overrides.

   Not included deliberately: notes and secondary lines (.gb-chip-note,
   .dy-coming-note and friends). One line of an aside is the point of an aside.
   This is about the thing being named.                                      */
@media (max-width: 560px) {
  .gl-title,                                      /* Grid list view (#6) */
  .gp-row-title,                                  /* Grid planner rows (#6) */
  .gt-meal-title,                                 /* Grid tray (#6) */
  .al-meal-name,                                  /* autofill list meals */
  .afp-row-name,                                  /* autofill picker rows */
  .ks-rank-name,                                  /* My Kitchen stats */
  .ks-fav-title,
  .sx-usual-name,                                 /* shopping "your usuals" */
  .dy-also-title,                                 /* Day: also today */
  :where(body.pg-cookbook) .item-grid.list-view .item-card-title {   /* Cookbook rows (#15) */
    /* Two lines, done WITHOUT -webkit-line-clamp. The clamp needs
       `display: -webkit-box`, and every selector in this list is a flex item,
       so the browser blockifies that value away - measured: computed display
       came back `flow-root` and the names stayed on one line. A line-height and
       a max-height of exactly two lines needs no particular display value and
       works on a flex item. */
    white-space: normal;
    overflow-wrap: anywhere;
    overflow: hidden;
    line-height: 1.25;
    max-height: 2.5em;          /* 2 x line-height */
    text-overflow: clip;
    /* And where the element IS a -webkit-box - the Cookbook list rows carry
       `-webkit-line-clamp: 1` from v3.7.8xx - the clamp beats a max-height, so
       it has to be raised too. Harmless on the selectors that are flex items,
       where the box display never survives. */
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  /* v3.7.913 — the dashboard's top-five rows, and the v3.7.910 workaround coming
     back out. Bex: "Try 2 first, remove the bar".

     910 made this row WRAP, and the reasoning was sound at the time: the stat
     card was 158px in a 2-up grid, the row 124px, and the number, bar, count and
     three gaps took 109 of it - leaving the name 15px. Wrapping was the only way
     to give the name room.

     912 then turned the stat cards into a working carousel, so the card is now
     ~281px and the name no longer needs rescuing. The wrap rule stayed, and at
     the new width it produced the worst of both: names that fit on one line,
     with the bar and count orphaned onto a second one - which is what Bex
     photographed, "15x" sitting alone under "Deep Fried Chicken and Fries".

     So the fix is a deletion, not an addition. The row goes back to the base
     rule, which already does the right thing at 281px: one line, name ellipsed
     if it must be. Only the bar is removed, and only here.

     Why the bar and not the count: the bar is a 50px decoration of a number
     printed immediately beside it, so on a phone it is the one element carrying
     no information of its own. The count stays because "47x" against "3x" is the
     whole reason a top five is worth reading - without it the list is just five
     names in an order nobody can account for. The bar is untouched on a desktop,
     where the space costs nothing. */
  .hm-rank-bar { display: none; }
}

/* v3.7.910: the ingredient lists on the Recipe and Meal views.
   Bex, 2 Nov: "Make ingredients 1 per line." They were two columns written as an
   inline style on the element, so the name wrapped mid-item ("Cream / cheese",
   "Parmesan / cheese") while its amount stayed on the first line, and the two
   columns drifted out of step with each other. An inline grid also cannot be
   overridden by a media query, which is why this needed a class before it could
   be fixed - the same trap as the Tags & Cuisines row.
   Two columns where there is room, one where there is not. */
.mg-ing-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 560px) {
  .mg-ing-grid { grid-template-columns: 1fr; }
}

/* v3.7.911 — the shared side-panel shell (includes/side_panel.php).
   The two panels that existed before this release wrote their own card markup inline,
   with `style="padding:0;overflow:hidden"` on the card and `style="padding:16px"` on the
   body. Those are classes now so every panel in the app agrees without copying a string,
   and so a phone can be given different padding from a desktop in one place. */
/* v3.7.920: two classes, not one. `.mg-sidebar .mg-card { padding: 16px }`
   (line ~3140) is a two-class rule, so the one-class `.mg-side-panel-card`
   below it never won and every component-built panel was drawing the card's
   16px AND the body's 16px - a 32px inset and 16px of dead space under the
   last control. The panels that predate v3.7.911 write their padding inline
   and were never affected, which is why only the new ones looked wrong.
   Matching the old rule class-for-class and sitting later in the file is what
   makes this one apply. */
.mg-sidebar .mg-side-panel-card { padding: 0; overflow: hidden; }
.mg-side-panel-body { padding: 16px; }

/* How far apart stacked tabs sit. One value, used by the slot calculation above. */
:root { --mg-panel-step: 7.5rem; }

@media (max-width: 480px) {
  /* Tighter on a phone: the tabs are longer than the screen is tall once there are two,
     and 16px of padding inside a 375px-wide panel is a lot of the width. */
  :root { --mg-panel-step: 6.5rem; }
  .mg-side-panel-body { padding: 14px; }
}

/* v3.7.911 — the saved-list picker.
   Desktop keeps the column of list buttons it always had. A phone gets a dropdown and
   the New list button directly under it, and the whole card moves to the top of the tab.
   Bex, 2 Nov: "move it to the top and have the existing lists display as a dropdown
   instead of a huge list" — and, on making it a side tab instead: "what's the point in
   having the side tab for just 1 button?" Your Lists is the tab's primary content, so it
   stays on the page. */
.al-list-select { display: none; }

@media (max-width: 560px) {
  .al-list-select {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--dark);
    font-size: var(--fs-body);
    font-family: inherit;
    min-height: 44px;          /* a finger, not a cursor */
  }
  .al-lists { display: none; }           /* the dropdown IS the list here */
  .al-side { order: -1; }                /* Your Lists first, then the editor */
  .al-side-foot { padding-top: 10px; }
}

/* v3.7.911 — Prep & Freeze list picker, the same treatment as Autofill. */
.pf-list-select { display: none; }

@media (max-width: 560px) {
  .pf-list-select {
    display: block;
    width: calc(100% - 28px);
    margin: 12px 14px 0;
    padding: 10px 12px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--dark);
    font-size: var(--fs-body);
    font-family: inherit;
    min-height: 44px;
  }
  /* The buttons are the dropdown's desktop form — only the New list button stays. */
  .pf-lists-body .pf-list-pick { display: none; }
  /* v3.7.913 — #4. Bex: "'your lists' card should be the first one on the page".
     The order: -1 below already existed and already worked, but only INSIDE
     .pf-side: it put Your lists above Shopping for this list, and both of them
     below the whole working area. On a phone that meant scrolling past "We
     cooked it" to reach the control that chooses which list you are looking at -
     the picker underneath the thing it picks.

     display: contents dissolves .pf-side as a box, so its two cards become
     direct children of .pf-wrap (already a column here) and the order rule can
     finally reach the whole page. Nothing moves in the HTML, so the tour
     anchors, the JavaScript and the tab order are all untouched - this is purely
     where the boxes are drawn.

     The result is Your lists, then the working area, then Shopping for this
     list, because Shopping keeps the default order and .pf-main precedes it in
     source. That is the order Bex asked for and leaves Shopping where it was
     relative to the list it totals up.

     .pf-side only ever supplied flex and a 16px gap - no background, border or
     padding - so there is nothing to lose by dissolving it; the children simply
     take .pf-wrap's 20px gap instead.                                        */
  .pf-side  { display: contents; }
  .pf-lists { order: -1; }
}

/* ===================================================================
   v3.7.912 — the mobile carousel (#2, #4)
   ===================================================================
   Bex, 2 Nov, twice: the dashboard stat cards as "1 box with a swipe to see other
   stats. Maybe add <> arrows so people know to swipe", and the week row as "individual
   day boxes bigger, maybe only showing 1 with a <> arrow swipe indicator aswell".

   Both are already horizontal scrollers, so this adds snap points and a page width
   rather than a new widget. The arrows come from the shared behaviour in app_footer.php.
   Tablet shows three days at a time — Bex looked at one and said "try 3". */

.mg-car-nav {
  display: none;                 /* desktop pages through nothing */
  gap: 8px;
  justify-content: center;
  padding: 2px 0 12px;
}
.mg-car-btn {
  width: 44px; height: 44px;     /* a finger, not a cursor */
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--dark);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.mg-car-btn:disabled { opacity: .35; cursor: default; }
.mg-car-btn:focus-visible { outline: 2px solid var(--terra-ink); outline-offset: 2px; }

@media (max-width: 1024px) {
  .mg-car-nav { display: flex; }

  /* The week row: whole days, snapped, so a swipe lands on a day rather than between
     two of them. Three across a tablet, one on a phone. */
  .hm-days { scroll-snap-type: x mandatory; scroll-padding-left: 14px; }
  .hm-days > .hm-day { scroll-snap-align: start; flex: 0 0 calc((100% - 48px) / 3); }
}

@media (max-width: 560px) {
  .hm-days > .hm-day { flex: 0 0 calc(100% - 28px); }

  /* NOTHING HERE FOR THE STAT CARDS, deliberately.
     They were ALREADY a snap carousel: see the @media (max-width: 767px) block on
     .home-stat-grid earlier in this file — flex, overflow-x:auto, scroll-snap, a
     `margin: 0 -24px` full-bleed with 24px of padding back, and cards at 75vw capped at
     300px. Bex's #2 was "1 box with a swipe to see other stats. Maybe add <> arrows so
     people know to swipe": the swipe existed, the arrows did not.
     The first version of this release added a second set of rules at a different
     breakpoint (560 vs 767) with a different flex basis and no full-bleed margin. The
     two fought, and the cards lost their 24px gutter - caught by the gutter probe added
     in v3.7.910. Deleted rather than reconciled: data-mg-carousel supplies the arrows,
     the existing block keeps doing the layout it already did correctly. */
}

/* ===================================================================
   v3.7.912 — swipe-to-reveal row actions on the Cookbook (#16)
   ===================================================================
   Measured at 375 in v3.7.909: edit, duplicate and delete take about 132px of a 375px
   row, plus the thumbnail, leaving the name roughly a third of the width — "Aiden…",
   "BBQ Chicke…". Two lines helped in v3.7.910; the width is the real problem.

   Bex, 2 Nov: "I like the swipe idea! Maybe all 3 can go in there… we're just have to
   somehow indicate that there are options on swipe", and then, on the affordance:
   "I like your suggestion, we're go with that" — a permanent chevron so it never
   disappears, plus a one-time nudge so the gesture is taught rather than guessed.

   Built as a scroll-snap track rather than drag handlers: a native scroller already
   knows about momentum, rubber-banding, right-to-left locales and a trackpad, and it
   keeps working with JavaScript off. The buttons stay in the DOM in their original
   order, so tab order and screen readers are unchanged — they are simply off to one
   side until you ask for them.                                                      */

/* Everywhere except the mobile list view, the wrapper does not exist as far as layout
   is concerned. This is what keeps the card grid and the whole desktop untouched. */
.item-card-swipe { display: contents; }

@media (max-width: 560px) {
  :where(body.pg-cookbook) .item-grid.list-view .item-card-swipe {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    flex: 1 1 auto;
  }
  :where(body.pg-cookbook) .item-grid.list-view .item-card-swipe::-webkit-scrollbar { display: none; }

  /* Pane one: the name and its details, the full width of the row. */
  :where(body.pg-cookbook) .item-grid.list-view .item-card-swipe > .item-card-body {
    flex: 0 0 100%;
    scroll-snap-align: start;
    min-width: 0;
    padding-right: 26px;        /* room for the chevron, so text never sits under it */
  }

  /* Pane two: the three actions, revealed by swiping. */
  :where(body.pg-cookbook) .item-grid.list-view .item-card-swipe > .item-card-actions {
    flex: 0 0 auto;
    scroll-snap-align: end;
    align-items: center;
    padding-right: 12px;
    gap: 8px;
  }
  :where(body.pg-cookbook) .item-grid.list-view .item-card-action-btn {
    width: 44px; height: 44px;   /* a finger, now that there is room for one */
  }

  /* The affordance: a chevron pinned to the right edge of the row, outside the track so
     scrolling does not carry it away. Not a button — pointer-events are off, so it never
     competes with the card's own tap. */
  :where(body.pg-cookbook) .item-grid.list-view .item-card { position: relative; }
  :where(body.pg-cookbook) .item-grid.list-view .item-card::after {
    content: "\f054";                      /* fa-chevron-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--muted);
    opacity: .55;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  /* Once a row is open, the chevron has said what it had to say. */
  :where(body.pg-cookbook) .item-grid.list-view .item-card.is-swiped::after { opacity: 0; }

  /* The one-time nudge: the first row slides open and settles, once. Reduced-motion
     users get nothing moving — the chevron is still there, which is why the affordance
     is not the animation. */
  @media (prefers-reduced-motion: no-preference) {
    :where(body.pg-cookbook) .item-grid.list-view .item-card.mg-nudge .item-card-swipe {
      animation: mgSwipeNudge 1.25s ease-in-out 1;
    }
  }
}

@keyframes mgSwipeNudge {
  0%   { transform: translateX(0); }
  30%  { transform: translateX(-26px); }
  60%  { transform: translateX(-26px); }
  100% { transform: translateX(0); }
}

/* ── On/off switch (v3.7.921) ──────────────────────────────────────────────
   A real <input type="checkbox"> wearing a switch. Built as a component rather
   than inline on the one setting that needed it, because the app had no on/off
   control at all before this - every boolean was a bare checkbox - and the next
   one should not invent a second look.

   It carries the word On or Off as well as the knob position. A knob alone
   states that something is switchable without saying which way it currently
   sits, which is the complaint that produced this.

   The input stays in the DOM and keeps working: it is the thing the form posts,
   the thing a screen reader announces, and the thing the space bar toggles.
   Opacity rather than display:none, so focus is never moved off-screen. */
.mg-switch {
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
  padding: .55rem .2rem;
  user-select: none;
}
.mg-switch > input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 44px;
  height: 26px;
  margin: 0;
  cursor: pointer;
}
.mg-switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-sunken, #e6e2d8);
  border: 1px solid var(--line, rgba(61,35,20,.18));
  transition: background .18s ease, border-color .18s ease;
}
.mg-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.28);
  transition: transform .18s cubic-bezier(.4,0,.2,1);
}
.mg-switch > input:checked ~ .mg-switch-track {
  background: var(--terra);
  border-color: var(--terra);
}
.mg-switch > input:checked ~ .mg-switch-track .mg-switch-knob { transform: translateX(18px); }
.mg-switch > input:focus-visible ~ .mg-switch-track {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}
.mg-switch-text { font-weight: 600; color: var(--body-color); }
/* The state word. Decorative only - aria-hidden on the element - because the
   checkbox already tells assistive tech whether it is checked. */
.mg-switch-state {
  margin-left: auto;
  font-size: var(--fs-meta);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mg-text-muted, #9A7868);
  min-width: 2.2em;
  text-align: right;
}
.mg-switch-state::after { content: 'Off'; }
.mg-switch > input:checked ~ .mg-switch-state { color: var(--terra-ink, var(--terra)); }
.mg-switch > input:checked ~ .mg-switch-state::after { content: 'On'; }
@media (prefers-reduced-motion: reduce) {
  .mg-switch-track, .mg-switch-knob { transition: none; }
}

/* ==========================================================================
   Legal pages — Privacy, Terms                              (v3.7.925)
   --------------------------------------------------------------------------
   These used to render in a stand-alone shell (includes/public_page.php) with
   no navigation at all: a reader who arrived from the footer could only go back.
   They now sit inside the real chrome — app header/footer when signed in,
   public header/footer when not — so this block only has to style the article
   itself, not the page furniture around it.

   .lg-content holds HTML written by a SuperAdmin in Kitchen, so every element
   the editor's toolbar can produce needs a rule here. Anything unstyled falls
   back to the browser default and looks like a 1998 word processor.
   ========================================================================== */
.lg-wrap {
  max-width: var(--lg-max, 860px);
  margin: 0 auto;
  padding: 32px 20px 64px;
  animation: lg-enter .4s ease-out both;
  position: relative;          /* above the Grid Walker canvas, which is z-index 0 */
  z-index: 1;
}
@keyframes lg-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lg-wrap { animation: none; } }

.lg-card {
  padding: 32px;
  /* v3.7.926: the Grid Walker now runs behind the public pages, and .mg-card is
     rgba(255,255,255,.75). That reads fine on a small member card; behind several
     hundred words of policy text it is a busy backdrop to read through. A reading
     surface gets opacity — the grid still frames the page around it. */
  background: var(--surface-card-solid, #fff);
}
.lg-title { margin-bottom: 6px; }
.lg-updated { margin-bottom: 24px; }

.lg-content { line-height: 1.8; }
.lg-content h2,
.lg-content h3,
.lg-content h4 { margin: 1.4em 0 .5em; line-height: 1.3; }
.lg-content h2 { font-size: var(--fs-section, 1.35rem); }
.lg-content h3 { font-size: var(--fs-card-title, 1.1rem); }
.lg-content p,
.lg-content li { font-size: var(--fs-body); }
.lg-content p { margin-bottom: .9em; }
.lg-content ul,
.lg-content ol { padding-left: 1.4em; margin-bottom: .9em; }
.lg-content li { margin-bottom: .35em; }
.lg-content a { color: var(--terra-ink, var(--terra)); text-decoration: underline; }
.lg-content a:hover { color: var(--terra-hover); }
.lg-content strong { font-weight: 700; }
.lg-content blockquote {
  margin: 1.2em 0;
  padding: .6em 1em;
  border-left: 3px solid var(--terra-tint, var(--rule));
  background: var(--mg-surface-2, rgba(0,0,0,.02));
  border-radius: 0 8px 8px 0;
}
.lg-content hr { border: 0; border-top: 1px solid var(--rule); margin: 1.6em 0; }
/* A pasted-in table should not blow the card open on a phone. */
.lg-content table { width: 100%; border-collapse: collapse; margin-bottom: 1em; display: block; overflow-x: auto; }
.lg-content th,
.lg-content td { border: 1px solid var(--rule); padding: .5em .7em; text-align: left; }

/* Nothing written yet. A SuperAdmin sees this and knows where to go. */
.lg-empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.lg-empty i { font-size: 2rem; opacity: .35; display: block; margin-bottom: 12px; }

.lg-foot { text-align: center; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--rule); }
.lg-foot a { color: var(--muted); text-decoration: none; }
.lg-foot a:hover { color: var(--terra-ink, var(--terra)); }
.lg-foot a.lg-here { color: var(--terra-ink, var(--terra)); font-weight: 600; }
.lg-foot span { margin: 0 .5em; color: var(--rule); }

@media (max-width: 600px) {
  .lg-wrap { padding: 20px 14px 48px; }
  .lg-card { padding: 20px; }
}

/* ==========================================================================
   Auth pages with public chrome + the community invite        (v3.7.925)
   --------------------------------------------------------------------------
   The auth pages used to be sealed: no nav, no footer, no way to the free
   community that is the app's best advertisement. They now carry the public
   nav and footer, which means .auth-page can no longer be a 100vh centring
   box - there is a nav above it and a tall footer below.
   ========================================================================== */
.auth-page.auth-has-chrome {
  min-height: 0;                 /* the nav and footer own their share now */
  align-items: flex-start;
  padding: 40px 16px 64px;
}

/* The sign-in card and the invite, side by side. */
.auth-duo {
  display: flex;
  justify-content: center;
  /* v3.7.929: stretch again. v3.7.925 used flex-start because a short vertical list
     left a slab of empty white under the button; the 2x2 grid fills the card and the
     button pins to the bottom, so matching heights now looks deliberate rather than
     padded. Bex: "can you make the boxes the same size?"
     NOTE: nothing in here may set an explicit height on .lv-card. align-items:stretch
     only stretches an item whose height is auto, so a well-meaning `height:100%`
     silently cancels this - which is exactly what the first mock-up of this did. */
  align-items: stretch;
  gap: 24px;
  width: 100%;
  flex-wrap: wrap;
}
.auth-duo-pair { max-width: 880px; margin: 0 auto; }
.auth-duo .auth-card { flex: 1 1 400px; max-width: 440px; }
.auth-duo .auth-aside { flex: 1 1 340px; max-width: 400px; }

/* ── The invite card ────────────────────────────────────────────────────── */
.lv-card {
  display: flex;
  flex-direction: column;
  /* v3.7.929 - Bex: "please center everything in the card". */
  align-items: center;
  text-align: center;
  background: var(--surface-card-solid);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 8px 40px rgba(61,35,20,.08);
  animation: lv-enter .5s .1s ease-out both;
}
@keyframes lv-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lv-card { animation: none; } }

.lv-badge {
  align-self: center;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; margin-bottom: 14px;
  border-radius: 999px;
  background: var(--terra-tint, rgba(138,171,106,.18));
  color: var(--terra-dark, var(--terra-ink));
  font-size: var(--fs-meta); font-weight: 700;
  letter-spacing: .02em;
}
.lv-heading {
  font-family: var(--tx-page-title-font);
  font-size: calc(var(--fs-page-title) * .78);
  color: var(--tx-page-title-color);
  margin: 0 0 10px;
  line-height: 1.2;
}
.lv-body { font-size: var(--fs-small); color: var(--muted); line-height: 1.65; }
.lv-body p { margin: 0 0 .7em; }
.lv-body p:last-child { margin-bottom: 0; }

/* ── The live recipe strip ──────────────────────────────────────────────── */
/* v3.7.929: two columns of tiles, not a vertical list. A list down one side of a wide
   card wasted the width and left the photos too small to be appetising, which is the
   entire job of this strip. Bex: "maybe use a grid for the recipe blocks instead of a
   list?" The tile count is kept even by SiteContent::teaserTiles(). */
.lv-strip {
  list-style: none; margin: 18px 0 0; padding: 0; width: 100%;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.lv-item a {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  height: 100%;                      /* tiles in a row match, whatever the title length */
  padding: 0; border-radius: 12px; overflow: hidden;
  background: var(--surface-card-solid, #fff);
  border: 1px solid var(--rule);
  text-decoration: none; color: inherit;
  transition: var(--ease, all .18s ease);
}
.lv-item a:hover {
  border-color: var(--terra-tint, var(--terra));
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm, 0 4px 12px rgba(0,0,0,.07));
}
.lv-thumb {
  flex: 0 0 84px; width: 100%; height: 84px; border-radius: 0;
  background-size: cover; background-position: center;
  background-color: var(--terra-tint, rgba(138,171,106,.2));
  display: flex; align-items: center; justify-content: center;
  color: var(--terra-dark, var(--terra-ink)); opacity: .95;
}
.lv-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 8px 10px 10px; }
.lv-name {
  font-weight: 600; font-size: var(--fs-small); color: var(--body-text);
  line-height: 1.25;
  /* Wraps now rather than truncating - a tile is two lines wide, and "Layered Cream
     Cheese and Salsa Dip" ellipsised to "Layered Cream..." tells a visitor nothing.
     Capped at two lines so one long title cannot push its row taller than the card. */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* v3.7.930: one line carrying cuisine and, when there is one, the save count -
   "Italian - Saved 2x". It replaces .lv-saves, which was shown only when a recipe had
   been saved: a tile for something nobody had saved yet had one less line of text than
   its neighbour inside a tile held to the same height, so the whitespace was visibly
   uneven. Every tile now has exactly one line here, which is why they come out level
   without being forced to. Deliberately muted - the photograph is the argument. */
.lv-facts { font-size: var(--fs-meta); color: var(--muted); }
.lv-facts i { opacity: .8; }
.lv-facts span { opacity: .55; margin: 0 .15em; }   /* the separator dot */

/* Kept: nothing in the app still writes this class, but a cached stylesheet paired with
   newer markup (or the reverse, mid-deploy) should not leave the text unstyled. */
.lv-saves { font-size: var(--fs-meta); color: var(--muted); }

/* auto, so the button sits at the foot of the card now that the heights match. */
.lv-cta { margin-top: auto; width: 100%; text-align: center; }
.lv-strip + .lv-cta { margin-top: 18px; }
.lv-note { font-size: var(--fs-meta); color: var(--muted); text-align: center; margin: 10px 0 0; }

@media (max-width: 860px) {
  /* Stacked: the form comes first, the invite reads as a follow-up. */
  .auth-duo { flex-direction: column; align-items: center; }
  .auth-duo .auth-card,
  .auth-duo .auth-aside { max-width: 440px; width: 100%; }
  .lv-card { padding: 24px 20px; }
}

/* ==========================================================================
   Community recipe: the back control                        (v3.7.927)
   --------------------------------------------------------------------------
   The back link used to be a .mg-subnav-tab sitting beside the recipe's own
   tab, which made the bar read as two peer tabs rather than as "go back" —
   and at rgba(255,255,255,.14) next to a solid white active tab, it was the
   quieter of the two. Bex: "it's really hard to notice... it just feels weird."

   It is now its own control: a button shape rather than a tab shape, pulled to
   the left edge so it reads as leaving rather than as switching.

   Everything here is scoped behind .mg-subnav.has-back. Five other pages use
   .mg-subnav as a genuine tab strip and none of them should feel this.
   ========================================================================== */
.mg-subnav.has-back .mg-subnav-inner { position: relative; }

.mg-subnav-back {
  /* Absolute, so the recipe tab stays centred in the full bar: on a long recipe
     the sticky bar is the only thing still naming what you are reading. */
  position: absolute;
  left: var(--nav-pad, 52px);
  bottom: 10px;                       /* matches .mg-subnav-tabs' padding-top */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .45);
  color: var(--nav-text, #fff);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-small);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s ease, border-color .2s ease;
}
.mg-subnav-back:hover,
.mg-subnav-back:focus-visible {
  background: rgba(255, 255, 255, .3);
  border-color: rgba(255, 255, 255, .75);
}
.mg-subnav-back i { transition: transform .2s ease; }
.mg-subnav-back:hover i { transform: translateX(-3px); }   /* it goes back, so it leans back */
@media (prefers-reduced-motion: reduce) { .mg-subnav-back i { transition: none; } }

@media (max-width: 1024px) { .mg-subnav-back { left: 24px; } }
@media (max-width: 600px) {
  /* The existing rule hides every .mg-subnav-label at this width, which would leave
     this as a bare arrow. The word "Back" is the whole point, so only the tail goes. */
  .mg-back-rest { display: none; }
  .mg-subnav-back { padding: 8px 12px; gap: 6px; }
}

/* --------------------------------------------------------------------------
   Community recipe subnav on a phone                        (v3.7.928)
   --------------------------------------------------------------------------
   At <=600px the existing rule hides every .mg-subnav-label, which reduced the
   recipe's own tab to a lone fork icon: a tab that names nothing, next to a
   back button, on the one screen size with no room to spare. The recipe title
   is already in the hero card directly beneath it.
   Bex: "honestly on the phone we dont really need it, just the back button
   would be fine."

   With the tabs gone the bar has nothing left in normal flow, and the back
   control is absolutely positioned — so it comes back into the flow here and
   gives the bar its height, rather than the bar collapsing to nothing with a
   button floating over the page.
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  .mg-subnav.has-back .mg-subnav-tabs { display: none; }
  .mg-subnav.has-back .mg-subnav-inner { justify-content: flex-start; }
  .mg-subnav.has-back .mg-subnav-back {
    position: static;
    margin: 9px 0;
  }
}
