/* ─────────────────────────────────────────────────────────────────────────────
   AIM (AI Menu) — Calm Editorial Design System CSS
   Playfair Display + Inter typography, minimal warm aesthetic, mobile-first
───────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
    --font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-family-serif: "Playfair Display", 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 dark;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

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); }
.badge-breakfast { background: #fff4e5; color: #b85c00; }
.badge-lunch     { background: #e5f4ff; color: #0057b8; }
.badge-dinner    { background: #f0e5ff; color: #6b00b8; }
.badge-snack     { background: #e5fff4; color: #006b39; }

/* ── 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;
}

.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); }
    .grocery-page-header h1 { font-size: var(--font-size-l); margin: var(--space-2) 0 var(--space-1); }
    .grocery-hero { padding: var(--space-4) var(--space-3); margin-bottom: var(--space-3); border-radius: var(--radius-l); }
    .grocery-hero-title { font-size: var(--font-size-l); margin: var(--space-1) 0 2px; }
    .grocery-hero-date { margin-bottom: var(--space-3); }
    .grocery-stats { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
    .grocery-stat { padding: var(--space-2); gap: var(--space-1); }
    .grocery-stat-num { font-size: 1.15rem; }
    .grocery-stat-label { font-size: var(--font-size-xs); }
    .grocery-toolbar { flex-wrap: wrap; gap: var(--space-2); }
    .grocery-toolbar-progress { flex: 1 1 100%; }
    .grocery-toolbar-btn { flex: 1 1 auto; text-align: center; font-size: var(--font-size-xs); }
    .grocery-export-card { padding: var(--space-3); margin-bottom: var(--space-3); }
    .grocery-export-form { flex-direction: column; align-items: stretch; gap: var(--space-2); }
    .grocery-export-form > div { width: 100%; }
    .grocery-export-form select { width: 100%; }
    .grocery-order-btns { flex-direction: column; }
    .grocery-order-btns .btn { width: 100%; text-align: center; }
    .grocery-categories { gap: var(--space-3); }
    .grocery-cat-toggle { padding: var(--space-2) var(--space-3); gap: var(--space-2); }
    .grocery-cat-badge { width: 32px; height: 32px; }
    .grocery-cat-badge span { font-size: var(--font-size-xs); }
    .grocery-cat-name { font-size: var(--font-size-base); }
    .grocery-cat-meta { font-size: var(--font-size-xs); }
    .grocery-label { padding: var(--space-2) var(--space-3); gap: var(--space-2); }
    .grocery-check { width: 18px; height: 18px; }
    .grocery-name { font-size: var(--font-size-s); }
    .grocery-qty { font-size: var(--font-size-xs); }
    .grocery-cost { font-size: var(--font-size-xs); min-width: 42px; }

    /* 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: block; 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;
}

/* ── 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: #e0f2f1; color: #00695c; }
.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: #e5f4ff; color: #0057b8; }
.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; gap: 0; background: var(--bg-layer2); border-radius: var(--radius-m); overflow: hidden; border: 1px solid var(--border-color); }
.cal-tab { padding: var(--space-2) var(--space-4); border: none; background: none; font-size: var(--font-size-s); font-weight: 600; cursor: pointer; color: var(--text-secondary); transition: background .15s, color .15s; }
.cal-tab:hover { background: var(--bg-layer1); }
.cal-tab.active { background: var(--accent); color: #fff; }
.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-body { padding: var(--space-2); flex: 1; overflow-y: auto; }

/* 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); }

    /* 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); }
}
@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: keep horizontal scroll, just smaller min-width */
    .cal-week-grid { grid-template-columns: repeat(7, minmax(100px, 1fr)); }

    /* Page header buttons stack */
    .page-header-actions { flex-direction: column; }
    .page-header-actions .btn { width: 100%; }
}

/* ── 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 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-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; }

/* ── Swap Picker Modal ─────────────────────────────────────────────────── */
.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; }
.swap-modal { background: var(--bg-base); border-radius: var(--radius-l); box-shadow: var(--shadow-8); width: 90%; max-width: 480px; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; }
.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); }
.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; }
.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-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: #fff4e5; color: #b85c00; }
.meal-type-badge.lunch     { background: #e5f4ff; color: #0057b8; }
.meal-type-badge.dinner    { background: #f0e5ff; color: #6b00b8; }
.meal-type-badge.snack     { background: #e5fff4; color: #006b39; }

/* Dashboard — household strip */
.dash-member-card {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
    min-width: 90px; padding: var(--space-3); background: var(--bg-base);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-2);
    text-align: center; flex-shrink: 0; 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); }
.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; }
    .dash-plan-actions .btn { width: 100%; }
    .dash-plan-header { gap: var(--space-2); }
    .dash-plan-icon { font-size: 1.25rem; }
    .dash-plan-title { font-size: var(--font-size-s); }
    .dash-plan-meta { font-size: 11px; }
    .dash-days-left { font-size: var(--font-size-m); }
    .dash-plan-progress { margin: var(--space-2) 0; }
    .dash-plan-bar { height: 8px; }
    .dash-members { gap: var(--space-2); }
    .dash-member-card { min-width: 80px; padding: var(--space-2); }
}
@media (max-width: 480px) {
    .dash-plan-card { padding: var(--space-3); }
    .dash-plan-meta { flex-direction: column; align-items: flex-start; gap: 2px; }
    .dash-days-left { font-size: var(--font-size-s); }
    .dash-plan-pct { font-size: 11px; }
}

/* 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; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.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 { font-size: 25px; margin-bottom: var(--space-2); }
.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: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--space-4); }
.history-card h3 { margin: var(--space-2) 0 var(--space-1); }
.history-card-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

/* ── 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 (compact shopping-list layout) ──────────────────────────── */
.grocery-page {
    max-width: 560px;
    margin: 0 auto;
    padding: var(--space-5) var(--space-4);
}

/* ── Hero ── */
.grocery-hero {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 50%, var(--accent-pressed) 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    color: #fff;
    margin-bottom: var(--space-5);
    position: relative;
    overflow: hidden;
}
.grocery-hero-bg {
    position: absolute; top: -30px; right: -20px;
    width: 140px; height: 140px;
    background: rgba(255,255,255,0.06); border-radius: 50%;
}
.grocery-hero-back { color: rgba(255,255,255,0.8); font-size: var(--font-size-s); text-decoration: none; }
.grocery-hero-title { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; margin: var(--space-2) 0 var(--space-1); }
.grocery-hero-date { opacity: 0.85; font-size: var(--font-size-s); margin-bottom: var(--space-4); }

.grocery-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-3);
}
.grocery-stat {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-m);
    padding: var(--space-2) var(--space-3);
    display: flex; align-items: center; gap: var(--space-2);
}
.grocery-stat-num { font-size: 1.5rem; font-weight: 700; }
.grocery-stat-label { font-size: var(--font-size-s); opacity: 0.9; white-space: nowrap; }

/* ── Toolbar: progress bar + action buttons inline ── */
.grocery-toolbar {
    display: flex; align-items: center; gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.grocery-toolbar-progress {
    flex: 0 1 50%; min-width: 0;
    padding: var(--space-2) var(--space-3) !important;
    margin: 0;
}
.grocery-toolbar-btn {
    white-space: nowrap; flex-shrink: 0;
    font-size: var(--font-size-s);
}

/* ── Export / order section ── */
.grocery-export-card { padding: var(--space-4); margin-bottom: var(--space-5); }
.grocery-export-header { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.grocery-export-desc { font-size: var(--font-size-s); color: var(--text-secondary); margin-bottom: var(--space-3); }
.grocery-export-form { display: flex; gap: var(--space-3); align-items: end; flex-wrap: wrap; }

.grocery-order-section { padding-top: var(--space-4); }
.grocery-order-section.has-border { margin-top: var(--space-4); border-top: 1px solid var(--border-color); }
.grocery-order-btns { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.grocery-btn-kroger { background: #0056a4; color: #fff; border-color: #0056a4; }
.grocery-btn-kroger:hover { background: #004080; }
.grocery-btn-kroger-outline { background: transparent; color: #0056a4; border: 1px solid #0056a4; }
.grocery-btn-instacart { background: #43b02a; color: #fff; border-color: #43b02a; }
.grocery-btn-instacart:hover { background: #369122; }
.grocery-btn-instacart-outline { background: transparent; color: #43b02a; border: 1px solid #43b02a; }

/* ── Category list ── */
.grocery-categories {
    display: flex; flex-direction: column; gap: var(--space-4);
}
.grocery-category {
    border-radius: var(--radius-l);
    background: var(--bg-base);
    box-shadow: var(--shadow-2);
    overflow: hidden;
}

/* ── Category toggle ── */
.grocery-cat-toggle {
    width: 100%; background: none; border: none;
    padding: var(--space-3) var(--space-4);
    display: flex; align-items: center; gap: var(--space-3);
    cursor: pointer; font-family: var(--font-family);
    color: var(--text-primary); text-align: left;
}
.grocery-cat-badge {
    width: 40px; height: 40px; border-radius: var(--radius-m);
    background: var(--accent-light);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.grocery-cat-badge span { font-weight: 700; color: var(--accent); font-size: var(--font-size-s); }
.grocery-cat-name { font-weight: 600; font-size: var(--font-size-m); }
.grocery-cat-meta { font-size: var(--font-size-s); color: var(--text-secondary); }

/* Mini progress bar inside each category header */
.grocery-cat-progress {
    width: 40px; height: 4px; border-radius: 2px;
    background: var(--bg-layer2); flex-shrink: 0;
}
.grocery-cat-progress-fill {
    height: 100%; border-radius: 2px;
    background: var(--accent); transition: width .3s ease;
}

.accordion-chevron-icon {
    font-size: var(--font-size-m); color: var(--text-tertiary); transition: transform 0.2s;
}

/* ── Item rows ── */
.grocery-item { border-bottom: 1px solid var(--border-color); }
.grocery-label {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer; transition: background 0.1s;
}
.grocery-label:hover { background: var(--bg-layer2); }
.grocery-check {
    width: 20px; height: 20px; accent-color: var(--accent);
    cursor: pointer; flex-shrink: 0;
}
.grocery-name { flex: 1; font-size: var(--font-size-base); }
.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: 600; color: var(--accent);
    white-space: nowrap; min-width: 50px; text-align: right;
}

.accordion-panel { border-top: 1px solid var(--border-color); }
.accordion-toggle[aria-expanded='false'] + .accordion-panel { display: none; }
.accordion-toggle[aria-expanded='false'] .accordion-chevron-icon { transform: rotate(-90deg); }
.grocery-item:last-child { border-bottom: none !important; }

/* ── 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; }

/* 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 – blue-green */
.tag-condition { background: #e0f2f1; color: #00695c; }
/* Goal tags – teal */
.tag-goal { background: #e0f2f1; color: #00695c; }

[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: #0a2e2a; color: #80cbc4; }
[data-theme="dark"] .tag-goal      { background: #0a2e2a; color: #80cbc4; }

/* ── 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); }

.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: var(--accent);
    color: #fff;
    padding: var(--space-8) 0;
}
.community-hero-bg {
    display: none;
}
.community-hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    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);
}
.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 {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    padding: var(--space-5);
    transition: box-shadow var(--transition-smooth);
}
.community-feature-card:hover { box-shadow: var(--shadow-4); }
.community-feature-icon { font-size: 1.5rem; margin-bottom: var(--space-3); }
.community-feature-card h3 { font-family: var(--font-family-serif); font-size: var(--font-size-m); font-weight: 500; margin-bottom: var(--space-2); }
.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 { font-size: 2rem; margin-bottom: var(--space-4); }
.community-sso-callout h2 { font-family: var(--font-family-serif); font-weight: 500; margin-bottom: var(--space-3); }
.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); }

/* 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; }
    .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;
}

@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%;
    max-width: 480px;
    margin: 0 auto;
    height: 100%;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--space-1) var(--space-2);
    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: 56px;
    -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); }
}
