/* ─────────────────────────────────────────────────────────────────────────────
   AIM (AI Menu) — Calm Editorial Design System CSS
   Fraunces + Inter typography, minimal warm aesthetic, mobile-first
───────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
    --font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-family-serif: "Fraunces", Georgia, "Times New Roman", serif;
    --font-family-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-size-xs:   11px;
    --font-size-s:    13px;
    --font-size-base: 15px;
    --font-size-m:    17px;
    --font-size-l:    22px;
    --font-size-xl:   30px;
    --font-size-2xl:  42px;

    --radius-s:  6px;
    --radius-m:  10px;
    --radius-l:  14px;
    --radius-xl: 20px;
    --radius-pill: 100px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    /* Sage green accent — calm, wellness-oriented */
    --accent:         #7B8E6B;
    --accent-hover:   #6B7E5B;
    --accent-pressed: #5E7050;
    --accent-light:   #f0f3ed;
    --accent-glow:    rgba(123,142,107,0.15);

    /* Neutrals (light mode) — warm cream tones */
    --bg-base:        #ffffff;
    --bg-layer1:      #eae7df;
    --bg-layer2:      #e1ded8;
    --border-color:   rgba(0, 0, 0, 0.08);
    --text-primary:   #2c2c2c;
    --text-secondary: #6b6b6b;
    --text-tertiary:  #9a9a9a;

    --shadow-2: 0 2px 6px rgba(0,0,0,.08);
    --shadow-4: 0 3px 10px rgba(0,0,0,.10);
    --shadow-8: 0 4px 16px rgba(0,0,0,.12);
    --shadow-glow: 0 0 0 3px var(--accent-glow);

    --nav-height: 60px;
    --bottom-nav-height: 68px;
    --content-max-width: 1280px;

    --transition-fast: 0.15s ease;
    --transition-spring: 0.25s ease;
    --transition-smooth: 0.2s ease;
}

/* ── Dark Mode ─────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg-base:        #1a1a18;
    --bg-layer1:      #242422;
    --bg-layer2:      #2e2e2b;
    --border-color:   rgba(255,255,255,0.08);
    --text-primary:   #e8e6e1;
    --text-secondary: #a8a6a1;
    --text-tertiary:  #6e6c68;
    --accent:         #96AC8A;
    --accent-hover:   #A6BA9A;
    --accent-pressed: #88A07C;
    --accent-light:   #2a2e28;
    --accent-glow:    rgba(150,172,138,0.2);
    --shadow-2: 0 1px 3px rgba(0,0,0,.3);
    --shadow-4: 0 2px 8px rgba(0,0,0,.3);
    --shadow-8: 0 4px 16px rgba(0,0,0,.4);
}

/* ── Icon System ───────────────────────────────────────────────────────────── */
.icon { display:inline-block; vertical-align:middle; flex-shrink:0; object-fit:contain; }
.icon-xs  { width:16px; height:16px; }
.icon-sm  { width:20px; height:20px; }
.icon-md  { width:24px; height:24px; }
.icon-lg  { width:32px; height:32px; }
.icon-xl  { width:48px; height:48px; }
.icon-2xl { width:64px; height:64px; }
.icon-hero { width:80px; height:80px; }
/* Dark-mode invert for icons that need it */
[data-theme="dark"] .icon-invert { filter: brightness(0.85) saturate(1.1); }

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: var(--font-size-base);
    color-scheme: light;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-layer1);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: -0.01em;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
    padding-bottom: var(--bottom-nav-height); /* space for mobile bottom nav */
}

@media (min-width: 769px) {
    body { padding-bottom: 0; }
}

a { color: var(--accent-hover); text-decoration: none; transition: color var(--transition-fast); }
a:hover { text-decoration: underline; color: var(--accent-pressed); }
img { max-width: 100%; height: auto; }

/* ── Layout Shell ──────────────────────────────────────────────────────────── */
.app-root { display: flex; flex-direction: column; min-height: 100vh; }

.app-main {
    flex: 1;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-7) var(--space-5);
    width: 100%;
}

/* ── Navigation Bar ────────────────────────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--nav-height);
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.nav-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: var(--content-max-width);
    margin: 0 auto;
    height: 100%;
    padding: 0 var(--space-5);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-m);
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
}

.brand:hover { text-decoration: none; color: var(--accent); }
.brand-icon { font-size: 22px; }

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-left: auto;
}

.nav-links a { text-decoration: none; }

.nav-link {
    padding: 6px 12px;
    border-radius: var(--radius-m);
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-family);
}

.nav-link:hover { background: var(--bg-layer2); color: var(--text-primary); }

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: var(--space-3);
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-m);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: background 0.15s, border-color 0.15s;
}

.theme-toggle-btn:hover { background: var(--bg-layer2); border-color: var(--accent); }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.app-footer {
    border-top: 1px solid var(--border-color);
    padding: var(--space-5);
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--font-size-s);
    background: var(--bg-base);
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 22px;
    border-radius: var(--radius-pill);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.12s ease, box-shadow 0.15s;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; box-shadow: var(--shadow-4); }
.btn:active { transform: scale(0.98); box-shadow: none; transition-duration: 0.08s; }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); color: white; }

.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-light); border-color: var(--accent-hover); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-layer2); color: var(--text-primary); }

.btn-white { background: white; color: var(--accent-hover); }
.btn-white:hover { opacity: 0.92; color: var(--accent-hover); }

.btn-outline-white { background: transparent; color: white; border: 1.5px solid rgba(255,255,255,0.7); }
.btn-outline-white:hover { border-color: white; background: rgba(255,255,255,0.12); color: white; }

.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; color: white; }

.btn-sm { padding: 6px 14px; font-size: var(--font-size-s); }
.btn-lg { padding: 14px 28px; font-size: var(--font-size-m); }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-base);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2);
    padding: var(--space-5);
    transition: box-shadow var(--transition-smooth);
}
.card:hover { box-shadow: var(--shadow-4); }
a.card:hover { text-decoration: none; }
a.card:active { box-shadow: var(--shadow-2); transition-duration: 0.08s; }

.card-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(182px, 1fr)); gap: var(--space-5); }
.card-grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-5); }
.card-grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: var(--space-4); }

/* ── Typography ─────────────────────────────────────────────────────────────── */
.page-title   { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--space-4); letter-spacing: -0.01em; }
.page-subtitle{ font-size: var(--font-size-m); color: var(--text-secondary); margin-bottom: var(--space-6); }
.section-title{ font-family: var(--font-family-serif); font-size: var(--font-size-l); font-weight: 600; margin-bottom: var(--space-4); letter-spacing: -0.01em; }

h1 { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-family: var(--font-family-serif); font-size: var(--font-size-l); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-family: var(--font-family-serif); font-size: var(--font-size-m); font-weight: 500; letter-spacing: 0; }

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
    background: var(--accent);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-7);
    color: white;
    margin-bottom: var(--space-8);
    position: relative;
    overflow: hidden;
}

.hero-content { position: relative; max-width: 600px; }
.hero-headline { font-family: var(--font-family-serif); font-size: var(--font-size-2xl); font-weight: 600; line-height: 1.1; margin-bottom: var(--space-4); letter-spacing: -0.01em; }
.hero-subtext  { font-size: var(--font-size-m); opacity: 0.92; margin-bottom: var(--space-6); line-height: 1.6; }
.hero-actions  { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* ── Tags & Badges ──────────────────────────────────────────────────────────── */
.tag {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent-hover);
    border-radius: var(--radius-pill);
    padding: 5px 14px;
    font-size: var(--font-size-s);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.tag:hover { background: var(--accent); color: white; text-decoration: none; transform: translateY(-1px); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.badge-accent { background: var(--accent); color: white; }
.badge-light  { background: var(--accent-light); color: var(--accent); }
.badge-gray   { background: var(--bg-layer2); color: var(--text-secondary); }
/* Meal-type badges — sage palette (shades of --accent) */
.badge-breakfast { background: #d8e2c7; color: #3d4a2a; }
.badge-lunch     { background: #aabb8b; color: #263220; }
.badge-dinner    { background: #7b8e6b; color: #ffffff; }
.badge-snack     { background: #eaf0e0; color: #5e7050; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-5); }
.form-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-m);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    padding-right: 40px;
    cursor: pointer;
}
[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a8a6a1' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    padding: var(--space-1) 0;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Light mode: give all checkboxes an explicit white background */
html:not([data-theme="dark"]) input[type="checkbox"] {
    background-color: #ffffff;
}

.validation-message { color: #d13438; font-size: var(--font-size-s); margin-top: var(--space-1); }

/* ── Wizard ─────────────────────────────────────────────────────────────────── */
.wizard-container { max-width: 760px; margin: 0 auto; }

.progress-bar-track {
    height: 6px;
    background: var(--bg-layer2);
    border-radius: 3px;
    margin-bottom: var(--space-3);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.step-indicators { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); }

.step-indicator {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-m);
    font-size: var(--font-size-s);
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg-layer2);
    text-align: center;
}

.step-indicator.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.step-indicator.done   { background: var(--accent); color: white; }

/* ── Selectable Cards ───────────────────────────────────────────────────────── */
.selectable-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    cursor: pointer;
    transition: all var(--transition-spring);
    background: var(--bg-base);
    user-select: none;
}

.selectable-card:hover { border-color: var(--accent); background: var(--accent-light); }
.selectable-card.selected { border-color: var(--accent); background: var(--accent-light); }
.selectable-card .card-icon { font-size: 20px; margin-bottom: var(--space-1); }
.selectable-card h3 { font-size: var(--font-size-s); font-weight: 600; margin-bottom: var(--space-1); }
.selectable-card p { font-size: var(--font-size-xs); color: var(--text-secondary); }

/* ── Meal Plan Grid ─────────────────────────────────────────────────────────── */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--space-3);
}

.day-card { background: var(--bg-base); border-radius: var(--radius-xl); box-shadow: var(--shadow-2); overflow: hidden; transition: box-shadow var(--transition-smooth); }
.day-card:hover { box-shadow: var(--shadow-4); }
.day-card-header { background: var(--accent); color: white; padding: var(--space-3) var(--space-4); font-weight: 600; font-size: var(--font-size-s); }

.meal-slot {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.meal-slot:last-child { border-bottom: none; }
.meal-slot-info { flex: 1; }
.meal-slot-name { font-weight: 500; }
.meal-slot-meta { font-size: var(--font-size-xs); color: var(--text-tertiary); margin-top: 2px; }

.swap-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-s);
    padding: 4px 8px;
    font-size: var(--font-size-xs);
    cursor: pointer;
    color: var(--text-secondary);
    font-family: var(--font-family);
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.swap-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Grocery List ───────────────────────────────────────────────────────────── */
.grocery-category { margin-bottom: var(--space-5); }

.grocery-category-title {
    font-size: var(--font-size-s);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--accent-light);
}

.grocery-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-m);
    transition: background 0.1s;
}

.grocery-item:hover { background: var(--bg-layer2); }
.grocery-item.checked { opacity: 0.5; }
.grocery-item.checked .grocery-name { text-decoration: line-through; }

.grocery-item input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.grocery-name { font-size: var(--font-size-base); }
.grocery-qty { font-size: var(--font-size-s); color: var(--text-secondary); margin-left: auto; }

/* ── Recipe Cards ───────────────────────────────────────────────────────────── */
.recipe-card {
    background: var(--bg-base);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2);
    overflow: hidden;
    transition: all var(--transition-spring);
    display: flex;
    flex-direction: column;
}

.recipe-card:hover { box-shadow: var(--shadow-4); }
.recipe-card-body { padding: var(--space-3); flex: 1; }
.recipe-card-footer { padding: var(--space-2) var(--space-3); border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.recipe-card-title { font-family: var(--font-family-serif); font-size: var(--font-size-base); font-weight: 500; margin-bottom: var(--space-1); }
.recipe-card-desc { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.5; margin-bottom: var(--space-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-meta { display: flex; gap: var(--space-3); font-size: var(--font-size-xs); color: var(--text-tertiary); }

/* ── Healing Callout ────────────────────────────────────────────────────────── */
.healing-callout {
    background: var(--accent-light);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius-m) var(--radius-m) 0;
    padding: var(--space-4);
    margin: var(--space-4) 0;
}

.healing-callout-title { font-size: var(--font-size-s); font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--space-2); }

/* ── Auth ───────────────────────────────────────────────────────────────────── */
.auth-container { max-width: 420px; margin: var(--space-7) auto; }
.auth-card { background: var(--bg-base); border-radius: var(--radius-xl); box-shadow: var(--shadow-4); padding: var(--space-7); }
.auth-title { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--space-2); }
.auth-subtitle { color: var(--text-secondary); margin-bottom: var(--space-6); }

/* ── Dashboard ──────────────────────────────────────────────────────────────── */
.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.stat-card { background: var(--bg-base); border-radius: var(--radius-xl); padding: var(--space-3); text-align: center; box-shadow: var(--shadow-2); }
.stat-number { font-size: var(--font-size-l); font-weight: 700; color: var(--accent); }
.stat-label { font-size: var(--font-size-xs); color: var(--text-secondary); margin-top: var(--space-1); }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert { padding: var(--space-4); border-radius: var(--radius-m); margin-bottom: var(--space-4); font-size: var(--font-size-s); }
.alert-success { background: #e8f5ee; color: #0d5c30; border: 1px solid #a8d5b8; }
.alert-error   { background: #fde8e8; color: #8b0000; border: 1px solid #f5a5a5; }
.alert-info    { background: #e5f0ff; color: #003d8f; border: 1px solid #a5c0f5; }
.validation-summary-valid { display: none; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --nav-height: 48px; }
    .app-main { padding: var(--space-4) var(--space-3); }
    .app-header { height: var(--nav-height); }
    .nav-bar { padding: 0 var(--space-3); gap: var(--space-2); }
    .brand-name { font-size: var(--font-size-s); }
    .brand img, .brand svg { height: 24px; }
    .page-header { margin-bottom: var(--space-4); gap: var(--space-2); }
    .page-header h1 { font-size: var(--font-size-l); }
    .page-header p { font-size: var(--font-size-s); margin-top: var(--space-1); }
    .hero { padding: var(--space-4) var(--space-3); }
    .hero-inner { flex-direction: column; text-align: center; }
    .hero-actions { justify-content: center; }
    .hero-image img { max-width: 140px; }
    .hero-headline { font-size: var(--font-size-xl); }
    .card-grid, .card-grid-3, .card-grid-4, .plan-grid { grid-template-columns: 1fr; }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .wizard-container { max-width: 100%; }
    .step-indicators { gap: var(--space-1); }
    .step-indicator { font-size: var(--font-size-xs); padding: var(--space-2); }
    .profile-section-nav { padding: var(--space-2) 0; margin-bottom: var(--space-3); }
    .profile-nav-link { padding: 4px 12px; font-size: var(--font-size-xs); }
    .form-section { margin-bottom: var(--space-4); padding-bottom: var(--space-4); }
    .form-section h2 { font-size: var(--font-size-m); }
    .card { padding: var(--space-3); }
    /* Grocery list mobile */
    .grocery-page { padding: var(--space-3) var(--space-2) 120px; }
    .grocery-hero-title { font-size: 22px; }
    .grocery-hero-cost { font-size: 24px; }
    .grocery-cat-progress { width: 100px; }
    .grocery-item-row { padding: 10px 12px; gap: 10px; }
    .grocery-item-qty { font-size: 10px; }
    .grocery-item-price { font-size: 12px; min-width: 44px; }

    /* Landing page mobile fixes */
    .tag-cloud { gap: var(--space-1); flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; -webkit-overflow-scrolling: touch; touch-action: pan-x; }
    .tag-cloud .tag { font-size: var(--font-size-xs); padding: 4px 10px; flex-shrink: 0; white-space: nowrap; }
    .section { padding: var(--space-5) var(--space-2); }
    .section-alt { padding: var(--space-5) var(--space-2); }
    .steps-grid { grid-template-columns: 1fr; gap: var(--space-3); }
    .step-card { padding: var(--space-3); }
    .goal-card { padding: var(--space-2); }
    .cta-section { padding: var(--space-5) var(--space-2); }
}

@media (max-width: 480px) {
    :root { --nav-height: 44px; }
    .app-main { padding: var(--space-3) var(--space-2); }
    .page-header h1 { font-size: var(--font-size-m); }
    .page-header p { font-size: var(--font-size-xs); }
    .hero-actions { flex-direction: column; }
    .dashboard-stats { grid-template-columns: 1fr; }
    /* Auth / Register mobile */
    .auth-page { padding: var(--space-4) var(--space-3); }
    .auth-card { padding: var(--space-4); }
    .auth-header { margin-bottom: var(--space-4); }
    .auth-icon { font-size: 30px; margin-bottom: var(--space-2); }
    .auth-header h1 { font-size: var(--font-size-m); font-weight: 700; line-height: 1.3; }
    .auth-header p { font-size: var(--font-size-s); }
    .form-group label { font-size: var(--font-size-base); }
    .form-control { font-size: 16px; padding: 11px 14px; } /* 16px prevents iOS zoom */
    .form-hint { font-size: var(--font-size-s); }
    .field-error { font-size: var(--font-size-s); }
    .hero-headline { font-size: var(--font-size-l); }
    h1 { font-size: var(--font-size-l); }
    h2 { font-size: var(--font-size-m); }
    .tag-cloud .tag { font-size: 10px; padding: 3px 8px; }
}

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-tertiary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-center { text-align: center; }

/* ── Navigation bar ──────────────────────────────────────────────────────── */
.site-nav {
    position: sticky; top: 0; z-index: 200;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-color);
}

.nav-inner {
    display: flex; align-items: center; gap: var(--space-3);
    max-width: var(--content-max-width);
    margin: 0 auto; padding: 0 var(--space-5); height: var(--nav-height);
}

.nav-brand {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: var(--font-size-m); font-weight: 700;
    color: var(--text-primary); text-decoration: none; flex-shrink: 0;
}
.nav-brand:hover { color: var(--accent); text-decoration: none; }
.nav-brand-logo { height: 36px; width: auto; display: block; }

.nav-actions {
    display: flex; align-items: center; gap: var(--space-1);
    margin-left: auto;
}

/* Hamburger button — always visible */
.nav-hamburger {
    background: none; border: none; cursor: pointer;
    padding: var(--space-2); display: flex; align-items: center; justify-content: center;
    color: var(--text-primary);
}
.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
    display: block; width: 20px; height: 2px;
    background: currentColor; border-radius: 1px;
    transition: transform 0.25s, opacity 0.25s;
}
.hamburger-icon { position: relative; }
.hamburger-icon::before,
.hamburger-icon::after { content: ''; position: absolute; left: 0; }
.hamburger-icon::before { top: -6px; }
.hamburger-icon::after  { top:  6px; }

/* ── Overlay ────────────────────────────────────────────────────────────── */
.nav-overlay {
    position: fixed; inset: 0; z-index: 299;
    background: rgba(0,0,0,0.4);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

/* ── Slide-out drawer ───────────────────────────────────────────────────── */
.nav-drawer {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 300px; max-width: 85vw; z-index: 300;
    background: var(--bg-base);
    border-right: none;
    box-shadow: 8px 0 40px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex; flex-direction: column;
    overflow-y: auto;
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}
.nav-drawer.open { transform: translateX(0); }

.nav-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}
.nav-drawer-title {
    font-family: var(--font-family-serif); font-size: var(--font-size-m); font-weight: 600; color: var(--text-primary);
}
.nav-drawer-close {
    background: none; border: none; font-size: 24px;
    cursor: pointer; color: var(--text-secondary);
    padding: var(--space-1); line-height: 1;
}
.nav-drawer-close:hover { color: var(--text-primary); }

.nav-drawer-links {
    list-style: none; padding: var(--space-3) 0; margin: 0; flex: 1;
}
.nav-drawer-bottom {
    margin-top: auto; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-color);
}
.nav-drawer-bottom a {
    display: block; text-decoration: none; font-size: var(--font-size-base); font-weight: 500;
    color: var(--text-secondary); transition: color 0.15s;
}
.nav-drawer-bottom a:hover { color: var(--text-primary); text-decoration: none; }
.nav-drawer-links li { margin: 0; }
.nav-drawer-links a,
.nav-drawer-link-btn {
    display: flex; align-items: center; gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-5);
    text-decoration: none; font-size: var(--font-size-base); font-weight: 500;
    color: var(--text-secondary);
    background: none; border: none; text-align: left; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.nav-drawer-links a:hover,
.nav-drawer-link-btn:hover {
    background: var(--bg-layer2); color: var(--text-primary); text-decoration: none;
}
.nav-drawer-links a svg,
.nav-drawer-link-btn svg {
    flex-shrink: 0;
    color: var(--text-tertiary);
}
.nav-drawer-links a:hover svg,
.nav-drawer-link-btn:hover svg {
    color: var(--accent);
}

/* ── User menu dropdown ──────────────────────────────────────────────────── */
.user-menu { position: relative; }
.user-menu-btn {
    background: none; border: 1.5px solid var(--border-color); border-radius: 50%;
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary); transition: border-color 0.15s, color 0.15s;
}
.user-menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.user-icon { flex-shrink: 0; }

.user-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 6px);
    min-width: 160px; background: var(--bg-base);
    border-radius: var(--radius-m);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1); z-index: 250;
    padding: var(--space-2) 0; flex-direction: column;
}
.user-dropdown.open { display: flex; }

.user-dropdown-item {
    display: block; width: 100%; padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-base); font-weight: 500;
    color: var(--text-secondary); text-decoration: none;
    background: none; border: none; text-align: left; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.user-dropdown-item:hover {
    background: var(--bg-layer2); color: var(--text-primary); text-decoration: none;
}

/* ── Buttons (primary/secondary aliases) ─────────────────────────────────── */
.btn-primary  { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; text-decoration: none; }
.btn-secondary { background: transparent; color: var(--accent-hover); border: 1.5px solid var(--accent); }
.btn-secondary:hover { background: var(--accent-light); text-decoration: none; }
.btn-hero-outline { background: transparent; color: white; border: 1.5px solid white; }
.btn-hero-outline:hover { background: rgba(255,255,255,0.15); color: white; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-layer2); color: var(--text-primary); text-decoration: none; }
.btn-icon { padding: 6px 10px; }
.btn-block { width: 100%; display: flex; }
.btn-xs { padding: 3px 8px; font-size: var(--font-size-xs); }
.btn-danger-text { color: var(--error-color, #d32f2f); }
.btn-danger-text:hover { color: #b71c1c; background: rgba(211,47,47,0.08); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border-color); padding: var(--space-5);
    text-align: center; color: var(--text-tertiary);
    font-size: var(--font-size-s); background: var(--bg-base);
}

/* ── Layout helpers ──────────────────────────────────────────────────────── */
.container { max-width: var(--content-max-width); margin: 0 auto; padding: 0 var(--space-5); }
main { max-width: var(--content-max-width); margin: 0 auto; padding: var(--space-5) var(--space-5) var(--space-6); }
.page-container { max-width: var(--content-max-width); margin: 0 auto; padding: 0 var(--space-5); }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-6); }
.page-header h1 { margin: 0; }
.page-header p { color: var(--text-secondary); margin: var(--space-2) 0 0; }
.page-header-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }

/* ── Hero (view aliases) ─────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 50%, var(--accent-pressed) 100%);
    border-radius: var(--radius-xl); padding: var(--space-6) var(--space-6); color: white;
    margin-bottom: var(--space-5); overflow: hidden; position: relative;
}
.hero::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(circle at 85% 20%, rgba(255,255,255,0.10) 0%, transparent 45%),
        radial-gradient(circle at 10% 85%, rgba(0,0,0,0.06) 0%, transparent 40%);
}
.hero::after {
    content: '\1F33F'; position: absolute; right: -20px; bottom: -20px;
    font-size: 180px; opacity: 0.06; pointer-events: none; line-height: 1;
    transform: rotate(-15deg);
}
.hero-inner { display: flex; align-items: center; gap: var(--space-5); }
.hero-content { max-width: 640px; flex: 1; }
.hero-badge { display: inline-block; background: rgba(255,255,255,0.2); border-radius: 100px; padding: 4px 14px; font-size: var(--font-size-s); margin-bottom: var(--space-4); }
.hero-title { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; line-height: 1.1; margin-bottom: var(--space-3); }
.hero-subtitle { font-size: var(--font-size-base); opacity: 0.92; margin-bottom: var(--space-4); line-height: 1.5; }
.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.hero-image { flex-shrink: 0; }
.hero-image img { max-width: 160px; height: auto; border-radius: var(--radius-l); filter: drop-shadow(0 4px 24px rgba(0,0,0,0.2)); }

/* ── Sections ────────────────────────────────────────────────────────────── */
.section { padding: var(--space-6) 0; }
.section-alt { background: var(--bg-layer1); }
.section-title { font-family: var(--font-family-serif); font-size: var(--font-size-l); font-weight: 600; margin-bottom: var(--space-4); text-align: center; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.section-actions { display: flex; gap: var(--space-3); }

/* Steps */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(154px, 1fr)); gap: var(--space-4); }
.step-card { text-align: center; padding: var(--space-3); }
.step-number { width: 44px; height: 44px; background: var(--accent); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: var(--font-size-m); font-weight: 700; margin: 0 auto var(--space-4); }
.step-card h3 { margin-bottom: var(--space-3); }
.step-card p { color: var(--text-secondary); font-size: var(--font-size-s); line-height: 1.6; }

/* Goal cards */
.goal-card { text-align: center; padding: var(--space-3); }
.goal-icon { font-size: 32px; margin-bottom: var(--space-3); }
.goal-card h3 { margin-bottom: var(--space-2); }
.goal-card p { color: var(--text-secondary); font-size: var(--font-size-s); }

/* Tags */
.tag-condition { background: var(--accent-light); color: var(--accent-pressed); }
.tag-more { background: var(--bg-layer2); color: var(--text-secondary); }
.tag-food { background: var(--accent-light); color: var(--accent); }
.tag-warning { background: #fff4e5; color: #b85c00; }
.tag-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Badges */
.badge-goal      { background: var(--accent); color: #ffffff; }
.badge-condition { background: var(--accent-light); color: var(--accent); }
.badge-diet      { background: var(--bg-layer2); color: var(--text-secondary); font-size: var(--font-size-xs); padding: 2px 8px; border-radius: 100px; }
.badge-primary-food { background: var(--accent); color: white; }

/* CTA */
.cta-section { padding: var(--space-6) 0; }
.cta-section h2 { margin-bottom: var(--space-3); }
.cta-section p { color: var(--text-secondary); margin-bottom: var(--space-5); }

/* Empty states */
.empty-state { text-align: center; padding: var(--space-8); }
.empty-icon { font-size: 48px; margin-bottom: var(--space-4); }
.empty-state h2 { margin-bottom: var(--space-3); }
.empty-state p { color: var(--text-secondary); margin-bottom: var(--space-5); }

/* ── Auth page ───────────────────────────────────────────────────────────── */
.auth-page { display: flex; align-items: flex-start; justify-content: center; padding: var(--space-7) var(--space-4); }
.auth-card { max-width: 420px; width: 100%; }
.auth-header { text-align: left; margin-bottom: var(--space-6); }
.auth-icon { font-size: 40px; margin-bottom: var(--space-3); }
.auth-header h1 { font-family: var(--font-family-serif); font-weight: 500; margin-bottom: var(--space-2); }
.auth-header p { color: var(--text-secondary); }
.auth-footer-text { text-align: center; margin-top: var(--space-5); font-size: var(--font-size-s); color: var(--text-secondary); }

/* 3-column measurements row: ft / in / lbs */
.register-measurements-row { grid-template-columns: 1fr 1fr 1.4fr; }
@media (max-width: 360px) {
    .register-measurements-row { grid-template-columns: 1fr 1fr; }
    .register-measurements-row .form-group:last-child { grid-column: 1 / -1; }
}

/* ── Forms (view-layer aliases) ──────────────────────────────────────────── */
.form-control {
    width: 100%; padding: 12px 16px;
    border: 1px solid var(--border-color); border-radius: var(--radius-m);
    background: var(--bg-base); color: var(--text-primary);
    font-size: var(--font-size-base); font-family: var(--font-family);
    transition: border-color var(--transition-fast);
}
.form-control:focus { outline: none; border-color: var(--accent); }
.form-control:disabled { opacity: 0.6; cursor: not-allowed; }

/* Select dropdowns */
select.form-control,
select.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    padding-right: 40px;
    cursor: pointer;
}
select.form-control:focus,
select.form-select:focus {
    border-color: var(--accent);
}
[data-theme="dark"] select.form-control,
[data-theme="dark"] select.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a8a6a1' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-group { margin-bottom: var(--space-4); }
.form-group label { display: block; font-size: var(--font-size-xs); font-weight: 600; margin-bottom: var(--space-2); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); }
.form-check { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.form-hint { font-size: var(--font-size-s); color: var(--text-secondary); margin-bottom: var(--space-3); }
.form-section { margin-bottom: var(--space-6); padding-bottom: var(--space-6); border-bottom: 1px solid var(--border-color); }
.form-section:last-child { border-bottom: none; }
.form-section h2 { margin-bottom: var(--space-3); }
.form-actions { display: flex; gap: var(--space-3); padding-top: var(--space-4); }
.form-card { margin-bottom: var(--space-4); }
.field-error { display: block; color: #d13438; font-size: var(--font-size-xs); margin-top: 4px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.checkbox-label { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; padding: 6px 14px; border: 1.5px solid var(--border-color); border-radius: 100px; font-size: var(--font-size-s); transition: border-color 0.15s, background 0.15s; }
.checkbox-label:has(input:checked) { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.checkbox-label input[type="checkbox"] { accent-color: var(--accent); }
.checkbox-label-lg { border-radius: var(--radius-m); padding: 10px 16px; font-size: var(--font-size-base); }

/* ── Wizard ──────────────────────────────────────────────────────────────── */
.wizard-progress { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); }
.wizard-step { flex: 1; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-m); font-size: var(--font-size-s); font-weight: 500; color: var(--text-tertiary); background: var(--bg-layer2); }
.wizard-step span { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-layer2); border: 2px solid var(--border-color); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.wizard-step.active { background: var(--accent-light); color: var(--accent); }
.wizard-step.active span { background: var(--accent); color: white; border-color: var(--accent); }
.wizard-step.done { background: var(--accent); color: white; }
.wizard-step.done span { background: white; color: var(--accent); border-color: white; }
.wizard-actions { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-6); }

.plan-type-tabs { display: flex; gap: var(--space-3); margin-bottom: var(--space-6); }
.tab-type-btn { flex: 1; padding: var(--space-4) var(--space-3); border: 2px solid var(--border-color); border-radius: var(--radius-l); background: var(--bg-base); font-size: var(--font-size-base); font-weight: 600; cursor: pointer; color: var(--text-secondary); font-family: var(--font-family); transition: all 0.15s; }
.tab-type-btn:hover { border-color: var(--accent); color: var(--accent); }
.tab-type-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

[data-plan-panel] { display: none; }
[data-plan-panel].active { display: block; }

.panel-title { font-size: var(--font-size-m); font-weight: 600; margin-bottom: var(--space-4); }
.condition-group { margin-bottom: var(--space-6); }
.condition-group-title { font-size: var(--font-size-s); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); margin-bottom: var(--space-3); }

.selectable-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--space-2); }
.selectable-card input[type="checkbox"] { display: none; }
.selectable-card-content { pointer-events: none; }
.selectable-icon { font-size: 26px; margin-bottom: var(--space-2); }
.selectable-name { font-size: var(--font-size-base); font-weight: 600; }
.selectable-desc { font-size: var(--font-size-xs); color: var(--text-secondary); margin-top: 4px; }

.review-card { margin-bottom: var(--space-5); }
.review-row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.review-row:last-child { border-bottom: none; }
.review-label { font-size: var(--font-size-s); font-weight: 600; color: var(--text-secondary); min-width: 140px; }

/* ── Meal Plan View ──────────────────────────────────────────────────────── */
.plan-week-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--space-3); }
.plan-day-card { overflow: hidden; }
.plan-day-card.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--shadow-4); }
.plan-day-header { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--bg-layer2); border-bottom: 1px solid var(--border-color); }
.plan-day-card.today .plan-day-header { background: var(--accent); color: white; }
.plan-day-name { font-weight: 700; font-size: var(--font-size-m); }
.plan-day-date { font-size: var(--font-size-s); color: var(--text-secondary); flex: 1; }
.plan-day-card.today .plan-day-date { color: rgba(255,255,255,0.8); }
.today-badge { font-size: var(--font-size-xs); background: white; color: var(--accent); padding: 2px 8px; border-radius: 100px; font-weight: 700; }
.plan-meal { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-color); }
.plan-meal:last-child { border-bottom: none; }
.plan-meal-type { font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.plan-meal-name { font-size: var(--font-size-s); font-weight: 500; display: block; color: var(--accent); margin-bottom: 4px; }
.plan-meal-name:hover { text-decoration: underline; }
.plan-meal-meta { font-size: var(--font-size-xs); color: var(--text-tertiary); }
.plan-meta { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.swap-form { margin-top: 4px; }

/* ── Calendar Views ────────────────────────────────────────────────────── */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-4); }
.cal-tabs {
    display: flex;
    background: rgba(107,122,90,0.10);
    border: none;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.cal-tab {
    flex: 1;
    height: 30px;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: #4D5A3E;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: background .15s, color .15s, box-shadow .15s;
}
.cal-tab:hover { background: rgba(255,255,255,0.5); }
.cal-tab.active {
    background: #fff;
    color: #2B2E25;
    box-shadow: 0 1px 2px rgba(45,58,30,0.1);
}
.cal-nav { display: flex; align-items: center; gap: var(--space-2); }
.cal-title { font-weight: 700; font-size: var(--font-size-m); min-width: 200px; text-align: center; }
.cal-prev, .cal-next { font-size: 1.4rem; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-m); }

/* Month grid */
.cal-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border-color); border-radius: var(--radius-l); overflow: hidden; }
.cal-month-hdr { padding: var(--space-2) var(--space-1); text-align: center; font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); background: var(--bg-layer2); border-bottom: 1px solid var(--border-color); }
.cal-month-cell { min-height: 100px; padding: var(--space-1); border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); background: var(--bg-base); position: relative; transition: background .15s; overflow: hidden; }
.cal-month-cell:nth-child(7n) { border-right: none; }
.cal-month-cell.cal-outside { background: var(--bg-layer1); }
.cal-month-cell.cal-in-plan { background: var(--accent-light); }
.cal-month-cell.cal-has-meals:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-month-cell.cal-today { background: var(--accent-light); }
.cal-month-date { font-size: var(--font-size-s); font-weight: 600; padding: 2px 6px; }
.cal-today-num { background: var(--accent); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; font-size: var(--font-size-s); }
.cal-legend { display: flex; gap: var(--space-4); padding: var(--space-3) 0; font-size: var(--font-size-s); color: var(--text-secondary); }
.cal-legend-item { display: flex; align-items: center; gap: var(--space-1); }
.cal-legend-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; }

/* Week grid */
.cal-week-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cal-week-grid { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 0; border: 1px solid var(--border-color); border-radius: var(--radius-l); overflow: hidden; min-width: min-content; }
.cal-week-col { border-right: 1px solid var(--border-color); background: var(--bg-base); min-height: 260px; display: flex; flex-direction: column; }
.cal-week-col:last-child { border-right: none; }
.cal-week-col.cal-in-plan { background: var(--accent-light); }
.cal-week-col.cal-today .cal-week-hdr { background: var(--accent); color: #fff; }
.cal-week-hdr { text-align: center; padding: var(--space-2) var(--space-1); font-size: var(--font-size-s); font-weight: 700; background: var(--bg-layer2); border-bottom: 1px solid var(--border-color); }
.cal-week-date { font-size: var(--font-size-l); font-weight: 700; }
.cal-week-hdr .cal-today-num { background: transparent; color: inherit; width: auto; height: auto; border-radius: 0; display: inline; font-size: inherit; font-weight: inherit; }
.cal-week-body { padding: var(--space-2); flex: 1; display: grid; gap: var(--space-2); min-height: 0; }
.cal-week-slot { display: flex; min-height: 0; }
.cal-week-slot > .cal-meal-card { margin-bottom: 0 !important; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.cal-week-slot > .cal-meal-card > a { display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-week-slot > .cal-meal-card .cal-meal-actions { margin-top: auto !important; }
.cal-week-empty { flex: 1; display: flex; align-items: center; justify-content: center; font-size: var(--font-size-xs); color: var(--text-tertiary); border: 1px dashed var(--border-color); border-radius: var(--radius-m); background: rgba(0,0,0,0.015); }
.cal-week-footer { padding: var(--space-2); font-size: var(--font-size-xs); color: var(--text-tertiary); text-align: center; border-top: 1px solid var(--border-color); min-height: 28px; }
.cal-meal-remove { padding: 2px 6px !important; line-height: 1 !important; font-size: 14px !important; }

/* ── Meal plan labelled action tiles (Grocery · Day prep · New plan) ──── */
.mp-actions-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.mp-action-tile {
    flex: 1 1 0;
    min-width: 0;
    display: flex; flex-direction: column; align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 14px;
    color: #2B2E25;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, color .15s, border-color .15s;
}
.mp-action-tile:hover { background: rgba(107,122,90,0.05); text-decoration: none; color: #2B2E25; }
.mp-action-icon {
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #4D5A3E;
}
.mp-action-icon svg { width: 18px; height: 18px; display: block; }
.mp-action-label {
    font-size: 10.5px; font-weight: 600;
    color: inherit;
    letter-spacing: 0.1px;
}
.mp-action-tile-primary {
    background: #6B7A5A;
    border-color: #6B7A5A;
    color: #fff;
}
.mp-action-tile-primary:hover {
    background: #5B6A4A;
    border-color: #5B6A4A;
    color: #fff;
}
.mp-action-tile-primary .mp-action-icon { color: #fff; }

/* ── School-lunches row card (spec: single row under day view) ─────────── */
.mp-lunchbox-row {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 14px;
}
.mp-lunchbox-icon {
    width: 32px; height: 32px; border-radius: 10px;
    background: rgba(107,122,90,0.12);
    color: #4D5A3E;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.mp-lunchbox-text { flex: 1; min-width: 0; }
.mp-lunchbox-title {
    font-family: var(--font-family-display);
    font-size: 13px; font-weight: 700;
    color: #2B2E25;
}
.mp-lunchbox-sub {
    font-size: 11px; color: #8A8E7B;
    margin-top: 1px;
}
.mp-lunchbox-btn {
    height: 30px; padding: 0 12px;
    border-radius: 999px;
    background: #6B7A5A; color: #fff;
    border: none; text-decoration: none;
    font-size: 11px; font-weight: 700;
    white-space: nowrap; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.mp-lunchbox-btn:hover { background: #5B6A4A; color: #fff; text-decoration: none; }

/* ── Meal plan hero (compact, especially on mobile) ─────────────────────── */
.mealplan-hero { flex-direction: column; gap: var(--space-3); }
.mealplan-hero h1 {
    font-family: var(--font-family-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #2B2E25;
    margin: 0;
}
.mealplan-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mp-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #4D5A3E;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.mp-icon-btn:hover { background: rgba(107,122,90,0.10); color: #2B2E25; }
.mp-icon-btn svg { width: 20px; height: 20px; display: block; }
.mp-icon-btn-end { margin-left: auto; }
.mealplan-hero .mealplan-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: #8A8E7B; }
.mealplan-hero .mealplan-meta > * { white-space: nowrap; }
.mealplan-hero .mealplan-meta-sep { color: #8A8E7B; }
.mealplan-hero .mealplan-meta .badge {
    font-size: 11px; font-weight: 600; color: #4D5A3E;
    background: rgba(107,122,90,0.12);
    padding: 3px 10px; border-radius: 999px;
    letter-spacing: 0.2px;
}
.mealplan-hero .mealplan-meta-cost { margin-left: auto; font-size: 12px; color: #8A8E7B; }
.mealplan-hero .mealplan-meta-cost strong { color: #2B2E25; font-weight: 600; }

/* Meal plan hero — mobile: compact top + 3-col meta row */
@media (max-width: 640px) {
    .mealplan-page .page-hero { padding-top: var(--space-2); padding-bottom: var(--space-2); margin-bottom: var(--space-3); }
    .mealplan-page .mealplan-hero { gap: var(--space-2); }
    .mealplan-page .mealplan-hero h1 { font-size: 22px; letter-spacing: -0.3px; }
    .mealplan-page .mealplan-hero .mealplan-meta {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 4px 10px;
        align-items: center;
        margin-top: 6px;
    }
    .mealplan-page .mealplan-hero .mealplan-meta .badge { justify-self: start; }
    .mealplan-page .mealplan-hero .mealplan-meta-dates { text-align: center; font-size: 11px; }
    .mealplan-page .mealplan-hero .mealplan-meta-cost {
        text-align: right; justify-self: end;
        font-size: 11px; margin-left: 0;
    }
    /* Collapse the date/duration span on mobile — only show the range itself */
    .mealplan-page .mealplan-hero .mealplan-meta-duration,
    .mealplan-page .mealplan-hero .mealplan-meta-dates .mealplan-meta-sep,
    .mealplan-page .mealplan-hero .mealplan-meta-cost .mealplan-meta-sep { display: none; }
    /* Budget line — drop to its own row if present */
    .mealplan-page .mealplan-hero .mealplan-meta-budget {
        grid-column: 1 / -1;
        text-align: center; font-size: 11px;
    }
}

/* ── Meal plan Day view (spec: agenda timeline) ─────────────────────── */
.mp-daycard {
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(45,58,30,0.04), 0 8px 20px -16px rgba(45,58,30,0.2);
}
.mp-daycard-band {
    padding: 14px 16px 10px;
    background: #F5F2E8;
    border-bottom: 1px solid rgba(107,122,90,0.18);
}
.mp-daycard-band-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mp-daycard-eyebrow {
    font-size: 10px; font-weight: 700;
    color: #6B7A5A; letter-spacing: 1.4px;
    text-transform: uppercase; white-space: nowrap;
}
.mp-daycard-title {
    font-family: var(--font-family-display);
    font-size: 15px; font-weight: 700;
    color: #2B2E25; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mp-daycard-band .btn-day-plan {
    height: 34px; padding: 0 12px;
    border-radius: 10px; border: none;
    background: #6B7A5A; color: #fff;
    font-size: 12px; font-weight: 600; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; flex-shrink: 0;
}
.mp-daycard-band .btn-day-plan:hover { background: #5B6A4A; }
.mp-daycard-stats {
    display: flex; justify-content: space-between; gap: 8px;
    margin-top: 8px; font-size: 11px; color: #8A8E7B;
    white-space: nowrap;
}
.mp-daycard-stats .mp-stat-cost { font-weight: 600; color: #2B2E25; }

.mp-timeline { position: relative; padding: 8px 14px 12px; }
.mp-timeline-spine {
    position: absolute; left: 52px; top: 20px; bottom: 20px;
    width: 2px; background: rgba(107,122,90,0.18); border-radius: 1px;
}
.mp-timeline-row { display: flex; align-items: stretch; gap: 10px; padding-top: 10px; position: relative; }
.mp-timeline-row:first-child { padding-top: 6px; }
.mp-timeline-time {
    width: 36px; text-align: right; padding-top: 14px;
    font-size: 11px; font-weight: 600; color: #8A8E7B;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.mp-timeline-dotcol { position: relative; width: 14px; flex-shrink: 0; }
.mp-timeline-dot {
    position: absolute; left: 3px; top: 16px;
    width: 12px; height: 12px; border-radius: 6px;
    background: #fff;
    box-shadow: 0 0 0 3px #fff;
    box-sizing: border-box;
}
.mp-timeline-dot.slot-breakfast { border: 2px solid #E8D9A8; }
.mp-timeline-dot.slot-lunch     { border: 2px solid #C9D5B4; }
.mp-timeline-dot.slot-dinner    { border: 2px solid #B8C4D0; }
.mp-timeline-dot.slot-snack     { border: 2px solid #E8C5B4; }
.mp-timeline-dot.done { background: #6B7A5A; border-color: #6B7A5A; }
.mp-timeline-card { flex: 1; min-width: 0; padding-bottom: 4px; }

/* Meal cards (spec) */
.mp-meal-card {
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
}
.mp-meal-card.done { opacity: 0.65; }
.mp-meal-stripe { width: 4px; flex-shrink: 0; }
.mp-meal-stripe.slot-breakfast { background: #E8D9A8; }
.mp-meal-stripe.slot-lunch     { background: #C9D5B4; }
.mp-meal-stripe.slot-dinner    { background: #B8C4D0; }
.mp-meal-stripe.slot-snack     { background: #E8C5B4; }
.mp-meal-body { flex: 1; padding: 12px 14px; min-width: 0; }
.mp-meal-top {
    display: flex; align-items: center; gap: 8px; margin-bottom: 3px;
}
.mp-slot-badge {
    font-size: 9px; font-weight: 700;
    padding: 2px 7px; border-radius: 999px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.mp-slot-badge.slot-breakfast { background: #E8D9A8; color: #7A5E1A; }
.mp-slot-badge.slot-lunch     { background: #C9D5B4; color: #4D5A3E; }
.mp-slot-badge.slot-dinner    { background: #B8C4D0; color: #3E4E60; }
.mp-slot-badge.slot-snack     { background: #E8C5B4; color: #7A4A30; }
.mp-done-label {
    font-size: 11px; font-weight: 600; color: #4D5A3E;
    display: inline-flex; align-items: center; gap: 3px;
}
.mp-meal-actions { margin-left: auto; display: flex; gap: 4px; }
.mp-meal-actions .btn-icon-sm {
    width: 24px; height: 24px; border-radius: 7px;
    border: none; background: rgba(107,122,90,0.08);
    color: #4D5A3E; font-size: 12px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
}
.mp-meal-actions .btn-icon-sm:hover { background: rgba(107,122,90,0.15); }
.mp-meal-title {
    font-size: 14px; font-weight: 600;
    color: #2B2E25; letter-spacing: -0.2px;
    text-decoration: none;
    display: block;
}
.mp-meal-card.done .mp-meal-title {
    text-decoration: line-through;
    text-decoration-color: #8A8E7B;
}
.mp-meal-meta {
    font-size: 11px; color: #8A8E7B; margin-top: 3px;
    font-variant-numeric: tabular-nums;
}
.mp-meal-cook-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    width: 160px;
    height: 36px;
    padding: 0 14px;
    margin: 10px auto 0;
    background: #6B7A5A;
    color: #fff;
    border-radius: 999px;
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
    text-decoration: none;
    transition: background .15s;
    align-self: center;
    flex: 0 0 auto;
}
.mp-meal-cook-btn:hover {
    background: #5B6A4A;
    color: #fff;
    text-decoration: none;
}
.mp-meal-card.done .mp-meal-cook-btn {
    background: rgba(107,122,90,0.08);
    color: #4D5A3E;
    border: 1px solid rgba(107,122,90,0.18);
}

/* Week strip day-picker (sits above the day card) */
.mp-week-strip { padding: 12px 0 0; }
.mp-week-strip-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px;
    padding: 0 4px 8px;
}
.mp-week-strip-title {
    flex: 1;
    text-align: center;
    font-family: var(--font-family-display);
    font-size: 13px; font-weight: 600;
    color: #2B2E25;
    letter-spacing: -0.2px;
}
.mp-week-strip-nav {
    width: 34px; height: 34px; border-radius: 999px;
    border: 1px solid rgba(107,122,90,0.18);
    background: transparent; color: #2B2E25;
    cursor: pointer; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
    transition: background .15s;
}
.mp-week-strip-nav:hover { background: rgba(107,122,90,0.05); }
.mp-week-strip-nav svg { width: 12px; height: 12px; display: block; }
.mp-week-strip-days { display: flex; gap: 4px; }
.mp-day-pill {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 0 6px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: #2B2E25;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.mp-day-pill.today {
    background: #fff;
    border: 1px dashed #6B7A5A;
}
.mp-day-pill.selected {
    background: #6B7A5A;
    color: #fff;
    border: 1px solid transparent;
}
.mp-day-pill-initial {
    font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
    color: #8A8E7B;
}
.mp-day-pill.selected .mp-day-pill-initial { color: rgba(255,255,255,0.8); }
.mp-day-pill-date {
    font-family: var(--font-family-display);
    font-size: 18px; font-weight: 700; line-height: 1;
}
.mp-day-pill-dots { display: flex; gap: 2px; height: 4px; margin-top: 2px; }
.mp-day-pill-dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(107,122,90,0.25); }
.mp-day-pill-dot.filled { background: #6B7A5A; }
.mp-day-pill.selected .mp-day-pill-dot { background: rgba(255,255,255,0.35); }
.mp-day-pill.selected .mp-day-pill-dot.filled { background: #fff; }

.mp-addmeal-btn {
    width: 100%; margin-top: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px dashed rgba(107,122,90,0.18);
    border-radius: 14px;
    color: #4D5A3E; font-size: 13px; font-weight: 600;
    cursor: pointer;
}
.mp-addmeal-btn:hover { background: rgba(107,122,90,0.05); }

/* ── Day summary card (spec: eyebrow + Fraunces date + meta + ring progress) ── */
.mp-today-summary {
    margin-top: 14px;
    padding: 14px;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 18px;
}
.mp-today-summary-head {
    display: flex; align-items: center;
    gap: 8px;
}
.mp-today-summary-left { flex: 1; min-width: 0; }
.mp-today-summary-eyebrow {
    font-size: 10px; font-weight: 700;
    color: #4D5A3E; letter-spacing: 1.2px;
    text-transform: uppercase;
}
.mp-today-summary-date {
    font-family: var(--font-family-display);
    font-size: 18px; font-weight: 700;
    color: #2B2E25;
    margin-top: 2px;
}
.mp-today-summary-meta {
    font-size: 11px; color: #8A8E7B;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.mp-today-ring {
    position: relative;
    width: 46px; height: 46px;
    flex-shrink: 0;
}
.mp-today-ring svg {
    width: 46px; height: 46px; display: block;
}
.mp-today-ring-label {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #2B2E25;
    font-variant-numeric: tabular-nums;
}
.mp-today-instructions-btn {
    margin-top: 12px;
    width: 100%;
    height: 36px;
    background: #fff;
    color: #2B2E25;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.mp-today-instructions-btn:hover { background: rgba(107,122,90,0.05); }
.mp-today-instructions-btn .icon-sm { width: 14px; height: 14px; opacity: 0.75; }

/* Meals list section head (spec: MEALS eyebrow + ghost + Add pill) */
.mp-day-meals { padding: 16px 0 8px; }
.mp-day-meals-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-bottom: 10px;
    padding: 4px 0 0;
}
.mp-day-meals-eyebrow {
    font-size: 11px; font-weight: 700;
    color: #4D5A3E; letter-spacing: 1.2px;
    text-transform: uppercase;
}
.mp-day-meals-add {
    height: 26px; padding: 0 10px;
    background: #fff; border: 1px solid rgba(107,122,90,0.18);
    border-radius: 999px;
    font-size: 11px; font-weight: 600;
    color: #2B2E25;
    white-space: nowrap; flex-shrink: 0;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.mp-day-meals-add:hover { background: rgba(107,122,90,0.05); color: #2B2E25; }
.mp-day-meals-list { display: flex; flex-direction: column; gap: 10px; }

/* Responsive — calendar */
@media (max-width: 768px) {
    .cal-toolbar { flex-direction: column; align-items: stretch; gap: var(--space-2); }
    .cal-tabs { justify-content: center; }
    .cal-nav { justify-content: center; }
    .cal-title { min-width: 0; font-size: var(--font-size-s); }

    /* Month: compact cells, hide meal pills, just show dot indicators */
    .cal-month-cell { min-height: 48px; padding: 2px; }
    .cal-month-cell .cal-meal-pill { font-size: 8px !important; padding: 0 3px !important; }
    .cal-month-date { font-size: var(--font-size-xs); padding: 1px 4px; }
    .cal-month-hdr { font-size: 10px; padding: var(--space-1); }
    .cal-today-num { width: 22px; height: 22px; font-size: var(--font-size-xs); }

    /* Week: horizontal scroll with min-width columns */
    .cal-week-col { min-height: 200px; }
    .cal-week-hdr { font-size: var(--font-size-xs); padding: var(--space-1); }
    .cal-week-date { font-size: var(--font-size-m); }
    .cal-week-body { padding: var(--space-1); gap: var(--space-1); }

    /* Day summary */
    .day-summary { flex-direction: column; align-items: stretch; gap: var(--space-2); padding: var(--space-2) var(--space-3); }
    .day-summary-stats { justify-content: center; gap: var(--space-2); font-size: var(--font-size-xs); }
    .day-summary .btn { width: 100%; text-align: center; }

    /* Meal cards in day/week views */
    .cal-meal-card { padding: var(--space-2) !important; }
    .cal-meal-actions { flex-wrap: wrap; }

    /* Page header actions */
    .page-header-actions { width: 100%; }
    .page-header-actions .btn { flex: 1; text-align: center; font-size: var(--font-size-xs); padding: var(--space-2) var(--space-2); }

    /* Meal plan hero — tighten header, compact meta, keep actions in one row */
    .mealplan-hero { gap: var(--space-2); margin-bottom: var(--space-3); }
    .mealplan-hero h1 { font-size: var(--font-size-l); margin: 0; }
    .mealplan-hero .mealplan-meta { font-size: var(--font-size-xs); gap: 4px 8px; margin-top: var(--space-1); row-gap: 2px; }
    .mealplan-hero .mealplan-meta-sep { display: none; }
}
@media (max-width: 480px) {
    /* Month: just show date numbers, no meal pills */
    .cal-month-cell { min-height: 36px; }
    .cal-month-cell .cal-meal-pill { display: none !important; }
    .cal-month-cell.cal-has-meals::after {
        content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
        width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
    }

    /* Week: fit all 7 days on phone screen without horizontal scroll */
    .cal-week-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 0; }
    .cal-week-scroll { overflow-x: hidden; }
    .cal-week-col { min-height: 160px; }
    .cal-week-hdr { font-size: 10px; padding: 2px 1px; line-height: 1.15; }
    .cal-week-date { font-size: var(--font-size-xs); }
    .cal-week-body { padding: 2px; gap: 2px; }
    .cal-week-slot > .cal-meal-card { padding: 3px 4px !important; }
    .cal-week-slot > .cal-meal-card > div:first-child { font-size: 8px !important; margin-bottom: 0 !important; letter-spacing: .04em !important; }
    .cal-week-slot > .cal-meal-card > a { font-size: 10px !important; line-height: 1.15 !important; margin-bottom: 1px !important; }
    .cal-week-slot > .cal-meal-card > div:nth-of-type(2) { font-size: 8px !important; line-height: 1.15 !important; }
    .cal-week-slot > .cal-meal-card .cal-meal-actions { gap: 2px !important; margin-top: 2px !important; }
    .cal-week-slot > .cal-meal-card .cal-meal-actions .btn { padding: 1px 3px !important; font-size: 9px !important; }
    .cal-week-footer { font-size: 9px; padding: 2px; min-height: 20px; }

    /* Page header buttons stack */
    .page-header-actions { flex-direction: column; }
    .page-header-actions .btn { width: 100%; }

    /* Compact calendar toolbar: tabs get smaller, nav tightens */
    .cal-tabs .cal-tab { height: 28px; padding: 0 10px; font-size: 11px; }
    .cal-nav { gap: var(--space-1); }
    .cal-title { flex: 1; text-align: center; font-size: var(--font-size-xs); }
}

/* ── Day Summary Bar ───────────────────────────────────────────────────── */
.day-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--bg-layer2); border-radius: var(--radius-m); box-shadow: var(--shadow-2); margin-bottom: var(--space-4); }
.day-summary-stats { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; font-size: var(--font-size-s); color: var(--text-secondary); font-weight: 500; }
.day-summary-stats span { white-space: nowrap; }
.day-summary-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* ── Day Instructions Modal Content ───────────────────────────────────── */
.instr-meal { border-radius: var(--radius-m); box-shadow: var(--shadow-2); overflow: hidden; margin-bottom: var(--space-4); }
.instr-meal:last-child { margin-bottom: 0; }
.instr-meal-header { padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.instr-meal-type { font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.instr-meal-name { font-size: var(--font-size-m); font-weight: 700; }
.instr-meal-meta { font-size: var(--font-size-xs); opacity: 0.8; }
.instr-desc { padding: var(--space-2) var(--space-4); font-size: var(--font-size-s); color: var(--text-secondary); font-style: italic; border-bottom: 1px solid var(--border-color); }
.instr-section { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border-color); }
.instr-section strong { display: block; font-size: var(--font-size-s); margin-bottom: var(--space-2); }
.instr-cook-action {
    padding: var(--space-3) var(--space-4) 0;
}
.instr-cook-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    height: 44px;
    background: #6B7A5A;
    color: #fff;
    border-radius: 999px;
    border: none;
    font-size: 14px; font-weight: 700;
    letter-spacing: 0.2px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(45,58,30,0.08);
    transition: background .15s;
}
.instr-cook-btn:hover {
    background: #5B6A4A;
    color: #fff;
    text-decoration: none;
}
.instr-ingredients { margin: 0; padding-left: var(--space-5); font-size: var(--font-size-s); }
.instr-ingredients li { margin-bottom: 2px; }
.instr-ol { margin: 0; padding-left: var(--space-5); font-size: var(--font-size-s); }
.instr-ol li { margin-bottom: var(--space-2); line-height: 1.5; }

.instr-grocery-prompt { padding: var(--space-4); background: #fff8e1; border: 1px solid #ffe082; border-radius: var(--radius-m); margin-bottom: var(--space-4); }
[data-theme="dark"] .instr-grocery-prompt { background: #3e2e00; border-color: #5c4300; }

/* ── Per-meal rating (inside instructions modal) ───────────────────────── */
.meal-rate {
    margin-top: var(--space-3); padding-top: var(--space-3);
    border-top: 1px dashed var(--border-color);
    display: flex; flex-direction: column; gap: var(--space-2);
}
.meal-rate-header { font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); }
.meal-rate-saved { color: var(--accent); font-weight: 600; text-transform: none; letter-spacing: 0; }
.meal-rate-stars { display: flex; gap: 4px; }
.meal-rate-star {
    background: none; border: none; cursor: pointer;
    font-size: 1.5rem; line-height: 1; padding: 0 2px;
    color: var(--border-color); transition: color var(--transition-fast), transform var(--transition-fast);
}
.meal-rate-star:hover { transform: scale(1.1); }
.meal-rate-star.filled { color: #d4a020; }
.meal-rate-ate { display: inline-flex; align-items: center; gap: 6px; font-size: var(--font-size-s); color: var(--text-secondary); }
.meal-rate-ate input { accent-color: var(--accent); }
.meal-rate-notes { resize: vertical; min-height: 48px; font-size: var(--font-size-s); }
.meal-rate-save { align-self: flex-start; }
.meal-rate-status { font-size: var(--font-size-xs); color: var(--text-secondary); margin-left: var(--space-2); }

/* ── Swap Picker Modal ─────────────────────────────────────────────────── */
/* Overlay scrolls as a safety net when the viewport is shorter than the modal's
   max-height (e.g. mobile browsers whose chrome steals vertical space). */
.swap-modal-overlay { position: fixed; inset: 0; z-index: 9998; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); justify-content: center; align-items: center; overflow-y: auto; padding: var(--space-3); -webkit-overflow-scrolling: touch; }
.swap-modal { background: var(--bg-base); border-radius: var(--radius-l); box-shadow: var(--shadow-8); width: 100%; max-width: 480px; max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); display: flex; flex-direction: column; overflow: hidden; margin: auto 0; }
.swap-modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.swap-modal-header h3 { margin: 0; font-size: var(--font-size-m); font-weight: 700; }
.swap-modal-body { padding: var(--space-3); overflow-y: auto; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.swap-loading { text-align: center; color: var(--text-secondary); padding: var(--space-5); }
.swap-options { display: flex; flex-direction: column; gap: var(--space-2); }
.swap-section-title { font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); margin-bottom: var(--space-2); }

/* Swap modal — tabs, build-a-meal form, AI suggestion card */
.swap-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border-color); margin-bottom: var(--space-3); }
.swap-tab { flex: 1; background: none; border: none; padding: var(--space-2) var(--space-3); font-size: var(--font-size-s); font-weight: 600; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.swap-tab:hover { color: var(--text-primary); }
.swap-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.swap-tab-panel[hidden] { display: none; }
.swap-empty { text-align: center; color: var(--text-secondary); font-size: var(--font-size-s); padding: var(--space-4) var(--space-2); }

.build-meal { padding: var(--space-1) 0; }
.build-meal-hint { font-size: var(--font-size-s); color: var(--text-secondary); margin-bottom: var(--space-3); }
.build-meal-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: var(--font-size-s); }

.ai-suggestion { border: 1px solid var(--accent); border-radius: var(--radius-m); padding: var(--space-3) var(--space-4); background: var(--accent-light); }
.ai-suggestion-header { margin-bottom: var(--space-2); }
.ai-suggestion-name { margin: 0; font-size: var(--font-size-m); font-weight: 700; color: var(--text-primary); }
.ai-suggestion-meta { font-size: var(--font-size-xs); color: var(--text-secondary); margin-top: 2px; }
.ai-suggestion-desc { font-size: var(--font-size-s); color: var(--text-primary); margin: var(--space-2) 0; }
.ai-suggestion-section { margin-top: var(--space-2); font-size: var(--font-size-s); }
.ai-suggestion-section strong { display: block; font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); margin-bottom: 4px; }
.ai-suggestion-target { font-size: var(--font-size-xs); color: var(--text-secondary); background: var(--bg-base); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin-top: var(--space-2); border: 1px dashed var(--border-color); }
.ai-ing-list { margin: 0; padding-left: var(--space-4); }
.ai-ing-list li { margin-bottom: 2px; }
.ai-ing-price { color: var(--accent-hover); font-weight: 600; font-size: var(--font-size-xs); margin-left: 4px; }
.ai-ing-total { margin-top: var(--space-2); font-size: var(--font-size-s); color: var(--text-primary); padding-top: var(--space-2); border-top: 1px solid var(--border-color); }
.ai-ing-source { color: var(--text-tertiary); font-size: var(--font-size-xs); font-weight: 400; }
.ai-instructions { white-space: normal; line-height: 1.5; }
.ai-suggestion-actions { margin-top: var(--space-3); display: flex; justify-content: flex-end; }
.swap-option-form { margin: 0; }
.swap-option { display: block; width: 100%; text-align: left; background: var(--bg-layer1); border: 1px solid var(--border-color); border-radius: var(--radius-m); padding: var(--space-3) var(--space-4); cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; font-family: inherit; }
.swap-option:hover { background: var(--accent-light); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.swap-option-name { font-weight: 600; font-size: var(--font-size-s); color: var(--text-primary); margin-bottom: 2px; }
.swap-option-meta { font-size: var(--font-size-xs); color: var(--text-tertiary); }

/* Meal type badges */
.meal-type-badge { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.meal-type-badge.breakfast { background: #d8e2c7; color: #3d4a2a; }
.meal-type-badge.lunch     { background: #aabb8b; color: #263220; }
.meal-type-badge.dinner    { background: #7b8e6b; color: #ffffff; }
.meal-type-badge.snack     { background: #eaf0e0; color: #5e7050; }

/* Dashboard — household strip */
.dash-members {
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    -webkit-overflow-scrolling: touch;
}
.dash-members::-webkit-scrollbar { height: 6px; }
.dash-members::-webkit-scrollbar-track { background: transparent; }
.dash-members::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.dash-member-card {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
    min-width: 96px; padding: var(--space-3); background: var(--bg-base);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-2);
    text-align: center; flex-shrink: 0; scroll-snap-align: start;
    transition: transform .15s, box-shadow .15s;
}
.dash-member-card:hover { box-shadow: var(--shadow-4); }
.dash-member-name { font-weight: 600; font-size: var(--font-size-s); }
.dash-member-badge { font-size: 10px; background: var(--accent); color: #fff; padding: 1px 8px; border-radius: 100px; }
.dash-member-kcal { font-weight: 700; color: var(--accent); font-size: var(--font-size-s); white-space: nowrap; }
.dash-member-kcal span { font-weight: 400; font-size: var(--font-size-xs); color: var(--text-tertiary); }
.dash-member-kcal-unset { color: var(--text-tertiary); font-weight: 400; font-size: var(--font-size-xs); }
.dash-member-total { border-style: dashed; }

/* Dashboard — plan card */
.dash-plan-card {
    display: flex; gap: var(--space-5); padding: var(--space-5);
    background: var(--bg-base); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2);
}
.dash-plan-card.dash-plan-expired { background: #fffbfb; box-shadow: 0 2px 6px rgba(139,0,0,.08); }
[data-theme="dark"] .dash-plan-card.dash-plan-expired { background: #2a1a1a; box-shadow: 0 2px 6px rgba(139,0,0,.15); }
.dash-plan-card.dash-plan-empty { justify-content: center; }
.dash-plan-left { flex: 1; min-width: 0; }
.dash-plan-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.dash-plan-icon { font-size: 1.5rem; flex-shrink: 0; }
.dash-plan-title { margin: 0; font-size: var(--font-size-m); font-weight: 700; }
.dash-plan-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--font-size-s); color: var(--text-secondary); margin-top: 2px; }
.dash-plan-progress { margin: var(--space-3) 0; }
.dash-plan-progress-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.dash-days-left { font-size: var(--font-size-l); font-weight: 700; }
.dash-plan-pct { font-size: var(--font-size-s); color: var(--text-tertiary); }
.dash-plan-bar { background: var(--bg-layer2); border-radius: 4px; height: 8px; overflow: hidden; }
.dash-plan-bar-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }
.dash-plan-urgent { padding: var(--space-3); background: #fde8e8; border-radius: var(--radius-m); margin-bottom: var(--space-2); }
.dash-plan-urgent p { font-size: var(--font-size-s); color: #8b0000; font-weight: 500; margin: 0; }
.dash-plan-actions { display: flex; flex-direction: column; gap: var(--space-2); min-width: 160px; flex-shrink: 0; }
.dash-plan-actions .btn { width: 100%; text-align: center; }
.dash-plan-btn-row { display: flex; gap: var(--space-2); }
.dash-plan-btn-row .btn { flex: 1; text-align: center; }

@media (max-width: 768px) {
    .dash-plan-card { flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
    .dash-plan-actions { min-width: auto; gap: var(--space-2); }
    .dash-plan-actions .btn { width: 100%; }
    .dash-plan-header { gap: var(--space-2); align-items: flex-start; }
    .dash-plan-icon { width: 22px; height: 22px; flex-shrink: 0; margin-top: 2px; }
    .dash-plan-title { font-size: var(--font-size-m); }
    .dash-plan-meta { font-size: var(--font-size-xs); gap: 2px 8px; }
    .dash-days-left { font-size: var(--font-size-m); }
    .dash-plan-progress { margin: var(--space-2) 0; }
    .dash-plan-bar { height: 6px; }
    .dash-members { gap: var(--space-2); padding-bottom: 6px; }
    .dash-member-card {
        min-width: 108px;
        padding: var(--space-3) var(--space-2);
        gap: 4px;
        border-radius: var(--radius-l);
    }
    .dash-member-card > div:first-child {
        width: 40px !important;
        height: 40px !important;
        font-size: var(--font-size-s) !important;
    }
    .dash-member-name { font-size: var(--font-size-xs); }
    .dash-member-kcal { font-size: var(--font-size-s); }
    .dash-member-kcal span { font-size: 10px; }
    .dash-member-badge { padding: 1px 6px; font-size: 9px; }
    .dash-member-total div:first-child { width: 40px !important; height: 40px !important; }
}
@media (max-width: 480px) {
    .dash-plan-card { padding: var(--space-3); }
    .dash-plan-meta { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
    .dash-days-left { font-size: var(--font-size-s); }
    .dash-plan-pct { font-size: 11px; }
    .dash-plan-btn-row { gap: var(--space-1); }
    .dash-plan-btn-row .btn { font-size: var(--font-size-xs); padding: var(--space-2); }
    .dash-member-card { min-width: 104px; }
}

/* ───── Dashboard v2 — design-handoff spec ─────────────────────── */
/* Design tokens (locked to spec; do not swap for theme vars) */
.dash-hero-v2,
.dash-household-v2,
.dash-plan-v2,
.dash-newplan-card-v2 {
    --dh-sage:   #6B7A5A;
    --dh-sage-d: #5B6A4A;
    --dh-sage-x: #4D5A3E;
    --dh-border: rgba(107,122,90,0.18);
    --dh-ink:    #2B2E25;
    --dh-muted:  #8A8E7B;
}

/* Hero stats card */
.dash-hero-v2 {
    background: linear-gradient(155deg, #8A9A7A 0%, #6B7A5A 45%, #4D5A3E 100%);
    color: #fff;
    border-radius: 24px;
    padding: 16px;
    margin: 0 0 20px;
    box-shadow: 0 10px 24px -12px rgba(77,90,62,0.5);
    position: relative;
    overflow: hidden;
}
.dash-hero-v2::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,0.18), transparent 55%),
        radial-gradient(90% 70% at 100% 100%, rgba(0,0,0,0.18), transparent 60%);
    pointer-events: none;
}
.dash-hero-v2 > * { position: relative; }
.dash-hero-v2-title {
    margin: 0 0 14px;
    padding: 0 8px;
    font-family: var(--font-family);   /* Inter, not serif */
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
    color: rgba(255,255,255,0.9);
    letter-spacing: 0;
}
.dash-hero-v2-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.dash-tile {
    position: relative;
    background: linear-gradient(145deg, rgba(255,255,255,0.22), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 16px;
    padding: 12px 14px;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 4px;
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    box-shadow:
        inset 1px 1px 0 rgba(255,255,255,0.35),
        inset -1px -1px 0 rgba(255,255,255,0.08),
        0 6px 16px -10px rgba(0,0,0,0.25);
}
.dash-tile > * { position: relative; }
.dash-tile-icon { width: 18px; height: 18px; color: rgba(255,255,255,0.85); }
.dash-tile-num {
    font-family: var(--font-family-display);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    margin-top: 2px;
    color: #fff;
    letter-spacing: 0;
}
.dash-tile-label {
    font-family: var(--font-family);
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

/* Household */
.dash-household-v2 { margin: 24px 0 0; }
.dash-household-head {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 0 0 10px;
}
.dash-household-title {
    margin: 0;
    font-family: var(--font-family-display);
    font-size: 20px;
    font-weight: 700;
    color: #2B2E25;
    letter-spacing: -0.3px;
}
.dash-household-manage {
    font-size: 13px;
    font-weight: 600;
    color: #4D5A3E;
    text-decoration: none;
}
.dash-members-v2 {
    display: flex;
    gap: 10px;
    padding: 0 0 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.dash-members-v2::-webkit-scrollbar { display: none; }

.dash-member-pill {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px 12px 12px;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(45,58,30,0.04), 0 8px 20px -16px rgba(45,58,30,0.2);
    text-decoration: none;
    color: inherit;
    min-width: 0;
    transition: transform .12s ease-out;
}
.dash-member-pill:active { transform: scale(0.97); }
.dash-member-pill.is-you { border: 1.5px solid #6B7A5A; }
.dash-member-pill-info { display: flex; flex-direction: column; min-width: 0; }
.dash-member-pill-top { display: flex; align-items: center; gap: 6px; }
.dash-member-pill-name {
    font-size: 14px;
    font-weight: 600;
    color: #2B2E25;
    letter-spacing: -0.2px;
}
.dash-member-pill-you {
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    background: #6B7A5A;
    padding: 2px 6px;
    border-radius: 999px;
    letter-spacing: 0.4px;
}
.dash-member-pill-kcal {
    font-size: 13px;
    font-weight: 600;
    color: #4D5A3E;
    margin-top: 1px;
    white-space: nowrap;
}
.dash-member-pill-kcal span { font-size: 11px; font-weight: 500; color: #8A8E7B; }
.dash-member-pill-kcal.unset { color: #8A8E7B; font-weight: 500; }

/* Current plan — timeline variant */
.dash-plan-v2 {
    margin: 20px 0 0;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 22px;
    box-shadow: 0 10px 24px -16px rgba(45,58,30,0.22);
    overflow: hidden;
}
.dash-plan-v2-band {
    padding: 14px 16px 12px;
    background: linear-gradient(180deg, rgba(107,122,90,0.08), rgba(107,122,90,0));
}
.dash-plan-v2-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.dash-plan-v2-eyebrow {
    font-family: var(--font-family);
    font-size: 10px;
    font-weight: 700;
    color: #6B7A5A;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}
.dash-plan-v2-title {
    margin: 2px 0 0;
    font-family: var(--font-family-display);
    font-size: 18px;
    font-weight: 700;
    color: #2B2E25;
    letter-spacing: -0.3px;
    line-height: 1.2;
}
.dash-plan-v2-right { text-align: right; display: flex; flex-direction: column; line-height: 1.1; }
.dash-plan-v2-pct {
    font-family: var(--font-family-display);
    font-size: 20px;
    font-weight: 700;
    color: #4D5A3E;
}
.dash-plan-v2-daysleft {
    font-size: 10px;
    color: #8A8E7B;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-top: 2px;
}
.dash-plan-v2-pills { display: flex; gap: 3px; margin-top: 12px; }
.dash-plan-v2-pill {
    flex: 1 1 0;
    min-width: 0;
    height: 6px;
    border-radius: 3px;
    background: rgba(107,122,90,0.15);
}
.dash-plan-v2-pill.done    { background: #6B7A5A; }
.dash-plan-v2-pill.current {
    background: #5B6A4A;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #4D5A3E;
}
.dash-plan-v2-dates {
    display: flex; justify-content: space-between;
    margin-top: 6px;
    font-size: 10px;
    color: #8A8E7B;
}

/* Next-meal row */
.dash-plan-v2-next {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid rgba(107,122,90,0.18);
}
.dash-plan-v2-next-thumb {
    width: 44px; height: 44px; border-radius: 12px;
    flex-shrink: 0;
    background: repeating-linear-gradient(45deg, #E6E0CE, #E6E0CE 6px, #DDD6C0 6px, #DDD6C0 12px);
}
.dash-plan-v2-next-info { flex: 1; min-width: 0; }
.dash-plan-v2-next-eyebrow {
    font-size: 10px;
    font-weight: 700;
    color: #6B7A5A;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.dash-plan-v2-next-title {
    font-size: 14px;
    font-weight: 600;
    color: #2B2E25;
    letter-spacing: -0.2px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-plan-v2-next-open {
    height: 36px;
    padding: 0 16px;
    border-radius: 999px;
    border: none;
    background: #6B7A5A;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}
.dash-plan-v2-next-open:hover { background: #5B6A4A; }

/* Footer action row (3-up with vertical dividers) */
.dash-plan-v2-actions {
    display: flex;
    border-top: 1px solid rgba(107,122,90,0.18);
}
.dash-plan-v2-action {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 8px;
    text-decoration: none;
    background: transparent;
    color: #2B2E25;
}
.dash-plan-v2-action + .dash-plan-v2-action { border-left: 1px solid rgba(107,122,90,0.18); }
.dash-plan-v2-action svg { width: 18px; height: 18px; color: #4D5A3E; opacity: 0.8; }
.dash-plan-v2-action span {
    font-size: 11px;
    font-weight: 600;
    color: #2B2E25;
    letter-spacing: -0.1px;
}
.dash-plan-v2-action:hover { background: rgba(107,122,90,0.05); }

.dash-plan-v2-expired { background: #fffbfb; }

/* Start a new plan — dashed card */
.dash-newplan-card-v2 {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 16px 0 0;
    padding: 18px 16px;
    background: #fff;
    border: 1px dashed rgba(107,122,90,0.18);
    border-radius: 22px;
    text-decoration: none;
    color: #4D5A3E;
    font-size: 13px;
    font-weight: 600;
}
.dash-newplan-card-v2-plus {
    width: 26px; height: 26px;
    border: 1.5px solid #6B7A5A;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #6B7A5A;
    font-size: 16px;
    line-height: 1;
}

@media (min-width: 768px) {
    .dash-hero-v2 { padding: 24px; }
    .dash-hero-v2-grid { grid-template-columns: repeat(4, 1fr); }
    .dash-tile { padding: 14px 16px; }
    .dash-tile-num { font-size: 28px; }
    .dash-plan-v2-title { font-size: 20px; }
}

/* Recipes list view (plan tab) */
.recipe-list-group { margin-bottom: var(--space-5); }
.recipe-list-group-hdr {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: var(--font-size-s); font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    padding: var(--space-2) var(--space-3); border-radius: var(--radius-m); margin-bottom: var(--space-2);
}
.recipe-list-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-base); border-radius: var(--radius-m); box-shadow: var(--shadow-2);
    margin-bottom: var(--space-2);
}
.recipe-list-info { flex: 1; min-width: 0; }
.recipe-list-name { font-weight: 600; font-size: var(--font-size-s); margin-bottom: 2px; }
.recipe-list-name a { color: var(--accent); text-decoration: none; }
.recipe-list-name a:hover { text-decoration: underline; }
.recipe-list-meta { font-size: var(--font-size-xs); color: var(--text-tertiary); }
.recipe-list-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }
@media (max-width: 768px) {
    .recipe-list-item { flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-3); }
    .recipe-list-actions { width: 100%; }
    .recipe-list-actions .btn { flex: 1; text-align: center; }
    .recipe-list-actions form { flex: 1; }
    .recipe-list-actions form .btn { width: 100%; }
}

/* Dashboard meals */
.dashboard-plan { margin-top: var(--space-6); }
.dashboard-actions { display: flex; gap: var(--space-3); margin-bottom: var(--space-6); flex-wrap: wrap; }
.today-meals h3 { font-size: var(--font-size-m); margin-bottom: var(--space-4); }
.meal-list { display: flex; flex-direction: column; gap: var(--space-2); }
.meal-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-color); }
.meal-row:last-child { border-bottom: none; }
.meal-time { margin-left: auto; font-size: var(--font-size-xs); color: var(--text-tertiary); }

/* Stats */
.stat-card { text-align: center; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.stat-card:hover { box-shadow: var(--shadow-4); }
.stat-card:active { transform: scale(0.985); box-shadow: var(--shadow-2); transition-duration: 0.06s; }
.stat-value { font-size: var(--font-size-2xl); font-weight: 700; color: var(--accent); }
.stat-label { font-size: var(--font-size-s); color: var(--text-secondary); margin-top: var(--space-1); }

/* ── Grocery List ─────────────────────────────────────────────────────────── */
.progress-bar-container { height: 8px; background: var(--bg-layer2); border-radius: 4px; margin-bottom: var(--space-5); overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.4s ease; }

.accordion { display: flex; flex-direction: column; gap: var(--space-3); }
.accordion-item { border-radius: var(--radius-l); background: var(--bg-base); box-shadow: var(--shadow-2); overflow: hidden; }
.accordion-header { width: 100%; background: none; border: none; padding: var(--space-4); display: flex; align-items: center; gap: var(--space-3); cursor: pointer; font-size: var(--font-size-base); font-weight: 600; font-family: var(--font-family); color: var(--text-primary); text-align: left; }
.accordion-header:hover { background: var(--bg-layer2); }
.accordion-count { font-size: var(--font-size-s); color: var(--text-secondary); font-weight: 400; }
.accordion-chevron { margin-left: auto; transition: transform 0.2s; }
.accordion-item:not(.open) .accordion-chevron { transform: rotate(-90deg); }
.accordion-body { display: none; padding: 0 var(--space-4) var(--space-4); }
.accordion-item.open .accordion-body { display: block; }

.grocery-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.grocery-label { display: flex; align-items: center; gap: var(--space-3); width: 100%; cursor: pointer; padding: var(--space-2) var(--space-3); border-radius: var(--radius-m); transition: background 0.1s; }
.grocery-label:hover { background: var(--bg-layer2); }
.grocery-item.checked .grocery-name { text-decoration: line-through; opacity: 0.5; }
.grocery-check {
    width: 18px; height: 18px;
    appearance: none; -webkit-appearance: none;
    background-color: #fff;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer; flex-shrink: 0;
    position: relative;
    transition: background-color 0.15s, border-color 0.15s;
}
[data-theme="dark"] .grocery-check { background-color: var(--bg-layer2); }
.grocery-check:checked { background-color: var(--accent); border-color: var(--accent); }
.grocery-check:checked::after {
    content: '';
    position: absolute;
    left: 3px; top: 0;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.grocery-name { font-size: var(--font-size-base); flex: 1; }
.grocery-qty { font-size: var(--font-size-s); color: var(--text-secondary); white-space: nowrap; }
.grocery-cost { font-size: var(--font-size-s); font-weight: 500; color: var(--accent); white-space: nowrap; min-width: 52px; text-align: right; }
.grocery-grand-total { font-size: var(--font-size-m); color: var(--accent); margin-top: var(--space-2); }
.accordion-subtotal { font-weight: 600; color: var(--accent); font-size: var(--font-size-s); margin-left: auto; }

/* ── Pricing ───────────────────────────────────────────────────────────── */
.ingredient-cost { margin-left: auto; font-weight: 600; color: var(--accent); font-size: var(--font-size-s); white-space: nowrap; }
.cost-summary { padding: var(--space-3) var(--space-4); background: var(--bg-layer1); border-radius: var(--radius-m); margin-top: var(--space-3); }
.cost-row { display: flex; justify-content: space-between; padding: var(--space-1) 0; font-size: var(--font-size-base); }
.plan-day-cost { padding: var(--space-2) var(--space-3); margin-top: var(--space-2); font-size: var(--font-size-s); font-weight: 600; color: var(--accent); text-align: right; border-top: 1px solid var(--border-color); }

/* ── Recipe pages ─────────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: flex-end; gap: var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-6); }
.filter-group { display: flex; flex-direction: column; gap: var(--space-2); }
.filter-group label { font-size: var(--font-size-s); font-weight: 600; color: var(--text-secondary); }
.filter-tabs { display: flex; gap: var(--space-1); flex-wrap: wrap; }

@media (max-width: 768px) {
    .filter-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: var(--space-1);
    }
    .filter-tabs::-webkit-scrollbar { display: none; }
    .filter-tab { flex-shrink: 0; }
}
.filter-tab { padding: 6px 14px; border-radius: 100px; font-size: var(--font-size-s); font-weight: 500; border: 1.5px solid var(--border-color); background: var(--bg-base); color: var(--text-secondary); cursor: pointer; text-decoration: none; transition: all 0.15s; }
.filter-tab:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.filter-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.search-group { flex-direction: row; align-items: center; gap: var(--space-2); margin-left: auto; }
.search-group input { width: 220px; }

.recipe-card { text-decoration: none; color: var(--text-primary); display: flex; flex-direction: column; }
.recipe-card:hover { box-shadow: var(--shadow-4); text-decoration: none; color: var(--text-primary); }
.recipe-card-header { margin-bottom: var(--space-1); }
.recipe-card-name { font-family: var(--font-family-serif); font-size: var(--font-size-base); font-weight: 500; margin-bottom: var(--space-1); flex: 1; }
.recipe-card-meta { display: flex; gap: var(--space-2); font-size: var(--font-size-xs); color: var(--text-tertiary); margin-bottom: var(--space-2); }
.recipe-card-foods { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-2); }
.recipe-card-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.card-link { text-decoration: none; }

.back-link { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text-secondary); font-size: var(--font-size-s); margin-bottom: var(--space-5); text-decoration: none; }
.back-link:hover { color: var(--accent); text-decoration: none; }

.recipe-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-6); flex-wrap: wrap; }
.recipe-meta-bar { display: flex; gap: var(--space-5); font-size: var(--font-size-s); color: var(--text-secondary); margin-top: var(--space-3); flex-wrap: wrap; }
.recipe-dietary-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.recipe-detail-columns { display: grid; grid-template-columns: 1fr 2fr; gap: var(--space-5); margin-top: var(--space-5); }
.recipe-cta { margin-top: var(--space-6); text-align: center; }

.beneficial-foods-card { margin-bottom: var(--space-5); }
.beneficial-foods-list { display: flex; flex-direction: column; gap: var(--space-3); }
.beneficial-food-item { padding: var(--space-4); background: var(--bg-layer1); border-radius: var(--radius-m); }
.beneficial-food-item.primary { border-left: 3px solid var(--accent); }
.beneficial-food-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.learn-more-link { font-size: var(--font-size-xs); color: var(--accent); }

.nutrition-card { margin-bottom: var(--space-5); }
.nutrition-grid { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.nutrient-item { display: flex; flex-direction: column; align-items: center; min-width: 90px; padding: var(--space-3) var(--space-4); background: var(--bg-layer1); border-radius: var(--radius-m); }
.nutrient-value { font-size: var(--font-size-l); font-weight: 700; color: var(--text-primary); }
.nutrient-label { font-size: var(--font-size-xs); color: var(--text-secondary); margin-top: var(--space-1); }

.ingredients-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.ingredient-item { display: flex; align-items: baseline; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-color); }
.ingredient-item:last-child { border-bottom: none; }
.ingredient-qty { font-size: var(--font-size-s); font-weight: 600; min-width: 70px; color: var(--accent); }
.ingredient-name { flex: 1; }
.ingredient-cat { font-size: var(--font-size-xs); color: var(--text-tertiary); }
.instructions-text { font-size: var(--font-size-base); line-height: 1.7; color: var(--text-secondary); }

/* ── Conditions pages ─────────────────────────────────────────────────────── */
.tabs-container { margin-top: var(--space-5); }
.tab-list { display: flex; gap: var(--space-2); border-bottom: 2px solid var(--border-color); margin-bottom: var(--space-6); }
.tab-btn { padding: var(--space-3) var(--space-5); border: none; background: none; cursor: pointer; font-size: var(--font-size-base); font-weight: 600; color: var(--text-secondary); font-family: var(--font-family); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color 0.15s, border-color 0.15s; }
.tab-btn:hover { color: var(--accent); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.conditions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.condition-card { text-align: center; }
.condition-card-icon { color: var(--accent); margin-bottom: var(--space-2); display: flex; justify-content: center; }
.condition-card-icon svg { width: 36px; height: 36px; }
.condition-card h3 { margin-bottom: var(--space-1); font-size: var(--font-size-base); }
.condition-card p { font-size: var(--font-size-xs); color: var(--text-secondary); margin-bottom: var(--space-3); }

/* Food detail */
.food-detail-header { margin-bottom: var(--space-5); }
.food-description { color: var(--text-secondary); margin: var(--space-3) 0; font-size: var(--font-size-m); }
.nutritional-highlights { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border-color); }
.food-links-card { margin-bottom: var(--space-5); }
.food-links-list { display: flex; flex-direction: column; gap: var(--space-3); }
.food-link-item { padding: var(--space-4); background: var(--bg-layer1); border-radius: var(--radius-m); }
.food-link-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.effectiveness-stars { display: flex; gap: 2px; }
.star { color: var(--border-color); font-size: 16px; }
.star.filled { color: #f0a900; }
.recipe-list-small { display: flex; flex-direction: column; gap: 0; }
.recipe-list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--border-color); text-decoration: none; color: var(--text-primary); transition: background 0.1s; }
.recipe-list-item:last-child { border-bottom: none; }
.recipe-list-item:hover { background: var(--bg-layer2); text-decoration: none; }
.recipe-list-name { flex: 1; font-size: var(--font-size-base); }
.recipe-list-time { font-size: var(--font-size-xs); color: var(--text-tertiary); }

/* ── Profile page ─────────────────────────────────────────────────────────── */
.profile-card { max-width: 720px; }

/* ── History page ─────────────────────────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: var(--space-4); }
.history-card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-4); width: 100%; }
.history-card-info { display: grid; grid-template-columns: 160px minmax(260px, 1fr) 100px; align-items: center; gap: var(--space-4); flex: 1; min-width: 0; }
.history-card-type { justify-self: start; white-space: nowrap; }
.history-card-dates { margin: 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-card-duration { margin: 0; color: var(--text-secondary); white-space: nowrap; }
.history-card-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

@media (max-width: 720px) {
    .history-card-info { grid-template-columns: 1fr; gap: var(--space-1); }
    .history-card-dates { white-space: normal; }
}

/* ── Responsive additions ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .recipe-detail-columns { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-group { flex-direction: row; }
    .search-group input { flex: 1; width: auto; }
    .plan-week-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .selectable-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

    /* Landing page hero */
    .hero-inner { flex-direction: column; text-align: center; }
    .hero-image { order: -1; }
    .hero-image img { max-width: 120px; }
    .hero-actions { justify-content: center; }
    .hero-badge { font-size: var(--font-size-xs); }
}

@media (max-width: 480px) {
    .hero { padding: var(--space-3) var(--space-2); border-radius: var(--radius-l); }
    .hero-title { font-size: var(--font-size-m); }
    .hero-subtitle { font-size: var(--font-size-s); }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions .btn { text-align: center; }
    .wizard-progress { flex-wrap: wrap; }
    .plan-type-tabs { flex-direction: column; }
    .wizard-actions { flex-direction: column-reverse; }
    .form-actions { flex-direction: column; }
    .dashboard-actions { flex-direction: column; }
}

/* ── Grocery Page (Variant B — hero + list) ──────────────────────────────── */
.grocery-page {
    max-width: 560px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-3) 120px;
}

/* ── Hero ── */
.grocery-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-pressed) 100%);
    border-radius: 18px;
    padding: 14px 16px;
    color: #fff;
    margin: 0 0 12px;
}
.grocery-hero-bg {
    position: absolute; top: -30px; right: -30px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,0.06); border-radius: 50%;
    pointer-events: none;
}
.grocery-hero-back {
    display: inline-block;
    background: rgba(255,255,255,0.18);
    color: #fff; font-size: 11px; line-height: 1;
    padding: 6px 10px; border-radius: 999px;
    text-decoration: none;
}
.grocery-hero-row {
    display: flex; align-items: baseline;
    gap: 10px; flex-wrap: wrap;
    margin-top: 8px;
}
.grocery-hero-spacer { flex: 1; }
.grocery-hero-title {
    font-family: var(--font-family-display);
    font-size: 24px; font-weight: 700;
    letter-spacing: -0.4px; line-height: 1;
    margin: 0;
}
.grocery-hero-cost {
    font-family: var(--font-family-display);
    font-size: 26px; font-weight: 700; line-height: 1;
}
.grocery-hero-cost-label { font-size: 11px; opacity: 0.85; margin-left: 5px; }
.grocery-hero-date { opacity: 0.75; font-size: 10px; margin: 4px 0 0; }
.grocery-hero-stats {
    margin-top: 10px; font-size: 11px; opacity: 0.9;
    line-height: 1.3;
}
.grocery-hero-stats b { font-size: 13px; font-weight: 700; opacity: 1; }
.grocery-hero-bar {
    margin-top: 8px; height: 5px;
    background: rgba(255,255,255,0.18);
    border-radius: 999px; overflow: hidden;
}
.grocery-hero-bar-fill {
    height: 100%; background: rgba(255,255,255,0.85);
    border-radius: 999px; transition: width 0.4s ease;
}

/* ── Toolbar ── */
.grocery-toolbar {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 8px; margin: 0 0 12px;
}
.grocery-tb-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 12px;
    border-radius: 999px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 12px; font-weight: 600;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    font-family: inherit;
}
.grocery-tb-btn .icon { width: 14px; height: 14px; }
.grocery-tb-btn:hover { background: var(--bg-layer1); }
.grocery-tb-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff; font-weight: 700;
}
.grocery-tb-btn-primary:hover { background: var(--accent-hover); }
.grocery-tb-spacer { flex: 1; }
.grocery-tb-reset {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 12px;
    background: transparent; border: none;
    color: var(--text-secondary);
    font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.grocery-tb-reset .icon { width: 14px; height: 14px; }

/* ── Connect banner ── */
.grocery-connect-banner {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 12px; padding: 10px 12px;
    background: rgba(198,139,46,0.12);
    border: 1px solid rgba(198,139,46,0.3);
    border-radius: 12px;
}
.grocery-connect-icon {
    width: 28px; height: 28px; border-radius: 8px;
    background: #fff; color: #C68B2E;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.grocery-connect-icon .icon { width: 16px; height: 16px; }
.grocery-connect-copy { flex: 1; min-width: 0; }
.grocery-connect-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.grocery-connect-helper { font-size: 11px; color: var(--text-secondary); line-height: 1.35; }
.grocery-connect-btn {
    display: inline-flex; align-items: center;
    height: 28px; padding: 0 10px;
    border-radius: 999px;
    background: #C68B2E; color: #fff; border: none;
    font-size: 11px; font-weight: 700;
    cursor: pointer; white-space: nowrap;
    text-decoration: none;
}
.grocery-connect-btn:hover { background: #AE7A28; color: #fff; }

/* ── Category cards ── */
.grocery-categories {
    display: flex; flex-direction: column; gap: 10px;
}
.grocery-category {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: none;
    margin: 0;
}
.grocery-cat-toggle {
    display: flex; align-items: center;
    width: 100%; padding: 12px 14px;
    background: transparent; border: none;
    cursor: pointer; text-align: left;
    font-family: inherit; color: var(--text-primary);
    gap: 10px;
}
.grocery-cat-head { flex: 1; min-width: 0; }
.grocery-cat-title-row {
    display: flex; align-items: baseline; gap: 6px;
    margin-bottom: 4px; flex-wrap: wrap;
}
.grocery-cat-name {
    font-family: var(--font-family-display);
    font-size: 16px; font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-primary);
    margin: 0;
}
.grocery-cat-meta { font-size: 11px; color: var(--text-secondary); }
.grocery-cat-meta b { color: var(--accent-pressed); font-weight: 700; }
.grocery-cat-progress {
    width: 120px; max-width: 60%; height: 4px;
    background: rgba(123,142,107,0.18);
    border-radius: 999px; overflow: hidden;
}
.grocery-cat-progress-fill {
    height: 100%; background: var(--accent);
    border-radius: 999px; transition: width .3s ease;
}
.grocery-cat-count {
    font-size: 11px; color: var(--text-secondary);
    margin-right: 2px; white-space: nowrap;
}
.grocery-cat-chevron {
    width: 14px; height: 14px;
    color: var(--text-secondary);
    transition: transform 160ms;
    flex-shrink: 0;
}
.accordion-toggle[aria-expanded='false'] .grocery-cat-chevron { transform: rotate(-90deg); }
.accordion-panel { }
.accordion-toggle[aria-expanded='false'] + .accordion-panel { display: none; }

/* ── Item rows ── */
.grocery-active-items,
.grocery-gotit-items { list-style: none; padding: 0; margin: 0; }
.grocery-item-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    cursor: pointer;
    transition: opacity 160ms ease;
}
.grocery-active-items > .grocery-item-row:first-child { border-top: none; }
.grocery-gotit-items > .grocery-item-row:first-child { border-top: none; }
.grocery-item-row.checked { opacity: 0.45; }
.grocery-item-row.checked .grocery-item-name { text-decoration: line-through; }

.grocery-item-check {
    appearance: none; -webkit-appearance: none;
    width: 22px; height: 22px; border-radius: 6px;
    border: 1.5px solid rgba(123,142,107,0.4);
    background: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; cursor: pointer; margin: 0;
    position: relative;
}
.grocery-item-check:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.grocery-item-check:checked::after {
    content: '';
    width: 11px; height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}
.grocery-item-name {
    flex: 1; min-width: 0;
    font-size: 14px; font-weight: 500;
    color: var(--text-primary);
}
.grocery-item-qty {
    font-size: 11px; color: var(--text-secondary);
    white-space: nowrap;
}
.grocery-item-price {
    font-size: 13px; font-weight: 700;
    color: var(--accent-pressed);
    min-width: 48px; text-align: right;
}

/* ── Got-it fold ── */
.grocery-gotit { border-top: 1px dashed var(--border-color); }
.grocery-gotit[data-empty='true'] { display: none; }
.grocery-active-items:empty + .grocery-gotit { border-top: none; }
.grocery-gotit-toggle {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 10px 14px;
    background: rgba(123,142,107,0.08);
    border: none; cursor: pointer; font-family: inherit;
}
.grocery-gotit-toggle .icon { width: 14px; height: 14px; }
.grocery-gotit-label {
    flex: 1; text-align: left;
    font-size: 12px; font-weight: 600;
    color: var(--accent-pressed);
}
.grocery-gotit-chevron {
    color: var(--accent-pressed);
    transition: transform 160ms;
}
.grocery-gotit[data-expanded='false'] .grocery-gotit-chevron { transform: rotate(-90deg); }
.grocery-gotit[data-expanded='false'] .grocery-gotit-items { display: none; }

/* ── Download bottom sheet ── */
.grocery-sheet-overlay {
    position: fixed; inset: 0;
    background: rgba(43,46,37,0.35);
    display: none;
    align-items: flex-end; justify-content: center;
    z-index: 1000;
    animation: grocery-sheet-fade 160ms ease;
}
.grocery-sheet-overlay.open { display: flex; }
.grocery-sheet {
    width: 100%; max-width: 560px;
    background: var(--bg-base);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 18px 16px 24px;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.12);
    animation: grocery-sheet-rise 220ms ease;
}
.grocery-sheet-handle {
    width: 36px; height: 4px;
    background: rgba(123,142,107,0.3);
    border-radius: 999px;
    margin: 0 auto 12px;
}
.grocery-sheet-title {
    font-family: var(--font-family-display);
    font-size: 18px; font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}
.grocery-sheet-helper {
    font-size: 12px; color: var(--text-secondary);
    margin: 0 0 14px;
}
.grocery-sheet-fields {
    display: grid; grid-template-columns: 2fr 1fr;
    gap: 10px; margin-bottom: 14px;
}
.grocery-sheet-field label {
    font-size: 11px; font-weight: 600;
    color: var(--text-primary);
    display: block; margin-bottom: 4px;
}
.grocery-sheet-field select { width: 100%; }
.grocery-sheet-primary {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; width: 100%; height: 44px;
    border-radius: 999px;
    background: var(--accent); color: #fff; border: none;
    font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    font-family: inherit;
}
.grocery-sheet-primary:hover { background: var(--accent-hover); color: #fff; }
.grocery-sheet-primary .icon { width: 14px; height: 14px; }

.grocery-sheet-secondary {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; width: 100%; height: 44px;
    margin-top: 10px;
    border-radius: 999px;
    background: var(--bg-base); color: var(--accent-pressed);
    border: 1.5px solid var(--accent);
    font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    font-family: inherit;
}
.grocery-sheet-secondary:hover { background: var(--accent-light); }
.grocery-sheet-secondary .icon { width: 14px; height: 14px; }
.grocery-sheet-secondary:disabled { opacity: 0.6; cursor: wait; }

.grocery-footnote {
    text-align: center; margin-top: var(--space-4);
    font-size: var(--font-size-s); color: var(--text-secondary);
}

@@keyframes grocery-sheet-fade { from { background: rgba(43,46,37,0); } to { background: rgba(43,46,37,0.35); } }
@@keyframes grocery-sheet-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ── Nutrition Program Pages ─────────────────────────────────────────────── */

/* Program Library */
.program-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--space-4);
}

.program-card {
    background: var(--bg-base);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    position: relative;
    transition: box-shadow 0.15s, transform 0.15s;
}

.program-card:hover { box-shadow: var(--shadow-4); }
.program-card--active { box-shadow: 0 0 0 2px var(--accent), var(--shadow-2); }

.program-card-active-badge {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
}

.badge-success { background: var(--accent); color: white; }
.program-card-header { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.program-card-title { font-size: var(--font-size-base); font-weight: 600; }
.program-card-desc { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.5; flex: 1; }

.program-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: var(--font-size-s);
    color: var(--text-tertiary);
}

.program-card-duration { font-weight: 600; }
.program-card-tiers { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.tier-pill { background: var(--bg-layer2); color: var(--text-secondary); padding: 2px 10px; border-radius: 100px; font-size: var(--font-size-xs); font-weight: 500; }
.program-card-cta { align-self: flex-start; margin-top: auto; }

/* Program Detail */
.detail-layout { max-width: 800px; }
.detail-section { margin-bottom: var(--space-6); padding-bottom: var(--space-6); border-bottom: 1px solid var(--border-color); }
.detail-section:last-child { border-bottom: none; padding-bottom: 0; }
.detail-section h2 { margin-bottom: var(--space-4); }
.detail-section h3 { margin: var(--space-4) 0 var(--space-3); }
.detail-section h4 { margin: var(--space-5) 0 var(--space-3); font-size: var(--font-size-base); color: var(--text-secondary); }
.detail-intro { color: var(--text-secondary); line-height: 1.7; font-size: var(--font-size-base); }

.benefits-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.benefits-list li { padding-left: var(--space-5); position: relative; line-height: 1.6; color: var(--text-secondary); }
.benefits-list li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

.tier-tabs { display: flex; gap: var(--space-3); margin-bottom: var(--space-5); }

.tier-panel { display: none; }
.tier-panel.active { display: block; }
.tier-panel h3 { font-size: var(--font-size-m); margin-bottom: var(--space-4); }

.nutrient-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-s);
    margin-bottom: var(--space-4);
}

.nutrient-table th,
.nutrient-table td {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-color);
}

.nutrient-table th { font-weight: 600; color: var(--text-secondary); font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.04em; }
.nutrient-table tbody tr:hover { background: var(--bg-layer1); }

.badge-xs { font-size: 10px; padding: 1px 6px; }

.meal-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: var(--space-2);
}

.meal-slot-card {
    background: var(--bg-layer1);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-2);
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.meal-slot-type { font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); }
.meal-slot-range { font-size: var(--font-size-s); font-weight: 600; color: var(--accent); }

/* Intake Questionnaire */
.intake-form { max-width: 700px; }

.intake-question {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
}

.intake-question-text { font-size: var(--font-size-m); margin-bottom: var(--space-4); }

.intake-choices { display: flex; gap: var(--space-3); flex-wrap: wrap; }

.intake-choice {
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-m);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-size: var(--font-size-base);
}

.intake-choice:hover { border-color: var(--accent); background: var(--accent-light); }
.intake-choice.selected { border-color: var(--accent); background: var(--accent-light); }
.intake-choice input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; cursor: pointer; }
.intake-choice-label { font-weight: 500; }

/* Recommendation */
.recommendation-layout { max-width: 700px; }

.recommendation-card {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-4);
    padding: var(--space-6);
}

.recommendation-card h2 { margin: var(--space-4) 0 var(--space-2); }
.recommendation-card h3 { margin: var(--space-5) 0 var(--space-3); }

.recommendation-reason {
    background: var(--accent-light);
    border-radius: var(--radius-m);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
}

.recommendation-reason h3 { margin: 0 0 var(--space-2); font-size: var(--font-size-base); }
.recommendation-reason p { color: var(--text-secondary); line-height: 1.6; margin: 0; }
.recommendation-intro { color: var(--text-secondary); line-height: 1.7; margin: var(--space-4) 0; }

.disclaimer-notice {
    background: #fff4e5;
    border-left: 4px solid #b85c00;
    border-radius: 0 var(--radius-m) var(--radius-m) 0;
    padding: var(--space-4);
    margin: var(--space-5) 0;
}

.disclaimer-notice h4 { color: #b85c00; margin-bottom: var(--space-2); }
.disclaimer-notice p { color: #7a4a00; font-size: var(--font-size-s); margin: 0; }
[data-theme="dark"] .disclaimer-notice { background: #3d2e00; }
[data-theme="dark"] .disclaimer-notice h4 { color: #ffb84d; }
[data-theme="dark"] .disclaimer-notice p { color: #e6a84d; }

/* Disclaimer Page */
.disclaimer-layout { max-width: 700px; }

.disclaimer-card {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-4);
    padding: var(--space-6);
}

.disclaimer-content {
    background: var(--bg-layer1);
    border-radius: var(--radius-m);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    line-height: 1.7;
    color: var(--text-secondary);
}

.disclaimer-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    cursor: pointer;
    padding: var(--space-4);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-m);
    margin-bottom: var(--space-5);
    line-height: 1.5;
    font-size: var(--font-size-s);
    transition: border-color 0.15s;
}

.disclaimer-checkbox:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.disclaimer-checkbox input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; margin-top: 2px; }

/* Nutrition Tab */
.nutrition-tabs { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); }

.assignment-card {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.assignment-card-header { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.assignment-card-header h2 { margin: 0; }
.assignment-reason { color: var(--text-secondary); line-height: 1.6; margin-bottom: var(--space-3); }
.assignment-meta { font-size: var(--font-size-s); color: var(--text-tertiary); margin-bottom: var(--space-4); }
.assignment-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }
.btn-danger-text { color: var(--error, #d32f2f); }
.btn-danger-text:hover { background: rgba(211,47,47,0.08); color: var(--error, #b71c1c); }
.empty-state-actions { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }

.history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-base);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-2);
    flex-wrap: wrap;
}

.history-card-info { display: flex; flex-direction: column; gap: var(--space-1); }
.text-muted { color: var(--text-tertiary); }

/* Education */
.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: var(--space-3);
}

.education-card {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    text-decoration: none;
    color: var(--text-primary);
    transition: box-shadow 0.15s, transform 0.15s;
    position: relative;
}

.education-card:hover { box-shadow: var(--shadow-4); text-decoration: none; color: var(--text-primary); }
.education-card--viewed { opacity: 0.8; }
.education-card h3 { font-size: var(--font-size-s); font-weight: 600; }
.education-card p { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.5; flex: 1; }

.education-viewed-badge {
    font-size: var(--font-size-xs);
    color: var(--accent);
    font-weight: 600;
}

.badge-topic { background: #e5f0ff; color: #003d8f; }
[data-theme="dark"] .badge-topic { background: #1a2d4d; color: #6da3ff; }

.bookmark-btn { cursor: pointer; }

/* Education Article */
.education-article {
    max-width: 700px;
    margin-bottom: var(--space-7);
}

.education-article-summary {
    font-size: var(--font-size-m);
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.education-article-body {
    font-size: var(--font-size-base);
    line-height: 1.8;
    color: var(--text-primary);
}

/* Meal calories on dashboard */
.meal-calories { font-size: var(--font-size-xs); color: var(--text-tertiary); margin-left: var(--space-2); }

/* ── Comprehensive Responsive Overrides ──────────────────────────────────── */

/* Tablet (≤ 768px) */
@media (max-width: 768px) {
    .program-grid { grid-template-columns: 1fr; }
    .education-grid { grid-template-columns: 1fr; }
    .meal-slot-grid { grid-template-columns: 1fr 1fr; }
    .tier-tabs { flex-wrap: wrap; }
    .nutrition-tabs { flex-wrap: wrap; }
    .recommendation-card { padding: var(--space-5); }
    .disclaimer-card { padding: var(--space-5); }
    .nutrient-table { font-size: var(--font-size-xs); }
    .nutrient-table th, .nutrient-table td { padding: var(--space-2); }
    .intake-form { max-width: 100%; }
    .detail-layout { max-width: 100%; }
    .recommendation-layout { max-width: 100%; }
    .disclaimer-layout { max-width: 100%; }
    .meal-row { flex-wrap: wrap; gap: var(--space-2); }
    .meal-calories { margin-left: 0; }
}

/* Phone (≤ 480px) */
@media (max-width: 480px) {
    .program-grid { grid-template-columns: 1fr; }
    .meal-slot-grid { grid-template-columns: 1fr; }
    .education-grid { grid-template-columns: 1fr; }
    .intake-choices { flex-direction: column; }
    .intake-choice { min-width: 0; }
    .tier-tabs { flex-direction: column; }
    .nutrition-tabs { flex-direction: column; }
    .assignment-card { padding: var(--space-4); }
    .recommendation-card { padding: var(--space-4); }
    .disclaimer-card { padding: var(--space-4); }
    .disclaimer-content { padding: var(--space-4); }
    .intake-question { padding: var(--space-4); }
    .program-card { padding: var(--space-4); }
    .history-card { flex-direction: column; align-items: flex-start; }
}

/* ── Food Browse Cards ─────────────────────────────────────────────────────── */
.food-card { text-decoration: none; color: var(--text-primary); display: flex; flex-direction: column; }
.food-card:hover { box-shadow: var(--shadow-4); text-decoration: none; color: var(--text-primary); }
.food-card-img { margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) var(--space-2); overflow: hidden; border-radius: var(--radius-m) var(--radius-m) 0 0; aspect-ratio: 16/9; }
.food-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.food-card-header { margin-bottom: var(--space-1); }
.food-card-name { font-family: var(--font-family-serif); font-size: var(--font-size-base); font-weight: 500; margin-bottom: var(--space-1); }
.food-card-desc { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.5; margin-bottom: var(--space-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.food-card-meta { font-size: var(--font-size-xs); color: var(--text-tertiary); margin-bottom: var(--space-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.food-card-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-2); }
.food-card-tags:last-child { margin-bottom: 0; }

/* Mobile: single-row horizontal scroller with tighter chips and a fade
   on the right edge so overflow is discoverable. */
@media (max-width: 520px) {
    .food-card-tags {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        margin-left: calc(-1 * var(--space-2));
        margin-right: calc(-1 * var(--space-2));
        padding: 2px var(--space-2);
        -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
                mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
    }
    .food-card-tags::-webkit-scrollbar { display: none; }
    .food-card-tags .tag {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 11px;
        padding: 3px 10px;
        line-height: 1.4;
    }

    /* Foods filter: compact card + horizontal-scroll category rail. */
    .food-filter {
        padding: var(--space-3);
        margin-bottom: var(--space-3);
    }
    .food-filter .pf-card-head { margin-bottom: 4px; }
    .food-filter .pf-card-sub { display: none; }
    .food-filter .pf-eyebrow { margin-top: 8px; margin-bottom: 4px; }
    .food-filter .pf-chip-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        margin-left: calc(-1 * var(--space-3));
        margin-right: calc(-1 * var(--space-3));
        padding: 2px var(--space-3);
        -webkit-mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%);
                mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%);
    }
    .food-filter .pf-chip-row::-webkit-scrollbar { display: none; }
    .food-filter .pf-chip-row .filter-tab { flex-shrink: 0; white-space: nowrap; }
    .food-filter .btn-accent { padding: 0 14px; }
}

/* Food category badges – distinct colour per type */
.badge-cat-spice       { background: #fff4e5; color: #b85c00; }
.badge-cat-root        { background: #fce8d5; color: #8b4513; }
.badge-cat-berry       { background: #f5e0f7; color: #8b008b; }
.badge-cat-allium      { background: #fef9e7; color: #7d6608; }
.badge-cat-leafy-green { background: #e0f5e0; color: #1b5e20; }
.badge-cat-herb        { background: #e8f5e9; color: #2e7d32; }
.badge-cat-fish        { background: #e0f0ff; color: #0d47a1; }
.badge-cat-nut         { background: #f0e6d3; color: #6d4c2f; }
.badge-cat-grain       { background: #fdf2d0; color: #8d6e00; }
.badge-cat-seed        { background: #e6edd5; color: #556b2f; }
.badge-cat-vegetable   { background: #dff0d8; color: #3c763d; }
.badge-cat-fruit       { background: #fde0e0; color: #c0392b; }
.badge-cat-citrus      { background: #fff9c4; color: #f57f17; }
.badge-cat-cruciferous { background: #d4edda; color: #155724; }
.badge-cat-root-veg    { background: #f5e1d0; color: #a0522d; }
.badge-cat-dairy       { background: #eef2ff; color: #3949ab; }
.badge-cat-sweet       { background: #fce4ec; color: #ad1457; }
.badge-cat-beverage    { background: #e0f2f1; color: #00695c; }
.badge-cat-broth       { background: #efebe9; color: #5d4037; }
.badge-cat-legume      { background: #e8eaf6; color: #283593; }
.badge-cat-condiment   { background: #fff3e0; color: #e65100; }

/* Condition tags — sage */
.tag-condition { background: var(--accent-light); color: var(--accent-pressed); }
/* Goal tags — sage (hue-shifted slightly via accent-hover) */
.tag-goal { background: var(--accent-light); color: var(--accent-hover); }

[data-theme="dark"] .badge-cat-spice       { background: #3d2800; color: #ffb74d; }
[data-theme="dark"] .badge-cat-root        { background: #3e2415; color: #d4956a; }
[data-theme="dark"] .badge-cat-berry       { background: #3a1040; color: #ce93d8; }
[data-theme="dark"] .badge-cat-allium      { background: #3d3500; color: #e6c648; }
[data-theme="dark"] .badge-cat-leafy-green { background: #0d3010; color: #81c784; }
[data-theme="dark"] .badge-cat-herb        { background: #1a3a1a; color: #a5d6a7; }
[data-theme="dark"] .badge-cat-fish        { background: #0a2540; color: #64b5f6; }
[data-theme="dark"] .badge-cat-nut         { background: #2e1f10; color: #c9a882; }
[data-theme="dark"] .badge-cat-grain       { background: #3a2e00; color: #e6c648; }
[data-theme="dark"] .badge-cat-seed        { background: #2a3318; color: #aed581; }
[data-theme="dark"] .badge-cat-vegetable   { background: #1b3a1b; color: #a5d6a7; }
[data-theme="dark"] .badge-cat-fruit       { background: #3a1010; color: #ef9a9a; }
[data-theme="dark"] .badge-cat-citrus      { background: #3d3000; color: #ffd54f; }
[data-theme="dark"] .badge-cat-cruciferous { background: #0d2e15; color: #81c784; }
[data-theme="dark"] .badge-cat-root-veg    { background: #3a2010; color: #d4956a; }
[data-theme="dark"] .badge-cat-dairy       { background: #1a1f3d; color: #9fa8da; }
[data-theme="dark"] .badge-cat-sweet       { background: #3a0e20; color: #f48fb1; }
[data-theme="dark"] .badge-cat-beverage    { background: #0a2e2a; color: #80cbc4; }
[data-theme="dark"] .badge-cat-broth       { background: #2e2018; color: #bcaaa4; }
[data-theme="dark"] .badge-cat-legume      { background: #151a3d; color: #9fa8da; }
[data-theme="dark"] .badge-cat-condiment   { background: #3d1f00; color: #ffab40; }
[data-theme="dark"] .tag-condition { background: var(--accent-light); color: var(--accent); }
[data-theme="dark"] .tag-goal      { background: var(--accent-light); color: var(--accent-hover); }

/* ── Guided "Help me decide" flow ──────────────────────────────────────────── */
.guide-screen { display: none; }
.guide-screen.active { display: block; animation: guideFadeIn 0.3s ease; }
@keyframes guideFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.guide-question { font-family: var(--font-family-serif); font-size: var(--font-size-l); font-weight: 600; margin-bottom: var(--space-2); }
.guide-subtext { font-size: var(--font-size-s); color: var(--text-secondary); margin-bottom: var(--space-5); line-height: 1.5; }

.guide-choices { display: flex; flex-direction: column; gap: var(--space-3); }

.guide-choice-btn {
    display: flex; align-items: center; gap: var(--space-4);
    width: 100%; padding: var(--space-4) var(--space-5);
    border: 2px solid var(--border-color); border-radius: var(--radius-l);
    background: var(--bg-base); cursor: pointer;
    font-family: var(--font-family); font-size: var(--font-size-base);
    color: var(--text-primary); text-align: left;
    transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.guide-choice-btn:hover {
    border-color: var(--accent); background: var(--accent-light); transform: translateX(4px);
}
.guide-choice-icon { font-size: 24px; flex-shrink: 0; }
.guide-choice-text { font-weight: 500; line-height: 1.4; }

.guide-result { text-align: center; padding: var(--space-6); }
.guide-result-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin: var(--space-5) 0; }
.guide-result-tags .tag { font-size: var(--font-size-base); padding: 6px 16px; }
.guide-result-actions { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); margin-top: var(--space-5); }

/* ── Admin ─────────────────────────────────────────────────────────────────── */
.admin-nav { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); border-bottom: 2px solid var(--border-color); padding-bottom: var(--space-2); }
.admin-nav-tab { padding: var(--space-2) var(--space-4); border-radius: var(--radius-m) var(--radius-m) 0 0; font-size: var(--font-size-s); font-weight: 600; color: var(--text-secondary); text-decoration: none; transition: all 0.15s; }
.admin-nav-tab:hover { color: var(--accent); background: var(--accent-light); text-decoration: none; }
.admin-nav-tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); margin-bottom: -2px; }

.admin-table { width: 100%; border-collapse: collapse; font-size: var(--font-size-s); }
.admin-table th { text-align: left; padding: var(--space-3) var(--space-3); font-weight: 700; color: var(--text-secondary); border-bottom: 2px solid var(--border-color); white-space: nowrap; }
.admin-table td { padding: var(--space-3) var(--space-3); border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.admin-table tbody tr:hover { background: var(--bg-layer1); }
.admin-actions { white-space: nowrap; display: flex; gap: var(--space-2); }

.form-row { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 120px; }
.form-hint { display: block; font-size: var(--font-size-xs); color: var(--text-tertiary); margin-top: var(--space-1); }
.required-star { color: #c62828; margin-left: 2px; font-weight: 700; }

/* Family member macro panel */
.macro-panel {
    background: var(--bg-layer1); border-radius: var(--radius-l);
    padding: var(--space-4); border: 1px solid var(--border-color);
}
.macro-panel-header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.macro-panel-title { margin: 0; font-size: var(--font-size-m); font-weight: 700; }
.macro-panel-sub { font-size: var(--font-size-xs); color: var(--text-tertiary); text-transform: lowercase; }
.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
@media (max-width: 520px) { .macro-grid { grid-template-columns: repeat(2, 1fr); } }
.macro-tile {
    background: var(--bg-base); border-radius: var(--radius-m);
    padding: var(--space-3) var(--space-3) var(--space-3); text-align: center;
    border-top: 3px solid var(--accent);
}
.macro-tile-label { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); font-weight: 600; margin-bottom: 2px; }
.macro-tile-value { font-size: var(--font-size-xl); font-weight: 700; color: var(--text-primary); }
.macro-tile-value span { font-size: var(--font-size-s); font-weight: 500; color: var(--text-secondary); margin-left: 2px; }
.macro-protein { border-top-color: #7b8e6b; }
.macro-carbs   { border-top-color: #aabb8b; }
.macro-fat     { border-top-color: #d8a060; }
.macro-fiber   { border-top-color: #5e7050; }
.macro-panel-note { font-size: var(--font-size-xs); color: var(--text-tertiary); margin: var(--space-3) 0 0; line-height: 1.5; }
.macro-panel-muted { background: var(--bg-base); }

/* ─── AIM styled alert / confirm modals ─── */
.aim-modal-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(15, 20, 14, 0.55);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-4);
    opacity: 0; transition: opacity .18s ease-out;
}
.aim-modal-overlay.aim-modal-open { opacity: 1; }
.aim-modal-card {
    background: var(--bg-base);
    border-radius: 18px;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.12);
    width: 100%; max-width: 420px;
    padding: var(--space-5) var(--space-5) var(--space-4);
    display: flex; flex-direction: column; gap: var(--space-3);
    transform: scale(.96) translateY(8px); opacity: 0;
    transition: transform .22s cubic-bezier(.2,.9,.3,1.2), opacity .18s ease-out;
    border: 1px solid var(--border-color);
}
.aim-modal-overlay.aim-modal-open .aim-modal-card {
    transform: scale(1) translateY(0); opacity: 1;
}
.aim-modal-icon {
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--accent-light); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    align-self: center;
    box-shadow: inset 0 0 0 1px rgba(123,142,107,.25);
}
.aim-modal-danger .aim-modal-icon {
    background: #fde8e8; color: #c62828;
    box-shadow: inset 0 0 0 1px rgba(198,40,40,.2);
}
.aim-modal-body { text-align: center; }
.aim-modal-title { font-size: var(--font-size-l); font-weight: 700; margin: 0 0 var(--space-2); }
.aim-modal-message {
    font-size: var(--font-size-m);
    color: var(--text-primary);
    margin: 0; line-height: 1.5;
    white-space: pre-wrap;
}
.aim-modal-actions {
    display: flex; gap: var(--space-2); justify-content: flex-end;
    margin-top: var(--space-2); flex-wrap: wrap;
}
.aim-modal-actions .btn { min-width: 104px; }
.aim-modal-danger-btn {
    background: #c62828; color: #fff;
    border: none;
}
.aim-modal-danger-btn:hover { background: #a61d1d; color: #fff; }

@media (max-width: 480px) {
    .aim-modal-card { max-width: 100%; padding: var(--space-4); }
    .aim-modal-actions { flex-direction: column-reverse; }
    .aim-modal-actions .btn { width: 100%; }
}

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--space-2); }
.checkbox-item { display: flex; align-items: center; gap: var(--space-2); font-size: var(--font-size-s); cursor: pointer; padding: var(--space-1) 0; }
.checkbox-item input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.csv-sample { background: var(--bg-layer2); padding: var(--space-4); border-radius: var(--radius-m); font-size: var(--font-size-xs); overflow-x: auto; white-space: pre-wrap; word-break: break-all; line-height: 1.6; }
.text-danger { color: #8b0000; font-size: var(--font-size-xs); }

/* ── Favorites ────────────────────────────────────────────────────────────── */
.btn-favorite {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-s);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, color 0.15s ease;
    color: var(--text-tertiary);
    z-index: 2;
    position: relative;
}
.btn-favorite svg { fill: none; stroke: currentColor; stroke-width: 1.5; transition: fill 0.15s ease, stroke 0.15s ease; }
.btn-favorite:hover { transform: scale(1.15); color: #e0245e; }
.btn-favorite:hover svg { fill: rgba(224, 36, 94, 0.15); }
.btn-favorite.favorited { color: #e0245e; }
.btn-favorite.favorited svg { fill: #e0245e; stroke: #e0245e; }
.btn-favorite.favorited:hover { transform: scale(1.15); }
.btn-favorite-lg svg { width: 24px; height: 24px; }

.detail-header-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.detail-header-row h1 { margin: 0; }

.food-card-header, .recipe-card-header { display: flex; align-items: center; justify-content: space-between; }

/* ── Profile Section Nav ──────────────────────────────────────────────────── */
.profile-section-nav {
    position: sticky;
    top: var(--nav-height, 60px);
    z-index: 90;
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) 0;
    margin-bottom: var(--space-4);
    background: var(--bg-layer1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 720px;
}
.profile-section-nav::-webkit-scrollbar { display: none; }

.profile-nav-link {
    flex: 0 0 auto;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: var(--font-size-s);
    font-weight: 500;
    border: 1.5px solid var(--border-color);
    background: var(--bg-base);
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.profile-nav-link:hover {
    text-decoration: none;
    border-color: var(--accent);
    color: var(--accent);
}
.profile-nav-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Landing Page ────────────────────────────────────────────────────��─── */
.landing-hero {
    position: relative; overflow: hidden; padding: var(--space-8) 0;
    color: #fff; margin-bottom: 0;
}
.landing-hero-bg {
    position: absolute; inset: 0; z-index: 0;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 40%, var(--accent-pressed) 100%);
}
.landing-hero-bg::before {
    content: '\1F33F'; position: absolute; left: -30px; top: -10px;
    font-size: 280px; opacity: 0.05; pointer-events: none; line-height: 1;
    transform: rotate(25deg);
}
.landing-hero-bg::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 75% 25%, rgba(255,255,255,0.14) 0%, transparent 55%),
                radial-gradient(ellipse at 15% 85%, rgba(0,0,0,0.08) 0%, transparent 45%),
                radial-gradient(circle at 90% 80%, rgba(255,255,255,0.06) 0%, transparent 30%);
}
@@keyframes landing-gradient {
    0%,100% { background-position: 0% 50%; }
    50%     { background-position: 100% 50%; }
}
.landing-hero-inner {
    display: flex; align-items: center; gap: var(--space-7);
}
.landing-hero-content { flex: 1; max-width: 620px; }
.landing-hero-badge {
    display: inline-block; padding: 6px 18px; border-radius: 100px;
    background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
    font-size: var(--font-size-s); font-weight: 600; letter-spacing: 0.03em;
    margin-bottom: var(--space-4); border: 1px solid rgba(255,255,255,0.2);
}
.landing-hero-title {
    font-family: var(--font-family-serif); font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 600; line-height: 1.1;
    margin-bottom: var(--space-4); letter-spacing: -0.01em;
}
.landing-hero-subtitle {
    font-size: var(--font-size-m); opacity: 0.9; line-height: 1.6;
    margin-bottom: var(--space-5); max-width: 480px;
}
.landing-hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.landing-hero-visual { flex-shrink: 0; position: relative; }
.landing-hero-visual img {
    width: 260px; height: 260px; object-fit: cover; border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.25);
    box-shadow: var(--shadow-8);
}
@@keyframes landing-float {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-10px); }
}

/* Landing buttons */
.btn-landing-primary {
    background: #fff; color: var(--accent-pressed); font-weight: 600; border: none;
    padding: 16px 36px; border-radius: var(--radius-pill); font-size: var(--font-size-base);
    transition: all var(--transition-smooth);
}
.btn-landing-primary:hover { box-shadow: var(--shadow-4); text-decoration: none; color: var(--accent-pressed); }
.btn-landing-ghost {
    background: rgba(255,255,255,0.12); color: #fff; border: 1.5px solid rgba(255,255,255,0.4);
    padding: 16px 36px; border-radius: var(--radius-pill); font-size: var(--font-size-base); font-weight: 600;
    backdrop-filter: blur(8px); transition: all var(--transition-fast);
}
.btn-landing-ghost:hover { background: rgba(255,255,255,0.22); border-color: #fff; text-decoration: none; color: #fff; }

/* Stats ribbon */
.landing-stats {
    background: var(--bg-base); border-bottom: 1px solid var(--border-color);
    padding: var(--space-5) 0;
}
.landing-stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); text-align: center;
}
.landing-stat-num {
    display: block; font-size: var(--font-size-xl); font-weight: 800; color: var(--accent);
    line-height: 1; margin-bottom: 4px;
}
.landing-stat-label { font-size: var(--font-size-s); color: var(--text-secondary); }

/* Sections */
.landing-section { padding: var(--space-7) 0; }
.landing-section-alt { background: var(--bg-layer1); }
.landing-section-header { text-align: center; margin-bottom: var(--space-6); }
.landing-section-header h2 { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--space-2); }
.landing-section-header p { color: var(--text-secondary); font-size: var(--font-size-m); }

/* Steps */
.landing-steps { display: flex; align-items: flex-start; gap: 0; justify-content: center; }
.landing-step {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    max-width: 260px; padding: 0 var(--space-3);
}
.landing-step-num {
    width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-family-serif); font-size: var(--font-size-l); font-weight: 600; color: #fff;
    background: var(--accent);
    margin-bottom: var(--space-4);
}
.landing-step-content h3 { font-size: var(--font-size-m); font-weight: 700; margin-bottom: var(--space-2); }
.landing-step-content p { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.6; }
.landing-step-line {
    width: 60px; height: 2px; background: var(--border-color); margin-top: 28px; flex-shrink: 0;
}

/* Condition pills */
.landing-conditions {
    display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center;
}
.landing-condition-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; border-radius: 100px; font-size: var(--font-size-s); font-weight: 500;
    background: var(--bg-base);
    color: var(--text-primary); text-decoration: none;
    transition: box-shadow .15s, transform .15s;
    box-shadow: var(--shadow-2);
}
.landing-condition-pill:hover {
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-4);
    transform: translateY(-1px); text-decoration: none; color: var(--text-primary);
}
.landing-condition-icon { font-size: 1.1em; }
.landing-condition-more { background: var(--accent); color: #fff; border-color: var(--accent); }
.landing-condition-more:hover { color: #fff; background: var(--accent-hover); }

/* Goal cards */
.landing-goals {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4);
}
.landing-goal {
    text-align: center; padding: var(--space-6) var(--space-5);
    background: var(--bg-base); box-shadow: var(--shadow-2);
    border-radius: var(--radius-xl); transition: all var(--transition-spring);
}
.landing-goal:hover { box-shadow: var(--shadow-4); }
.landing-goal-icon { font-size: 2.5rem; margin-bottom: var(--space-3); }
.landing-goal h3 { font-size: var(--font-size-m); font-weight: 700; margin-bottom: var(--space-2); }
.landing-goal p { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.5; }

/* Feature grid */
.landing-features {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-4);
}
.landing-feature {
    padding: var(--space-6) var(--space-5);
    background: var(--bg-base); box-shadow: var(--shadow-2);
    border-radius: var(--radius-xl); transition: all var(--transition-spring);
}
.landing-feature:hover { box-shadow: var(--shadow-4); }
.landing-feature-icon { font-size: 2rem; margin-bottom: var(--space-3); }
.landing-feature h3 { font-size: var(--font-size-m); font-weight: 700; margin-bottom: var(--space-2); }
.landing-feature p { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.5; }

/* CTA */
.landing-cta {
    padding: var(--space-8) 0;
    background: var(--accent);
    color: #fff;
}
.landing-cta h2 { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--space-3); }
.landing-cta p { font-size: var(--font-size-m); opacity: 0.9; margin-bottom: var(--space-5); }

/* ── Landing page: Community section ── */
.landing-community-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-7);
    align-items: center;
}
.landing-community-badge {
    display: inline-block;
    background: var(--accent-light); color: var(--accent);
    font-size: var(--font-size-xs); font-weight: 600;
    padding: 4px 14px; border-radius: 100px;
    margin-bottom: var(--space-3); letter-spacing: 0.06em;
    text-transform: uppercase;
}
.landing-community-content h2 { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 500; margin-bottom: var(--space-3); }
.landing-community-content p { font-size: var(--font-size-base); color: var(--text-secondary); line-height: 1.7; margin-bottom: var(--space-4); }
.landing-community-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }
.landing-community-pill {
    background: var(--bg-layer2); box-shadow: var(--shadow-2);
    border-radius: 100px; padding: 6px 14px;
    font-size: var(--font-size-s); font-weight: 500;
}
.landing-community-visual { display: flex; flex-direction: column; gap: var(--space-3); }
.landing-community-card {
    display: flex; align-items: flex-start; gap: var(--space-3);
    background: var(--bg-base);
    border-radius: var(--radius-l); padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-2);
}
.landing-community-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: var(--font-size-s);
}
.landing-community-name { font-family: var(--font-family-serif); font-weight: 500; font-size: var(--font-size-s); margin-bottom: 2px; }
.landing-community-msg { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.5; }

/* ── Community page ── */
.community-page { }

.community-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-pressed) 100%);
    color: #fff;
    padding: var(--space-8) 0;
}
/* Soft sage highlights to give the hero dimension without imagery */
.community-hero-bg {
    display: block; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(circle at 12% 18%, rgba(255,255,255,0.10) 0%, transparent 42%),
        radial-gradient(circle at 88% 82%, rgba(255,255,255,0.08) 0%, transparent 44%),
        radial-gradient(circle at 50% 110%, rgba(216,226,199,0.18) 0%, transparent 55%);
}
.community-hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.18);
    font-size: var(--font-size-xs); font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; padding: 5px 16px; border-radius: 100px;
    margin-bottom: var(--space-4);
    border: 1px solid rgba(255,255,255,0.22);
}
.community-hero-title {
    font-family: var(--font-family-serif); font-size: var(--font-size-2xl); font-weight: 500;
    letter-spacing: -0.01em; margin-bottom: var(--space-3);
}
.community-hero-subtitle {
    font-size: var(--font-size-base); opacity: 0.92; line-height: 1.7;
    max-width: 520px; margin: 0 auto var(--space-6);
}
.community-hero-actions { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }

/* Feature cards on Community/Index */
.community-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}
.community-feature-card {
    position: relative;
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    padding: var(--space-5);
    border-top: 3px solid transparent;
    transition: box-shadow var(--transition-smooth), transform var(--transition-smooth), border-color var(--transition-smooth);
}
.community-feature-card:hover {
    box-shadow: var(--shadow-4);
    transform: translateY(-2px);
    border-top-color: var(--accent);
}
.community-feature-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    margin-bottom: var(--space-3);
    background: var(--accent-light);
    color: var(--accent-pressed);
}
/* Cycle through sage-palette tints so the row has visual rhythm */
.community-feature:nth-child(1) .community-feature-icon { background: #d8e2c7; color: #3d4a2a; }
.community-feature:nth-child(2) .community-feature-icon { background: #eaf0e0; color: #5e7050; }
.community-feature:nth-child(3) .community-feature-icon { background: #aabb8b; color: #1e2a17; }
.community-feature:nth-child(4) .community-feature-icon { background: #f0f3ed; color: #6B7E5B; }
.community-feature:nth-child(5) .community-feature-icon { background: #d8e2c7; color: #3d4a2a; }
.community-feature:nth-child(6) .community-feature-icon { background: #eaf0e0; color: #5e7050; }

/* Dark mode: collapse all tints to accent-light to avoid bright patches */
[data-theme="dark"] .community-feature .community-feature-icon {
    background: var(--accent-light);
    color: var(--accent-hover);
}

.community-feature-card h3 { font-family: var(--font-family-serif); font-size: var(--font-size-m); font-weight: 500; margin-bottom: var(--space-2); color: var(--text-primary); }
.community-feature-card p { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.7; margin: 0; }

/* SSO callout */
.community-sso-callout {
    text-align: center; max-width: 520px; margin: 0 auto;
}
.community-sso-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 80px; height: 80px; border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    margin-bottom: var(--space-4);
}
.community-sso-callout h2 { font-family: var(--font-family-serif); font-weight: 500; margin-bottom: var(--space-3); color: var(--text-primary); }
.community-sso-callout p { color: var(--text-secondary); font-size: var(--font-size-base); line-height: 1.7; margin-bottom: var(--space-5); }
.community-sso-signin { margin-top: var(--space-3); font-size: var(--font-size-s); color: var(--text-secondary); }
.community-sso-signin a { color: var(--accent-hover); font-weight: 600; }

/* Landing mobile */
@media (max-width: 768px) {
    .landing-hero { padding: var(--space-6) 0; }
    .landing-hero-inner { flex-direction: column; text-align: center; }
    .landing-hero-visual { order: -1; }
    .landing-hero-visual img { width: 160px; height: 160px; }
    .landing-hero-subtitle { max-width: 100%; }
    .landing-hero-actions { justify-content: center; }
    .landing-stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
    .landing-steps { flex-direction: column; align-items: center; gap: var(--space-4); }
    .landing-step-line { width: 2px; height: 24px; margin: 0; }
    .landing-step { max-width: 100%; }
    .landing-goals { grid-template-columns: repeat(2, 1fr); }
    .landing-features { grid-template-columns: 1fr; }
    .landing-section { padding: var(--space-5) 0; }
    .landing-cta { padding: var(--space-6) 0; }
    .landing-community-inner { grid-template-columns: 1fr; gap: var(--space-5); }
    .landing-community-content { text-align: center; }
    .landing-community-pills { justify-content: center; }
    .community-features { grid-template-columns: repeat(2, 1fr); }
    .community-hero { padding: var(--space-6) 0; }
    .community-hero-title { font-size: var(--font-size-xl); }
    .community-hero-subtitle { font-size: var(--font-size-s); }
}
@media (max-width: 480px) {
    .landing-hero { padding: var(--space-5) 0; }
    .landing-hero-visual img { width: 120px; height: 120px; }
    .landing-hero-actions { flex-direction: column; align-items: stretch; }
    .landing-hero-actions .btn-landing-primary,
    .landing-hero-actions .btn-landing-ghost { text-align: center; padding: 12px 24px; }
    .landing-stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
    .landing-stat-num { font-size: var(--font-size-l); }
    .landing-section-header h2 { font-size: var(--font-size-l); }
    .landing-section-header p { font-size: var(--font-size-s); }
    .landing-condition-pill { padding: 8px 14px; font-size: var(--font-size-xs); }
    .landing-goals { grid-template-columns: 1fr; }
    .landing-cta h2 { font-size: var(--font-size-l); }
    .community-features { grid-template-columns: 1fr; }
    .community-hero-title { font-size: var(--font-size-l); }
    .community-hero-actions { flex-direction: column; align-items: center; }
    .community-hero-actions .btn { width: 100%; max-width: 320px; text-align: center; }
}

/* ── Learn / Article Pages ──────────────────────────────────────────────── */
.learn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.learn-card { display: flex; flex-direction: column; padding: var(--space-5); text-decoration: none; color: var(--text-primary); transition: transform .15s, box-shadow .15s; }
.learn-card:hover { box-shadow: var(--shadow-4); text-decoration: none; color: var(--text-primary); }
.learn-card-icon { font-size: 2.5rem; margin-bottom: var(--space-3); }
.learn-card h2 { font-size: var(--font-size-m); font-weight: 700; margin-bottom: var(--space-2); }
.learn-card p { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.6; flex: 1; }
.learn-card-cta { font-size: var(--font-size-s); font-weight: 600; color: var(--accent); margin-top: var(--space-3); }

/* Article layout */
.article-page { max-width: 760px; }
.article-header { text-align: center; margin-bottom: var(--space-6); padding-bottom: var(--space-5); border-bottom: 1px solid var(--border-color); }
.article-icon { font-size: 3rem; margin-bottom: var(--space-3); }
.article-header h1 { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--space-3); }
.article-subtitle { font-size: var(--font-size-m); color: var(--text-secondary); line-height: 1.6; max-width: 560px; margin: 0 auto; }
.article-body h2 { font-size: var(--font-size-l); font-weight: 700; margin: var(--space-6) 0 var(--space-3); }
.article-body p { font-size: var(--font-size-base); line-height: 1.7; color: var(--text-primary); margin-bottom: var(--space-4); }
.article-body ul { padding-left: var(--space-5); margin-bottom: var(--space-4); }
.article-body li { margin-bottom: var(--space-2); line-height: 1.6; }

/* Callout */
.article-callout {
    padding: var(--space-4) var(--space-5); margin: var(--space-5) 0;
    background: var(--accent-light); border-left: 4px solid var(--accent); border-radius: 0 var(--radius-m) var(--radius-m) 0;
    font-size: var(--font-size-s); line-height: 1.6;
}

/* Two-column compare */
.article-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin: var(--space-5) 0; }
.article-col { padding: var(--space-4); border-radius: var(--radius-m); }
.article-col h3 { font-size: var(--font-size-s); font-weight: 700; margin-bottom: var(--space-3); }
.article-col ul { padding-left: var(--space-4); margin: 0; }
.article-col li { font-size: var(--font-size-s); margin-bottom: var(--space-2); line-height: 1.5; }
.article-col-good { background: #e8f5ee; border: 1px solid #b2dfdb; }
.article-col-bad { background: #fde8e8; border: 1px solid #f5c6c6; }
[data-theme="dark"] .article-col-good { background: #1a3d2a; border-color: #2e5e3e; }
[data-theme="dark"] .article-col-bad { background: #3d1a1a; border-color: #5e2e2e; }

/* Highlight grid */
.article-highlight-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); margin: var(--space-5) 0; }
.article-highlight { padding: var(--space-4); background: var(--bg-layer1); border-radius: var(--radius-m); box-shadow: var(--shadow-2); }
.article-highlight-icon { font-size: 1.75rem; margin-bottom: var(--space-2); }
.article-highlight h3 { font-size: var(--font-size-s); font-weight: 700; margin-bottom: var(--space-1); }
.article-highlight p { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.5; margin: 0; }

/* Snack grid */
.article-snack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); margin: var(--space-5) 0; }
.article-snack { padding: var(--space-4); background: var(--bg-layer1); border-radius: var(--radius-l); box-shadow: var(--shadow-2); transition: transform .15s; }
.article-snack:hover { transform: translateY(-2px); }
.article-snack-emoji { font-size: 2rem; margin-bottom: var(--space-2); }
.article-snack h3 { font-size: var(--font-size-s); font-weight: 700; margin-bottom: var(--space-2); }
.article-snack p { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.5; margin-bottom: var(--space-2); }
.article-snack-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.article-snack-tags .tag { font-size: 10px; padding: 2px 8px; }

/* Avoid list */
.article-avoid-list li { color: var(--text-primary); }
.article-avoid-list li strong { color: #c62828; }

/* FAQ */
.article-faq { margin: var(--space-5) 0; }
.article-faq-item { border-radius: var(--radius-m); box-shadow: var(--shadow-2); margin-bottom: var(--space-2); overflow: hidden; }
.article-faq-item summary {
    padding: var(--space-3) var(--space-4); font-weight: 600; font-size: var(--font-size-s);
    cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-layer1); transition: background .15s;
}
.article-faq-item summary:hover { background: var(--bg-layer2); }
.article-faq-item summary::after { content: '+'; font-size: 1.25rem; color: var(--text-tertiary); }
.article-faq-item[open] summary::after { content: '\2212'; }
.article-faq-item p { padding: var(--space-3) var(--space-4); font-size: var(--font-size-s); line-height: 1.6; margin: 0; }

/* Article CTA */
.article-cta {
    margin: var(--space-6) 0; padding: var(--space-5); text-align: center;
    background: var(--accent-light); border-radius: var(--radius-l); box-shadow: var(--shadow-2);
}
[data-theme="dark"] .article-cta { background: var(--accent-light); }
.article-cta h3 { font-size: var(--font-size-m); font-weight: 700; margin-bottom: var(--space-2); }
.article-cta p { font-size: var(--font-size-s); color: var(--text-secondary); margin-bottom: var(--space-4); }

/* Article mobile */
@media (max-width: 768px) {
    .article-two-col { grid-template-columns: 1fr; }
    .article-highlight-grid { grid-template-columns: 1fr 1fr; }
    .article-snack-grid { grid-template-columns: 1fr; }
    .learn-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .article-header h1 { font-size: var(--font-size-l); }
    .article-highlight-grid { grid-template-columns: 1fr; }
}

/* ── AI Chat ───────────────────────────────────────────────────────────── */
.chat-msg { display: flex; margin-bottom: var(--space-3); }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.assistant { justify-content: flex-start; }
.chat-bubble { max-width: 80%; padding: var(--space-3) var(--space-4); border-radius: var(--radius-l); font-size: var(--font-size-s); line-height: 1.5; word-wrap: break-word; }
.chat-bubble.user { background: var(--accent); color: #fff; border-bottom-right-radius: var(--radius-s); }
.chat-bubble.assistant { background: var(--bg-layer2); color: var(--text-primary); border-bottom-left-radius: var(--radius-s); }
.chat-bubble ul { margin: var(--space-1) 0; padding-left: var(--space-4); }
.chat-bubble li { margin-bottom: 2px; }
.chat-typing { color: var(--text-tertiary); font-style: italic; }

/* ── Print: show only the instructions modal ──────────────────────────── */
@media print {
    body > *:not(#instructions-modal) { display: none !important; }
    #instructions-modal { display: block !important; position: static !important; background: none !important; }
    #instructions-modal .swap-modal { max-width: 100% !important; box-shadow: none !important; max-height: none !important; overflow: visible !important; }
    #instructions-modal .swap-modal-header button { display: none !important; }
    #instructions-modal .instr-cook-action { display: none !important; }
    .instr-meal { break-inside: avoid; }
    .bottom-nav { display: none !important; }
}

/* ═════════════════════════════════════════════════════════════════════════════
   MODERN APP ENHANCEMENTS — Bottom Nav, Animations, Polish
═════════════════════════════════════════════════════════════════════════════ */

/* ── Mobile Bottom Tab Navigation ──────────────────────────────────────── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 250;
    height: var(--bottom-nav-height);
    background: var(--bg-base);
    border-top: 1px solid var(--border-color);
    padding: 0 var(--space-2);
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
    padding-top: 2px;
    /* Promote to its own compositing layer so mobile URL-bar transitions
       don't cause the bar to flicker off and reposition on scroll reverse. */
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    .site-footer { padding-bottom: calc(var(--bottom-nav-height) + var(--space-3)); }
}

.bottom-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    margin: 0 auto;
    height: 100%;
}

.bottom-nav-item {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--space-1) 4px;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: var(--radius-m);
    transition: all var(--transition-fast);
    position: relative;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:hover,
.bottom-nav-item:active {
    text-decoration: none;
    color: var(--accent);
}

.bottom-nav-item.active {
    color: var(--accent);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--accent);
}

.bottom-nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform var(--transition-spring);
}

.bottom-nav-item:active .bottom-nav-icon {
    transform: scale(0.85);
}

.bottom-nav-item.active .bottom-nav-icon {
    transform: scale(1.1);
}

.bottom-nav-label {
    white-space: nowrap;
}

/* More button in bottom nav — styled like a nav item but is a <button> */
button.bottom-nav-item {
    background: none;
    border: none;
    font-family: var(--font-family);
    cursor: pointer;
}

/* ── Hide hamburger on mobile, show on desktop ────────────────────────── */
@media (max-width: 768px) {
    .nav-hamburger { display: none; }
}

/* ── More Menu Popup (mobile) ─────────────────────────────────────────── */
.more-menu-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 299;
    background: rgba(0,0,0,0.35);
}
.more-menu-overlay.open { display: block; }

.more-menu {
    display: none;
    position: fixed;
    bottom: var(--bottom-nav-height);
    left: 0; right: 0;
    z-index: 300;
    background: var(--bg-base);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.1);
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.more-menu.open {
    display: block;
    transform: translateY(0);
}

.more-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}
.more-menu-title {
    font-family: var(--font-family-serif);
    font-size: var(--font-size-m);
    font-weight: 500;
}
.more-menu-close {
    background: none; border: none;
    font-size: 24px; cursor: pointer;
    color: var(--text-secondary);
    padding: var(--space-1);
    line-height: 1;
}
.more-menu-close:hover { color: var(--text-primary); }

.more-menu-links {
    list-style: none;
    padding: var(--space-2) 0;
    margin: 0;
}
.more-menu-links li { margin: 0; }

.more-menu-links a,
.more-menu-link-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-5);
    text-decoration: none;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: var(--font-family);
    transition: background 0.15s, color 0.15s;
}
.more-menu-links a:hover,
.more-menu-link-btn:hover {
    background: var(--bg-layer2);
    color: var(--text-primary);
    text-decoration: none;
}

.more-menu-links a svg,
.more-menu-link-btn svg {
    flex-shrink: 0;
    color: var(--text-tertiary);
}
.more-menu-links a:hover svg,
.more-menu-link-btn:hover svg {
    color: var(--accent);
}

.more-menu-link-danger { color: #c0392b; }
.more-menu-link-danger:hover { color: #a93226; background: #fde8e8; }
.more-menu-link-danger svg { color: #c0392b; }

.more-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-2) var(--space-5);
}

/* Hide More menu components on desktop */
@media (min-width: 769px) {
    .more-menu,
    .more-menu-overlay { display: none !important; }
}

/* ── Entrance Animations ────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes softBounceIn {
    0%   { opacity: 0; transform: translateY(20px) scale(0.96); }
    60%  { opacity: 1; transform: translateY(-3px) scale(1.01); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Reusable animation utility classes ───────────────────────────────── */
.anim-fade-up     { animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1) both; }
.anim-fade-in     { animation: fadeIn 0.4s ease-out both; }
.anim-scale-in    { animation: scaleIn 0.4s cubic-bezier(0.23,1,0.32,1) both; }
.anim-slide-right { animation: slideInRight 0.4s cubic-bezier(0.23,1,0.32,1) both; }
.anim-slide-left  { animation: slideInLeft 0.4s cubic-bezier(0.23,1,0.32,1) both; }
.anim-bounce-in   { animation: softBounceIn 0.5s cubic-bezier(0.23,1,0.32,1) both; }

/* Stagger delay helpers (combine with any anim- class) */
.anim-d1 { animation-delay: 0.04s; }
.anim-d2 { animation-delay: 0.08s; }
.anim-d3 { animation-delay: 0.12s; }
.anim-d4 { animation-delay: 0.16s; }
.anim-d5 { animation-delay: 0.20s; }
.anim-d6 { animation-delay: 0.24s; }
.anim-d7 { animation-delay: 0.28s; }
.anim-d8 { animation-delay: 0.32s; }

/* ── Global page-level entrance ───────────────────────────────────────── */
/* Every page container fades in smoothly */
.page-container {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}

/* Page headers always glide in */
.page-header { animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both; }

/* Cards in any grid stagger */
.card-grid > *, .card-grid-3 > *, .card-grid-4 > * {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
.card-grid > *:nth-child(1),  .card-grid-3 > *:nth-child(1),  .card-grid-4 > *:nth-child(1)  { animation-delay: 0.03s; }
.card-grid > *:nth-child(2),  .card-grid-3 > *:nth-child(2),  .card-grid-4 > *:nth-child(2)  { animation-delay: 0.07s; }
.card-grid > *:nth-child(3),  .card-grid-3 > *:nth-child(3),  .card-grid-4 > *:nth-child(3)  { animation-delay: 0.11s; }
.card-grid > *:nth-child(4),  .card-grid-3 > *:nth-child(4),  .card-grid-4 > *:nth-child(4)  { animation-delay: 0.15s; }
.card-grid > *:nth-child(5),  .card-grid-3 > *:nth-child(5),  .card-grid-4 > *:nth-child(5)  { animation-delay: 0.19s; }
.card-grid > *:nth-child(6),  .card-grid-3 > *:nth-child(6),  .card-grid-4 > *:nth-child(6)  { animation-delay: 0.23s; }
.card-grid > *:nth-child(n+7),.card-grid-3 > *:nth-child(n+7),.card-grid-4 > *:nth-child(n+7) { animation-delay: 0.26s; }

/* Standalone .card elements inside page-container stagger naturally */
.page-container > .card,
.page-container > div > .card,
.page-container > form > .card {
    animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1) both;
}
.page-container > .card:nth-child(1), .page-container > div > .card:nth-child(1) { animation-delay: 0.04s; }
.page-container > .card:nth-child(2), .page-container > div > .card:nth-child(2) { animation-delay: 0.10s; }
.page-container > .card:nth-child(3), .page-container > div > .card:nth-child(3) { animation-delay: 0.16s; }
.page-container > .card:nth-child(4), .page-container > div > .card:nth-child(4) { animation-delay: 0.22s; }
.page-container > .card:nth-child(n+5), .page-container > div > .card:nth-child(n+5) { animation-delay: 0.26s; }

/* ── Selectable grids (conditions / goals picker) ─────────────────────── */
.selectable-grid > * {
    animation: scaleIn 0.35s cubic-bezier(0.23,1,0.32,1) both;
}
.selectable-grid > *:nth-child(1)  { animation-delay: 0.02s; }
.selectable-grid > *:nth-child(2)  { animation-delay: 0.05s; }
.selectable-grid > *:nth-child(3)  { animation-delay: 0.08s; }
.selectable-grid > *:nth-child(4)  { animation-delay: 0.11s; }
.selectable-grid > *:nth-child(5)  { animation-delay: 0.14s; }
.selectable-grid > *:nth-child(6)  { animation-delay: 0.17s; }
.selectable-grid > *:nth-child(7)  { animation-delay: 0.20s; }
.selectable-grid > *:nth-child(8)  { animation-delay: 0.23s; }
.selectable-grid > *:nth-child(n+9){ animation-delay: 0.25s; }

/* ── Landing page ─────────────────────────────────────────────────────── */
.landing-goal, .landing-feature, .landing-condition-pill {
    animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Dashboard ────────────────────────────────────────────────────────── */
/* ── Dashboard Hero ─────────────────────────────────────────────────────── */
.dash-hero {
    position: relative; overflow: hidden; animation: fadeIn 0.5s ease-out;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    margin-bottom: var(--space-6); color: #fff;
    box-shadow: 0 8px 32px rgba(94,112,80,0.25);
}
.dash-hero-bg {
    position: absolute; inset: 0; z-index: 0;
    background:
        linear-gradient(160deg, #8fa580 0%, var(--accent) 30%, var(--accent-hover) 60%, var(--accent-pressed) 100%);
}
.dash-hero-bg::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 600px 400px at 85% 15%, rgba(255,255,255,0.18) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 10% 90%, rgba(0,0,0,0.10) 0%, transparent 60%),
        radial-gradient(circle 300px at 50% 50%, rgba(255,255,255,0.04) 0%, transparent 100%);
}
.dash-hero-bg::after {
    content: '\1F33F\00a0\1F331\00a0\1F343';
    position: absolute; right: -10px; bottom: -30px;
    font-size: 120px; opacity: 0.06; pointer-events: none; line-height: 1;
    transform: rotate(-12deg); letter-spacing: -20px; white-space: nowrap;
}
.dash-hero-inner {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: var(--space-6);
    padding: var(--space-7) var(--space-6) var(--space-6);
}
.dash-hero-text { flex: 1; min-width: 0; }
.dash-hero-badge {
    display: inline-block; padding: 5px 16px; border-radius: 100px;
    background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
    font-size: var(--font-size-s); font-weight: 600; letter-spacing: 0.03em;
    margin-bottom: var(--space-3); border: 1px solid rgba(255,255,255,0.2);
}
.dash-hero-title {
    font-family: var(--font-family-serif); font-size: var(--font-size-xl);
    font-weight: 700; line-height: 1.15; margin-bottom: var(--space-2);
    letter-spacing: -0.01em;
}
.dash-hero-sub {
    font-size: var(--font-size-m); opacity: 0.88; line-height: 1.5;
    margin-bottom: var(--space-4); max-width: 380px;
}
.dash-hero-cta {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; color: var(--accent-pressed); font-weight: 600;
    padding: 12px 28px; border-radius: var(--radius-pill);
    font-size: var(--font-size-base); border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    transition: all var(--transition-smooth);
}
.dash-hero-cta:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.18); transform: translateY(-1px);
    text-decoration: none; color: var(--accent-pressed);
}

/* Glass stat cards */
.dash-hero-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    flex-shrink: 0; width: 280px;
}
.dash-stat-glass {
    background: rgba(255,255,255,0.13); backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--radius-l); padding: var(--space-3) var(--space-3);
    text-align: center; display: flex; flex-direction: column; align-items: center;
    gap: 2px; transition: all var(--transition-fast);
}
.dash-stat-glass:hover {
    background: rgba(255,255,255,0.20);
    border-color: rgba(255,255,255,0.30);
    transform: translateY(-2px);
}
.dash-stat-icon { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-bottom: 2px; opacity: 0.85; }
.dash-stat-num { font-size: var(--font-size-l); font-weight: 800; line-height: 1; }
.dash-stat-label { font-size: 11px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }

@media (max-width: 768px) {
    .dash-hero-inner { flex-direction: column; text-align: center; padding: var(--space-6) var(--space-4) var(--space-5); }
    .dash-hero-sub { max-width: none; }
    .dash-hero-stats { width: 100%; max-width: 320px; }
    .dash-hero-cta { width: 100%; justify-content: center; }
}
@media (max-width: 480px) {
    .dash-hero-inner { padding: var(--space-5) var(--space-3) var(--space-4); gap: var(--space-4); }
    .dash-hero-title { font-size: var(--font-size-l); }
    .dash-hero-sub { font-size: var(--font-size-base); }
    .dash-hero-stats { gap: 8px; }
    .dash-stat-glass { padding: var(--space-2); }
    .dash-stat-num { font-size: var(--font-size-m); }
}
.dash-member-card { animation: scaleIn 0.35s cubic-bezier(0.23,1,0.32,1) both; }
.dash-member-card:nth-child(1) { animation-delay: 0.05s; }
.dash-member-card:nth-child(2) { animation-delay: 0.10s; }
.dash-member-card:nth-child(3) { animation-delay: 0.15s; }
.dash-member-card:nth-child(4) { animation-delay: 0.20s; }
.dash-member-card:nth-child(5) { animation-delay: 0.25s; }
.dash-plan-card { animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1) 0.12s both; }

/* ── Meal plan view — day cards stagger ───────────────────────────────── */
.meal-day-card {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
.meal-day-card:nth-child(1) { animation-delay: 0.03s; }
.meal-day-card:nth-child(2) { animation-delay: 0.07s; }
.meal-day-card:nth-child(3) { animation-delay: 0.11s; }
.meal-day-card:nth-child(4) { animation-delay: 0.15s; }
.meal-day-card:nth-child(5) { animation-delay: 0.19s; }
.meal-day-card:nth-child(6) { animation-delay: 0.23s; }
.meal-day-card:nth-child(7) { animation-delay: 0.27s; }

/* ── Grocery list — categories stagger ────────────────────────────────── */
.grocery-category {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
.grocery-category:nth-child(1) { animation-delay: 0.03s; }
.grocery-category:nth-child(2) { animation-delay: 0.07s; }
.grocery-category:nth-child(3) { animation-delay: 0.11s; }
.grocery-category:nth-child(4) { animation-delay: 0.15s; }
.grocery-category:nth-child(n+5) { animation-delay: 0.19s; }

/* ── Profile sections stagger ─────────────────────────────────────────── */
.profile-section {
    animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1) both;
}
.profile-section:nth-child(1) { animation-delay: 0.04s; }
.profile-section:nth-child(2) { animation-delay: 0.10s; }
.profile-section:nth-child(3) { animation-delay: 0.16s; }
.profile-section:nth-child(4) { animation-delay: 0.22s; }
.profile-section:nth-child(5) { animation-delay: 0.28s; }
.profile-section:nth-child(n+6) { animation-delay: 0.32s; }

/* ── Auth pages (login, register, onboarding) ─────────────────────────── */
.auth-card {
    animation: softBounceIn 0.55s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Learn page cards ─────────────────────────────────────────────────── */
.learn-card {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Community features ───────────────────────────────────────────────── */
.community-feature {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
.community-feature:nth-child(1) { animation-delay: 0.04s; }
.community-feature:nth-child(2) { animation-delay: 0.10s; }
.community-feature:nth-child(3) { animation-delay: 0.16s; }
.community-feature:nth-child(n+4) { animation-delay: 0.22s; }

/* ── Recipe cards stagger ─────────────────────────────────────────────── */
.recipe-card {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Food cards stagger ───────────────────────────────────────────────── */
.food-card {
    animation: scaleIn 0.35s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Condition cards stagger ──────────────────────────────────────────── */
.condition-card {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Wizard step indicator ────────────────────────────────────────────── */
.wizard-steps {
    animation: fadeIn 0.35s ease-out both;
}

/* ── Hero sections across pages ───────────────────────────────────────── */
.page-hero,
.section-hero {
    animation: fadeIn 0.5s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Admin table rows ─────────────────────────────────────────────────── */
.admin-table tbody tr {
    animation: fadeIn 0.3s ease-out both;
}
.admin-table tbody tr:nth-child(1)  { animation-delay: 0.02s; }
.admin-table tbody tr:nth-child(2)  { animation-delay: 0.04s; }
.admin-table tbody tr:nth-child(3)  { animation-delay: 0.06s; }
.admin-table tbody tr:nth-child(4)  { animation-delay: 0.08s; }
.admin-table tbody tr:nth-child(5)  { animation-delay: 0.10s; }
.admin-table tbody tr:nth-child(n+6){ animation-delay: 0.12s; }

/* ── Icon entrance (subtle pop) ───────────────────────────────────────── */
.icon-animate {
    animation: scaleIn 0.35s cubic-bezier(0.23,1,0.32,1) 0.1s both;
}

/* ── Chat messages ────────────────────────────────────────────────────── */
.chat-message {
    animation: slideInRight 0.3s cubic-bezier(0.23,1,0.32,1) both;
}
.chat-message.assistant {
    animation-name: slideInLeft;
}

/* ── Accordion body expand ────────────────────────────────────────────── */
.accordion-body {
    animation: fadeIn 0.25s ease-out;
}

/* ── Smooth hover lifts ───────────────────────────────────────────────── */
.card,
.recipe-card,
.food-card,
.learn-card,
.selectable-card,
.community-feature,
.condition-card,
.program-card,
.education-card {
    transition: transform 0.2s cubic-bezier(0.23,1,0.32,1), box-shadow 0.2s ease;
}
.card:hover,
.recipe-card:hover,
.food-card:hover,
.learn-card:hover,
.community-feature:hover,
.condition-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-8);
}

/* ── Respect reduced motion preference ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Smooth Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 100px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Focus Ring (accessibility) ────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-s);
}

/* ── Selection ─────────────────────────────────────────────────────────── */
::selection {
    background: rgba(107,124,107,0.2);
    color: var(--text-primary);
}

/* ── Smooth hover glow on interactive cards ────────────────────────────── */
.landing-condition-pill,
.landing-goal,
.landing-feature,
.recipe-card,
.food-card,
.program-card,
.education-card,
.learn-card {
    position: relative;
}

/* ── Alert auto-dismiss animation ──────────────────────────────────────── */
.alert[data-auto-dismiss] {
    animation: fadeInUp 0.3s ease-out, fadeOut 0.4s ease-out 4s forwards;
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}

/* ── Responsive polish ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .card { padding: var(--space-4); }
    .card-grid { gap: var(--space-3); }
    .btn-lg { padding: 12px 24px; }
}

@media (max-width: 480px) {
    .card { padding: var(--space-3); border-radius: var(--radius-l); }
    .card-grid, .card-grid-3, .card-grid-4 { gap: var(--space-3); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Profile Redesign — stacked cards, sticky pill nav, floating save bar
   ═══════════════════════════════════════════════════════════════════════════ */
.pf-shell {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--space-3) 120px;
}

.pf-header { padding: var(--space-2) var(--space-3) 0; }
.pf-header h1 {
    font-family: var(--font-family-display);
    font-size: 26px; font-weight: 700; letter-spacing: -0.4px;
    margin: 0; color: var(--text-primary);
}
.pf-header-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; overflow-wrap: anywhere; word-break: break-word; }

/* Sticky pill nav — opt-in variant applied alongside .profile-section-nav */
.profile-section-nav.pf-sticky-nav {
    position: sticky;
    top: var(--nav-height, 60px);
    z-index: 90;
    display: flex;
    gap: 6px;
    padding: 10px var(--space-3);
    margin: var(--space-3) calc(-1 * var(--space-3)) var(--space-3);
    background: color-mix(in srgb, var(--bg-layer1) 94%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
    max-width: none;
}
.profile-section-nav.pf-sticky-nav::-webkit-scrollbar { display: none; }

.pf-sticky-nav .profile-nav-link {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 12px; font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.15s;
}
.pf-sticky-nav .profile-nav-link:hover {
    color: var(--accent); border-color: var(--accent); text-decoration: none;
}
.pf-sticky-nav .profile-nav-link.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.pf-nav-icon { font-size: 13px; line-height: 1; display: inline-flex; align-items: center; }
.pf-nav-icon svg { width: 14px; height: 14px; }

/* Cards */
.pf-card {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: var(--space-4);
    margin-bottom: 14px;
}
.pf-card-head {
    display: flex; align-items: center; gap: var(--space-2);
    margin-bottom: var(--space-1);
}
.pf-card-head-icon {
    width: 28px; height: 28px;
    border-radius: 9px;
    background: var(--accent-light);
    color: var(--accent-pressed);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.pf-card-head-icon img { width: 16px; height: 16px; }
.pf-card-head-icon svg { width: 16px; height: 16px; }
.pf-card-title {
    font-family: var(--font-family-display);
    font-size: 18px; font-weight: 700; letter-spacing: -0.3px;
    margin: 0; color: var(--text-primary);
}
.pf-card-sub {
    font-size: 12px; color: var(--text-secondary);
    margin: 4px 0 var(--space-3); padding-left: 36px; line-height: 1.45;
}

/* Eyebrows */
.pf-eyebrow {
    font-size: 11px; font-weight: 700;
    color: var(--accent-pressed);
    letter-spacing: 0.08em; text-transform: uppercase;
    margin-bottom: var(--space-2);
}
.pf-eyebrow-muted { color: var(--text-secondary); }

/* Subscription status block */
.pf-status {
    background: var(--accent-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-l);
    padding: 14px;
    margin-bottom: var(--space-3);
    display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.pf-status-inner { min-width: 0; }
.pf-status-plan {
    font-family: var(--font-family-display);
    font-size: 20px; font-weight: 700;
    color: var(--text-primary); margin-top: 2px;
}
.pf-status-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.pf-status-badge {
    font-size: 10px; font-weight: 700; color: #fff;
    background: var(--accent);
    padding: 4px 10px; border-radius: 999px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.pf-status-badge-trial { background: var(--accent-pressed); }

/* Check list */
.pf-check-list { margin-bottom: var(--space-3); }
.pf-check-row {
    display: flex; align-items: center; gap: var(--space-2);
    padding: 4px 0;
    font-size: 13px; color: var(--text-primary);
}
.pf-check-row svg { color: var(--accent); flex-shrink: 0; }

/* Full-width pill primary + ghost row */
.pf-btn-full {
    width: 100%; height: 44px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.pf-btn-row { display: flex; gap: 8px; margin-top: 8px; }
.pf-btn-row .btn { flex: 1; height: 40px; border-radius: 999px; }

.pf-footnote { font-size: 11px; color: var(--text-secondary); margin-top: 10px; line-height: 1.4; }

/* Personal — identity row */
.pf-identity {
    display: flex; gap: 12px; align-items: center;
    margin-bottom: 14px;
}
.pf-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    position: relative; cursor: pointer; flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 3px var(--border-color);
    background: var(--accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.4rem;
    background-size: cover; background-position: center;
    border: none;
    font-family: var(--font-family-display);
}
.pf-avatar-badge {
    position: absolute; bottom: -2px; right: -2px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-base);
    display: flex; align-items: center; justify-content: center; color: #fff;
}
.pf-identity-meta .t { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.pf-identity-meta .s { font-size: 11px; color: var(--text-secondary); line-height: 1.4; margin-top: 2px; }

/* Grids */
.pf-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-bottom: 12px; }
.pf-grid-2-tight { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pf-field-stack { margin-bottom: 12px; }

/* Compact labels */
.pf-label {
    font-size: 10px; font-weight: 700; color: var(--text-primary);
    letter-spacing: 0.08em; text-transform: uppercase;
    margin-bottom: 6px; display: block;
}
.pf-label .req { color: #c62828; margin-left: 3px; }

/* Slim input wrapper — pairs input + suffix */
.pf-input-wrap {
    display: flex; align-items: center;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 12px; height: 40px;
    transition: border-color var(--transition-fast);
}
.pf-input-wrap:focus-within { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.pf-input-wrap input,
.pf-input-wrap select {
    border: none; outline: none; flex: 1; min-width: 0;
    font-size: 14px; color: var(--text-primary);
    background: transparent; font-family: inherit;
    height: 100%;
    appearance: none; -webkit-appearance: none;
}
.pf-input-wrap .suffix {
    font-size: 12px; color: var(--text-secondary);
    margin-left: 6px; white-space: nowrap;
}
.pf-help { font-size: 11px; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }

/* Divider inside card */
.pf-divider {
    margin: 6px -4px 14px;
    padding: 10px 4px 0;
    border-top: 1px solid var(--border-color);
}
.pf-divider .pf-eyebrow { margin-bottom: 2px; }

/* Calorie result (gradient) */
.pf-result {
    border-radius: var(--radius-l);
    padding: 14px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-pressed));
    color: #fff;
    position: relative; overflow: hidden;
}
.pf-result-eyebrow {
    font-size: 10px; font-weight: 700;
    letter-spacing: 0.14em; opacity: 0.85;
}
.pf-result-big { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.pf-result-big .num {
    font-family: var(--font-family-display);
    font-size: 34px; font-weight: 700; line-height: 1;
}
.pf-result-big .unit { font-size: 14px; font-weight: 500; opacity: 0.85; }
.pf-result-macros {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 8px; margin-top: 12px;
}
.pf-result-macros > div {
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 8px 6px;
    text-align: center;
}
.pf-result-macros .bar {
    width: 14px; height: 3px; border-radius: 2px;
    margin: 0 auto 5px;
}
.pf-result-macros .val {
    font-family: var(--font-family-display);
    font-size: 14px; font-weight: 700;
}
.pf-result-macros .val span { font-size: 10px; margin-left: 1px; opacity: 0.8; }
.pf-result-macros .lbl {
    font-size: 9px; opacity: 0.85; letter-spacing: 0.4px; margin-top: 1px;
    text-transform: uppercase;
}
.pf-result-foot { font-size: 10px; opacity: 0.75; margin-top: 10px; line-height: 1.4; }

/* Appearance segmented control */
.pf-segmented {
    display: flex;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-radius: 10px; padding: 3px; gap: 2px;
}
.pf-segmented button {
    flex: 1; height: 32px; border: none; border-radius: 8px;
    background: transparent; color: var(--accent-pressed);
    font-size: 12px; font-weight: 600; cursor: pointer;
    font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.pf-segmented button.active {
    background: var(--bg-base);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(45,58,30,0.1);
}

.pf-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Household row */
.pf-house-row { display: flex; align-items: center; gap: 12px; }
.pf-house-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-family-display);
    font-size: 16px; font-weight: 700;
    flex-shrink: 0;
    background-size: cover; background-position: center;
}
.pf-house-meta { flex: 1; min-width: 0; }
.pf-house-meta .t { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.pf-house-meta .s { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Provider rows (Grocery Ordering) */
.pf-provider-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
}
.pf-provider-row.first { border-top: none; padding-top: 0; }
.pf-provider-tile {
    width: 32px; height: 32px; border-radius: 9px;
    background: var(--bg-layer2); border: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: var(--text-primary); font-weight: 700;
    flex-shrink: 0;
}
.pf-provider-meta { flex: 1; min-width: 0; }
.pf-provider-meta .t { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.pf-provider-meta .s { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.pf-connect-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-m);
    padding: var(--space-4);
    margin-top: var(--space-3);
}

/* Plan grid (empty-state subscription) */
.pf-plan-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-3);
}

/* Floating save bar */
.pf-save-bar {
    position: fixed; left: 0; right: 0;
    bottom: 0;
    z-index: 150;
    padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent 0, color-mix(in srgb, var(--bg-layer1) 95%, transparent) 40%);
    pointer-events: none;
    transform: translateY(140%);
    transition: transform 0.25s cubic-bezier(.2,.9,.3,1);
}
.pf-save-bar.visible { transform: translateY(0); }
@media (max-width: 768px) {
    .pf-save-bar { bottom: var(--bottom-nav-height, 68px); }
}
.pf-save-inner {
    max-width: 720px; margin: 0 auto;
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-base);
    border-radius: 999px;
    box-shadow: 0 12px 28px -8px rgba(45,58,30,0.22), 0 0 0 1px var(--border-color);
    padding: 6px;
    pointer-events: auto;
}
.pf-save-msg {
    flex: 1; font-size: 12px; color: var(--text-primary);
    padding-left: 12px;
    display: flex; align-items: center; gap: 6px;
}
.pf-save-dot { width: 7px; height: 7px; border-radius: 50%; background: #C68B2E; }
.pf-save-discard {
    height: 36px; padding: 0 14px; border-radius: 999px;
    background: transparent; border: none;
    color: var(--text-secondary); font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.pf-save-discard:hover { color: var(--text-primary); }
.pf-save-primary {
    height: 36px; padding: 0 16px; border-radius: 999px;
    background: var(--accent); color: #fff; border: none;
    font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.pf-save-primary:hover { background: var(--accent-hover); }

/* Dashed empty callout */
.pf-empty-callout {
    padding: 12px; border-radius: 10px;
    background: var(--bg-layer1);
    border: 1px dashed var(--border-color);
    font-size: 12px; color: var(--text-secondary);
    text-align: center;
}

/* Pantry add row */
.pf-add-row { display: flex; gap: 8px; margin-bottom: 10px; }
.pf-add-row .pf-input-wrap { flex: 1; }

/* Responsive: macros to 2-col on narrow */
@media (max-width: 520px) {
    .pf-result-macros { grid-template-columns: repeat(2, 1fr); }
}
