/* ─────────────────────────────────────────────────────────────────────────────
   AIM (AI Menu) — Calm Editorial Design System CSS
   Fraunces + Inter typography, minimal warm aesthetic, mobile-first
───────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
    --font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-family-serif: "Fraunces", Georgia, "Times New Roman", serif;
    --font-family-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-size-xs:   11px;
    --font-size-s:    13px;
    --font-size-base: 15px;
    --font-size-m:    17px;
    --font-size-l:    22px;
    --font-size-xl:   30px;
    --font-size-2xl:  42px;

    --radius-s:  6px;
    --radius-m:  10px;
    --radius-l:  14px;
    --radius-xl: 20px;
    --radius-pill: 100px;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    /* Sage green accent — calm, wellness-oriented */
    --accent:         #7B8E6B;
    --accent-hover:   #6B7E5B;
    --accent-pressed: #5E7050;
    --accent-light:   #f0f3ed;
    --accent-glow:    rgba(123,142,107,0.15);

    /* Neutrals (light mode) — warm cream tones */
    --bg-base:        #ffffff;
    --bg-layer1:      #eae7df;
    --bg-layer2:      #e1ded8;
    --border-color:   rgba(0, 0, 0, 0.08);
    --text-primary:   #2c2c2c;
    --text-secondary: #6b6b6b;
    --text-tertiary:  #9a9a9a;

    --shadow-2: 0 2px 6px rgba(0,0,0,.08);
    --shadow-4: 0 3px 10px rgba(0,0,0,.10);
    --shadow-8: 0 4px 16px rgba(0,0,0,.12);
    --shadow-glow: 0 0 0 3px var(--accent-glow);

    --nav-height: 60px;
    --bottom-nav-height: 68px;
    --content-max-width: 1280px;

    --transition-fast: 0.15s ease;
    --transition-spring: 0.25s ease;
    --transition-smooth: 0.2s ease;
}

/* ── Dark Mode ─────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg-base:        #000000;
    --bg-layer1:      #0d0d0d;
    --bg-layer2:      #1a1a1a;
    --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:   #1f1f1f;
    --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; }

em,
i,
cite,
dfn,
var,
address {
    font-style: normal;
}

html {
    font-size: var(--font-size-base);
    color-scheme: light;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-layer1);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: -0.01em;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
    padding-bottom: var(--bottom-nav-height); /* space for mobile bottom nav */
}

@media (min-width: 769px) {
    body { padding-bottom: 0; }
}

a { color: var(--accent-hover); text-decoration: none; transition: color var(--transition-fast); }
a:hover { text-decoration: underline; color: var(--accent-pressed); }
img { max-width: 100%; height: auto; }

/* ── Layout Shell ──────────────────────────────────────────────────────────── */
.app-root { display: flex; flex-direction: column; min-height: 100vh; }

.app-main {
    flex: 1;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-7) var(--space-5);
    width: 100%;
}

/* ── Navigation Bar ────────────────────────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--nav-height);
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.nav-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: var(--content-max-width);
    margin: 0 auto;
    height: 100%;
    padding: 0 var(--space-5);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-m);
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
}

.brand:hover { text-decoration: none; color: var(--accent); }
.brand-icon { font-size: 22px; }

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-left: auto;
}

.nav-links a { text-decoration: none; }

.nav-link {
    padding: 6px 12px;
    border-radius: var(--radius-m);
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-family);
}

.nav-link:hover { background: var(--bg-layer2); color: var(--text-primary); }

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: var(--space-3);
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-m);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: background 0.15s, border-color 0.15s;
}

.theme-toggle-btn:hover { background: var(--bg-layer2); border-color: var(--accent); }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.app-footer {
    border-top: 1px solid var(--border-color);
    padding: var(--space-5);
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--font-size-s);
    background: var(--bg-base);
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 22px;
    border-radius: var(--radius-pill);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.12s ease, box-shadow 0.15s;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; box-shadow: var(--shadow-4); }
.btn:active { transform: scale(0.98); box-shadow: none; transition-duration: 0.08s; }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); color: white; }

.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover { background: var(--accent-light); border-color: var(--accent-hover); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-layer2); color: var(--text-primary); }

.btn-white { background: white; color: var(--accent-hover); }
.btn-white:hover { opacity: 0.92; color: var(--accent-hover); }

.btn-outline-white { background: transparent; color: white; border: 1.5px solid rgba(255,255,255,0.7); }
.btn-outline-white:hover { border-color: white; background: rgba(255,255,255,0.12); color: white; }

.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; color: white; }

.btn-sm { padding: 6px 14px; font-size: var(--font-size-s); }
.btn-lg { padding: 14px 28px; font-size: var(--font-size-m); }

/* ── Cooking busy indicator (per-button) ─────────────────────────────────── */
.aim-cook-spinner {
    display: inline-block;
    width: 1.08em;
    height: 1.08em;
    border: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%, transparent 0 32%, currentColor 34% 39%, transparent 41%),
        radial-gradient(circle at 50% 50%, transparent 0 66%, currentColor 68% 73%, transparent 75%);
    box-shadow: inset 0 0 0 1.5px currentColor;
    animation: cook-plate-spin 2.8s linear infinite;
    transform-origin: 50% 50%;
    vertical-align: -0.12em;
    margin-right: 0.45em;
    opacity: 0.85;
}
.aim-cook-spinner:only-child {
    margin-right: 0;
}
button.is-cooking {
    pointer-events: none;
    cursor: progress;
    opacity: 0.85;
}
@keyframes cook-plate-spin {
    to { transform: rotateY(360deg); }
}
@keyframes bulk-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .aim-cook-spinner {
        animation: none;
    }
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-base);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2);
    padding: var(--space-5);
    transition: box-shadow var(--transition-smooth);
}
.card:hover { box-shadow: var(--shadow-4); }
a.card:hover { text-decoration: none; }
a.card:active { box-shadow: var(--shadow-2); transition-duration: 0.08s; }

.card-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(182px, 1fr)); gap: var(--space-5); }
.card-grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-5); }
.card-grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: var(--space-4); }

/* ── Typography ─────────────────────────────────────────────────────────────── */
.page-title   { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--space-4); letter-spacing: -0.01em; }
.page-subtitle{ font-size: var(--font-size-m); color: var(--text-secondary); margin-bottom: var(--space-6); }
.section-title{ font-family: var(--font-family-serif); font-size: var(--font-size-l); font-weight: 600; margin-bottom: var(--space-4); letter-spacing: -0.01em; }

h1 { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-family: var(--font-family-serif); font-size: var(--font-size-l); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-family: var(--font-family-serif); font-size: var(--font-size-m); font-weight: 500; letter-spacing: 0; }

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
    background: var(--accent);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-7);
    color: white;
    margin-bottom: var(--space-8);
    position: relative;
    overflow: hidden;
}

.hero-content { position: relative; max-width: 600px; }
.hero-headline { font-family: var(--font-family-serif); font-size: var(--font-size-2xl); font-weight: 600; line-height: 1.1; margin-bottom: var(--space-4); letter-spacing: -0.01em; }
.hero-subtext  { font-size: var(--font-size-m); opacity: 0.92; margin-bottom: var(--space-6); line-height: 1.6; }
.hero-actions  { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* ── Tags & Badges ──────────────────────────────────────────────────────────── */
.tag {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent-hover);
    border-radius: var(--radius-pill);
    padding: 5px 14px;
    font-size: var(--font-size-s);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.tag:hover { background: var(--accent); color: white; text-decoration: none; transform: translateY(-1px); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.badge-accent { background: var(--accent); color: white; }
.badge-light  { background: var(--accent-light); color: var(--accent); }
.badge-gray   { background: var(--bg-layer2); color: var(--text-secondary); }
/* Meal-type badges — sage palette (shades of --accent) */
.badge-breakfast { background: #d8e2c7; color: #3d4a2a; }
.badge-lunch     { background: #aabb8b; color: #263220; }
.badge-dinner    { background: #7b8e6b; color: #ffffff; }
.badge-snack     { background: #eaf0e0; color: #5e7050; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-5); }
.form-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-m);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--aim-ink, #2A4A3A);
    box-shadow: 0 0 0 3px rgba(42, 74, 58, 0.18);
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    padding-right: 40px;
    cursor: pointer;
}
[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a8a6a1' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    padding: var(--space-1) 0;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Light mode: give all checkboxes an explicit white background */
html:not([data-theme="dark"]) input[type="checkbox"] {
    background-color: #ffffff;
}

.validation-message { color: #d13438; font-size: var(--font-size-s); margin-top: var(--space-1); }

/* ── Wizard ─────────────────────────────────────────────────────────────────── */
.wizard-container { max-width: 760px; margin: 0 auto; }

.progress-bar-track {
    height: 6px;
    background: var(--bg-layer2);
    border-radius: 3px;
    margin-bottom: var(--space-3);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.step-indicators { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); }

.step-indicator {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-m);
    font-size: var(--font-size-s);
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg-layer2);
    text-align: center;
}

.step-indicator.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.step-indicator.done   { background: var(--accent); color: white; }

/* ── Selectable Cards ───────────────────────────────────────────────────────── */
.selectable-card {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    cursor: pointer;
    transition: all var(--transition-spring);
    background: var(--bg-base);
    user-select: none;
}

.selectable-card:hover { border-color: var(--accent); background: var(--accent-light); }
.selectable-card.selected { border-color: var(--accent); background: var(--accent-light); }
.selectable-card .card-icon { font-size: 20px; margin-bottom: var(--space-1); }
.selectable-card h3 { font-size: var(--font-size-s); font-weight: 600; margin-bottom: var(--space-1); }
.selectable-card p { font-size: var(--font-size-xs); color: var(--text-secondary); }

/* ── Meal Plan Grid ─────────────────────────────────────────────────────────── */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--space-3);
}

.day-card { background: var(--bg-base); border-radius: var(--radius-xl); box-shadow: var(--shadow-2); overflow: hidden; transition: box-shadow var(--transition-smooth); }
.day-card:hover { box-shadow: var(--shadow-4); }
.day-card-header { background: var(--accent); color: white; padding: var(--space-3) var(--space-4); font-weight: 600; font-size: var(--font-size-s); }

.meal-slot {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.meal-slot:last-child { border-bottom: none; }
.meal-slot-info { flex: 1; }
.meal-slot-name { font-weight: 500; }
.meal-slot-meta { font-size: var(--font-size-xs); color: var(--text-tertiary); margin-top: 2px; }

.swap-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-s);
    padding: 4px 8px;
    font-size: var(--font-size-xs);
    cursor: pointer;
    color: var(--text-secondary);
    font-family: var(--font-family);
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.swap-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Grocery List ───────────────────────────────────────────────────────────── */
.grocery-category { margin-bottom: var(--space-5); }

.grocery-category-title {
    font-size: var(--font-size-s);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--accent-light);
}

.grocery-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-m);
    transition: background 0.1s;
}

.grocery-item:hover { background: var(--bg-layer2); }
.grocery-item.checked { opacity: 0.5; }
.grocery-item.checked .grocery-name { text-decoration: line-through; }

.grocery-item input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.grocery-name { font-size: var(--font-size-base); }
.grocery-qty { font-size: var(--font-size-s); color: var(--text-secondary); margin-left: auto; }

/* ── Recipe Cards ───────────────────────────────────────────────────────────── */
.recipe-card {
    background: var(--bg-base);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2);
    overflow: hidden;
    transition: all var(--transition-spring);
    display: flex;
    flex-direction: column;
}

.recipe-card:hover { box-shadow: var(--shadow-4); }
.recipe-card-body { padding: var(--space-3); flex: 1; }
.recipe-card-footer { padding: var(--space-2) var(--space-3); border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.recipe-card-title { font-family: var(--font-family-serif); font-size: var(--font-size-base); font-weight: 500; margin-bottom: var(--space-1); }
.recipe-card-desc { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.5; margin-bottom: var(--space-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-meta { display: flex; gap: var(--space-3); font-size: var(--font-size-xs); color: var(--text-tertiary); }

/* ── Healing Callout ────────────────────────────────────────────────────────── */
.healing-callout {
    background: var(--accent-light);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius-m) var(--radius-m) 0;
    padding: var(--space-4);
    margin: var(--space-4) 0;
}

.healing-callout-title { font-size: var(--font-size-s); font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--space-2); }

/* ── Auth ───────────────────────────────────────────────────────────────────── */
.auth-container { max-width: 420px; margin: var(--space-7) auto; }
.auth-card { background: var(--bg-base); border-radius: var(--radius-xl); box-shadow: var(--shadow-4); padding: var(--space-7); }
.auth-title { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--space-2); }
.auth-subtitle { color: var(--text-secondary); margin-bottom: var(--space-6); }

/* ── Dashboard ──────────────────────────────────────────────────────────────── */
.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.stat-card { background: var(--bg-base); border-radius: var(--radius-xl); padding: var(--space-3); text-align: center; box-shadow: var(--shadow-2); }
.stat-number { font-size: var(--font-size-l); font-weight: 700; color: var(--accent); }
.stat-label { font-size: var(--font-size-xs); color: var(--text-secondary); margin-top: var(--space-1); }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert { padding: var(--space-4); border-radius: var(--radius-m); margin-bottom: var(--space-4); font-size: var(--font-size-s); }
.alert-success { background: #e8f5ee; color: #0d5c30; border: 1px solid #a8d5b8; }
.alert-error   { background: #fde8e8; color: #8b0000; border: 1px solid #f5a5a5; }
.alert-info    { background: #e5f0ff; color: #003d8f; border: 1px solid #a5c0f5; }
.validation-summary-valid { display: none; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --nav-height: 48px; }
    .app-main { padding: var(--space-4) var(--space-3); }
    .app-header { height: var(--nav-height); }
    .nav-bar { padding: 0 var(--space-3); gap: var(--space-2); }
    .brand-name { font-size: var(--font-size-s); }
    .brand img, .brand svg { height: 24px; }
    .page-header { margin-bottom: var(--space-4); gap: var(--space-2); }
    .page-header h1 { font-size: var(--font-size-l); }
    .page-header p { font-size: var(--font-size-s); margin-top: var(--space-1); }
    .hero { padding: var(--space-4) var(--space-3); }
    .hero-inner { flex-direction: column; text-align: center; }
    .hero-actions { justify-content: center; }
    .hero-image img { max-width: 140px; }
    .hero-headline { font-size: var(--font-size-xl); }
    .card-grid, .card-grid-3, .card-grid-4, .plan-grid { grid-template-columns: 1fr; }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .wizard-container { max-width: 100%; }
    .step-indicators { gap: var(--space-1); }
    .step-indicator { font-size: var(--font-size-xs); padding: var(--space-2); }
    .profile-section-nav { padding: var(--space-2) 0; margin-bottom: var(--space-3); }
    .profile-nav-link { padding: 4px 12px; font-size: var(--font-size-xs); }
    .form-section { margin-bottom: var(--space-4); padding-bottom: var(--space-4); }
    .form-section h2 { font-size: var(--font-size-m); }
    .card { padding: var(--space-3); }
    /* Grocery list mobile */
    .grocery-page { padding: var(--space-3) var(--space-2) 120px; }
    .grocery-hero-title { font-size: 22px; }
    .grocery-hero-cost { font-size: 24px; }
    .grocery-cat-progress { width: 100px; }
    .grocery-item-row { padding: 10px 12px; gap: 10px; }
    .grocery-item-qty { font-size: 10px; }
    .grocery-item-price { font-size: 12px; min-width: 44px; }

    /* Landing page mobile fixes */
    .tag-cloud { gap: var(--space-1); flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; -webkit-overflow-scrolling: touch; touch-action: pan-x; }
    .tag-cloud .tag { font-size: var(--font-size-xs); padding: 4px 10px; flex-shrink: 0; white-space: nowrap; }
    .section { padding: var(--space-5) var(--space-2); }
    .section-alt { padding: var(--space-5) var(--space-2); }
    .steps-grid { grid-template-columns: 1fr; gap: var(--space-3); }
    .step-card { padding: var(--space-3); }
    .goal-card { padding: var(--space-2); }
    .cta-section { padding: var(--space-5) var(--space-2); }
}

@media (max-width: 480px) {
    :root { --nav-height: 44px; }
    .app-main { padding: var(--space-3) var(--space-2); }
    .page-header h1 { font-size: var(--font-size-m); }
    .page-header p { font-size: var(--font-size-xs); }
    .hero-actions { flex-direction: column; }
    .dashboard-stats { grid-template-columns: 1fr; }
    /* Auth / Register mobile */
    .auth-page { padding: var(--space-4) var(--space-3); }
    .auth-card { padding: var(--space-4); }
    .auth-header { margin-bottom: var(--space-4); }
    .auth-icon { font-size: 30px; margin-bottom: var(--space-2); }
    .auth-header h1 { font-size: var(--font-size-m); font-weight: 700; line-height: 1.3; }
    .auth-header p { font-size: var(--font-size-s); }
    .form-group label { font-size: var(--font-size-base); }
    .form-control { font-size: 16px; padding: 11px 14px; } /* 16px prevents iOS zoom */
    .form-hint { font-size: var(--font-size-s); }
    .field-error { font-size: var(--font-size-s); }
    .hero-headline { font-size: var(--font-size-l); }
    h1 { font-size: var(--font-size-l); }
    h2 { font-size: var(--font-size-m); }
    .tag-cloud .tag { font-size: 10px; padding: 3px 8px; }
}

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-tertiary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-center { text-align: center; }

/* ── Navigation bar ──────────────────────────────────────────────────────── */
.site-nav {
    position: sticky; top: 0; z-index: 200;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-color);
}

.nav-inner {
    display: flex; align-items: center; gap: var(--space-3);
    max-width: var(--content-max-width);
    margin: 0 auto; padding: 0 var(--space-5); height: var(--nav-height);
}

.nav-brand {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: var(--font-size-m); font-weight: 700;
    color: var(--text-primary); text-decoration: none; flex-shrink: 0;
}
.nav-brand:hover { color: var(--accent); text-decoration: none; }
.nav-brand-logo { height: 36px; width: auto; display: block; }

.nav-actions {
    display: flex; align-items: center; gap: var(--space-1);
    margin-left: auto;
}

/* Hamburger button — always visible */
.nav-hamburger {
    background: none; border: none; cursor: pointer;
    padding: var(--space-2); display: flex; align-items: center; justify-content: center;
    color: var(--text-primary);
}
.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
    display: block; width: 20px; height: 2px;
    background: currentColor; border-radius: 1px;
    transition: transform 0.25s, opacity 0.25s;
}
.hamburger-icon { position: relative; }
.hamburger-icon::before,
.hamburger-icon::after { content: ''; position: absolute; left: 0; }
.hamburger-icon::before { top: -6px; }
.hamburger-icon::after  { top:  6px; }

/* ── Overlay ────────────────────────────────────────────────────────────── */
.nav-overlay {
    position: fixed; inset: 0; z-index: 299;
    background: rgba(0,0,0,0.4);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

/* ── Slide-out drawer ───────────────────────────────────────────────────── */
.nav-drawer {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 300px; max-width: 85vw; z-index: 300;
    background: var(--bg-base);
    border-right: none;
    box-shadow: 8px 0 40px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex; flex-direction: column;
    overflow-y: auto;
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
}
.nav-drawer.open { transform: translateX(0); }

.nav-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}
.nav-drawer-title {
    font-family: var(--font-family-serif); font-size: var(--font-size-m); font-weight: 600; color: var(--text-primary);
}
.nav-drawer-close {
    background: none; border: none; font-size: 24px;
    cursor: pointer; color: var(--text-secondary);
    padding: var(--space-1); line-height: 1;
}
.nav-drawer-close:hover { color: var(--text-primary); }

.nav-drawer-links {
    list-style: none; padding: var(--space-3) 0; margin: 0; flex: 1;
}
.nav-drawer-bottom {
    margin-top: auto; padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-color);
}
.nav-drawer-bottom a {
    display: block; text-decoration: none; font-size: var(--font-size-base); font-weight: 500;
    color: var(--text-secondary); transition: color 0.15s;
}
.nav-drawer-bottom a:hover { color: var(--text-primary); text-decoration: none; }
.nav-drawer-links li { margin: 0; }
.nav-drawer-links a,
.nav-drawer-link-btn {
    display: flex; align-items: center; gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-5);
    text-decoration: none; font-size: var(--font-size-base); font-weight: 500;
    color: var(--text-secondary);
    background: none; border: none; text-align: left; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.nav-drawer-links a:hover,
.nav-drawer-link-btn:hover {
    background: var(--bg-layer2); color: var(--text-primary); text-decoration: none;
}
.nav-drawer-links a svg,
.nav-drawer-link-btn svg {
    flex-shrink: 0;
    color: var(--text-tertiary);
}
.nav-drawer-links a:hover svg,
.nav-drawer-link-btn:hover svg {
    color: var(--accent);
}

/* ── User menu dropdown ──────────────────────────────────────────────────── */
.user-menu { position: relative; }
.user-menu-btn {
    background: none; border: 1.5px solid var(--border-color); border-radius: 50%;
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary); transition: border-color 0.15s, color 0.15s;
}
.user-menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.user-icon { flex-shrink: 0; }

.user-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 6px);
    min-width: 160px; background: var(--bg-base);
    border-radius: var(--radius-m);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1); z-index: 250;
    padding: var(--space-2) 0; flex-direction: column;
}
.user-dropdown.open { display: flex; }

.user-dropdown-item {
    display: block; width: 100%; padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-base); font-weight: 500;
    color: var(--text-secondary); text-decoration: none;
    background: none; border: none; text-align: left; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.user-dropdown-item:hover {
    background: var(--bg-layer2); color: var(--text-primary); text-decoration: none;
}

/* ── Buttons (primary/secondary aliases) ─────────────────────────────────── */
.btn-primary  { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; text-decoration: none; }
.btn-secondary { background: transparent; color: var(--accent-hover); border: 1.5px solid var(--accent); }
.btn-secondary:hover { background: var(--accent-light); text-decoration: none; }
.btn-hero-outline { background: transparent; color: white; border: 1.5px solid white; }
.btn-hero-outline:hover { background: rgba(255,255,255,0.15); color: white; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-layer2); color: var(--text-primary); text-decoration: none; }
.btn-icon { padding: 6px 10px; }
.btn-block { width: 100%; display: flex; }
.btn-xs { padding: 3px 8px; font-size: var(--font-size-xs); }
.btn-danger-text { color: var(--error-color, #d32f2f); }
.btn-danger-text:hover { color: #b71c1c; background: rgba(211,47,47,0.08); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border-color); padding: var(--space-3) var(--space-4);
    text-align: center; color: var(--text-tertiary);
    font-size: var(--font-size-xs); background: var(--bg-base);
}
.site-footer p { margin: 0; }

/* ── Layout helpers ──────────────────────────────────────────────────────── */
.container { max-width: var(--content-max-width); margin: 0 auto; padding: 0 var(--space-5); }
main { max-width: var(--content-max-width); margin: 0 auto; padding: var(--space-5) var(--space-5) var(--space-6); }
.page-container { max-width: var(--content-max-width); margin: 0 auto; padding: 0 var(--space-5); }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-6); }
.page-header h1 { margin: 0; }
.page-header p { color: var(--text-secondary); margin: var(--space-2) 0 0; }
.page-header-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }

/* ── Hero (view aliases) ─────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 50%, var(--accent-pressed) 100%);
    border-radius: var(--radius-xl); padding: var(--space-6) var(--space-6); color: white;
    margin-bottom: var(--space-5); overflow: hidden; position: relative;
}
.hero::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(circle at 85% 20%, rgba(255,255,255,0.10) 0%, transparent 45%),
        radial-gradient(circle at 10% 85%, rgba(0,0,0,0.06) 0%, transparent 40%);
}
.hero::after {
    content: '\1F33F'; position: absolute; right: -20px; bottom: -20px;
    font-size: 180px; opacity: 0.06; pointer-events: none; line-height: 1;
    transform: rotate(-15deg);
}
.hero-inner { display: flex; align-items: center; gap: var(--space-5); }
.hero-content { max-width: 640px; flex: 1; }
.hero-badge { display: inline-block; background: rgba(255,255,255,0.2); border-radius: 100px; padding: 4px 14px; font-size: var(--font-size-s); margin-bottom: var(--space-4); }
.hero-title { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; line-height: 1.1; margin-bottom: var(--space-3); }
.hero-subtitle { font-size: var(--font-size-base); opacity: 0.92; margin-bottom: var(--space-4); line-height: 1.5; }
.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.hero-image { flex-shrink: 0; }
.hero-image img { max-width: 160px; height: auto; border-radius: var(--radius-l); filter: drop-shadow(0 4px 24px rgba(0,0,0,0.2)); }

/* ── Sections ────────────────────────────────────────────────────────────── */
.section { padding: var(--space-6) 0; }
.section-alt { background: var(--bg-layer1); }
.section-title { font-family: var(--font-family-serif); font-size: var(--font-size-l); font-weight: 600; margin-bottom: var(--space-4); text-align: center; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.section-actions { display: flex; gap: var(--space-3); }

/* Steps */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(154px, 1fr)); gap: var(--space-4); }
.step-card { text-align: center; padding: var(--space-3); }
.step-number { width: 44px; height: 44px; background: var(--accent); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: var(--font-size-m); font-weight: 700; margin: 0 auto var(--space-4); }
.step-card h3 { margin-bottom: var(--space-3); }
.step-card p { color: var(--text-secondary); font-size: var(--font-size-s); line-height: 1.6; }

/* Goal cards */
.goal-card { text-align: center; padding: var(--space-3); }
.goal-icon { font-size: 32px; margin-bottom: var(--space-3); }
.goal-card h3 { margin-bottom: var(--space-2); }
.goal-card p { color: var(--text-secondary); font-size: var(--font-size-s); }

/* Tags */
.tag-condition { background: var(--accent-light); color: var(--accent-pressed); }
.tag-more { background: var(--bg-layer2); color: var(--text-secondary); }
.tag-food { background: var(--accent-light); color: var(--accent); }
.tag-warning { background: #fff4e5; color: #b85c00; }
.tag-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Badges */
.badge-goal      { background: var(--accent); color: #ffffff; }
.badge-condition { background: var(--accent-light); color: var(--accent); }
.badge-lunchbox  { background: #dce9f2; color: #2a4a63; }
.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(--aim-ink, #2A4A3A);
    box-shadow: 0 0 0 3px rgba(42, 74, 58, 0.18);
}
.form-control:disabled { opacity: 0.6; cursor: not-allowed; }

/* Select dropdowns */
select.form-control,
select.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    padding-right: 40px;
    cursor: pointer;
}
select.form-control:focus,
select.form-select:focus {
    border-color: var(--accent);
}
[data-theme="dark"] select.form-control,
[data-theme="dark"] select.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a8a6a1' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-group { margin-bottom: var(--space-4); }
.form-group label { display: block; font-size: var(--font-size-xs); font-weight: 600; margin-bottom: var(--space-2); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); }
.form-check { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.form-hint { font-size: var(--font-size-s); color: var(--text-secondary); margin-bottom: var(--space-3); }
.form-section { margin-bottom: var(--space-6); padding-bottom: var(--space-6); border-bottom: 1px solid var(--border-color); }
.form-section:last-child { border-bottom: none; }
.form-section h2 { margin-bottom: var(--space-3); }
.form-actions { display: flex; gap: var(--space-3); padding-top: var(--space-4); }
.form-card { margin-bottom: var(--space-4); }
.field-error { display: block; color: #d13438; font-size: var(--font-size-xs); margin-top: 4px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.checkbox-label { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; padding: 6px 14px; border: 1.5px solid var(--border-color); border-radius: 100px; font-size: var(--font-size-s); transition: border-color 0.15s, background 0.15s; }
.checkbox-label:has(input:checked) { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.checkbox-label input[type="checkbox"] { accent-color: var(--accent); }
.checkbox-label-lg { border-radius: var(--radius-m); padding: 10px 16px; font-size: var(--font-size-base); }

/* ── Wizard ──────────────────────────────────────────────────────────────── */
.wizard-progress { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); }
.wizard-step { flex: 1; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-m); font-size: var(--font-size-s); font-weight: 500; color: var(--text-tertiary); background: var(--bg-layer2); }
.wizard-step span { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-layer2); border: 2px solid var(--border-color); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.wizard-step.active { background: var(--accent-light); color: var(--accent); }
.wizard-step.active span { background: var(--accent); color: white; border-color: var(--accent); }
.wizard-step.done { background: var(--accent); color: white; }
.wizard-step.done span { background: white; color: var(--accent); border-color: white; }
.wizard-actions { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-6); }

.plan-type-tabs { display: flex; gap: var(--space-3); margin-bottom: var(--space-6); }
.tab-type-btn { flex: 1; padding: var(--space-4) var(--space-3); border: 2px solid var(--border-color); border-radius: var(--radius-l); background: var(--bg-base); font-size: var(--font-size-base); font-weight: 600; cursor: pointer; color: var(--text-secondary); font-family: var(--font-family); transition: all 0.15s; }
.tab-type-btn:hover { border-color: var(--accent); color: var(--accent); }
.tab-type-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

[data-plan-panel] { display: none; }
[data-plan-panel].active { display: block; }

.panel-title { font-size: var(--font-size-m); font-weight: 600; margin-bottom: var(--space-4); }
.condition-group { margin-bottom: var(--space-6); }
.condition-group-title { font-size: var(--font-size-s); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); margin-bottom: var(--space-3); }

.selectable-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--space-2); }
.selectable-card input[type="checkbox"] { display: none; }
.selectable-card-content { pointer-events: none; }
.selectable-icon { font-size: 26px; margin-bottom: var(--space-2); }
.selectable-name { font-size: var(--font-size-base); font-weight: 600; }
.selectable-desc { font-size: var(--font-size-xs); color: var(--text-secondary); margin-top: 4px; }

.review-card { margin-bottom: var(--space-5); }
.review-row { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.review-row:last-child { border-bottom: none; }
.review-label { font-size: var(--font-size-s); font-weight: 600; color: var(--text-secondary); min-width: 140px; }

/* ── Meal Plan View ──────────────────────────────────────────────────────── */
.plan-week-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--space-3); }
.plan-day-card { overflow: hidden; }
.plan-day-card.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--shadow-4); }
.plan-day-header { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--bg-layer2); border-bottom: 1px solid var(--border-color); }
.plan-day-card.today .plan-day-header { background: var(--accent); color: white; }
.plan-day-name { font-weight: 700; font-size: var(--font-size-m); }
.plan-day-date { font-size: var(--font-size-s); color: var(--text-secondary); flex: 1; }
.plan-day-card.today .plan-day-date { color: rgba(255,255,255,0.8); }
.today-badge { font-size: var(--font-size-xs); background: white; color: var(--accent); padding: 2px 8px; border-radius: 100px; font-weight: 700; }
.plan-meal { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-color); }
.plan-meal:last-child { border-bottom: none; }
.plan-meal-type { font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.plan-meal-name { font-size: var(--font-size-s); font-weight: 500; display: block; color: var(--accent); margin-bottom: 4px; }
.plan-meal-name:hover { text-decoration: underline; }
.plan-meal-meta { font-size: var(--font-size-xs); color: var(--text-tertiary); }
.plan-meta { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.swap-form { margin-top: 4px; }

/* ── Calendar Views ────────────────────────────────────────────────────── */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-4); }
.cal-tabs {
    display: flex;
    background: rgba(107,122,90,0.10);
    border: none;
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.cal-tab {
    flex: 1;
    height: 30px;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: #4D5A3E;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: background .15s, color .15s, box-shadow .15s;
}
.cal-tab:hover { background: rgba(255,255,255,0.5); }
.cal-tab.active {
    background: #fff;
    color: #2B2E25;
    box-shadow: 0 1px 2px rgba(45,58,30,0.1);
}
.cal-nav { display: flex; align-items: center; gap: var(--space-2); }
.cal-title { font-weight: 700; font-size: var(--font-size-m); min-width: 200px; text-align: center; }
.cal-prev, .cal-next { font-size: 1.4rem; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-m); }

/* Month grid */
.cal-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border-color); border-radius: var(--radius-l); overflow: hidden; }
.cal-month-hdr { padding: var(--space-2) var(--space-1); text-align: center; font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); background: var(--bg-layer2); border-bottom: 1px solid var(--border-color); }
.cal-month-cell { min-height: 100px; padding: var(--space-1); border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); background: var(--bg-base); position: relative; transition: background .15s; overflow: hidden; }
.cal-month-cell:nth-child(7n) { border-right: none; }
.cal-month-cell.cal-outside { background: var(--bg-layer1); }
.cal-month-cell.cal-in-plan { background: var(--accent-light); }
.cal-month-cell.cal-has-meals:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-month-cell.cal-today { background: var(--accent-light); }
.cal-month-date { font-size: var(--font-size-s); font-weight: 600; padding: 2px 6px; }
.cal-today-num { background: var(--accent); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; font-size: var(--font-size-s); }
.cal-legend { display: flex; gap: var(--space-4); padding: var(--space-3) 0; font-size: var(--font-size-s); color: var(--text-secondary); }
.cal-legend-item { display: flex; align-items: center; gap: var(--space-1); }
.cal-legend-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; }

/* Week grid */
.cal-week-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cal-week-grid { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 0; border: 1px solid var(--border-color); border-radius: var(--radius-l); overflow: hidden; min-width: min-content; }
.cal-week-col { border-right: 1px solid var(--border-color); background: var(--bg-base); min-height: 260px; display: flex; flex-direction: column; }
.cal-week-col:last-child { border-right: none; }
.cal-week-col.cal-in-plan { background: var(--accent-light); }
.cal-week-col.cal-today .cal-week-hdr { background: var(--accent); color: #fff; }
.cal-week-hdr { text-align: center; padding: var(--space-2) var(--space-1); font-size: var(--font-size-s); font-weight: 700; background: var(--bg-layer2); border-bottom: 1px solid var(--border-color); }
.cal-week-date { font-size: var(--font-size-l); font-weight: 700; }
.cal-week-hdr .cal-today-num { background: transparent; color: inherit; width: auto; height: auto; border-radius: 0; display: inline; font-weight: inherit; }
.cal-week-body { padding: var(--space-2); flex: 1; display: grid; gap: var(--space-2); min-height: 0; }
.cal-week-slot { display: flex; min-height: 0; }
.cal-week-slot > .cal-meal-card { margin-bottom: 0 !important; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.cal-week-slot > .cal-meal-card > a { display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-week-slot > .cal-meal-card .cal-meal-actions { margin-top: auto !important; }
.cal-week-empty { flex: 1; display: flex; align-items: center; justify-content: center; font-size: var(--font-size-xs); color: var(--text-tertiary); border: 1px dashed var(--border-color); border-radius: var(--radius-m); background: rgba(0,0,0,0.015); }
.cal-week-footer { padding: var(--space-2); font-size: var(--font-size-xs); color: var(--text-tertiary); text-align: center; border-top: 1px solid var(--border-color); min-height: 28px; }
.cal-meal-remove { padding: 4px 8px !important; line-height: 1 !important; font-size: 16px !important; color: #c0392b !important; background: rgba(192, 57, 43, 0.1) !important; border-radius: var(--radius-s) !important; }
.cal-meal-remove:hover { background: rgba(192, 57, 43, 0.2) !important; color: #a93226 !important; }

/* ── Meal plan labelled action tiles (Grocery · Day prep · New plan) ──── */
.mp-actions-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.mp-action-tile {
    flex: 1 1 0;
    min-width: 0;
    display: flex; flex-direction: column; align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 14px;
    color: #2B2E25;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, color .15s, border-color .15s;
}
.mp-action-tile:hover { background: rgba(107,122,90,0.05); text-decoration: none; color: #2B2E25; }
.mp-action-icon {
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #4D5A3E;
}
.mp-action-icon svg { width: 18px; height: 18px; display: block; }
.mp-action-label {
    font-size: 10.5px; font-weight: 600;
    color: inherit;
    letter-spacing: 0.1px;
}
.mp-action-tile-primary {
    background: #6B7A5A;
    border-color: #6B7A5A;
    color: #fff;
}
.mp-action-tile-primary:hover {
    background: #5B6A4A;
    border-color: #5B6A4A;
    color: #fff;
}
.mp-action-tile-primary .mp-action-icon { color: #fff; }

/* ── School-lunches row card (spec: single row under day view) ─────────── */
.mp-lunchbox-row {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 14px;
}
.mp-lunchbox-icon {
    width: 32px; height: 32px; border-radius: 10px;
    background: rgba(107,122,90,0.12);
    color: #4D5A3E;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.mp-lunchbox-text { flex: 1; min-width: 0; }
.mp-lunchbox-title {
    font-family: var(--font-family-display);
    font-size: 13px; font-weight: 700;
    color: #2B2E25;
}
.mp-lunchbox-sub {
    font-size: 11px; color: #8A8E7B;
    margin-top: 1px;
}
.mp-lunchbox-btn {
    height: 30px; padding: 0 12px;
    border-radius: 999px;
    background: #6B7A5A; color: #fff;
    border: none; text-decoration: none;
    font-size: 11px; font-weight: 700;
    white-space: nowrap; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.mp-lunchbox-btn:hover { background: #5B6A4A; color: #fff; text-decoration: none; }

/* ── Meal plan hero (compact, especially on mobile) ─────────────────────── */
.mealplan-hero { flex-direction: column; gap: var(--space-3); }
.mealplan-hero h1 {
    font-family: var(--font-family-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #2B2E25;
    margin: 0;
}
.mealplan-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mp-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #4D5A3E;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.mp-icon-btn:hover { background: rgba(107,122,90,0.10); color: #2B2E25; }
.mp-icon-btn svg { width: 20px; height: 20px; display: block; }
.mp-icon-btn-end { margin-left: auto; }
.mealplan-hero .mealplan-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: #8A8E7B; }
.mealplan-hero .mealplan-meta > * { white-space: nowrap; }
.mealplan-hero .mealplan-meta-sep { color: #8A8E7B; }
.mealplan-hero .mealplan-meta .badge {
    font-size: 11px; font-weight: 600; color: #4D5A3E;
    background: rgba(107,122,90,0.12);
    padding: 3px 10px; border-radius: 999px;
    letter-spacing: 0.2px;
}
.mealplan-hero .mealplan-meta-cost { margin-left: auto; font-size: 12px; color: #8A8E7B; }
.mealplan-hero .mealplan-meta-cost strong { color: #2B2E25; font-weight: 600; }

/* Meal plan hero — mobile: compact top + 3-col meta row */
@media (max-width: 640px) {
    .mealplan-page .page-hero { padding-top: var(--space-2); padding-bottom: var(--space-2); margin-bottom: var(--space-3); }
    .mealplan-page .mealplan-hero { gap: var(--space-2); }
    .mealplan-page .mealplan-hero h1 { font-size: 22px; letter-spacing: -0.3px; }
    .mealplan-page .mealplan-hero .mealplan-meta {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 4px 10px;
        align-items: center;
        margin-top: 6px;
    }
    .mealplan-page .mealplan-hero .mealplan-meta .badge { justify-self: start; }
    .mealplan-page .mealplan-hero .mealplan-meta-dates { text-align: center; font-size: 11px; }
    .mealplan-page .mealplan-hero .mealplan-meta-cost {
        text-align: right; justify-self: end;
        font-size: 11px; margin-left: 0;
    }
    /* Collapse the date/duration span on mobile — only show the range itself */
    .mealplan-page .mealplan-hero .mealplan-meta-duration,
    .mealplan-page .mealplan-hero .mealplan-meta-dates .mealplan-meta-sep,
    .mealplan-page .mealplan-hero .mealplan-meta-cost .mealplan-meta-sep { display: none; }
    /* Budget line — drop to its own row if present */
    .mealplan-page .mealplan-hero .mealplan-meta-budget {
        grid-column: 1 / -1;
        text-align: center; font-size: 11px;
    }
}

/* ── Meal plan Day view (spec: agenda timeline) ─────────────────────── */
.mp-daycard {
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(45,58,30,0.04), 0 8px 20px -16px rgba(45,58,30,0.2);
}
.mp-daycard-band {
    padding: 14px 16px 10px;
    background: #F5F2E8;
    border-bottom: 1px solid rgba(107,122,90,0.18);
}
.mp-daycard-band-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mp-daycard-eyebrow {
    font-size: 10px; font-weight: 700;
    color: #6B7A5A; letter-spacing: 1.4px;
    text-transform: uppercase; white-space: nowrap;
}
.mp-daycard-title {
    font-family: var(--font-family-display);
    font-size: 15px; font-weight: 700;
    color: #2B2E25; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mp-daycard-band .btn-day-plan {
    height: 34px; padding: 0 12px;
    border-radius: 10px; border: none;
    background: #6B7A5A; color: #fff;
    font-size: 12px; font-weight: 600; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; flex-shrink: 0;
}
.mp-daycard-band .btn-day-plan:hover { background: #5B6A4A; }
.mp-daycard-stats {
    display: flex; justify-content: space-between; gap: 8px;
    margin-top: 8px; font-size: 11px; color: #8A8E7B;
    white-space: nowrap;
}
.mp-daycard-stats .mp-stat-cost { font-weight: 600; color: #2B2E25; }

.mp-timeline { position: relative; padding: 8px 14px 12px; }
.mp-timeline-spine {
    position: absolute; left: 52px; top: 20px; bottom: 20px;
    width: 2px; background: rgba(107,122,90,0.18); border-radius: 1px;
}
.mp-timeline-row { display: flex; align-items: stretch; gap: 10px; padding-top: 10px; position: relative; }
.mp-timeline-row:first-child { padding-top: 6px; }
.mp-timeline-time {
    width: 36px; text-align: right; padding-top: 14px;
    font-size: 11px; font-weight: 600; color: #8A8E7B;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.mp-timeline-dotcol { position: relative; width: 14px; flex-shrink: 0; }
.mp-timeline-dot {
    position: absolute; left: 3px; top: 16px;
    width: 12px; height: 12px; border-radius: 6px;
    background: #fff;
    box-shadow: 0 0 0 3px #fff;
    box-sizing: border-box;
}
.mp-timeline-dot.slot-breakfast { border: 2px solid #E8D9A8; }
.mp-timeline-dot.slot-lunch     { border: 2px solid #C9D5B4; }
.mp-timeline-dot.slot-dinner    { border: 2px solid #B8C4D0; }
.mp-timeline-dot.slot-snack     { border: 2px solid #E8C5B4; }
.mp-timeline-dot.done { background: #6B7A5A; border-color: #6B7A5A; }
.mp-timeline-card { flex: 1; min-width: 0; padding-bottom: 4px; }

/* Meal cards (spec) */
.mp-meal-card {
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
}
.mp-meal-card.done { opacity: 0.65; }
.mp-meal-stripe { width: 4px; flex-shrink: 0; }
.mp-meal-stripe.slot-breakfast { background: #E8D9A8; }
.mp-meal-stripe.slot-lunch     { background: #C9D5B4; }
.mp-meal-stripe.slot-dinner    { background: #B8C4D0; }
.mp-meal-stripe.slot-snack     { background: #E8C5B4; }
.mp-meal-body { flex: 1; padding: 12px 14px; min-width: 0; }
.mp-meal-top {
    display: flex; align-items: center; gap: 8px; margin-bottom: 3px;
}
.mp-slot-badge {
    font-size: 9px; font-weight: 700;
    padding: 2px 7px; border-radius: 999px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}
.mp-slot-badge.slot-breakfast { background: #E8D9A8; color: #7A5E1A; }
.mp-slot-badge.slot-lunch     { background: #C9D5B4; color: #4D5A3E; }
.mp-slot-badge.slot-dinner    { background: #B8C4D0; color: #3E4E60; }
.mp-slot-badge.slot-snack     { background: #E8C5B4; color: #7A4A30; }
.mp-done-label {
    font-size: 11px; font-weight: 600; color: #4D5A3E;
    display: inline-flex; align-items: center; gap: 3px;
}
.mp-meal-actions { margin-left: auto; display: flex; gap: 4px; }
.mp-meal-actions .btn-icon-sm {
    width: 24px; height: 24px; border-radius: 7px;
    border: none; background: rgba(107,122,90,0.08);
    color: #4D5A3E; font-size: 12px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
}
.mp-meal-actions .btn-icon-sm:hover { background: rgba(107,122,90,0.15); }
.mp-meal-title {
    font-size: 14px; font-weight: 600;
    color: #2B2E25; letter-spacing: -0.2px;
    text-decoration: none;
    display: block;
}
.mp-meal-card.done .mp-meal-title {
    text-decoration: line-through;
    text-decoration-color: #8A8E7B;
}
.mp-meal-meta {
    font-size: 11px; color: #8A8E7B; margin-top: 3px;
    font-variant-numeric: tabular-nums;
}
.mp-meal-cook-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    width: 160px;
    height: 36px;
    padding: 0 14px;
    margin: 10px auto 0;
    background: #6B7A5A;
    color: #fff;
    border-radius: 999px;
    font-size: 12px; font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
    text-decoration: none;
    transition: background .15s;
    align-self: center;
    flex: 0 0 auto;
}
.mp-meal-cook-btn:hover {
    background: #5B6A4A;
    color: #fff;
    text-decoration: none;
}
.mp-meal-card.done .mp-meal-cook-btn {
    background: rgba(107,122,90,0.08);
    color: #4D5A3E;
    border: 1px solid rgba(107,122,90,0.18);
}

/* Week strip day-picker (sits above the day card) */
.mp-week-strip { padding: 12px 0 0; }
.mp-week-strip-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px;
    padding: 0 4px 8px;
}
.mp-week-strip-title {
    flex: 1;
    text-align: center;
    font-family: var(--font-family-display);
    font-size: 13px; font-weight: 600;
    color: #2B2E25;
    letter-spacing: -0.2px;
}
.mp-week-strip-nav {
    width: 34px; height: 34px; border-radius: 999px;
    border: 1px solid rgba(107,122,90,0.18);
    background: transparent; color: #2B2E25;
    cursor: pointer; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1;
    transition: background .15s;
}
.mp-week-strip-nav:hover { background: rgba(107,122,90,0.05); }
.mp-week-strip-nav svg { width: 12px; height: 12px; display: block; }
.mp-week-strip-days { display: flex; gap: 4px; }
.mp-day-pill {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 0 6px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: #2B2E25;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}
.mp-day-pill.today {
    background: #fff;
    border: 1px dashed #6B7A5A;
}
.mp-day-pill.selected {
    background: #6B7A5A;
    color: #fff;
    border: 1px solid transparent;
}
.mp-day-pill-initial {
    font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
    color: #8A8E7B;
}
.mp-day-pill.selected .mp-day-pill-initial { color: rgba(255,255,255,0.8); }
.mp-day-pill-date {
    font-family: var(--font-family-display);
    font-size: 18px; font-weight: 700; line-height: 1;
}
.mp-day-pill-dots { display: flex; gap: 2px; height: 4px; margin-top: 2px; }
.mp-day-pill-dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(107,122,90,0.25); }
.mp-day-pill-dot.filled { background: #6B7A5A; }
.mp-day-pill.selected .mp-day-pill-dot { background: rgba(255,255,255,0.35); }
.mp-day-pill.selected .mp-day-pill-dot.filled { background: #fff; }

.mp-addmeal-btn {
    width: 100%; margin-top: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px dashed rgba(107,122,90,0.18);
    border-radius: 14px;
    color: #4D5A3E; font-size: 13px; font-weight: 600;
    cursor: pointer;
}
.mp-addmeal-btn:hover { background: rgba(107,122,90,0.05); }

/* ── Day summary card (spec: eyebrow + Fraunces date + meta + ring progress) ── */
.mp-today-summary {
    margin-top: 14px;
    padding: 14px;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 18px;
}
.mp-today-summary-head {
    display: flex; align-items: center;
    gap: 8px;
}
.mp-today-summary-left { flex: 1; min-width: 0; }
.mp-today-summary-eyebrow {
    font-size: 10px; font-weight: 700;
    color: #4D5A3E; letter-spacing: 1.2px;
    text-transform: uppercase;
}
.mp-today-summary-date {
    font-family: var(--font-family-display);
    font-size: 18px; font-weight: 700;
    color: #2B2E25;
    margin-top: 2px;
}
.mp-today-summary-meta {
    font-size: 11px; color: #8A8E7B;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
.mp-today-ring {
    position: relative;
    width: 46px; height: 46px;
    flex-shrink: 0;
}
.mp-today-ring svg {
    width: 46px; height: 46px; display: block;
}
.mp-today-ring-label {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #2B2E25;
    font-variant-numeric: tabular-nums;
}
.mp-today-instructions-btn {
    margin-top: 12px;
    width: 100%;
    height: 36px;
    background: #fff;
    color: #2B2E25;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 999px;
    font-size: 12px; font-weight: 600;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.mp-today-instructions-btn:hover { background: rgba(107,122,90,0.05); }
.mp-today-instructions-btn .icon-sm { width: 14px; height: 14px; opacity: 0.75; }
.mp-day-shopping-status {
    margin-top: 8px;
    min-height: 20px;
    text-align: center;
    font-size: 12px;
}
.mp-day-shopping-status a,
.mp-day-shopping-status a:visited {
    color: #4D5A3E;
    font-weight: 600;
    text-decoration: none;
}
.mp-day-shopping-status a:hover { text-decoration: underline; }
.mp-day-shopping-muted { color: #8A8E7B; }
.mp-day-shopping-ready { color: #3F6244 !important; }

/* Meals list section head (spec: MEALS eyebrow + ghost + Add pill) */
.mp-day-meals { padding: 16px 0 8px; }
.mp-day-meals-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-bottom: 10px;
    padding: 4px 0 0;
}
.mp-day-meals-eyebrow {
    font-size: 11px; font-weight: 700;
    color: #4D5A3E; letter-spacing: 1.2px;
    text-transform: uppercase;
}
.mp-day-meals-add {
    height: 26px; padding: 0 10px;
    background: #fff; border: 1px solid rgba(107,122,90,0.18);
    border-radius: 999px;
    font-size: 11px; font-weight: 600;
    color: #2B2E25;
    white-space: nowrap; flex-shrink: 0;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.mp-day-meals-add:hover { background: rgba(107,122,90,0.05); color: #2B2E25; }
.mp-day-meals-list { display: flex; flex-direction: column; gap: 10px; }

/* Responsive — calendar */
@media (max-width: 768px) {
    .cal-toolbar { flex-direction: column; align-items: stretch; gap: var(--space-2); }
    .cal-tabs { justify-content: center; }
    .cal-nav { justify-content: center; }
    .cal-title { min-width: 0; font-size: var(--font-size-s); }

    /* Month: compact cells, hide meal pills, just show dot indicators */
    .cal-month-cell { min-height: 48px; padding: 2px; }
    .cal-month-cell .cal-meal-pill { font-size: 8px !important; padding: 0 3px !important; }
    .cal-month-date { font-size: var(--font-size-xs); padding: 1px 4px; }
    .cal-month-hdr { font-size: 10px; padding: var(--space-1); }
    .cal-today-num { width: 22px; height: 22px; font-size: var(--font-size-xs); }

    /* Week: horizontal scroll with min-width columns */
    .cal-week-col { min-height: 200px; }
    .cal-week-hdr { font-size: var(--font-size-xs); padding: var(--space-1); }
    .cal-week-date { font-size: var(--font-size-m); }
    .cal-week-body { padding: var(--space-1); gap: var(--space-1); }

    /* Day summary */
    .day-summary { flex-direction: column; align-items: stretch; gap: var(--space-2); padding: var(--space-2) var(--space-3); }
    .day-summary-stats { justify-content: center; gap: var(--space-2); font-size: var(--font-size-xs); }
    .day-summary .btn { width: 100%; text-align: center; }

    /* Meal cards in day/week views */
    .cal-meal-card { padding: var(--space-2) !important; }
    .cal-meal-actions { flex-wrap: wrap; }

    /* Page header actions */
    .page-header-actions { width: 100%; }
    .page-header-actions .btn { flex: 1; text-align: center; font-size: var(--font-size-xs); padding: var(--space-2) var(--space-2); }

    /* Meal plan hero — tighten header, compact meta, keep actions in one row */
    .mealplan-hero { gap: var(--space-2); margin-bottom: var(--space-3); }
    .mealplan-hero h1 { font-size: var(--font-size-l); margin: 0; }
    .mealplan-hero .mealplan-meta { font-size: var(--font-size-xs); gap: 4px 8px; margin-top: var(--space-1); row-gap: 2px; }
    .mealplan-hero .mealplan-meta-sep { display: none; }
}
@media (max-width: 480px) {
    /* Month: just show date numbers, no meal pills */
    .cal-month-cell { min-height: 36px; }
    .cal-month-cell .cal-meal-pill { display: none !important; }
    .cal-month-cell.cal-has-meals::after {
        content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
        width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
    }

    /* Week: fit all 7 days on phone screen without horizontal scroll */
    .cal-week-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 0; }
    .cal-week-scroll { overflow-x: hidden; }
    .cal-week-col { min-height: 160px; }
    .cal-week-hdr { font-size: 10px; padding: 2px 1px; line-height: 1.15; }
    .cal-week-date { font-size: var(--font-size-xs); }
    .cal-week-body { padding: 2px; gap: 2px; }
    .cal-week-slot > .cal-meal-card { padding: 3px 4px !important; }
    .cal-week-slot > .cal-meal-card > div:first-child { font-size: 8px !important; margin-bottom: 0 !important; letter-spacing: .04em !important; }
    .cal-week-slot > .cal-meal-card > a { font-size: 10px !important; line-height: 1.15 !important; margin-bottom: 1px !important; }
    .cal-week-slot > .cal-meal-card > div:nth-of-type(2) { font-size: 8px !important; line-height: 1.15 !important; }
    .cal-week-slot > .cal-meal-card .cal-meal-actions { gap: 2px !important; margin-top: 2px !important; }
    .cal-week-slot > .cal-meal-card .cal-meal-actions .btn { padding: 1px 3px !important; font-size: 9px !important; }
    .cal-week-slot > .cal-meal-card .cal-meal-actions .cal-meal-remove { padding: 3px 6px !important; font-size: 13px !important; }
    .cal-week-footer { font-size: 9px; padding: 2px; min-height: 20px; }

    /* Page header buttons stack */
    .page-header-actions { flex-direction: column; }
    .page-header-actions .btn { width: 100%; }

    /* Compact calendar toolbar: tabs get smaller, nav tightens */
    .cal-tabs .cal-tab { height: 28px; padding: 0 10px; font-size: 11px; }
    .cal-nav { gap: var(--space-1); }
    .cal-title { flex: 1; text-align: center; font-size: var(--font-size-xs); }
}

/* ── Day Summary Bar ───────────────────────────────────────────────────── */
.day-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--bg-layer2); border-radius: var(--radius-m); box-shadow: var(--shadow-2); margin-bottom: var(--space-4); }
.day-summary-stats { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; font-size: var(--font-size-s); color: var(--text-secondary); font-weight: 500; }
.day-summary-stats span { white-space: nowrap; }
.day-summary-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* ── Day Instructions Modal Content ───────────────────────────────────── */
.instr-meal { border-radius: var(--radius-m); box-shadow: var(--shadow-2); overflow: hidden; margin-bottom: var(--space-4); }
.instr-meal:last-child { margin-bottom: 0; }
.instr-meal-header { padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.instr-meal-type { font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.instr-meal-title-row { display: flex; align-items: center; gap: 10px; }
.instr-meal-name { font-size: var(--font-size-m); font-weight: 700; }
.instr-meal-title-row .instr-meal-name { flex: 1 1 auto; min-width: 0; }
.instr-favorite {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(45, 58, 30, 0.14);
    color: var(--aim-ink, #2d3a1e);
}
.instr-favorite:hover { background: #fff; }
.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: normal; 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); }
/* Lunchbox "to pack" group in the day-instructions popup */
.instr-lunchbox-section { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 2px dashed var(--border-color); }
.instr-lunchbox-head { font-size: var(--font-size-s); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); margin-bottom: var(--space-3); }
.instr-lunchbox-member { font-size: var(--font-size-s); font-weight: 700; color: #2a4a63; margin: var(--space-3) 0 var(--space-2); }
[data-theme="dark"] .instr-lunchbox-member { color: #8fbce0; }
.instr-cook-action {
    padding: var(--space-3) var(--space-4) 0;
}
.instr-cook-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%;
    height: 44px;
    background: var(--aim-ink);
    color: var(--aim-bg);
    border-radius: 999px;
    border: 1px solid var(--aim-ink);
    font-size: 14px; font-weight: 700;
    letter-spacing: 0.2px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(45,58,30,0.08);
    transition: opacity .15s ease;
}
.instr-cook-btn:hover {
    opacity: 0.92;
    color: var(--aim-bg);
    text-decoration: none;
}
.instr-ingredients { margin: 0; padding-left: var(--space-5); font-size: var(--font-size-s); }
.instr-ingredients li { margin-bottom: 2px; }
.instr-ol { margin: 0; padding-left: var(--space-5); font-size: var(--font-size-s); }
.instr-ol li { margin-bottom: var(--space-2); line-height: 1.5; }

.instr-grocery-prompt {
    padding: var(--space-4);
    background: var(--aim-bg-soft, #f3f6ec);
    color: var(--aim-ink, #2d3a1e);
    border: 1px solid var(--aim-line, #d8dfcc);
    border-radius: var(--radius-m);
    margin-bottom: var(--space-4);
}
.instr-grocery-prompt p { color: var(--aim-muted, #5e7050) !important; }
[data-theme="dark"] .instr-grocery-prompt {
    background: var(--bg-layer2);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* ── Per-meal rating (inside instructions modal) ───────────────────────── */
.meal-rate {
    margin-top: var(--space-3); padding-top: var(--space-3);
    border-top: 1px dashed var(--border-color);
    display: flex; flex-direction: column; gap: var(--space-2);
}
.meal-rate-header { font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); }
.meal-rate-saved { color: var(--accent); font-weight: 600; text-transform: none; letter-spacing: 0; }
.meal-rate-stars { display: flex; gap: 4px; }
.meal-rate-star {
    background: none; border: none; cursor: pointer;
    font-size: 1.5rem; line-height: 1; padding: 0 2px;
    color: var(--border-color); transition: color var(--transition-fast), transform var(--transition-fast);
}
.meal-rate-star:hover { transform: scale(1.1); }
.meal-rate-star.filled { color: #d4a020; }
.meal-rate-ate { display: inline-flex; align-items: center; gap: 6px; font-size: var(--font-size-s); color: var(--text-secondary); }
.meal-rate-ate input { accent-color: var(--accent); }
.meal-rate-notes { resize: vertical; min-height: 48px; font-size: var(--font-size-s); }
.meal-rate-save { align-self: flex-start; }
.meal-rate-status { font-size: var(--font-size-xs); color: var(--text-secondary); margin-left: var(--space-2); }

/* ── Swap Picker Modal ─────────────────────────────────────────────────── */
/* Overlay scrolls as a safety net when the viewport is shorter than the modal's
   max-height (e.g. mobile browsers whose chrome steals vertical space). */
.swap-modal-overlay { position: fixed; inset: 0; z-index: 9998; background: rgba(43, 46, 37, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); justify-content: center; align-items: center; overflow-y: auto; padding: var(--space-3); -webkit-overflow-scrolling: touch; }
.swap-modal { background: var(--aim-bg); border: 1px solid var(--aim-line); border-radius: 18px; box-shadow: 0 24px 60px rgba(43, 46, 37, 0.18); width: 100%; max-width: 480px; max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); display: flex; flex-direction: column; overflow: hidden; margin: auto 0; color: var(--aim-ink); }
.swap-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; background: var(--aim-bg-soft); border-bottom: 1px solid var(--aim-line); flex-shrink: 0; }
.swap-modal-header h3 { margin: 0; font-family: var(--aim-serif); font-weight: 400; font-size: 20px; color: var(--aim-ink); }
.swap-modal-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; color: var(--aim-ink-2); }
.swap-loading { text-align: center; color: var(--aim-ink-soft); padding: var(--space-5); }
.swap-options { display: flex; flex-direction: column; gap: var(--space-2); }
.swap-section-title { font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--aim-ink-soft); margin-bottom: var(--space-2); }

/* Swap modal — tabs, build-a-meal form, AI suggestion card */
.swap-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--aim-line); margin-bottom: var(--space-3); }
.swap-tab { flex: 1; background: none; border: none; padding: var(--space-2) var(--space-3); font-size: var(--font-size-s); font-weight: 600; color: var(--aim-ink-soft); cursor: pointer; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.swap-tab:hover { color: var(--aim-ink); }
.swap-tab.active { color: var(--aim-ink); border-bottom-color: var(--aim-ink); }
.swap-tab-panel[hidden] { display: none; }
.swap-empty { text-align: center; color: var(--aim-ink-soft); font-size: var(--font-size-s); padding: var(--space-4) var(--space-2); }

.build-meal { padding: var(--space-1) 0; }
.build-meal-hint { font-size: var(--font-size-s); color: var(--text-secondary); margin-bottom: var(--space-3); }
.build-meal-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: var(--font-size-s); }

.ai-suggestion { border: 1px solid var(--accent); border-radius: var(--radius-m); padding: var(--space-3) var(--space-4); background: var(--accent-light); }
.ai-suggestion-header { margin-bottom: var(--space-2); }
.ai-suggestion-name { margin: 0; font-size: var(--font-size-m); font-weight: 700; color: var(--text-primary); }
.ai-suggestion-meta { font-size: var(--font-size-xs); color: var(--text-secondary); margin-top: 2px; }
.ai-suggestion-desc { font-size: var(--font-size-s); color: var(--text-primary); margin: var(--space-2) 0; }
.ai-suggestion-section { margin-top: var(--space-2); font-size: var(--font-size-s); }
.ai-suggestion-section strong { display: block; font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); margin-bottom: 4px; }
.ai-suggestion-target { font-size: var(--font-size-xs); color: var(--text-secondary); background: var(--bg-base); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); margin-top: var(--space-2); border: 1px dashed var(--border-color); }
.ai-ing-list { margin: 0; padding-left: var(--space-4); }
.ai-ing-list li { margin-bottom: 2px; }
.ai-ing-price { color: var(--accent-hover); font-weight: 600; font-size: var(--font-size-xs); margin-left: 4px; }
.ai-ing-total { margin-top: var(--space-2); font-size: var(--font-size-s); color: var(--text-primary); padding-top: var(--space-2); border-top: 1px solid var(--border-color); }
.ai-ing-source { color: var(--text-tertiary); font-size: var(--font-size-xs); font-weight: 400; }
.ai-instructions { white-space: normal; line-height: 1.5; }
.ai-suggestion-actions { margin-top: var(--space-3); display: flex; justify-content: flex-end; }
.swap-option-form { margin: 0; }
.swap-option { display: block; width: 100%; text-align: left; background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px; padding: var(--space-3) var(--space-4); cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; font-family: inherit; color: var(--aim-ink); }
.swap-option:hover { background: var(--aim-bg-soft); border-color: var(--aim-accent); box-shadow: none; }
.swap-option-name { font-weight: 600; font-size: var(--font-size-s); color: var(--aim-ink); margin-bottom: 2px; }
.swap-option-meta { font-size: var(--font-size-xs); color: var(--aim-ink-soft); }

/* Meal type badges */
.meal-type-badge { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.meal-type-badge.breakfast { background: #d8e2c7; color: #3d4a2a; }
.meal-type-badge.lunch     { background: #aabb8b; color: #263220; }
.meal-type-badge.dinner    { background: #7b8e6b; color: #ffffff; }
.meal-type-badge.snack     { background: #eaf0e0; color: #5e7050; }

/* Dashboard — household strip */
.dash-members {
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    -webkit-overflow-scrolling: touch;
}
.dash-members::-webkit-scrollbar { height: 6px; }
.dash-members::-webkit-scrollbar-track { background: transparent; }
.dash-members::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.dash-member-card {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
    min-width: 96px; padding: var(--space-3); background: var(--bg-base);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-2);
    text-align: center; flex-shrink: 0; scroll-snap-align: start;
    transition: transform .15s, box-shadow .15s;
}
.dash-member-card:hover { box-shadow: var(--shadow-4); }
.dash-member-name { font-weight: 600; font-size: var(--font-size-s); }
.dash-member-badge { font-size: 10px; background: var(--accent); color: #fff; padding: 1px 8px; border-radius: 100px; }
.dash-member-kcal { font-weight: 700; color: var(--accent); font-size: var(--font-size-s); white-space: nowrap; }
.dash-member-kcal span { font-weight: 400; font-size: var(--font-size-xs); color: var(--text-tertiary); }
.dash-member-kcal-unset { color: var(--text-tertiary); font-weight: 400; font-size: var(--font-size-xs); }
.dash-member-total { border-style: dashed; }

/* Dashboard — plan card */
.dash-plan-card {
    display: flex; gap: var(--space-5); padding: var(--space-5);
    background: var(--bg-base); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2);
}
.dash-plan-card.dash-plan-expired { background: #fffbfb; box-shadow: 0 2px 6px rgba(139,0,0,.08); }
[data-theme="dark"] .dash-plan-card.dash-plan-expired { background: #2a1a1a; box-shadow: 0 2px 6px rgba(139,0,0,.15); }
.dash-plan-card.dash-plan-empty { justify-content: center; }
.dash-plan-left { flex: 1; min-width: 0; }
.dash-plan-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.dash-plan-icon { font-size: 1.5rem; flex-shrink: 0; }
.dash-plan-title { margin: 0; font-size: var(--font-size-m); font-weight: 700; }
.dash-plan-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--font-size-s); color: var(--text-secondary); margin-top: 2px; }
.dash-plan-progress { margin: var(--space-3) 0; }
.dash-plan-progress-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.dash-days-left { font-size: var(--font-size-l); font-weight: 700; }
.dash-plan-pct { font-size: var(--font-size-s); color: var(--text-tertiary); }
.dash-plan-bar { background: var(--bg-layer2); border-radius: 4px; height: 8px; overflow: hidden; }
.dash-plan-bar-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }
.dash-plan-urgent { padding: var(--space-3); background: #fde8e8; border-radius: var(--radius-m); margin-bottom: var(--space-2); }
.dash-plan-urgent p { font-size: var(--font-size-s); color: #8b0000; font-weight: 500; margin: 0; }
.dash-plan-actions { display: flex; flex-direction: column; gap: var(--space-2); min-width: 160px; flex-shrink: 0; }
.dash-plan-actions .btn { width: 100%; text-align: center; }
.dash-plan-btn-row { display: flex; gap: var(--space-2); }
.dash-plan-btn-row .btn { flex: 1; text-align: center; }

@media (max-width: 768px) {
    .dash-plan-card { flex-direction: column; gap: var(--space-3); padding: var(--space-4); }
    .dash-plan-actions { min-width: auto; gap: var(--space-2); }
    .dash-plan-actions .btn { width: 100%; }
    .dash-plan-header { gap: var(--space-2); align-items: flex-start; }
    .dash-plan-icon { width: 22px; height: 22px; flex-shrink: 0; margin-top: 2px; }
    .dash-plan-title { font-size: var(--font-size-m); }
    .dash-plan-meta { font-size: var(--font-size-xs); gap: 2px 8px; }
    .dash-days-left { font-size: var(--font-size-m); }
    .dash-plan-progress { margin: var(--space-2) 0; }
    .dash-plan-bar { height: 6px; }
    .dash-members { gap: var(--space-2); padding-bottom: 6px; }
    .dash-member-card {
        min-width: 108px;
        padding: var(--space-3) var(--space-2);
        gap: 4px;
        border-radius: var(--radius-l);
    }
    .dash-member-card > div:first-child {
        width: 40px !important;
        height: 40px !important;
        font-size: var(--font-size-s) !important;
    }
    .dash-member-name { font-size: var(--font-size-xs); }
    .dash-member-kcal { font-size: var(--font-size-s); }
    .dash-member-kcal span { font-size: 10px; }
    .dash-member-badge { padding: 1px 6px; font-size: 9px; }
    .dash-member-total div:first-child { width: 40px !important; height: 40px !important; }
}
@media (max-width: 480px) {
    .dash-plan-card { padding: var(--space-3); }
    .dash-plan-meta { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
    .dash-days-left { font-size: var(--font-size-s); }
    .dash-plan-pct { font-size: 11px; }
    .dash-plan-btn-row { gap: var(--space-1); }
    .dash-plan-btn-row .btn { font-size: var(--font-size-xs); padding: var(--space-2); }
    .dash-member-card { min-width: 104px; }
}

/* ───── Dashboard v2 — design-handoff spec ─────────────────────── */
/* Design tokens (locked to spec; do not swap for theme vars) */
.dash-hero-v2,
.dash-household-v2,
.dash-plan-v2,
.dash-newplan-card-v2 {
    --dh-sage:   #6B7A5A;
    --dh-sage-d: #5B6A4A;
    --dh-sage-x: #4D5A3E;
    --dh-border: rgba(107,122,90,0.18);
    --dh-ink:    #2B2E25;
    --dh-muted:  #8A8E7B;
}

/* Hero stats card */
.dash-hero-v2 {
    background: linear-gradient(155deg, #8A9A7A 0%, #6B7A5A 45%, #4D5A3E 100%);
    color: #fff;
    border-radius: 20px;
    padding: 10px 10px 12px;
    margin: 0 0 16px;
    box-shadow: 0 10px 24px -12px rgba(77,90,62,0.5);
    position: relative;
    overflow: hidden;
}
.dash-hero-v2::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,0.18), transparent 55%),
        radial-gradient(90% 70% at 100% 100%, rgba(0,0,0,0.18), transparent 60%);
    pointer-events: none;
}
.dash-hero-v2 > * { position: relative; }
.dash-hero-v2-title {
    margin: 0 0 10px;
    padding: 0 6px;
    font-family: var(--font-family);   /* Inter, not serif */
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    color: rgba(255,255,255,0.9);
    letter-spacing: 0;
}
.dash-hero-v2-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.dash-tile {
    position: relative;
    background: linear-gradient(145deg, rgba(255,255,255,0.22), rgba(255,255,255,0.06));
    border: 1px solid rgba(255,255,255,0.28);
    border-radius: 14px;
    padding: 8px 10px;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 2px;
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    box-shadow:
        inset 1px 1px 0 rgba(255,255,255,0.35),
        inset -1px -1px 0 rgba(255,255,255,0.08),
        0 6px 16px -10px rgba(0,0,0,0.25);
}
.dash-tile > * { position: relative; }
.dash-tile-icon { width: 16px; height: 16px; color: rgba(255,255,255,0.85); }
.dash-tile-num {
    font-family: var(--font-family-display);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    margin-top: 1px;
    color: #fff;
    letter-spacing: 0;
}
.dash-tile-label {
    font-family: var(--font-family);
    font-size: 9px;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Household */
.dash-household-v2 { margin: 24px 0 0; }
.dash-household-head {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 0 0 10px;
}
.dash-household-title {
    margin: 0;
    font-family: var(--font-family-display);
    font-size: 20px;
    font-weight: 700;
    color: #2B2E25;
    letter-spacing: -0.3px;
}
.dash-household-count {
    color: #8A8E7B;
    font-weight: 500;
    margin-left: 4px;
}
.dash-household-manage {
    font-size: 13px;
    font-weight: 600;
    color: #4D5A3E;
    text-decoration: none;
}
.dash-members-v2 {
    display: flex;
    gap: 14px;
    padding: 0 0 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.dash-members-v2::-webkit-scrollbar { display: none; }

.dash-member-pill {
    position: relative;
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px 12px 12px;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(45,58,30,0.04), 0 8px 20px -16px rgba(45,58,30,0.2);
    text-decoration: none;
    color: inherit;
    min-width: 0;
    transition: transform .12s ease-out;
}
.dash-member-pill:not(:last-child)::after {
    content: "";
    position: absolute;
    right: -8px;
    top: 25%;
    bottom: 25%;
    width: 1px;
    background: rgba(107,122,90,0.35);
}
.dash-member-pill:active { transform: scale(0.97); }
.dash-member-pill.is-you { border: 1.5px solid #6B7A5A; }
.dash-member-pill-info { display: flex; flex-direction: column; min-width: 0; }
.dash-member-pill-top { display: flex; align-items: center; gap: 6px; }
.dash-member-pill-name {
    font-size: 14px;
    font-weight: 600;
    color: #2B2E25;
    letter-spacing: -0.2px;
}
.dash-member-pill-you {
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    background: #6B7A5A;
    padding: 2px 6px;
    border-radius: 999px;
    letter-spacing: 0.4px;
}
.dash-member-pill-kcal {
    font-size: 13px;
    font-weight: 600;
    color: #4D5A3E;
    margin-top: 1px;
    white-space: nowrap;
}
.dash-member-pill-kcal span { font-size: 11px; font-weight: 500; color: #8A8E7B; }
.dash-member-pill-kcal.unset { color: #8A8E7B; font-weight: 500; }

/* Current plan — timeline variant */
.dash-plan-v2 {
    margin: 20px 0 0;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 22px;
    box-shadow: 0 10px 24px -16px rgba(45,58,30,0.22);
    overflow: hidden;
}
.dash-plan-v2-band {
    padding: 18px 20px 16px;
    background: linear-gradient(180deg, rgba(107,122,90,0.08), rgba(107,122,90,0));
}
.dash-plan-v2-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.dash-plan-v2-eyebrow {
    font-family: var(--font-family);
    font-size: 12px;
    font-weight: 700;
    color: #6B7A5A;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}
.dash-plan-v2-title {
    margin: 2px 0 0;
    font-family: var(--font-family-display);
    font-size: 18px;
    font-weight: 700;
    color: #2B2E25;
    letter-spacing: -0.3px;
    line-height: 1.2;
}
.dash-plan-v2-right { text-align: right; display: flex; flex-direction: column; line-height: 1.1; }
.dash-plan-v2-pct {
    font-family: var(--font-family-display);
    font-size: 20px;
    font-weight: 700;
    color: #4D5A3E;
}
.dash-plan-v2-daysleft {
    font-size: 10px;
    color: #8A8E7B;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-top: 2px;
}
.dash-plan-v2-pills { display: flex; gap: 4px; margin-top: 16px; }
.dash-plan-v2-pill {
    flex: 1 1 0;
    min-width: 0;
    height: 8px;
    border-radius: 4px;
    background: rgba(107,122,90,0.15);
}
.dash-plan-v2-pill.done    { background: #6B7A5A; }
.dash-plan-v2-pill.current {
    background: #5B6A4A;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #4D5A3E;
}
.dash-plan-v2-dates {
    display: flex; justify-content: space-between;
    margin-top: 6px;
    font-size: 10px;
    color: #8A8E7B;
}

/* Next-meal row */
.dash-plan-v2-next {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 20px;
    border-top: 1px solid rgba(107,122,90,0.18);
}
.dash-plan-v2-next-thumb {
    width: 64px; height: 64px; border-radius: 14px;
    flex-shrink: 0;
    background: repeating-linear-gradient(45deg, #E6E0CE, #E6E0CE 6px, #DDD6C0 6px, #DDD6C0 12px);
}
.dash-plan-v2-next-info { flex: 1; min-width: 0; }
.dash-plan-v2-next-eyebrow {
    font-size: 11px;
    font-weight: 700;
    color: #6B7A5A;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.dash-plan-v2-next-title {
    font-size: 17px;
    font-weight: 700;
    color: #2B2E25;
    letter-spacing: -0.3px;
    line-height: 1.25;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-plan-v2-next-open {
    height: 44px;
    padding: 0 20px;
    border-radius: 999px;
    border: none;
    background: #6B7A5A;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}
.dash-plan-v2-next-open:hover { background: #5B6A4A; }

/* Footer action row (3-up with vertical dividers) */
.dash-plan-v2-actions {
    display: flex;
    border-top: 1px solid rgba(107,122,90,0.18);
}
.dash-plan-v2-action {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 12px 8px;
    text-decoration: none;
    background: transparent;
    color: #2B2E25;
}
.dash-plan-v2-action + .dash-plan-v2-action { border-left: 1px solid rgba(107,122,90,0.18); }
.dash-plan-v2-action svg { width: 18px; height: 18px; color: #4D5A3E; opacity: 0.8; }
.dash-plan-v2-action span {
    font-size: 11px;
    font-weight: 600;
    color: #2B2E25;
    letter-spacing: -0.1px;
}
.dash-plan-v2-action:hover { background: rgba(107,122,90,0.05); }

.dash-plan-v2-expired { background: #fffbfb; }

/* Next meal — broken-away card with image thumb on right */
.dash-nextmeal {
    position: relative;
    margin: 16px 0 0;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 22px;
    box-shadow: 0 10px 24px -16px rgba(45,58,30,0.22);
    overflow: hidden;
}
.dash-nextmeal-link {
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 18px 18px 16px;
    text-decoration: none;
    color: inherit;
}
.dash-nextmeal-link:hover { background: rgba(107,122,90,0.04); }
.dash-nextmeal-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dash-nextmeal-eyebrow {
    font-family: var(--font-family);
    font-size: 11px;
    font-weight: 700;
    color: #6B7A5A;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}
.dash-nextmeal-title {
    font-family: var(--font-family-display);
    font-size: 20px;
    font-weight: 700;
    color: #2B2E25;
    letter-spacing: -0.4px;
    line-height: 1.2;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.dash-nextmeal-kcal {
    font-size: 13px;
    font-weight: 600;
    color: #8A8E7B;
    letter-spacing: 0.5px;
    margin-top: 4px;
}
.dash-nextmeal-pills {
    display: flex;
    gap: 4px;
    margin-top: auto;
    padding-top: 12px;
}
.dash-nextmeal-pill {
    flex: 1 1 0;
    min-width: 0;
    height: 6px;
    border-radius: 3px;
    background: rgba(107,122,90,0.18);
}
.dash-nextmeal-pill.done    { background: #6B7A5A; }
.dash-nextmeal-pill.current { background: #4D5A3E; }
.dash-nextmeal-thumb {
    flex: 0 0 96px;
    width: 96px;
    align-self: stretch;
    border-radius: 14px;
    background: repeating-linear-gradient(45deg, #E6E0CE, #E6E0CE 6px, #DDD6C0 6px, #DDD6C0 12px);
    background-size: cover;
    background-position: center;
}
.dash-nextmeal-swap {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(107,122,90,0.25);
    background: rgba(255,255,255,0.92);
    color: #4D5A3E;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(4px);
}
.dash-nextmeal-swap:hover { background: #fff; border-color: #6B7A5A; color: #2B2E25; }
.dash-nextmeal-swap svg { width: 12px; height: 12px; }

/* Quick-actions card (Calendar / Grocery / Full Plan / New Plan) */
.dash-actions-card {
    display: flex;
    margin: 16px 0 0;
    background: #fff;
    border: 1px solid rgba(107,122,90,0.18);
    border-radius: 22px;
    box-shadow: 0 10px 24px -16px rgba(45,58,30,0.22);
    overflow: hidden;
}
.dash-actions-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 16px 8px;
    text-decoration: none;
    background: transparent;
    color: #2B2E25;
}
.dash-actions-item + .dash-actions-item { border-left: 1px solid rgba(107,122,90,0.18); }
.dash-actions-item svg { width: 22px; height: 22px; color: #4D5A3E; opacity: 0.85; }
.dash-actions-item span {
    font-size: 12px;
    font-weight: 600;
    color: #2B2E25;
    letter-spacing: -0.1px;
}
.dash-actions-item:hover { background: rgba(107,122,90,0.06); }

/* Start a new plan — dashed card */
.dash-newplan-card-v2 {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 16px 0 0;
    padding: 18px 16px;
    background: #fff;
    border: 1px dashed rgba(107,122,90,0.18);
    border-radius: 22px;
    text-decoration: none;
    color: #4D5A3E;
    font-size: 13px;
    font-weight: 600;
}
.dash-newplan-card-v2-plus {
    width: 26px; height: 26px;
    border: 1.5px solid #6B7A5A;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #6B7A5A;
    font-size: 16px;
    line-height: 1;
}

@media (min-width: 768px) {
    .dash-hero-v2 { padding: 24px; }
    .dash-hero-v2-grid { grid-template-columns: repeat(4, 1fr); }
    .dash-tile { padding: 14px 16px; }
    .dash-tile-num { font-size: 28px; }
    .dash-plan-v2-title { font-size: 20px; }
}

/* Recipes list view (plan tab) */
.recipe-list-group { margin-bottom: var(--space-5); }
.recipe-list-group-hdr {
    display: flex; align-items: center; gap: var(--space-2);
    font-size: var(--font-size-s); font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    padding: var(--space-2) var(--space-3); border-radius: var(--radius-m); margin-bottom: var(--space-2);
}
.recipe-list-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-base); border-radius: var(--radius-m); box-shadow: var(--shadow-2);
    margin-bottom: var(--space-2);
}
.recipe-list-info { flex: 1; min-width: 0; }
.recipe-list-name { font-weight: 600; font-size: var(--font-size-s); margin-bottom: 2px; }
.recipe-list-name a { color: var(--accent); text-decoration: none; }
.recipe-list-name a:hover { text-decoration: underline; }
.recipe-list-meta { font-size: var(--font-size-xs); color: var(--text-tertiary); }
.recipe-list-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }
@media (max-width: 768px) {
    .recipe-list-item { flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: var(--space-3); }
    .recipe-list-actions { width: 100%; }
    .recipe-list-actions .btn { flex: 1; text-align: center; }
    .recipe-list-actions form { flex: 1; }
    .recipe-list-actions form .btn { width: 100%; }
}

/* Dashboard meals */
.dashboard-plan { margin-top: var(--space-6); }
.dashboard-actions { display: flex; gap: var(--space-3); margin-bottom: var(--space-6); flex-wrap: wrap; }
.today-meals h3 { font-size: var(--font-size-m); margin-bottom: var(--space-4); }
.meal-list { display: flex; flex-direction: column; gap: var(--space-2); }
.meal-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-color); }
.meal-row:last-child { border-bottom: none; }
.meal-time { margin-left: auto; font-size: var(--font-size-xs); color: var(--text-tertiary); }

/* Stats */
.stat-card { text-align: center; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.stat-card:hover { box-shadow: var(--shadow-4); }
.stat-card:active { transform: scale(0.985); box-shadow: var(--shadow-2); transition-duration: 0.06s; }
.stat-value { font-size: var(--font-size-2xl); font-weight: 700; color: var(--accent); }
.stat-label { font-size: var(--font-size-s); color: var(--text-secondary); margin-top: var(--space-1); }

/* ── Grocery List ─────────────────────────────────────────────────────────── */
.progress-bar-container { height: 8px; background: var(--bg-layer2); border-radius: 4px; margin-bottom: var(--space-5); overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.4s ease; }

.accordion { display: flex; flex-direction: column; gap: var(--space-3); }
.accordion-item { border-radius: var(--radius-l); background: var(--bg-base); box-shadow: var(--shadow-2); overflow: hidden; }
.accordion-header { width: 100%; background: none; border: none; padding: var(--space-4); display: flex; align-items: center; gap: var(--space-3); cursor: pointer; font-size: var(--font-size-base); font-weight: 600; font-family: var(--font-family); color: var(--text-primary); text-align: left; }
.accordion-header:hover { background: var(--bg-layer2); }
.accordion-count { font-size: var(--font-size-s); color: var(--text-secondary); font-weight: 400; }
.accordion-chevron { margin-left: auto; transition: transform 0.2s; }
.accordion-item:not(.open) .accordion-chevron { transform: rotate(-90deg); }
.accordion-body { display: none; padding: 0 var(--space-4) var(--space-4); }
.accordion-item.open .accordion-body { display: block; }

.grocery-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.grocery-label { display: flex; align-items: center; gap: var(--space-3); width: 100%; cursor: pointer; padding: var(--space-2) var(--space-3); border-radius: var(--radius-m); transition: background 0.1s; }
.grocery-label:hover { background: var(--bg-layer2); }
.grocery-item.checked .grocery-name { text-decoration: line-through; opacity: 0.5; }
.grocery-check {
    width: 18px; height: 18px;
    appearance: none; -webkit-appearance: none;
    background-color: #fff;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer; flex-shrink: 0;
    position: relative;
    transition: background-color 0.15s, border-color 0.15s;
}
[data-theme="dark"] .grocery-check { background-color: var(--bg-layer2); }
.grocery-check:checked { background-color: var(--accent); border-color: var(--accent); }
.grocery-check:checked::after {
    content: '';
    position: absolute;
    left: 3px; top: 0;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.grocery-name { font-size: var(--font-size-base); flex: 1; }
.grocery-qty { font-size: var(--font-size-s); color: var(--text-secondary); white-space: nowrap; }
.grocery-cost { font-size: var(--font-size-s); font-weight: 500; color: var(--accent); white-space: nowrap; min-width: 52px; text-align: right; }
.grocery-grand-total { font-size: var(--font-size-m); color: var(--accent); margin-top: var(--space-2); }
.accordion-subtotal { font-weight: 600; color: var(--accent); font-size: var(--font-size-s); margin-left: auto; }

/* ── Pricing ───────────────────────────────────────────────────────────── */
.ingredient-cost { margin-left: auto; font-weight: 600; color: var(--accent); font-size: var(--font-size-s); white-space: nowrap; }
.cost-summary { padding: var(--space-3) var(--space-4); background: var(--bg-layer1); border-radius: var(--radius-m); margin-top: var(--space-3); }
.cost-row { display: flex; justify-content: space-between; padding: var(--space-1) 0; font-size: var(--font-size-base); }
.plan-day-cost { padding: var(--space-2) var(--space-3); margin-top: var(--space-2); font-size: var(--font-size-s); font-weight: 600; color: var(--accent); text-align: right; border-top: 1px solid var(--border-color); }

/* ── Recipe pages ─────────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: flex-end; gap: var(--space-5); flex-wrap: wrap; margin-bottom: var(--space-6); }
.filter-group { display: flex; flex-direction: column; gap: var(--space-2); }
.filter-group label { font-size: var(--font-size-s); font-weight: 600; color: var(--text-secondary); }
.filter-tabs { display: flex; gap: var(--space-1); flex-wrap: wrap; }

@media (max-width: 768px) {
    .filter-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: var(--space-1);
    }
    .filter-tabs::-webkit-scrollbar { display: none; }
    .filter-tab { flex-shrink: 0; }
}
.filter-tab { padding: 6px 14px; border-radius: 100px; font-size: var(--font-size-s); font-weight: 500; border: 1.5px solid var(--border-color); background: var(--bg-base); color: var(--text-secondary); cursor: pointer; text-decoration: none; transition: all 0.15s; }
.filter-tab:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.filter-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.search-group { flex-direction: row; align-items: center; gap: var(--space-2); margin-left: auto; }
.search-group input { width: 220px; }

.recipe-card { text-decoration: none; color: var(--text-primary); display: flex; flex-direction: column; }
.recipe-card:hover { box-shadow: var(--shadow-4); text-decoration: none; color: var(--text-primary); }
.recipe-card-header { margin-bottom: var(--space-1); }
.recipe-card-name { font-family: var(--font-family-serif); font-size: var(--font-size-base); font-weight: 500; margin-bottom: var(--space-1); flex: 1; }
.recipe-card-meta { display: flex; gap: var(--space-2); font-size: var(--font-size-xs); color: var(--text-tertiary); margin-bottom: var(--space-2); }
.recipe-card-foods { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-2); }
.recipe-card-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.card-link { text-decoration: none; }

.back-link { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text-secondary); font-size: var(--font-size-s); margin-bottom: var(--space-5); text-decoration: none; }
.back-link:hover { color: var(--accent); text-decoration: none; }

.recipe-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-6); flex-wrap: wrap; }
.recipe-meta-bar { display: flex; gap: var(--space-5); font-size: var(--font-size-s); color: var(--text-secondary); margin-top: var(--space-3); flex-wrap: wrap; }
.recipe-dietary-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.recipe-detail-columns { display: grid; grid-template-columns: 1fr 2fr; gap: var(--space-5); margin-top: var(--space-5); }
.recipe-cta { margin-top: var(--space-6); text-align: center; }

.beneficial-foods-card { margin-bottom: var(--space-5); }
.beneficial-foods-list { display: flex; flex-direction: column; gap: var(--space-3); }
.beneficial-food-item { padding: var(--space-4); background: var(--bg-layer1); border-radius: var(--radius-m); }
.beneficial-food-item.primary { border-left: 3px solid var(--accent); }
.beneficial-food-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.learn-more-link { font-size: var(--font-size-xs); color: var(--accent); }

.nutrition-card { margin-bottom: var(--space-5); }
.nutrition-grid { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.nutrient-item { display: flex; flex-direction: column; align-items: center; min-width: 90px; padding: var(--space-3) var(--space-4); background: var(--bg-layer1); border-radius: var(--radius-m); }
.nutrient-value { font-size: var(--font-size-l); font-weight: 700; color: var(--text-primary); }
.nutrient-label { font-size: var(--font-size-xs); color: var(--text-secondary); margin-top: var(--space-1); }

.ingredients-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.ingredient-item { display: flex; align-items: baseline; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-color); }
.ingredient-item:last-child { border-bottom: none; }
.ingredient-qty { font-size: var(--font-size-s); font-weight: 600; min-width: 70px; color: var(--accent); }
.ingredient-name { flex: 1; }
.ingredient-cat { font-size: var(--font-size-xs); color: var(--text-tertiary); }
.instructions-text { font-size: var(--font-size-base); line-height: 1.7; color: var(--text-secondary); }

/* ── Conditions pages ─────────────────────────────────────────────────────── */
.tabs-container { margin-top: var(--space-5); }
.tab-list { display: flex; gap: var(--space-2); border-bottom: 2px solid var(--border-color); margin-bottom: var(--space-6); }
.tab-btn { padding: var(--space-3) var(--space-5); border: none; background: none; cursor: pointer; font-size: var(--font-size-base); font-weight: 600; color: var(--text-secondary); font-family: var(--font-family); border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color 0.15s, border-color 0.15s; }
.tab-btn:hover { color: var(--accent); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.conditions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.condition-card { text-align: center; }
.condition-card-icon { color: var(--accent); margin-bottom: var(--space-2); display: flex; justify-content: center; }
.condition-card-icon svg { width: 36px; height: 36px; }
.condition-card h3 { margin-bottom: var(--space-1); font-size: var(--font-size-base); }
.condition-card p { font-size: var(--font-size-xs); color: var(--text-secondary); margin-bottom: var(--space-3); }

/* ── Conditions page — AIM-themed treatment ───────────────────────────── */
.aim-r .conditions-grid {
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 14px;
    margin-bottom: 0;
}
.aim-r .conditions-section { margin-top: 28px; }
.aim-r .conditions-section + .conditions-section { margin-top: 36px; }
.aim-r .conditions-section-title {
    font-family: var(--aim-serif);
    font-weight: 400;
    font-size: 22px;
    line-height: 1.2;
    color: var(--aim-ink);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.aim-r .conditions-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--aim-line) 0%, transparent 100%);
}

.aim-r .condition-card {
    position: relative;
    padding: 22px 16px 18px;
    border-radius: 16px;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    text-align: center;
    overflow: hidden;
    transition: transform .25s cubic-bezier(0.23,1,0.32,1), box-shadow .25s ease, border-color .15s ease;
}
.aim-r .condition-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--aim-ink) 0%, var(--aim-accent) 100%);
    opacity: 0;
    transition: opacity .25s ease;
}
.aim-r .condition-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(42, 74, 58, 0.10);
    border-color: var(--aim-ink-mute);
}
.aim-r .condition-card:hover::before { opacity: 1; }

.aim-r .condition-card-iconchip {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 16px;
    background: var(--aim-tint);
    color: var(--aim-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s cubic-bezier(0.23,1,0.32,1), background .2s ease;
}
.aim-r .condition-card-iconchip svg { width: 28px; height: 28px; }
.aim-r .condition-card:hover .condition-card-iconchip {
    transform: scale(1.06);
    background: var(--aim-accent-soft);
}

.aim-r .condition-card h3 {
    font-family: var(--aim-serif);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.2;
    color: var(--aim-ink);
    margin: 0 0 6px;
}
.aim-r .condition-card p {
    font-size: 13px;
    line-height: 1.45;
    color: var(--aim-ink-soft);
    margin: 0;
}

/* ── Conditions index — feature cards w/ per-category accent ──────────── */
.aim-r .cond-hero {
    padding: 8px 0 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--aim-line);
}
.aim-r .cond-hero-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--aim-accent);
    margin-bottom: 10px;
}
.aim-r .cond-hero h1 {
    font-family: var(--aim-serif);
    font-weight: 400;
    font-size: 40px;
    line-height: 1.08;
    color: var(--aim-ink);
    margin: 0 0 12px;
    letter-spacing: -0.01em;
}
.aim-r .cond-hero h1 .ital { font-style: italic; color: var(--aim-accent); }
.aim-r .cond-hero p {
    font-size: 15px;
    color: var(--aim-ink-soft);
    max-width: 62ch;
    line-height: 1.55;
    margin: 0;
}

.aim-r .conditions-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-bottom: 40px;
}

.aim-r .condition-card-feature {
    padding: 26px 22px 22px;
    text-align: left;
    display: flex;
    flex-direction: column;
    min-height: 220px;
}
.aim-r .condition-card-feature .condition-card-iconchip {
    margin: 0 0 16px;
    width: 52px;
    height: 52px;
    border-radius: 14px;
}
.aim-r .condition-card-feature .condition-card-iconchip svg { width: 26px; height: 26px; }
.aim-r .condition-card-feature:hover .condition-card-iconchip { transform: scale(1.04); }

.aim-r .condition-card-feature h3 {
    font-size: 21px;
    line-height: 1.15;
    margin: 0 0 4px;
}
.aim-r .cond-count {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--aim-ink-soft);
    margin-bottom: 14px;
}
.aim-r .cond-samples {
    font-size: 13px;
    color: var(--aim-ink-soft);
    line-height: 1.55;
    margin: 0 0 18px;
    flex: 1;
}
.aim-r .cond-samples strong { color: var(--aim-ink); font-weight: 600; }

.aim-r .cond-cta {
    margin-top: auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--aim-ink);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap .2s ease, color .15s ease;
}
.aim-r .cond-cta::after {
    content: "→";
    transition: transform .25s cubic-bezier(0.23,1,0.32,1);
}
.aim-r .condition-card-feature:hover .cond-cta { color: var(--aim-accent); }
.aim-r .condition-card-feature:hover .cond-cta::after { transform: translateX(4px); }

/* Per-category accent palette. Slugs come from ConditionsController.Slugify
   and are stable: any rename of the TopCategory string also renames the class.
   The colors are exposed as --cc-color (full strength) and --cc-soft (chip bg)
   so they can drive any component placed inside a .cc-<slug> wrapper. */
.aim-r .cc-immune-infections     { --cc-color: #7A8C5E; --cc-soft: #DEE6CF; }
.aim-r .cc-digestive-metabolic   { --cc-color: #B8945B; --cc-soft: #F2E2C4; }
.aim-r .cc-brain-mood-nerves     { --cc-color: #8A6F9E; --cc-soft: #E5DBED; }
.aim-r .cc-skin-hair-outer-health { --cc-color: #C18C84; --cc-soft: #F2E0DC; }
.aim-r .cc-hormonal-reproductive { --cc-color: #A87897; --cc-soft: #ECDBE5; }
.aim-r .cc-heart-circulation     { --cc-color: #6B8AA0; --cc-soft: #D9E3EC; }
.aim-r .cc-bones-joints-muscles  { --cc-color: #8A7A5C; --cc-soft: #E8DFCB; }

.aim-r .condition-card-feature .condition-card-iconchip {
    background: var(--cc-soft, var(--aim-tint));
    color: var(--cc-color, var(--aim-ink));
}
.aim-r .condition-card-feature::before {
    background: linear-gradient(90deg, var(--cc-color, var(--aim-ink)) 0%, var(--aim-accent) 100%);
}

/* The shared ::before stripe is 3px and only appears on hover for the base
   condition-card. Make it slightly thicker + always-visible for feature cards
   so each card reads as belonging to its category at rest. */
.aim-r .condition-card-feature::before { height: 4px; opacity: .45; }
.aim-r .condition-card-feature:hover::before { opacity: 1; }

/* ── Drill pages — breadcrumb + tinted hero ─────────────────────────────── */
.aim-r .cond-hero-breadcrumb {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 12px;
    color: var(--aim-ink-soft);
}
.aim-r .cond-hero-breadcrumb a {
    color: var(--aim-ink-soft);
    text-decoration: none;
    transition: color .15s ease;
}
.aim-r .cond-hero-breadcrumb a:hover { color: var(--aim-ink); }
.aim-r .cond-hero-breadcrumb .sep { margin: 0 8px; color: var(--aim-line); }
.aim-r .cond-hero-breadcrumb .current {
    color: var(--cc-color, var(--aim-accent));
    font-weight: 700;
}

/* Slim accent stripe across the top of the drill page hero — the same
   gradient used on feature cards, so the bucket identity carries through. */
.aim-r .cond-hero-tinted {
    position: relative;
    padding-top: 24px;
}
.aim-r .cond-hero-tinted::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--cc-color, var(--aim-ink)) 0%, var(--aim-accent) 100%);
    opacity: .65;
}

/* ── Drill pages — compact text-forward cards ───────────────────────────── */
.aim-r .conditions-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 40px;
}
.aim-r .condition-card-list {
    position: relative;
    padding: 20px 20px 18px;
    border-radius: 14px;
    background: var(--aim-bg-card, white);
    border: 1px solid var(--aim-line);
    text-align: left;
    display: flex;
    flex-direction: column;
    min-height: 130px;
    overflow: hidden;
    transition: transform .25s cubic-bezier(0.23,1,0.32,1), box-shadow .25s ease, border-color .15s ease;
}
.aim-r .condition-card-list::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--cc-color, var(--aim-ink)) 0%, var(--aim-accent) 100%);
    opacity: 0;
    transition: opacity .2s ease;
}
.aim-r .condition-card-list:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(42, 74, 58, 0.08);
    border-color: var(--aim-ink-mute);
}
.aim-r .condition-card-list:hover::before { opacity: 1; }

.aim-r .condition-card-list h3 {
    font-family: var(--aim-serif);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.2;
    color: var(--aim-ink);
    margin: 0 0 6px;
}
.aim-r .condition-card-list .cond-meta {
    font-size: 12px;
    color: var(--aim-ink-soft);
    margin: 0 0 10px;
    line-height: 1.45;
    flex: 1;
}
.aim-r .condition-card-list .cond-cta {
    margin-top: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--cc-color, var(--aim-ink));
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap .2s ease;
}
.aim-r .condition-card-list .cond-cta::after {
    content: "→";
    transition: transform .25s cubic-bezier(0.23,1,0.32,1);
}
.aim-r .condition-card-list:hover .cond-cta { gap: 10px; }
.aim-r .condition-card-list:hover .cond-cta::after { transform: translateX(3px); }

/* ── Wellness-style cards in the Conditions context ────────────────────── */

/* The pill icon picks up the category accent when inside a .cc-<slug>
   wrapper, falling back to the default sage tint otherwise (so the Home
   page wellness goals keep their original look). */
.aim-r .m-wellness-goal-icon {
    background: var(--cc-soft, var(--aim-tint));
    color: var(--cc-color, var(--aim-ink));
}
.aim-r .m-wellness-goal:hover {
    border-color: var(--cc-color, var(--aim-ink-mute));
}

/* A flatter, less-marketing variant of m-wellness-goals: single column on
   mobile, auto-fill columns on tablet/desktop, no sidecar slot reserved.
   Used by the Conditions index and drill pages. */
.aim-r .cond-wellness-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 40px;
}
@media (min-width: 768px) {
    .aim-r .cond-wellness-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 14px;
    }
}

/* Stretch the body so the "Explore →" CTA can anchor to the bottom of the
   card regardless of description length — matches the home wellness goal
   feel where the name reads first and detail flows beneath. */
.aim-r .cond-wellness-grid .m-wellness-goal {
    min-height: 138px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 14px;
}
.aim-r .cond-wellness-grid .m-wellness-goal-body {
    flex: 1;
    width: 100%;
}
.aim-r .cond-wellness-grid .m-wellness-goal-cta {
    margin-top: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cc-color, var(--aim-ink));
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap .2s ease;
}
.aim-r .cond-wellness-grid .m-wellness-goal-cta::after {
    content: "→";
    transition: transform .25s cubic-bezier(0.23,1,0.32,1);
}
.aim-r .cond-wellness-grid .m-wellness-goal:hover .m-wellness-goal-cta { gap: 10px; }
.aim-r .cond-wellness-grid .m-wellness-goal:hover .m-wellness-goal-cta::after { transform: translateX(3px); }

/* When the m-wellness-goal-desc is the only line under the name (drill
   pages with short metadata like "12 conditions"), let it sit flush rather
   than getting clamped to 2 lines. */
.aim-r .cond-wellness-grid .m-wellness-goal-desc {
    -webkit-line-clamp: 3;
}

/* Soft empty-state card matching the wellness aesthetic. */
.aim-r .cond-empty-card {
    padding: 32px 28px;
    border-radius: 18px;
    background: var(--aim-bg-soft, var(--aim-tint));
    border: 1px solid var(--aim-line);
    text-align: center;
    margin-bottom: 40px;
}
.aim-r .cond-empty-card p {
    color: var(--aim-ink-soft);
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.55;
}

/* Bigger, more wellness-magazine hero on the Conditions root + drill pages.
   Pairs an italic-accented serif h1 with the eyebrow / breadcrumb above. */
.aim-r .cond-hero h1 .ital {
    font-style: italic;
    color: var(--cc-color, var(--aim-accent));
}
@media (min-width: 768px) {
    .aim-r .cond-hero h1 { font-size: 52px; line-height: 1.05; }
    .aim-r .cond-hero p  { font-size: 16px; }
}

/* ── Detail page — condition hero w/ "Also covers" pill row ─────────────── */
.aim-r .cond-detail-covers {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.aim-r .cond-detail-covers .cond-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--cc-soft, var(--aim-tint));
    color: var(--cc-color, var(--aim-ink));
    letter-spacing: .02em;
}
.aim-r .cond-detail-covers .cond-pill-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--aim-ink-soft);
    padding: 4px 0;
}

/* Goals tab keeps the existing small-card density; only Conditions tab uses
   the feature treatment. */

/* Food detail */
.food-detail-header { margin-bottom: var(--space-5); }
.food-description { color: var(--text-secondary); margin: var(--space-3) 0; font-size: var(--font-size-m); }
.nutritional-highlights { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border-color); }
.food-links-card { margin-bottom: var(--space-5); }
.food-links-list { display: flex; flex-direction: column; gap: var(--space-3); }
.food-link-item { padding: var(--space-4); background: var(--bg-layer1); border-radius: var(--radius-m); }
.food-link-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.effectiveness-stars { display: flex; gap: 2px; }
.star { color: var(--border-color); font-size: 16px; }
.star.filled { color: #f0a900; }
.recipe-list-small { display: flex; flex-direction: column; gap: 0; }
.recipe-list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--border-color); text-decoration: none; color: var(--text-primary); transition: background 0.1s; }
.recipe-list-item:last-child { border-bottom: none; }
.recipe-list-item:hover { background: var(--bg-layer2); text-decoration: none; }
.recipe-list-name { flex: 1; font-size: var(--font-size-base); }
.recipe-list-time { font-size: var(--font-size-xs); color: var(--text-tertiary); }

/* ── Profile page ─────────────────────────────────────────────────────────── */
.profile-card { max-width: 720px; }

/* ── History page ─────────────────────────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: var(--space-4); }
.history-card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-4); width: 100%; }
.history-card-info { display: grid; grid-template-columns: 160px minmax(260px, 1fr) 100px; align-items: center; gap: var(--space-4); flex: 1; min-width: 0; }
.history-card-type { justify-self: start; white-space: nowrap; }
.history-card-dates { margin: 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-card-duration { margin: 0; color: var(--text-secondary); white-space: nowrap; }
.history-card-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

@media (max-width: 720px) {
    .history-card-info { grid-template-columns: 1fr; gap: var(--space-1); }
    .history-card-dates { white-space: normal; }
}

/* ── Responsive additions ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .recipe-detail-columns { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-group { flex-direction: row; }
    .search-group input { flex: 1; width: auto; }
    .plan-week-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; }
    .selectable-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

    /* Landing page hero */
    .hero-inner { flex-direction: column; text-align: center; }
    .hero-image { order: -1; }
    .hero-image img { max-width: 120px; }
    .hero-actions { justify-content: center; }
    .hero-badge { font-size: var(--font-size-xs); }
}

@media (max-width: 480px) {
    .hero { padding: var(--space-3) var(--space-2); border-radius: var(--radius-l); }
    .hero-title { font-size: var(--font-size-m); }
    .hero-subtitle { font-size: var(--font-size-s); }
    .hero-actions { flex-direction: column; align-items: stretch; }
    .hero-actions .btn { text-align: center; }
    .wizard-progress { flex-wrap: wrap; }
    .plan-type-tabs { flex-direction: column; }
    .wizard-actions { flex-direction: column-reverse; }
    .form-actions { flex-direction: column; }
    .dashboard-actions { flex-direction: column; }
}

/* ── Grocery Page (Variant B — hero + list) ──────────────────────────────── */
.grocery-page {
    max-width: 560px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-3) 120px;
}

/* ── Hero ── */
.grocery-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-pressed) 100%);
    border-radius: 18px;
    padding: 14px 16px;
    color: #fff;
    margin: 0 0 12px;
}
.grocery-hero-bg {
    position: absolute; top: -30px; right: -30px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,0.06); border-radius: 50%;
    pointer-events: none;
}
.grocery-hero-back {
    display: inline-block;
    background: rgba(255,255,255,0.18);
    color: #fff; font-size: 11px; line-height: 1;
    padding: 6px 10px; border-radius: 999px;
    text-decoration: none;
}
.grocery-hero-row {
    display: flex; align-items: baseline;
    gap: 10px; flex-wrap: wrap;
    margin-top: 8px;
}
.grocery-hero-spacer { flex: 1; }
.grocery-hero-title {
    font-family: var(--font-family-display);
    font-size: 24px; font-weight: 700;
    letter-spacing: -0.4px; line-height: 1;
    margin: 0;
}
.grocery-hero-cost {
    font-family: var(--font-family-display);
    font-size: 26px; font-weight: 700; line-height: 1;
}
.grocery-hero-cost-label { font-size: 11px; opacity: 0.85; margin-left: 5px; }
.grocery-hero-date { opacity: 0.75; font-size: 10px; margin: 4px 0 0; }
.grocery-hero-stats {
    margin-top: 10px; font-size: 11px; opacity: 0.9;
    line-height: 1.3;
}
.grocery-hero-stats b { font-size: 13px; font-weight: 700; opacity: 1; }
.grocery-hero-bar {
    margin-top: 8px; height: 5px;
    background: rgba(255,255,255,0.18);
    border-radius: 999px; overflow: hidden;
}
.grocery-hero-bar-fill {
    height: 100%; background: rgba(255,255,255,0.85);
    border-radius: 999px; transition: width 0.4s ease;
}

/* ── Toolbar ── */
.grocery-toolbar {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 8px; margin: 0 0 12px;
}
.grocery-tb-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 12px;
    border-radius: 999px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 12px; font-weight: 600;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    font-family: inherit;
}
.grocery-tb-btn .icon { width: 14px; height: 14px; }
.grocery-tb-btn:hover { background: var(--bg-layer1); }
.grocery-tb-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff; font-weight: 700;
}
.grocery-tb-btn-primary:hover { background: var(--accent-hover); }
.grocery-tb-spacer { flex: 1; }
.grocery-tb-reset {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 12px;
    background: transparent; border: none;
    color: var(--text-secondary);
    font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.grocery-tb-reset .icon { width: 14px; height: 14px; }

/* ── Connect banner ── */
.grocery-connect-banner {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 12px; padding: 10px 12px;
    background: rgba(198,139,46,0.12);
    border: 1px solid rgba(198,139,46,0.3);
    border-radius: 12px;
}
.grocery-connect-icon {
    width: 28px; height: 28px; border-radius: 8px;
    background: #fff; color: #C68B2E;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.grocery-connect-icon .icon { width: 16px; height: 16px; }
.grocery-connect-copy { flex: 1; min-width: 0; }
.grocery-connect-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.grocery-connect-helper { font-size: 11px; color: var(--text-secondary); line-height: 1.35; }
.grocery-connect-btn {
    display: inline-flex; align-items: center;
    height: 28px; padding: 0 10px;
    border-radius: 999px;
    background: #C68B2E; color: #fff; border: none;
    font-size: 11px; font-weight: 700;
    cursor: pointer; white-space: nowrap;
    text-decoration: none;
}
.grocery-connect-btn:hover { background: #AE7A28; color: #fff; }

/* ── Category cards ── */
.grocery-categories {
    display: flex; flex-direction: column; gap: 10px;
}
.grocery-category {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: none;
    margin: 0;
}
.grocery-cat-toggle {
    display: flex; align-items: center;
    width: 100%; padding: 12px 14px;
    background: transparent; border: none;
    cursor: pointer; text-align: left;
    font-family: inherit; color: var(--text-primary);
    gap: 10px;
}
.grocery-cat-head { flex: 1; min-width: 0; }
.grocery-cat-title-row {
    display: flex; align-items: baseline; gap: 6px;
    margin-bottom: 4px; flex-wrap: wrap;
}
.grocery-cat-name {
    font-family: var(--font-family-display);
    font-size: 16px; font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-primary);
    margin: 0;
}
.grocery-cat-meta { font-size: 11px; color: var(--text-secondary); }
.grocery-cat-meta b { color: var(--accent-pressed); font-weight: 700; }
.grocery-cat-progress {
    width: 120px; max-width: 60%; height: 4px;
    background: rgba(123,142,107,0.18);
    border-radius: 999px; overflow: hidden;
}
.grocery-cat-progress-fill {
    height: 100%; background: var(--accent);
    border-radius: 999px; transition: width .3s ease;
}
.grocery-cat-count {
    font-size: 11px; color: var(--text-secondary);
    margin-right: 2px; white-space: nowrap;
}
.grocery-cat-chevron {
    width: 14px; height: 14px;
    color: var(--text-secondary);
    transition: transform 160ms;
    flex-shrink: 0;
}
.accordion-toggle[aria-expanded='false'] .grocery-cat-chevron { transform: rotate(-90deg); }
.accordion-panel { }
.accordion-toggle[aria-expanded='false'] + .accordion-panel { display: none; }

/* ── Item rows ── */
.grocery-active-items,
.grocery-gotit-items { list-style: none; padding: 0; margin: 0; }
.grocery-item-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    cursor: pointer;
    transition: opacity 160ms ease;
}
.grocery-active-items > .grocery-item-row:first-child { border-top: none; }
.grocery-gotit-items > .grocery-item-row:first-child { border-top: none; }
.grocery-item-row.checked { opacity: 0.45; }
.grocery-item-row.checked .grocery-item-name { text-decoration: line-through; }

.grocery-item-check {
    appearance: none; -webkit-appearance: none;
    width: 22px; height: 22px; border-radius: 6px;
    border: 1.5px solid rgba(123,142,107,0.4);
    background: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; cursor: pointer; margin: 0;
    position: relative;
}
.grocery-item-check:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.grocery-item-check:checked::after {
    content: '';
    width: 11px; height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}
.grocery-item-name {
    flex: 1; min-width: 0;
    font-size: 14px; font-weight: 500;
    color: var(--text-primary);
}
.grocery-item-qty {
    font-size: 11px; color: var(--text-secondary);
    white-space: nowrap;
}
.grocery-item-price {
    font-size: 13px; font-weight: 700;
    color: var(--accent-pressed);
    min-width: 48px; text-align: right;
}

/* ── Got-it fold ── */
.grocery-gotit { border-top: 1px dashed var(--border-color); }
.grocery-gotit[data-empty='true'] { display: none; }
.grocery-active-items:empty + .grocery-gotit { border-top: none; }
.grocery-gotit-toggle {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 10px 14px;
    background: rgba(123,142,107,0.08);
    border: none; cursor: pointer; font-family: inherit;
}
.grocery-gotit-toggle .icon { width: 14px; height: 14px; }
.grocery-gotit-label {
    flex: 1; text-align: left;
    font-size: 12px; font-weight: 600;
    color: var(--accent-pressed);
}
.grocery-gotit-chevron {
    color: var(--accent-pressed);
    transition: transform 160ms;
}
.grocery-gotit[data-expanded='false'] .grocery-gotit-chevron { transform: rotate(-90deg); }
.grocery-gotit[data-expanded='false'] .grocery-gotit-items { display: none; }

/* ── Download bottom sheet ── */
.grocery-sheet-overlay {
    position: fixed; inset: 0;
    background: rgba(43,46,37,0.35);
    display: none;
    align-items: flex-end; justify-content: center;
    z-index: 1000;
    animation: grocery-sheet-fade 160ms ease;
}
.grocery-sheet-overlay.open { display: flex; }
.grocery-sheet {
    width: 100%; max-width: 560px;
    background: var(--aim-bg);
    border: 1px solid var(--aim-line);
    border-bottom: 0;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 18px 16px 24px;
    box-shadow: 0 -12px 40px rgba(43, 46, 37, 0.18);
    animation: grocery-sheet-rise 220ms ease;
    color: var(--aim-ink);
}
.grocery-sheet-handle {
    width: 36px; height: 4px;
    background: var(--aim-line);
    border-radius: 999px;
    margin: 0 auto 12px;
}
.grocery-sheet-title {
    font-family: var(--aim-serif);
    font-size: 22px; font-weight: 400;
    color: var(--aim-ink);
    margin: 0 0 4px;
}
.grocery-sheet-helper {
    font-size: 12.5px; color: var(--aim-ink-soft);
    margin: 0 0 14px;
}
.grocery-sheet-fields {
    display: grid; grid-template-columns: 2fr 1fr;
    gap: 10px; margin-bottom: 14px;
}
.grocery-sheet-field label {
    font-size: 11px; font-weight: 600;
    color: var(--text-primary);
    display: block; margin-bottom: 4px;
}
.grocery-sheet-field select { width: 100%; }
.grocery-sheet-primary {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; width: 100%; height: 44px;
    border-radius: 999px;
    background: var(--accent); color: #fff; border: none;
    font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    font-family: inherit;
}
.grocery-sheet-primary:hover { background: var(--accent-hover); color: #fff; }
.grocery-sheet-primary .icon { width: 14px; height: 14px; }

.grocery-sheet-secondary {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; width: 100%; height: 44px;
    margin-top: 10px;
    border-radius: 999px;
    background: var(--bg-base); color: var(--accent-pressed);
    border: 1.5px solid var(--accent);
    font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    font-family: inherit;
}
.grocery-sheet-secondary:hover { background: var(--accent-light); }
.grocery-sheet-secondary .icon { width: 14px; height: 14px; }
.grocery-sheet-secondary:disabled { opacity: 0.6; cursor: wait; }

/* ── Reset confirmation dialog ── */
body.grocery-reset-open { overflow: hidden; }
.grocery-reset-overlay {
    position: fixed; inset: 0;
    display: none;
    align-items: center; justify-content: center;
    padding: 22px;
    background: rgba(43,46,37,0.42);
    z-index: 1100;
}
.grocery-reset-overlay.open { display: flex; }
.grocery-reset-dialog {
    width: min(100%, 360px);
    background: var(--aim-bg);
    border: 1px solid var(--aim-line);
    border-radius: 22px;
    padding: 22px 18px 18px;
    color: var(--aim-ink);
    text-align: center;
    box-shadow: 0 22px 70px rgba(43,46,37,0.26);
}
.grocery-reset-icon {
    width: 52px; height: 52px;
    margin: 0 auto 12px;
    border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    background: var(--aim-bg-soft);
    color: var(--aim-ink);
}
.grocery-reset-icon .icon { width: 20px; height: 20px; }
.grocery-reset-title {
    margin: 0;
    color: var(--aim-ink);
    font-family: var(--aim-serif);
    font-size: 25px;
    font-weight: 400;
    line-height: 1.1;
}
.grocery-reset-copy {
    margin: 10px auto 18px;
    max-width: 280px;
    color: var(--aim-ink-soft);
    font-size: 13px;
    line-height: 1.45;
}
.grocery-reset-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.grocery-reset-cancel,
.grocery-reset-confirm {
    min-height: 42px;
    border-radius: 999px;
    padding: 9px 14px;
    border: 1px solid var(--aim-line);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.grocery-reset-cancel {
    background: var(--aim-bg-card);
    color: var(--aim-ink);
}
.grocery-reset-confirm {
    background: var(--aim-ink);
    border-color: var(--aim-ink);
    color: var(--aim-bg);
}
.grocery-reset-cancel:hover { border-color: var(--aim-ink-soft); }
.grocery-reset-confirm:hover { opacity: 0.92; }

.grocery-footnote {
    text-align: center; margin-top: var(--space-4);
    font-size: var(--font-size-s); color: var(--text-secondary);
}

@@keyframes grocery-sheet-fade { from { background: rgba(43,46,37,0); } to { background: rgba(43,46,37,0.35); } }
@@keyframes grocery-sheet-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ── Nutrition Program Pages ─────────────────────────────────────────────── */

/* Program Library */
.program-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--space-4);
}

.program-card {
    background: var(--bg-base);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    position: relative;
    transition: box-shadow 0.15s, transform 0.15s;
}

.program-card:hover { box-shadow: var(--shadow-4); }
.program-card--active { box-shadow: 0 0 0 2px var(--accent), var(--shadow-2); }

.program-card-active-badge {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
}

.badge-success { background: var(--accent); color: white; }
.program-card-header { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.program-card-title { font-size: var(--font-size-base); font-weight: 600; }
.program-card-desc { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.5; flex: 1; }

.program-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: var(--font-size-s);
    color: var(--text-tertiary);
}

.program-card-duration { font-weight: 600; }
.program-card-tiers { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.tier-pill { background: var(--bg-layer2); color: var(--text-secondary); padding: 2px 10px; border-radius: 100px; font-size: var(--font-size-xs); font-weight: 500; }
.program-card-cta { align-self: flex-start; margin-top: auto; }

/* Program Detail */
.detail-layout { max-width: 800px; }
.detail-section { margin-bottom: var(--space-6); padding-bottom: var(--space-6); border-bottom: 1px solid var(--border-color); }
.detail-section:last-child { border-bottom: none; padding-bottom: 0; }
.detail-section h2 { margin-bottom: var(--space-4); }
.detail-section h3 { margin: var(--space-4) 0 var(--space-3); }
.detail-section h4 { margin: var(--space-5) 0 var(--space-3); font-size: var(--font-size-base); color: var(--text-secondary); }
.detail-intro { color: var(--text-secondary); line-height: 1.7; font-size: var(--font-size-base); }

.benefits-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.benefits-list li { padding-left: var(--space-5); position: relative; line-height: 1.6; color: var(--text-secondary); }
.benefits-list li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

.tier-tabs { display: flex; gap: var(--space-3); margin-bottom: var(--space-5); }

.tier-panel { display: none; }
.tier-panel.active { display: block; }
.tier-panel h3 { font-size: var(--font-size-m); margin-bottom: var(--space-4); }

.nutrient-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-s);
    margin-bottom: var(--space-4);
}

.nutrient-table th,
.nutrient-table td {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-color);
}

.nutrient-table th { font-weight: 600; color: var(--text-secondary); font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.04em; }
.nutrient-table tbody tr:hover { background: var(--bg-layer1); }

.badge-xs { font-size: 10px; padding: 1px 6px; }

.meal-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: var(--space-2);
}

.meal-slot-card {
    background: var(--bg-layer1);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-2);
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.meal-slot-type { font-size: var(--font-size-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); }
.meal-slot-range { font-size: var(--font-size-s); font-weight: 600; color: var(--accent); }

/* Intake Questionnaire */
.intake-form { max-width: 700px; }

.intake-question {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
}

.intake-question-text { font-size: var(--font-size-m); margin-bottom: var(--space-4); }

.intake-choices { display: flex; gap: var(--space-3); flex-wrap: wrap; }

.intake-choice {
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-m);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-size: var(--font-size-base);
}

.intake-choice:hover { border-color: var(--accent); background: var(--accent-light); }
.intake-choice.selected { border-color: var(--accent); background: var(--accent-light); }
.intake-choice input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; cursor: pointer; }
.intake-choice-label { font-weight: 500; }

/* Recommendation */
.recommendation-layout { max-width: 700px; }

.recommendation-card {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-4);
    padding: var(--space-6);
}

.recommendation-card h2 { margin: var(--space-4) 0 var(--space-2); }
.recommendation-card h3 { margin: var(--space-5) 0 var(--space-3); }

.recommendation-reason {
    background: var(--accent-light);
    border-radius: var(--radius-m);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
}

.recommendation-reason h3 { margin: 0 0 var(--space-2); font-size: var(--font-size-base); }
.recommendation-reason p { color: var(--text-secondary); line-height: 1.6; margin: 0; }
.recommendation-intro { color: var(--text-secondary); line-height: 1.7; margin: var(--space-4) 0; }

.disclaimer-notice {
    background: #fff4e5;
    border-left: 4px solid #b85c00;
    border-radius: 0 var(--radius-m) var(--radius-m) 0;
    padding: var(--space-4);
    margin: var(--space-5) 0;
}

.disclaimer-notice h4 { color: #b85c00; margin-bottom: var(--space-2); }
.disclaimer-notice p { color: #7a4a00; font-size: var(--font-size-s); margin: 0; }
[data-theme="dark"] .disclaimer-notice { background: #3d2e00; }
[data-theme="dark"] .disclaimer-notice h4 { color: #ffb84d; }
[data-theme="dark"] .disclaimer-notice p { color: #e6a84d; }

/* Disclaimer Page */
.disclaimer-layout { max-width: 700px; }

.disclaimer-card {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-4);
    padding: var(--space-6);
}

.disclaimer-content {
    background: var(--bg-layer1);
    border-radius: var(--radius-m);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    line-height: 1.7;
    color: var(--text-secondary);
}

.disclaimer-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    cursor: pointer;
    padding: var(--space-4);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-m);
    margin-bottom: var(--space-5);
    line-height: 1.5;
    font-size: var(--font-size-s);
    transition: border-color 0.15s;
}

.disclaimer-checkbox:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.disclaimer-checkbox input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; margin-top: 2px; }

/* Nutrition Tab */
.nutrition-tabs { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); }

.assignment-card {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.assignment-card-header { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.assignment-card-header h2 { margin: 0; }
.assignment-reason { color: var(--text-secondary); line-height: 1.6; margin-bottom: var(--space-3); }
.assignment-meta { font-size: var(--font-size-s); color: var(--text-tertiary); margin-bottom: var(--space-4); }
.assignment-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }
.btn-danger-text { color: var(--error, #d32f2f); }
.btn-danger-text:hover { background: rgba(211,47,47,0.08); color: var(--error, #b71c1c); }
.empty-state-actions { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }

.history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-base);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-2);
    flex-wrap: wrap;
}

.history-card-info { display: flex; flex-direction: column; gap: var(--space-1); }
.text-muted { color: var(--text-tertiary); }

/* Education */
.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: var(--space-3);
}

.education-card {
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    text-decoration: none;
    color: var(--text-primary);
    transition: box-shadow 0.15s, transform 0.15s;
    position: relative;
}

.education-card:hover { box-shadow: var(--shadow-4); text-decoration: none; color: var(--text-primary); }
.education-card--viewed { opacity: 0.8; }
.education-card h3 { font-size: var(--font-size-s); font-weight: 600; }
.education-card p { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.5; flex: 1; }

.education-viewed-badge {
    font-size: var(--font-size-xs);
    color: var(--accent);
    font-weight: 600;
}

.badge-topic { background: #e5f0ff; color: #003d8f; }
[data-theme="dark"] .badge-topic { background: #1a2d4d; color: #6da3ff; }

.bookmark-btn { cursor: pointer; }

/* Education Article */
.education-article {
    max-width: 700px;
    margin-bottom: var(--space-7);
}

.education-article-summary {
    font-size: var(--font-size-m);
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.education-article-body {
    font-size: var(--font-size-base);
    line-height: 1.8;
    color: var(--text-primary);
}

/* Meal calories on dashboard */
.meal-calories { font-size: var(--font-size-xs); color: var(--text-tertiary); margin-left: var(--space-2); }

/* ── Comprehensive Responsive Overrides ──────────────────────────────────── */

/* Tablet (≤ 768px) */
@media (max-width: 768px) {
    .program-grid { grid-template-columns: 1fr; }
    .education-grid { grid-template-columns: 1fr; }
    .meal-slot-grid { grid-template-columns: 1fr 1fr; }
    .tier-tabs { flex-wrap: wrap; }
    .nutrition-tabs { flex-wrap: wrap; }
    .recommendation-card { padding: var(--space-5); }
    .disclaimer-card { padding: var(--space-5); }
    .nutrient-table { font-size: var(--font-size-xs); }
    .nutrient-table th, .nutrient-table td { padding: var(--space-2); }
    .intake-form { max-width: 100%; }
    .detail-layout { max-width: 100%; }
    .recommendation-layout { max-width: 100%; }
    .disclaimer-layout { max-width: 100%; }
    .meal-row { flex-wrap: wrap; gap: var(--space-2); }
    .meal-calories { margin-left: 0; }
}

/* Phone (≤ 480px) */
@media (max-width: 480px) {
    .program-grid { grid-template-columns: 1fr; }
    .meal-slot-grid { grid-template-columns: 1fr; }
    .education-grid { grid-template-columns: 1fr; }
    .intake-choices { flex-direction: column; }
    .intake-choice { min-width: 0; }
    .tier-tabs { flex-direction: column; }
    .nutrition-tabs { flex-direction: column; }
    .assignment-card { padding: var(--space-4); }
    .recommendation-card { padding: var(--space-4); }
    .disclaimer-card { padding: var(--space-4); }
    .disclaimer-content { padding: var(--space-4); }
    .intake-question { padding: var(--space-4); }
    .program-card { padding: var(--space-4); }
    .history-card { flex-direction: column; align-items: flex-start; }
}

/* ── Food Browse Cards ─────────────────────────────────────────────────────── */
.food-card { text-decoration: none; color: var(--text-primary); display: flex; flex-direction: column; }
.food-card:hover { box-shadow: var(--shadow-4); text-decoration: none; color: var(--text-primary); }
.food-card-img { margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) var(--space-2); overflow: hidden; border-radius: var(--radius-m) var(--radius-m) 0 0; aspect-ratio: 16/9; }
.food-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.food-card-header { margin-bottom: var(--space-1); }
.food-card-name { font-family: var(--font-family-serif); font-size: var(--font-size-base); font-weight: 500; margin-bottom: var(--space-1); }
.food-card-desc { font-size: var(--font-size-xs); color: var(--text-secondary); line-height: 1.5; margin-bottom: var(--space-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.food-card-meta { font-size: var(--font-size-xs); color: var(--text-tertiary); margin-bottom: var(--space-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.food-card-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-2); }
.food-card-tags:last-child { margin-bottom: 0; }

/* Mobile: single-row horizontal scroller with tighter chips and a fade
   on the right edge so overflow is discoverable. */
@media (max-width: 520px) {
    .food-card-tags {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        margin-left: calc(-1 * var(--space-2));
        margin-right: calc(-1 * var(--space-2));
        padding: 2px var(--space-2);
        -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
                mask-image: linear-gradient(to right, black calc(100% - 24px), transparent 100%);
    }
    .food-card-tags::-webkit-scrollbar { display: none; }
    .food-card-tags .tag {
        flex-shrink: 0;
        white-space: nowrap;
        font-size: 11px;
        padding: 3px 10px;
        line-height: 1.4;
    }

    /* Foods filter: compact card + horizontal-scroll category rail. */
    .food-filter {
        padding: var(--space-3);
        margin-bottom: var(--space-3);
    }
    .food-filter .pf-card-head { margin-bottom: 4px; }
    .food-filter .pf-card-sub { display: none; }
    .food-filter .pf-eyebrow { margin-top: 8px; margin-bottom: 4px; }
    .food-filter .pf-chip-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        margin-left: calc(-1 * var(--space-3));
        margin-right: calc(-1 * var(--space-3));
        padding: 2px var(--space-3);
        -webkit-mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%);
                mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%);
    }
    .food-filter .pf-chip-row::-webkit-scrollbar { display: none; }
    .food-filter .pf-chip-row .filter-tab { flex-shrink: 0; white-space: nowrap; }
    .food-filter .btn-accent { padding: 0 14px; }
}

/* Food category badges – distinct colour per type */
.badge-cat-spice       { background: #fff4e5; color: #b85c00; }
.badge-cat-root        { background: #fce8d5; color: #8b4513; }
.badge-cat-berry       { background: #f5e0f7; color: #8b008b; }
.badge-cat-allium      { background: #fef9e7; color: #7d6608; }
.badge-cat-leafy-green { background: #e0f5e0; color: #1b5e20; }
.badge-cat-herb        { background: #e8f5e9; color: #2e7d32; }
.badge-cat-fish        { background: #e0f0ff; color: #0d47a1; }
.badge-cat-nut         { background: #f0e6d3; color: #6d4c2f; }
.badge-cat-grain       { background: #fdf2d0; color: #8d6e00; }
.badge-cat-seed        { background: #e6edd5; color: #556b2f; }
.badge-cat-vegetable   { background: #dff0d8; color: #3c763d; }
.badge-cat-fruit       { background: #fde0e0; color: #c0392b; }
.badge-cat-citrus      { background: #fff9c4; color: #f57f17; }
.badge-cat-cruciferous { background: #d4edda; color: #155724; }
.badge-cat-root-veg    { background: #f5e1d0; color: #a0522d; }
.badge-cat-dairy       { background: #eef2ff; color: #3949ab; }
.badge-cat-sweet       { background: #fce4ec; color: #ad1457; }
.badge-cat-beverage    { background: #e0f2f1; color: #00695c; }
.badge-cat-broth       { background: #efebe9; color: #5d4037; }
.badge-cat-legume      { background: #e8eaf6; color: #283593; }
.badge-cat-condiment   { background: #fff3e0; color: #e65100; }

/* Condition tags — sage */
.tag-condition { background: var(--accent-light); color: var(--accent-pressed); }
/* Goal tags — sage (hue-shifted slightly via accent-hover) */
.tag-goal { background: var(--accent-light); color: var(--accent-hover); }

[data-theme="dark"] .badge-cat-spice       { background: #3d2800; color: #ffb74d; }
[data-theme="dark"] .badge-cat-root        { background: #3e2415; color: #d4956a; }
[data-theme="dark"] .badge-cat-berry       { background: #3a1040; color: #ce93d8; }
[data-theme="dark"] .badge-cat-allium      { background: #3d3500; color: #e6c648; }
[data-theme="dark"] .badge-cat-leafy-green { background: #0d3010; color: #81c784; }
[data-theme="dark"] .badge-cat-herb        { background: #1a3a1a; color: #a5d6a7; }
[data-theme="dark"] .badge-cat-fish        { background: #0a2540; color: #64b5f6; }
[data-theme="dark"] .badge-cat-nut         { background: #2e1f10; color: #c9a882; }
[data-theme="dark"] .badge-cat-grain       { background: #3a2e00; color: #e6c648; }
[data-theme="dark"] .badge-cat-seed        { background: #2a3318; color: #aed581; }
[data-theme="dark"] .badge-cat-vegetable   { background: #1b3a1b; color: #a5d6a7; }
[data-theme="dark"] .badge-cat-fruit       { background: #3a1010; color: #ef9a9a; }
[data-theme="dark"] .badge-cat-citrus      { background: #3d3000; color: #ffd54f; }
[data-theme="dark"] .badge-cat-cruciferous { background: #0d2e15; color: #81c784; }
[data-theme="dark"] .badge-cat-root-veg    { background: #3a2010; color: #d4956a; }
[data-theme="dark"] .badge-cat-dairy       { background: #1a1f3d; color: #9fa8da; }
[data-theme="dark"] .badge-cat-sweet       { background: #3a0e20; color: #f48fb1; }
[data-theme="dark"] .badge-cat-beverage    { background: #0a2e2a; color: #80cbc4; }
[data-theme="dark"] .badge-cat-broth       { background: #2e2018; color: #bcaaa4; }
[data-theme="dark"] .badge-cat-legume      { background: #151a3d; color: #9fa8da; }
[data-theme="dark"] .badge-cat-condiment   { background: #3d1f00; color: #ffab40; }
[data-theme="dark"] .tag-condition { background: var(--accent-light); color: var(--accent); }
[data-theme="dark"] .tag-goal      { background: var(--accent-light); color: var(--accent-hover); }

/* ── Guided "Help me decide" flow ──────────────────────────────────────────── */
.guide-screen { display: none; }
.guide-screen.active { display: block; animation: guideFadeIn 0.3s ease; }
@keyframes guideFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.guide-question { font-family: var(--font-family-serif); font-size: var(--font-size-l); font-weight: 600; margin-bottom: var(--space-2); }
.guide-subtext { font-size: var(--font-size-s); color: var(--text-secondary); margin-bottom: var(--space-5); line-height: 1.5; }

.guide-choices { display: flex; flex-direction: column; gap: var(--space-3); }

.guide-choice-btn {
    display: flex; align-items: center; gap: var(--space-4);
    width: 100%; padding: var(--space-4) var(--space-5);
    border: 2px solid var(--border-color); border-radius: var(--radius-l);
    background: var(--bg-base); cursor: pointer;
    font-family: var(--font-family); font-size: var(--font-size-base);
    color: var(--text-primary); text-align: left;
    transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.guide-choice-btn:hover {
    border-color: var(--accent); background: var(--accent-light); transform: translateX(4px);
}
.guide-choice-icon { font-size: 24px; flex-shrink: 0; }
.guide-choice-text { font-weight: 500; line-height: 1.4; }

.guide-result { text-align: center; padding: var(--space-6); }
.guide-result-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin: var(--space-5) 0; }
.guide-result-tags .tag { font-size: var(--font-size-base); padding: 6px 16px; }
.guide-result-actions { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); margin-top: var(--space-5); }

/* ── Admin ─────────────────────────────────────────────────────────────────── */
.admin-nav { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); border-bottom: 2px solid var(--border-color); padding-bottom: var(--space-2); }
.admin-nav-tab { padding: var(--space-2) var(--space-4); border-radius: var(--radius-m) var(--radius-m) 0 0; font-size: var(--font-size-s); font-weight: 600; color: var(--text-secondary); text-decoration: none; transition: all 0.15s; }
.admin-nav-tab:hover { color: var(--accent); background: var(--accent-light); text-decoration: none; }
.admin-nav-tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); margin-bottom: -2px; }

.admin-table { width: 100%; border-collapse: collapse; font-size: var(--font-size-s); }
.admin-table th { text-align: left; padding: var(--space-3) var(--space-3); font-weight: 700; color: var(--text-secondary); border-bottom: 2px solid var(--border-color); white-space: nowrap; }
.admin-table td { padding: var(--space-3) var(--space-3); border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.admin-table tbody tr:hover { background: var(--bg-layer1); }
.admin-actions { white-space: nowrap; display: flex; gap: var(--space-2); }

.admin-pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; flex-wrap: wrap; }
.admin-pager-summary { font-size: var(--font-size-s); color: var(--text-secondary); }
.admin-pager-links { display: flex; gap: var(--space-2); }

.form-row { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 120px; }
.form-hint { display: block; font-size: var(--font-size-xs); color: var(--text-tertiary); margin-top: var(--space-1); }
.required-star { color: #c62828; margin-left: 2px; font-weight: 700; }

/* Family member macro panel */
.macro-panel {
    background: var(--bg-layer1); border-radius: var(--radius-l);
    padding: var(--space-4); border: 1px solid var(--border-color);
}
.macro-panel-header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.macro-panel-title { margin: 0; font-size: var(--font-size-m); font-weight: 700; }
.macro-panel-sub { font-size: var(--font-size-xs); color: var(--text-tertiary); text-transform: lowercase; }
.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
@media (max-width: 520px) { .macro-grid { grid-template-columns: repeat(2, 1fr); } }
.macro-tile {
    background: var(--bg-base); border-radius: var(--radius-m);
    padding: var(--space-3) var(--space-3) var(--space-3); text-align: center;
    border-top: 3px solid var(--accent);
}
.macro-tile-label { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); font-weight: 600; margin-bottom: 2px; }
.macro-tile-value { font-size: var(--font-size-xl); font-weight: 700; color: var(--text-primary); }
.macro-tile-value span { font-size: var(--font-size-s); font-weight: 500; color: var(--text-secondary); margin-left: 2px; }
.macro-protein { border-top-color: #7b8e6b; }
.macro-carbs   { border-top-color: #aabb8b; }
.macro-fat     { border-top-color: #d8a060; }
.macro-fiber   { border-top-color: #5e7050; }
.macro-panel-note { font-size: var(--font-size-xs); color: var(--text-tertiary); margin: var(--space-3) 0 0; line-height: 1.5; }
.macro-panel-muted { background: var(--bg-base); }

/* ─── AIM styled alert / confirm modals ─── */
.aim-modal-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(43, 46, 37, 0.45);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: var(--space-4);
    opacity: 0; transition: opacity .18s ease-out;
}
.aim-modal-overlay.aim-modal-open { opacity: 1; }
.aim-modal-card {
    background: var(--aim-bg);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(43, 46, 37, 0.18);
    width: 100%; max-width: 420px;
    padding: var(--space-5) var(--space-5) var(--space-4);
    display: flex; flex-direction: column; gap: var(--space-3);
    transform: scale(.96) translateY(8px); opacity: 0;
    transition: transform .22s cubic-bezier(.2,.9,.3,1.2), opacity .18s ease-out;
    border: 1px solid var(--aim-line);
    color: var(--aim-ink);
}
.aim-modal-overlay.aim-modal-open .aim-modal-card {
    transform: scale(1) translateY(0); opacity: 1;
}
.aim-modal-icon {
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--aim-tint); color: var(--aim-ink);
    display: flex; align-items: center; justify-content: center;
    align-self: center;
    box-shadow: inset 0 0 0 1px var(--aim-line);
}
.aim-modal-danger .aim-modal-icon {
    background: #fde8e8; color: var(--aim-danger);
    box-shadow: inset 0 0 0 1px rgba(180,90,74,.25);
}
.aim-modal-body { text-align: center; }
.aim-modal-title { font-family: var(--aim-serif); font-weight: 400; font-size: 22px; line-height: 1.15; color: var(--aim-ink); margin: 0 0 var(--space-2); }
.aim-modal-message {
    font-size: var(--font-size-m);
    color: var(--aim-ink-2);
    margin: 0; line-height: 1.55;
    white-space: pre-wrap;
}
.aim-modal-actions {
    display: flex; gap: var(--space-2); justify-content: flex-end;
    margin-top: var(--space-2); flex-wrap: wrap;
}
.aim-modal-actions .btn { min-width: 104px; }
.aim-modal-danger-btn {
    background: var(--aim-danger); color: #fff;
    border: none;
}
.aim-modal-danger-btn:hover { background: #9a4a3c; color: #fff; }

@media (max-width: 480px) {
    .aim-modal-card { max-width: 100%; padding: var(--space-4); }
    .aim-modal-actions { flex-direction: column-reverse; }
    .aim-modal-actions .btn { width: 100%; }
}

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--space-2); }
.checkbox-item { display: flex; align-items: center; gap: var(--space-2); font-size: var(--font-size-s); cursor: pointer; padding: var(--space-1) 0; }
.checkbox-item input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.csv-sample { background: var(--bg-layer2); padding: var(--space-4); border-radius: var(--radius-m); font-size: var(--font-size-xs); overflow-x: auto; white-space: pre-wrap; word-break: break-all; line-height: 1.6; }
.text-danger { color: #8b0000; font-size: var(--font-size-xs); }

/* ── Favorites ────────────────────────────────────────────────────────────── */
.btn-favorite {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-s);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, color 0.15s ease;
    color: var(--text-tertiary);
    z-index: 2;
    position: relative;
}
.btn-favorite svg { fill: none; stroke: currentColor; stroke-width: 1.5; transition: fill 0.15s ease, stroke 0.15s ease; }
.btn-favorite:hover { transform: scale(1.15); color: #e0245e; }
.btn-favorite:hover svg { fill: rgba(224, 36, 94, 0.15); }
.btn-favorite.favorited { color: #e0245e; }
.btn-favorite.favorited svg { fill: #e0245e; stroke: #e0245e; }
.btn-favorite.favorited:hover { transform: scale(1.15); }
.btn-favorite-lg svg { width: 24px; height: 24px; }

.detail-header-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.detail-header-row h1 { margin: 0; }

.food-card-header, .recipe-card-header { display: flex; align-items: center; justify-content: space-between; }

/* ── Profile Section Nav ──────────────────────────────────────────────────── */
.profile-section-nav {
    position: sticky;
    top: var(--nav-height, 60px);
    z-index: 90;
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) 0;
    margin-bottom: var(--space-4);
    background: var(--bg-layer1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 720px;
}
.profile-section-nav::-webkit-scrollbar { display: none; }

.profile-nav-link {
    flex: 0 0 auto;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: var(--font-size-s);
    font-weight: 500;
    border: 1.5px solid var(--border-color);
    background: var(--bg-base);
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.profile-nav-link:hover {
    text-decoration: none;
    border-color: var(--accent);
    color: var(--accent);
}
.profile-nav-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Landing Page ────────────────────────────────────────────────────��─── */
.landing-hero {
    position: relative; overflow: hidden; padding: var(--space-8) 0;
    color: #fff; margin-bottom: 0;
}
.landing-hero-bg {
    position: absolute; inset: 0; z-index: 0;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 40%, var(--accent-pressed) 100%);
}
.landing-hero-bg::before {
    content: '\1F33F'; position: absolute; left: -30px; top: -10px;
    font-size: 280px; opacity: 0.05; pointer-events: none; line-height: 1;
    transform: rotate(25deg);
}
.landing-hero-bg::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(ellipse at 75% 25%, rgba(255,255,255,0.14) 0%, transparent 55%),
                radial-gradient(ellipse at 15% 85%, rgba(0,0,0,0.08) 0%, transparent 45%),
                radial-gradient(circle at 90% 80%, rgba(255,255,255,0.06) 0%, transparent 30%);
}
@@keyframes landing-gradient {
    0%,100% { background-position: 0% 50%; }
    50%     { background-position: 100% 50%; }
}
.landing-hero-inner {
    display: flex; align-items: center; gap: var(--space-7);
}
.landing-hero-content { flex: 1; max-width: 620px; }
.landing-hero-badge {
    display: inline-block; padding: 6px 18px; border-radius: 100px;
    background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
    font-size: var(--font-size-s); font-weight: 600; letter-spacing: 0.03em;
    margin-bottom: var(--space-4); border: 1px solid rgba(255,255,255,0.2);
}
.landing-hero-title {
    font-family: var(--font-family-serif); font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 600; line-height: 1.1;
    margin-bottom: var(--space-4); letter-spacing: -0.01em;
}
.landing-hero-subtitle {
    font-size: var(--font-size-m); opacity: 0.9; line-height: 1.6;
    margin-bottom: var(--space-5); max-width: 480px;
}
.landing-hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.landing-hero-visual { flex-shrink: 0; position: relative; }
.landing-hero-visual img {
    width: 260px; height: 260px; object-fit: cover; border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.25);
    box-shadow: var(--shadow-8);
}
@@keyframes landing-float {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(-10px); }
}

/* Landing buttons */
.btn-landing-primary {
    background: #fff; color: var(--accent-pressed); font-weight: 600; border: none;
    padding: 16px 36px; border-radius: var(--radius-pill); font-size: var(--font-size-base);
    transition: all var(--transition-smooth);
}
.btn-landing-primary:hover { box-shadow: var(--shadow-4); text-decoration: none; color: var(--accent-pressed); }
.btn-landing-ghost {
    background: rgba(255,255,255,0.12); color: #fff; border: 1.5px solid rgba(255,255,255,0.4);
    padding: 16px 36px; border-radius: var(--radius-pill); font-size: var(--font-size-base); font-weight: 600;
    backdrop-filter: blur(8px); transition: all var(--transition-fast);
}
.btn-landing-ghost:hover { background: rgba(255,255,255,0.22); border-color: #fff; text-decoration: none; color: #fff; }

/* Stats ribbon */
.landing-stats {
    background: var(--bg-base); border-bottom: 1px solid var(--border-color);
    padding: var(--space-5) 0;
}
.landing-stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); text-align: center;
}
.landing-stat-num {
    display: block; font-size: var(--font-size-xl); font-weight: 800; color: var(--accent);
    line-height: 1; margin-bottom: 4px;
}
.landing-stat-label { font-size: var(--font-size-s); color: var(--text-secondary); }

/* Sections */
.landing-section { padding: var(--space-7) 0; }
.landing-section-alt { background: var(--bg-layer1); }
.landing-section-header { text-align: center; margin-bottom: var(--space-6); }
.landing-section-header h2 { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--space-2); }
.landing-section-header p { color: var(--text-secondary); font-size: var(--font-size-m); }

/* Steps */
.landing-steps { display: flex; align-items: flex-start; gap: 0; justify-content: center; }
.landing-step {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    max-width: 260px; padding: 0 var(--space-3);
}
.landing-step-num {
    width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-family-serif); font-size: var(--font-size-l); font-weight: 600; color: #fff;
    background: var(--accent);
    margin-bottom: var(--space-4);
}
.landing-step-content h3 { font-size: var(--font-size-m); font-weight: 700; margin-bottom: var(--space-2); }
.landing-step-content p { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.6; }
.landing-step-line {
    width: 60px; height: 2px; background: var(--border-color); margin-top: 28px; flex-shrink: 0;
}

/* Condition pills */
.landing-conditions {
    display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center;
}
.landing-condition-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; border-radius: 100px; font-size: var(--font-size-s); font-weight: 500;
    background: var(--bg-base);
    color: var(--text-primary); text-decoration: none;
    transition: box-shadow .15s, transform .15s;
    box-shadow: var(--shadow-2);
}
.landing-condition-pill:hover {
    box-shadow: 0 0 0 2px var(--accent), var(--shadow-4);
    transform: translateY(-1px); text-decoration: none; color: var(--text-primary);
}
.landing-condition-icon { font-size: 1.1em; }
.landing-condition-more { background: var(--accent); color: #fff; border-color: var(--accent); }
.landing-condition-more:hover { color: #fff; background: var(--accent-hover); }

/* Goal cards */
.landing-goals {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4);
}
.landing-goal {
    text-align: center; padding: var(--space-6) var(--space-5);
    background: var(--bg-base); box-shadow: var(--shadow-2);
    border-radius: var(--radius-xl); transition: all var(--transition-spring);
}
.landing-goal:hover { box-shadow: var(--shadow-4); }
.landing-goal-icon { font-size: 2.5rem; margin-bottom: var(--space-3); }
.landing-goal h3 { font-size: var(--font-size-m); font-weight: 700; margin-bottom: var(--space-2); }
.landing-goal p { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.5; }

/* Feature grid */
.landing-features {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-4);
}
.landing-feature {
    padding: var(--space-6) var(--space-5);
    background: var(--bg-base); box-shadow: var(--shadow-2);
    border-radius: var(--radius-xl); transition: all var(--transition-spring);
}
.landing-feature:hover { box-shadow: var(--shadow-4); }
.landing-feature-icon { font-size: 2rem; margin-bottom: var(--space-3); }
.landing-feature h3 { font-size: var(--font-size-m); font-weight: 700; margin-bottom: var(--space-2); }
.landing-feature p { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.5; }

/* CTA */
.landing-cta {
    padding: var(--space-8) 0;
    background: var(--accent);
    color: #fff;
}
.landing-cta h2 { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 600; margin-bottom: var(--space-3); }
.landing-cta p { font-size: var(--font-size-m); opacity: 0.9; margin-bottom: var(--space-5); }

/* ── Landing page: Community section ── */
.landing-community-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-7);
    align-items: center;
}
.landing-community-badge {
    display: inline-block;
    background: var(--accent-light); color: var(--accent);
    font-size: var(--font-size-xs); font-weight: 600;
    padding: 4px 14px; border-radius: 100px;
    margin-bottom: var(--space-3); letter-spacing: 0.06em;
    text-transform: uppercase;
}
.landing-community-content h2 { font-family: var(--font-family-serif); font-size: var(--font-size-xl); font-weight: 500; margin-bottom: var(--space-3); }
.landing-community-content p { font-size: var(--font-size-base); color: var(--text-secondary); line-height: 1.7; margin-bottom: var(--space-4); }
.landing-community-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }
.landing-community-pill {
    background: var(--bg-layer2); box-shadow: var(--shadow-2);
    border-radius: 100px; padding: 6px 14px;
    font-size: var(--font-size-s); font-weight: 500;
}
.landing-community-visual { display: flex; flex-direction: column; gap: var(--space-3); }
.landing-community-card {
    display: flex; align-items: flex-start; gap: var(--space-3);
    background: var(--bg-base);
    border-radius: var(--radius-l); padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-2);
}
.landing-community-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: var(--font-size-s);
}
.landing-community-name { font-family: var(--font-family-serif); font-weight: 500; font-size: var(--font-size-s); margin-bottom: 2px; }
.landing-community-msg { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.5; }

/* ── Community page ── */
.community-page { }

.community-hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-pressed) 100%);
    color: #fff;
    padding: var(--space-8) 0;
}
/* Soft sage highlights to give the hero dimension without imagery */
.community-hero-bg {
    display: block; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(circle at 12% 18%, rgba(255,255,255,0.10) 0%, transparent 42%),
        radial-gradient(circle at 88% 82%, rgba(255,255,255,0.08) 0%, transparent 44%),
        radial-gradient(circle at 50% 110%, rgba(216,226,199,0.18) 0%, transparent 55%);
}
.community-hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.18);
    font-size: var(--font-size-xs); font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; padding: 5px 16px; border-radius: 100px;
    margin-bottom: var(--space-4);
    border: 1px solid rgba(255,255,255,0.22);
}
.community-hero-title {
    font-family: var(--font-family-serif); font-size: var(--font-size-2xl); font-weight: 500;
    letter-spacing: -0.01em; margin-bottom: var(--space-3);
}
.community-hero-subtitle {
    font-size: var(--font-size-base); opacity: 0.92; line-height: 1.7;
    max-width: 520px; margin: 0 auto var(--space-6);
}
.community-hero-actions { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }

/* Feature cards on Community/Index */
.community-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}
.community-feature-card {
    position: relative;
    background: var(--bg-base);
    border-radius: var(--radius-l);
    box-shadow: var(--shadow-2);
    padding: var(--space-5);
    border-top: 3px solid transparent;
    transition: box-shadow var(--transition-smooth), transform var(--transition-smooth), border-color var(--transition-smooth);
}
.community-feature-card:hover {
    box-shadow: var(--shadow-4);
    transform: translateY(-2px);
    border-top-color: var(--accent);
}
.community-feature-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    margin-bottom: var(--space-3);
    background: var(--accent-light);
    color: var(--accent-pressed);
}
/* Cycle through sage-palette tints so the row has visual rhythm */
.community-feature:nth-child(1) .community-feature-icon { background: #d8e2c7; color: #3d4a2a; }
.community-feature:nth-child(2) .community-feature-icon { background: #eaf0e0; color: #5e7050; }
.community-feature:nth-child(3) .community-feature-icon { background: #aabb8b; color: #1e2a17; }
.community-feature:nth-child(4) .community-feature-icon { background: #f0f3ed; color: #6B7E5B; }
.community-feature:nth-child(5) .community-feature-icon { background: #d8e2c7; color: #3d4a2a; }
.community-feature:nth-child(6) .community-feature-icon { background: #eaf0e0; color: #5e7050; }

/* Dark mode: collapse all tints to accent-light to avoid bright patches */
[data-theme="dark"] .community-feature .community-feature-icon {
    background: var(--accent-light);
    color: var(--accent-hover);
}

.community-feature-card h3 { font-family: var(--font-family-serif); font-size: var(--font-size-m); font-weight: 500; margin-bottom: var(--space-2); color: var(--text-primary); }
.community-feature-card p { font-size: var(--font-size-s); color: var(--text-secondary); line-height: 1.7; margin: 0; }

/* SSO callout */
.community-sso-callout {
    text-align: center; max-width: 520px; margin: 0 auto;
}
.community-sso-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 80px; height: 80px; border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    margin-bottom: var(--space-4);
}
.community-sso-callout h2 { font-family: var(--font-family-serif); font-weight: 500; margin-bottom: var(--space-3); color: var(--text-primary); }
.community-sso-callout p { color: var(--text-secondary); font-size: var(--font-size-base); line-height: 1.7; margin-bottom: var(--space-5); }
.community-sso-signin { margin-top: var(--space-3); font-size: var(--font-size-s); color: var(--text-secondary); }
.community-sso-signin a { color: var(--accent-hover); font-weight: 600; }

/* Landing mobile */
@media (max-width: 768px) {
    .landing-hero { padding: var(--space-6) 0; }
    .landing-hero-inner { flex-direction: column; text-align: center; }
    .landing-hero-visual { order: -1; }
    .landing-hero-visual img { width: 160px; height: 160px; }
    .landing-hero-subtitle { max-width: 100%; }
    .landing-hero-actions { justify-content: center; }
    .landing-stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
    .landing-steps { flex-direction: column; align-items: center; gap: var(--space-4); }
    .landing-step-line { width: 2px; height: 24px; margin: 0; }
    .landing-step { max-width: 100%; }
    .landing-goals { grid-template-columns: repeat(2, 1fr); }
    .landing-features { grid-template-columns: 1fr; }
    .landing-section { padding: var(--space-5) 0; }
    .landing-cta { padding: var(--space-6) 0; }
    .landing-community-inner { grid-template-columns: 1fr; gap: var(--space-5); }
    .landing-community-content { text-align: center; }
    .landing-community-pills { justify-content: center; }
    .community-features { grid-template-columns: repeat(2, 1fr); }
    .community-hero { padding: var(--space-6) 0; }
    .community-hero-title { font-size: var(--font-size-xl); }
    .community-hero-subtitle { font-size: var(--font-size-s); }
}
@media (max-width: 480px) {
    .landing-hero { padding: var(--space-5) 0; }
    .landing-hero-visual img { width: 120px; height: 120px; }
    .landing-hero-actions { flex-direction: column; align-items: stretch; }
    .landing-hero-actions .btn-landing-primary,
    .landing-hero-actions .btn-landing-ghost { text-align: center; padding: 12px 24px; }
    .landing-stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
    .landing-stat-num { font-size: var(--font-size-l); }
    .landing-section-header h2 { font-size: var(--font-size-l); }
    .landing-section-header p { font-size: var(--font-size-s); }
    .landing-condition-pill { padding: 8px 14px; font-size: var(--font-size-xs); }
    .landing-goals { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
    .landing-goal { padding: var(--space-4) var(--space-3); }
    .landing-goal-icon { font-size: 1.75rem; margin-bottom: var(--space-2); }
    .landing-goal-icon svg { width: 22px; height: 22px; }
    .landing-goal h3 { font-size: var(--font-size-s); margin-bottom: var(--space-1); }
    .landing-goal p { font-size: var(--font-size-xs); line-height: 1.4; }
    .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 ──────────────────────────────────────────────── */
.aim-r .learn-pagehead {
    text-align: center;
    align-items: center;
}
.aim-r .learn-pagehead .a-pagehead-row {
    justify-content: center;
}
.aim-r .learn-pagehead p {
    margin-left: auto;
    margin-right: auto;
    max-width: 540px;
}
.aim-r .learn-search {
    width: 100%;
    max-width: 420px;
    margin: 16px auto 0;
}
.aim-r .learn-empty {
    text-align: center;
    color: var(--aim-ink-soft);
    font-size: 14px;
    padding: 32px 12px;
}
.aim-r .learn-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.aim-r .learn-card {
    min-height: 100%;
}
.aim-r .learn-card:hover {
    box-shadow: none;
}
.aim-r .learn-card-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    background: var(--aim-bg-soft);
}
.aim-r .learn-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
    padding: 16px;
}
.aim-r .learn-card h2 {
    font-family: var(--aim-serif);
    font-size: 20px;
    line-height: 1.1;
    font-weight: 400;
    color: var(--aim-ink);
    margin: 2px 0 0;
}
.aim-r .learn-card p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--aim-ink-2);
    margin: 0;
    flex: 1;
}
.aim-r .learn-card-cta {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--aim-ink);
    margin-top: 4px;
}

/* Article layout */
.aim-r .learn-article-head {
    gap: 12px;
}
.aim-r .learn-article-head h1 {
    margin-top: 2px;
}
.aim-r .learn-article-head .article-subtitle {
    max-width: 620px;
}
.aim-r .article-hero-image {
    width: 100%;
    max-height: 340px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    border-radius: 16px;
    background: var(--aim-bg-soft);
    border: 1px solid var(--aim-line);
}
.aim-r .article-body {
    gap: 0;
    padding: 20px;
}
.aim-r .article-body p {
    color: var(--aim-ink-2);
}
.aim-r .article-body li {
    color: var(--aim-ink-2);
}
.aim-r .article-body strong {
    color: var(--aim-ink);
}
.aim-r .article-body .icon {
    filter: none;
}

/* Callout */
.aim-r .article-callout {
    padding: 15px 16px;
    margin: 18px 0;
    background: var(--aim-bg-soft);
    border: 1px solid var(--aim-line);
    border-left: 4px solid var(--aim-accent);
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--aim-ink-2);
}

/* Two-column compare */
.aim-r .article-two-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 18px 0;
}
.aim-r .article-col {
    padding: 16px;
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-soft);
}
.aim-r .article-col h3 {
    font-family: var(--aim-serif);
    font-size: 18px;
    line-height: 1.15;
    font-weight: 400;
    margin: 0 0 10px;
}
.aim-r .article-col ul {
    padding-left: 18px;
    margin: 0;
}
.aim-r .article-col li {
    font-size: 13px;
    margin-bottom: 7px;
    line-height: 1.5;
}
.aim-r .article-col-good {
    background: rgba(122,144,114,0.10);
    border-color: rgba(122,144,114,0.35);
}
.aim-r .article-col-bad {
    background: rgba(180,90,74,0.08);
    border-color: rgba(180,90,74,0.28);
}

/* Highlight grid */
.aim-r .article-highlight-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 18px 0;
}
.aim-r .article-highlight {
    padding: 16px;
    background: var(--aim-bg-soft);
    border: 1px solid var(--aim-line);
    border-radius: 14px;
}
.aim-r .article-highlight-icon,
.aim-r .article-snack-emoji {
    width: 42px;
    height: 42px;
    border-radius: 99px;
    background: var(--aim-tint);
    color: var(--aim-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 10px;
}
.aim-r .article-highlight h3,
.aim-r .article-snack h3 {
    font-family: var(--aim-serif);
    font-size: 18px;
    line-height: 1.15;
    font-weight: 400;
    margin: 0 0 6px;
    color: var(--aim-ink);
}
.aim-r .article-highlight p,
.aim-r .article-snack p {
    font-size: 13px;
    color: var(--aim-ink-2);
    line-height: 1.5;
    margin: 0;
}

/* Snack grid */
.aim-r .article-snack-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 18px 0;
}
.aim-r .article-snack {
    padding: 16px;
    background: var(--aim-bg-soft);
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    transition: border-color .15s ease, transform .15s ease;
}
.aim-r .article-snack:hover {
    border-color: var(--aim-ink-soft);
    transform: translateY(-1px);
}
.aim-r .article-snack-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}
.aim-r .article-snack-tags .chip {
    padding: 5px 10px;
    font-size: 11px;
}

/* Avoid list */
.aim-r .article-avoid-list li strong {
    color: var(--aim-danger);
}

/* FAQ */
.aim-r .article-faq {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 18px 0;
}
.aim-r .article-faq-item {
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-soft);
    overflow: hidden;
}
.aim-r .article-faq-item summary {
    padding: 13px 15px;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--aim-ink);
}
.aim-r .article-faq-item summary:hover {
    background: rgba(255,255,255,0.45);
}
.aim-r .article-faq-item summary::after {
    content: '+';
    font-size: 18px;
    line-height: 1;
    color: var(--aim-ink-soft);
}
.aim-r .article-faq-item[open] summary::after {
    content: '\2212';
}
.aim-r .article-faq-item p {
    padding: 0 15px 14px;
    font-size: 13px;
    line-height: 1.55;
    margin: 0;
}

/* Article CTA */
.aim-r .article-cta {
    margin: 24px 0 0;
    padding: 20px;
    text-align: center;
    background: var(--aim-ink);
    color: #fff;
    border-radius: 16px;
}
.aim-r .article-cta h3 {
    color: #fff;
    font-size: 22px;
    margin: 0 0 8px;
}
.aim-r .article-cta p {
    color: rgba(255,254,251,0.82);
    font-size: 13.5px;
    margin: 0 auto 16px;
    max-width: 460px;
}
.aim-r .article-cta .btn-pill {
    background: #fff;
    color: var(--aim-ink);
    border-color: #fff;
}

@media (min-width: 520px) {
    .aim-r .learn-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .aim-r .article-highlight-grid,
    .aim-r .article-snack-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 900px) {
    .aim-r .learn-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
    .aim-r .learn-card-image {
        height: 170px;
    }
    .aim-r .article-body {
        padding: 24px;
    }
    .aim-r .article-two-col {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }
}
@media (max-width: 480px) {
    .aim-r .article-hero-image {
        border-radius: 14px;
    }
    .aim-r .article-body {
        padding: 16px;
    }
}

/* ── 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: normal; }

/* ── Print: show only the instructions modal ──────────────────────────── */
@media print {
    body > *:not(#instructions-modal) { display: none !important; }
    #instructions-modal { display: block !important; position: static !important; background: none !important; }
    #instructions-modal .swap-modal { max-width: 100% !important; box-shadow: none !important; max-height: none !important; overflow: visible !important; }
    #instructions-modal .swap-modal-header button { display: none !important; }
    #instructions-modal .instr-cook-action { display: none !important; }
    .instr-meal { break-inside: avoid; }
    .bottom-nav { display: none !important; }
}

/* ═════════════════════════════════════════════════════════════════════════════
   MODERN APP ENHANCEMENTS — Bottom Nav, Animations, Polish
═════════════════════════════════════════════════════════════════════════════ */

/* ── Mobile Bottom Tab Navigation ──────────────────────────────────────── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 250;
    height: var(--bottom-nav-height);
    background: var(--bg-base);
    border-top: 1px solid var(--border-color);
    padding: 0 var(--space-2);
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0));
    padding-top: 2px;
    /* Promote to its own compositing layer so mobile URL-bar transitions
       don't cause the bar to flicker off and reposition on scroll reverse. */
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    .site-footer { padding-bottom: calc(var(--bottom-nav-height) + var(--space-3)); }
}

.bottom-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    margin: 0 auto;
    height: 100%;
}

.bottom-nav-item {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--space-1) 4px;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: var(--radius-m);
    transition: all var(--transition-fast);
    position: relative;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item:hover,
.bottom-nav-item:active {
    text-decoration: none;
    color: var(--accent);
}

.bottom-nav-item.active {
    color: var(--accent);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--accent);
}

.bottom-nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform var(--transition-spring);
}

.bottom-nav-item:active .bottom-nav-icon {
    transform: scale(0.85);
}

.bottom-nav-item.active .bottom-nav-icon {
    transform: scale(1.1);
}

.bottom-nav-label {
    white-space: nowrap;
}

/* More button in bottom nav — styled like a nav item but is a <button> */
button.bottom-nav-item {
    background: none;
    border: none;
    font-family: var(--font-family);
    cursor: pointer;
}

/* ── Hide hamburger on mobile, show on desktop ────────────────────────── */
@media (max-width: 768px) {
    .nav-hamburger { display: none; }
}

/* ── More Menu Popup (mobile) ─────────────────────────────────────────── */
.more-menu-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 299;
    background: rgba(0,0,0,0.35);
}
.more-menu-overlay.open { display: block; }

.more-menu {
    display: none;
    position: fixed;
    bottom: var(--bottom-nav-height);
    left: 0; right: 0;
    z-index: 300;
    background: var(--bg-base);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.1);
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.more-menu.open {
    display: block;
    transform: translateY(0);
}

.more-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}
.more-menu-title {
    font-family: var(--font-family-serif);
    font-size: var(--font-size-m);
    font-weight: 500;
}
.more-menu-close {
    background: none; border: none;
    font-size: 24px; cursor: pointer;
    color: var(--text-secondary);
    padding: var(--space-1);
    line-height: 1;
}
.more-menu-close:hover { color: var(--text-primary); }

.more-menu-links {
    list-style: none;
    padding: var(--space-2) 0;
    margin: 0;
}
.more-menu-links li { margin: 0; }

.more-menu-links a,
.more-menu-link-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-5);
    text-decoration: none;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: var(--font-family);
    transition: background 0.15s, color 0.15s;
}
.more-menu-links a:hover,
.more-menu-link-btn:hover {
    background: var(--bg-layer2);
    color: var(--text-primary);
    text-decoration: none;
}

.more-menu-links a svg,
.more-menu-link-btn svg {
    flex-shrink: 0;
    color: var(--text-tertiary);
}
.more-menu-links a:hover svg,
.more-menu-link-btn:hover svg {
    color: var(--accent);
}

.more-menu-link-danger { color: #c0392b; }
.more-menu-link-danger:hover { color: #a93226; background: #fde8e8; }
.more-menu-link-danger svg { color: #c0392b; }

.more-menu-links li.more-menu-sub > a { padding-left: calc(var(--space-5) + var(--space-5)); font-size: var(--font-size-sm); }

.more-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-2) var(--space-5);
}

/* Hide More menu components on desktop */
@media (min-width: 769px) {
    .more-menu,
    .more-menu-overlay { display: none !important; }
}

/* ── Entrance Animations ────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes softBounceIn {
    0%   { opacity: 0; transform: translateY(20px) scale(0.96); }
    60%  { opacity: 1; transform: translateY(-3px) scale(1.01); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Reusable animation utility classes ───────────────────────────────── */
.anim-fade-up     { animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1) both; }
.anim-fade-in     { animation: fadeIn 0.4s ease-out both; }
.anim-scale-in    { animation: scaleIn 0.4s cubic-bezier(0.23,1,0.32,1) both; }
.anim-slide-right { animation: slideInRight 0.4s cubic-bezier(0.23,1,0.32,1) both; }
.anim-slide-left  { animation: slideInLeft 0.4s cubic-bezier(0.23,1,0.32,1) both; }
.anim-bounce-in   { animation: softBounceIn 0.5s cubic-bezier(0.23,1,0.32,1) both; }

/* Stagger delay helpers (combine with any anim- class) */
.anim-d1 { animation-delay: 0.04s; }
.anim-d2 { animation-delay: 0.08s; }
.anim-d3 { animation-delay: 0.12s; }
.anim-d4 { animation-delay: 0.16s; }
.anim-d5 { animation-delay: 0.20s; }
.anim-d6 { animation-delay: 0.24s; }
.anim-d7 { animation-delay: 0.28s; }
.anim-d8 { animation-delay: 0.32s; }

/* ── Global page-level entrance ───────────────────────────────────────── */
/* Every page container fades in smoothly */
.page-container {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}

/* Page headers always glide in */
.page-header { animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both; }

/* Cards in any grid stagger */
.card-grid > *, .card-grid-3 > *, .card-grid-4 > * {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
.card-grid > *:nth-child(1),  .card-grid-3 > *:nth-child(1),  .card-grid-4 > *:nth-child(1)  { animation-delay: 0.03s; }
.card-grid > *:nth-child(2),  .card-grid-3 > *:nth-child(2),  .card-grid-4 > *:nth-child(2)  { animation-delay: 0.07s; }
.card-grid > *:nth-child(3),  .card-grid-3 > *:nth-child(3),  .card-grid-4 > *:nth-child(3)  { animation-delay: 0.11s; }
.card-grid > *:nth-child(4),  .card-grid-3 > *:nth-child(4),  .card-grid-4 > *:nth-child(4)  { animation-delay: 0.15s; }
.card-grid > *:nth-child(5),  .card-grid-3 > *:nth-child(5),  .card-grid-4 > *:nth-child(5)  { animation-delay: 0.19s; }
.card-grid > *:nth-child(6),  .card-grid-3 > *:nth-child(6),  .card-grid-4 > *:nth-child(6)  { animation-delay: 0.23s; }
.card-grid > *:nth-child(n+7),.card-grid-3 > *:nth-child(n+7),.card-grid-4 > *:nth-child(n+7) { animation-delay: 0.26s; }

/* Standalone .card elements inside page-container stagger naturally */
.page-container > .card,
.page-container > div > .card,
.page-container > form > .card {
    animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1) both;
}
.page-container > .card:nth-child(1), .page-container > div > .card:nth-child(1) { animation-delay: 0.04s; }
.page-container > .card:nth-child(2), .page-container > div > .card:nth-child(2) { animation-delay: 0.10s; }
.page-container > .card:nth-child(3), .page-container > div > .card:nth-child(3) { animation-delay: 0.16s; }
.page-container > .card:nth-child(4), .page-container > div > .card:nth-child(4) { animation-delay: 0.22s; }
.page-container > .card:nth-child(n+5), .page-container > div > .card:nth-child(n+5) { animation-delay: 0.26s; }

/* ── Selectable grids (conditions / goals picker) ─────────────────────── */
.selectable-grid > * {
    animation: scaleIn 0.35s cubic-bezier(0.23,1,0.32,1) both;
}
.selectable-grid > *:nth-child(1)  { animation-delay: 0.02s; }
.selectable-grid > *:nth-child(2)  { animation-delay: 0.05s; }
.selectable-grid > *:nth-child(3)  { animation-delay: 0.08s; }
.selectable-grid > *:nth-child(4)  { animation-delay: 0.11s; }
.selectable-grid > *:nth-child(5)  { animation-delay: 0.14s; }
.selectable-grid > *:nth-child(6)  { animation-delay: 0.17s; }
.selectable-grid > *:nth-child(7)  { animation-delay: 0.20s; }
.selectable-grid > *:nth-child(8)  { animation-delay: 0.23s; }
.selectable-grid > *:nth-child(n+9){ animation-delay: 0.25s; }

/* ── Landing page ─────────────────────────────────────────────────────── */
.landing-goal, .landing-feature, .landing-condition-pill {
    animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Dashboard ────────────────────────────────────────────────────────── */
/* ── Dashboard Hero ─────────────────────────────────────────────────────── */
.dash-hero {
    position: relative; overflow: hidden; animation: fadeIn 0.5s ease-out;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    margin-bottom: var(--space-6); color: #fff;
    box-shadow: 0 8px 32px rgba(94,112,80,0.25);
}
.dash-hero-bg {
    position: absolute; inset: 0; z-index: 0;
    background:
        linear-gradient(160deg, #8fa580 0%, var(--accent) 30%, var(--accent-hover) 60%, var(--accent-pressed) 100%);
}
.dash-hero-bg::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(ellipse 600px 400px at 85% 15%, rgba(255,255,255,0.18) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 10% 90%, rgba(0,0,0,0.10) 0%, transparent 60%),
        radial-gradient(circle 300px at 50% 50%, rgba(255,255,255,0.04) 0%, transparent 100%);
}
.dash-hero-bg::after {
    content: '\1F33F\00a0\1F331\00a0\1F343';
    position: absolute; right: -10px; bottom: -30px;
    font-size: 120px; opacity: 0.06; pointer-events: none; line-height: 1;
    transform: rotate(-12deg); letter-spacing: -20px; white-space: nowrap;
}
.dash-hero-inner {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: var(--space-6);
    padding: var(--space-7) var(--space-6) var(--space-6);
}
.dash-hero-text { flex: 1; min-width: 0; }
.dash-hero-badge {
    display: inline-block; padding: 5px 16px; border-radius: 100px;
    background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
    font-size: var(--font-size-s); font-weight: 600; letter-spacing: 0.03em;
    margin-bottom: var(--space-3); border: 1px solid rgba(255,255,255,0.2);
}
.dash-hero-title {
    font-family: var(--font-family-serif); font-size: var(--font-size-xl);
    font-weight: 700; line-height: 1.15; margin-bottom: var(--space-2);
    letter-spacing: -0.01em;
}
.dash-hero-sub {
    font-size: var(--font-size-m); opacity: 0.88; line-height: 1.5;
    margin-bottom: var(--space-4); max-width: 380px;
}
.dash-hero-cta {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; color: var(--accent-pressed); font-weight: 600;
    padding: 12px 28px; border-radius: var(--radius-pill);
    font-size: var(--font-size-base); border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    transition: all var(--transition-smooth);
}
.dash-hero-cta:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.18); transform: translateY(-1px);
    text-decoration: none; color: var(--accent-pressed);
}

/* Glass stat cards */
.dash-hero-stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    flex-shrink: 0; width: 280px;
}
.dash-stat-glass {
    background: rgba(255,255,255,0.13); backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--radius-l); padding: var(--space-3) var(--space-3);
    text-align: center; display: flex; flex-direction: column; align-items: center;
    gap: 2px; transition: all var(--transition-fast);
}
.dash-stat-glass:hover {
    background: rgba(255,255,255,0.20);
    border-color: rgba(255,255,255,0.30);
    transform: translateY(-2px);
}
.dash-stat-icon { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-bottom: 2px; opacity: 0.85; }
.dash-stat-num { font-size: var(--font-size-l); font-weight: 800; line-height: 1; }
.dash-stat-label { font-size: 11px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }

@media (max-width: 768px) {
    .dash-hero-inner { flex-direction: column; text-align: center; padding: var(--space-6) var(--space-4) var(--space-5); }
    .dash-hero-sub { max-width: none; }
    .dash-hero-stats { width: 100%; max-width: 320px; }
    .dash-hero-cta { width: 100%; justify-content: center; }
}
@media (max-width: 480px) {
    .dash-hero-inner { padding: var(--space-5) var(--space-3) var(--space-4); gap: var(--space-4); }
    .dash-hero-title { font-size: var(--font-size-l); }
    .dash-hero-sub { font-size: var(--font-size-base); }
    .dash-hero-stats { gap: 8px; }
    .dash-stat-glass { padding: var(--space-2); }
    .dash-stat-num { font-size: var(--font-size-m); }
}
.dash-member-card { animation: scaleIn 0.35s cubic-bezier(0.23,1,0.32,1) both; }
.dash-member-card:nth-child(1) { animation-delay: 0.05s; }
.dash-member-card:nth-child(2) { animation-delay: 0.10s; }
.dash-member-card:nth-child(3) { animation-delay: 0.15s; }
.dash-member-card:nth-child(4) { animation-delay: 0.20s; }
.dash-member-card:nth-child(5) { animation-delay: 0.25s; }
.dash-plan-card { animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1) 0.12s both; }

/* ── Meal plan view — day cards stagger ───────────────────────────────── */
.meal-day-card {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
.meal-day-card:nth-child(1) { animation-delay: 0.03s; }
.meal-day-card:nth-child(2) { animation-delay: 0.07s; }
.meal-day-card:nth-child(3) { animation-delay: 0.11s; }
.meal-day-card:nth-child(4) { animation-delay: 0.15s; }
.meal-day-card:nth-child(5) { animation-delay: 0.19s; }
.meal-day-card:nth-child(6) { animation-delay: 0.23s; }
.meal-day-card:nth-child(7) { animation-delay: 0.27s; }

/* ── Grocery list — categories stagger ────────────────────────────────── */
.grocery-category {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
.grocery-category:nth-child(1) { animation-delay: 0.03s; }
.grocery-category:nth-child(2) { animation-delay: 0.07s; }
.grocery-category:nth-child(3) { animation-delay: 0.11s; }
.grocery-category:nth-child(4) { animation-delay: 0.15s; }
.grocery-category:nth-child(n+5) { animation-delay: 0.19s; }

/* ── Profile sections stagger ─────────────────────────────────────────── */
.profile-section {
    animation: fadeInUp 0.45s cubic-bezier(0.23,1,0.32,1) both;
}
.profile-section:nth-child(1) { animation-delay: 0.04s; }
.profile-section:nth-child(2) { animation-delay: 0.10s; }
.profile-section:nth-child(3) { animation-delay: 0.16s; }
.profile-section:nth-child(4) { animation-delay: 0.22s; }
.profile-section:nth-child(5) { animation-delay: 0.28s; }
.profile-section:nth-child(n+6) { animation-delay: 0.32s; }

/* ── Auth pages (login, register, onboarding) ─────────────────────────── */
.auth-card {
    animation: softBounceIn 0.55s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Learn page cards ─────────────────────────────────────────────────── */
.learn-card {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Community features ───────────────────────────────────────────────── */
.community-feature {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
.community-feature:nth-child(1) { animation-delay: 0.04s; }
.community-feature:nth-child(2) { animation-delay: 0.10s; }
.community-feature:nth-child(3) { animation-delay: 0.16s; }
.community-feature:nth-child(n+4) { animation-delay: 0.22s; }

/* ── Recipe cards stagger ─────────────────────────────────────────────── */
.recipe-card {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Food cards stagger ───────────────────────────────────────────────── */
.food-card {
    animation: scaleIn 0.35s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Condition cards stagger ──────────────────────────────────────────── */
.condition-card {
    animation: fadeInUp 0.4s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Wizard step indicator ────────────────────────────────────────────── */
.wizard-steps {
    animation: fadeIn 0.35s ease-out both;
}

/* ── Hero sections across pages ───────────────────────────────────────── */
.page-hero,
.section-hero {
    animation: fadeIn 0.5s cubic-bezier(0.23,1,0.32,1) both;
}

/* ── Admin table rows ─────────────────────────────────────────────────── */
.admin-table tbody tr {
    animation: fadeIn 0.3s ease-out both;
}
.admin-table tbody tr:nth-child(1)  { animation-delay: 0.02s; }
.admin-table tbody tr:nth-child(2)  { animation-delay: 0.04s; }
.admin-table tbody tr:nth-child(3)  { animation-delay: 0.06s; }
.admin-table tbody tr:nth-child(4)  { animation-delay: 0.08s; }
.admin-table tbody tr:nth-child(5)  { animation-delay: 0.10s; }
.admin-table tbody tr:nth-child(n+6){ animation-delay: 0.12s; }

/* ── Icon entrance (subtle pop) ───────────────────────────────────────── */
.icon-animate {
    animation: scaleIn 0.35s cubic-bezier(0.23,1,0.32,1) 0.1s both;
}

/* ── Chat messages ────────────────────────────────────────────────────── */
.chat-message {
    animation: slideInRight 0.3s cubic-bezier(0.23,1,0.32,1) both;
}
.chat-message.assistant {
    animation-name: slideInLeft;
}

/* ── Accordion body expand ────────────────────────────────────────────── */
.accordion-body {
    animation: fadeIn 0.25s ease-out;
}

/* ── Smooth hover lifts ───────────────────────────────────────────────── */
.card,
.recipe-card,
.food-card,
.learn-card,
.selectable-card,
.community-feature,
.condition-card,
.program-card,
.education-card {
    transition: transform 0.2s cubic-bezier(0.23,1,0.32,1), box-shadow 0.2s ease;
}
.card:hover,
.recipe-card:hover,
.food-card:hover,
.learn-card:hover,
.community-feature:hover,
.condition-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-8);
}

/* ── Respect reduced motion preference ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Smooth Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 100px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Focus Ring (accessibility) ────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-s);
}

/* ── Selection ─────────────────────────────────────────────────────────── */
::selection {
    background: rgba(107,124,107,0.2);
    color: var(--text-primary);
}

/* ── Smooth hover glow on interactive cards ────────────────────────────── */
.landing-condition-pill,
.landing-goal,
.landing-feature,
.recipe-card,
.food-card,
.program-card,
.education-card,
.learn-card {
    position: relative;
}

/* ── Alert auto-dismiss animation ──────────────────────────────────────── */
.alert[data-auto-dismiss] {
    animation: fadeInUp 0.3s ease-out, fadeOut 0.4s ease-out 4s forwards;
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}

/* ── Responsive polish ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .card { padding: var(--space-4); }
    .card-grid { gap: var(--space-3); }
    .btn-lg { padding: 12px 24px; }
}

@media (max-width: 480px) {
    .card { padding: var(--space-3); border-radius: var(--radius-l); }
    .card-grid, .card-grid-3, .card-grid-4 { gap: var(--space-3); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Profile Redesign — stacked cards, sticky pill nav, floating save bar
   ═══════════════════════════════════════════════════════════════════════════ */
.pf-shell {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--space-3) 120px;
}

.pf-header { padding: var(--space-2) var(--space-3) 0; }
.pf-header h1 {
    font-family: var(--font-family-display);
    font-size: 26px; font-weight: 700; letter-spacing: -0.4px;
    margin: 0; color: var(--text-primary);
}
.pf-header-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; overflow-wrap: anywhere; word-break: break-word; }

/* Sticky pill nav — opt-in variant applied alongside .profile-section-nav */
.profile-section-nav.pf-sticky-nav {
    position: sticky;
    top: var(--nav-height, 60px);
    z-index: 90;
    display: flex;
    gap: 6px;
    padding: 10px var(--space-3);
    margin: var(--space-3) calc(-1 * var(--space-3)) var(--space-3);
    background: color-mix(in srgb, var(--bg-layer1) 94%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
    max-width: none;
}
.profile-section-nav.pf-sticky-nav::-webkit-scrollbar { display: none; }

.pf-sticky-nav .profile-nav-link {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 12px; font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.15s;
}
.pf-sticky-nav .profile-nav-link:hover {
    color: var(--accent); border-color: var(--accent); text-decoration: none;
}
.pf-sticky-nav .profile-nav-link.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.pf-nav-icon { font-size: 13px; line-height: 1; display: inline-flex; align-items: center; }
.pf-nav-icon svg { width: 14px; height: 14px; }

/* Cards */
.pf-card {
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: var(--space-4);
    margin-bottom: 14px;
}
.pf-card-head {
    display: flex; align-items: center; gap: var(--space-2);
    margin-bottom: var(--space-1);
}
.pf-card-head-icon {
    width: 28px; height: 28px;
    border-radius: 9px;
    background: var(--accent-light);
    color: var(--accent-pressed);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.pf-card-head-icon img { width: 16px; height: 16px; }
.pf-card-head-icon svg { width: 16px; height: 16px; }
.pf-card-title {
    font-family: var(--font-family-display);
    font-size: 18px; font-weight: 700; letter-spacing: -0.3px;
    margin: 0; color: var(--text-primary);
}
.pf-card-sub {
    font-size: 12px; color: var(--text-secondary);
    margin: 4px 0 var(--space-3); padding-left: 36px; line-height: 1.45;
}

/* Eyebrows */
.pf-eyebrow {
    font-size: 11px; font-weight: 700;
    color: var(--accent-pressed);
    letter-spacing: 0.08em; text-transform: uppercase;
    margin-bottom: var(--space-2);
}
.pf-eyebrow-muted { color: var(--text-secondary); }

/* Subscription status block */
.pf-status {
    background: var(--accent-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-l);
    padding: 14px;
    margin-bottom: var(--space-3);
    display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.pf-status-inner { min-width: 0; }
.pf-status-plan {
    font-family: var(--font-family-display);
    font-size: 20px; font-weight: 700;
    color: var(--text-primary); margin-top: 2px;
}
.pf-status-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.pf-status-badge {
    font-size: 10px; font-weight: 700; color: #fff;
    background: var(--accent);
    padding: 4px 10px; border-radius: 999px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.pf-status-badge-trial { background: var(--accent-pressed); }

/* Check list */
.pf-check-list { margin-bottom: var(--space-3); }
.pf-check-row {
    display: flex; align-items: center; gap: var(--space-2);
    padding: 4px 0;
    font-size: 13px; color: var(--text-primary);
}
.pf-check-row svg { color: var(--accent); flex-shrink: 0; }

/* Full-width pill primary + ghost row */
.pf-btn-full {
    width: 100%; height: 44px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.pf-btn-row { display: flex; gap: 8px; margin-top: 8px; }
.pf-btn-row .btn { flex: 1; height: 40px; border-radius: 999px; }

.pf-footnote { font-size: 11px; color: var(--text-secondary); margin-top: 10px; line-height: 1.4; }

/* Personal — identity row */
.pf-identity {
    display: flex; gap: 12px; align-items: center;
    margin-bottom: 14px;
}
.pf-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    position: relative; cursor: pointer; flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--bg-base), 0 0 0 3px var(--border-color);
    background: var(--accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.4rem;
    background-size: cover; background-position: center;
    border: none;
    font-family: var(--font-family-display);
}
.pf-avatar-badge {
    position: absolute; bottom: -2px; right: -2px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-base);
    display: flex; align-items: center; justify-content: center; color: #fff;
}
.pf-identity-meta .t { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.pf-identity-meta .s { font-size: 11px; color: var(--text-secondary); line-height: 1.4; margin-top: 2px; }

/* Grids */
.pf-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-bottom: 12px; }
.pf-grid-2-tight { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pf-field-stack { margin-bottom: 12px; }

/* Compact labels */
.pf-label {
    font-size: 10px; font-weight: 700; color: var(--text-primary);
    letter-spacing: 0.08em; text-transform: uppercase;
    margin-bottom: 6px; display: block;
}
.pf-label .req { color: #c62828; margin-left: 3px; }

/* Slim input wrapper — pairs input + suffix */
.pf-input-wrap {
    display: flex; align-items: center;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 12px; height: 40px;
    transition: border-color var(--transition-fast);
}
.pf-input-wrap:focus-within {
    border-color: var(--aim-ink, #2A4A3A);
    box-shadow: 0 0 0 3px rgba(42, 74, 58, 0.18);
}
.pf-input-wrap input,
.pf-input-wrap select {
    border: none; outline: none; flex: 1; min-width: 0;
    font-size: 14px; color: var(--text-primary);
    background: transparent; font-family: inherit;
    height: 100%;
    appearance: none; -webkit-appearance: none;
}
.pf-input-wrap .suffix {
    font-size: 12px; color: var(--text-secondary);
    margin-left: 6px; white-space: nowrap;
}
.pf-help { font-size: 11px; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }

/* Divider inside card */
.pf-divider {
    margin: 6px -4px 14px;
    padding: 10px 4px 0;
    border-top: 1px solid var(--border-color);
}
.pf-divider .pf-eyebrow { margin-bottom: 2px; }

/* Calorie result (gradient) */
.pf-result {
    border-radius: var(--radius-l);
    padding: 14px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-pressed));
    color: #fff;
    position: relative; overflow: hidden;
}
.pf-result-eyebrow {
    font-size: 10px; font-weight: 700;
    letter-spacing: 0.14em; opacity: 0.85;
}
.pf-result-big { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.pf-result-big .num {
    font-family: var(--font-family-display);
    font-size: 34px; font-weight: 700; line-height: 1;
}
.pf-result-big .unit { font-size: 14px; font-weight: 500; opacity: 0.85; }
.pf-result-macros {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 8px; margin-top: 12px;
}
.pf-result-macros > div {
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 8px 6px;
    text-align: center;
}
.pf-result-macros .bar {
    width: 14px; height: 3px; border-radius: 2px;
    margin: 0 auto 5px;
}
.pf-result-macros .val {
    font-family: var(--font-family-display);
    font-size: 14px; font-weight: 700;
}
.pf-result-macros .val span { font-size: 10px; margin-left: 1px; opacity: 0.8; }
.pf-result-macros .lbl {
    font-size: 9px; opacity: 0.85; letter-spacing: 0.4px; margin-top: 1px;
    text-transform: uppercase;
}
.pf-result-foot { font-size: 10px; opacity: 0.75; margin-top: 10px; line-height: 1.4; }

/* Appearance segmented control */
.pf-segmented {
    display: flex;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border-radius: 10px; padding: 3px; gap: 2px;
}
.pf-segmented button {
    flex: 1; height: 32px; border: none; border-radius: 8px;
    background: transparent; color: var(--accent-pressed);
    font-size: 12px; font-weight: 600; cursor: pointer;
    font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.pf-segmented button.active {
    background: var(--bg-base);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(45,58,30,0.1);
}

.pf-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Household row */
.pf-house-row { display: flex; align-items: center; gap: 12px; }
.pf-house-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-family-display);
    font-size: 16px; font-weight: 700;
    flex-shrink: 0;
    background-size: cover; background-position: center;
}
.pf-house-meta { flex: 1; min-width: 0; }
.pf-house-meta .t { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.pf-house-meta .s { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Provider rows (Grocery Ordering) */
.pf-provider-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
}
.pf-provider-row.first { border-top: none; padding-top: 0; }
.pf-provider-tile {
    width: 32px; height: 32px; border-radius: 9px;
    background: var(--bg-layer2); border: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: var(--text-primary); font-weight: 700;
    flex-shrink: 0;
}
.pf-provider-meta { flex: 1; min-width: 0; }
.pf-provider-meta .t { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.pf-provider-meta .s { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

.pf-connect-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-m);
    padding: var(--space-4);
    margin-top: var(--space-3);
}

/* Plan grid (empty-state subscription) */
.pf-plan-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-3);
}

/* Floating save bar */
.pf-save-bar {
    position: fixed; left: 0; right: 0;
    bottom: 0;
    z-index: 150;
    padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent 0, color-mix(in srgb, var(--bg-layer1) 95%, transparent) 40%);
    pointer-events: none;
    transform: translateY(140%);
    transition: transform 0.25s cubic-bezier(.2,.9,.3,1);
}
.pf-save-bar.visible { transform: translateY(0); }
@media (max-width: 768px) {
    .pf-save-bar { bottom: var(--bottom-nav-height, 68px); }
}
@media (max-width: 899px) {
    .pf-save-bar,
    body.aim-r .pf-save-bar {
        bottom: calc(var(--aim-mob-nav-h, 64px) + env(safe-area-inset-bottom, 0px) + 12px) !important;
        z-index: 80;
    }
}
.pf-save-inner {
    max-width: 720px; margin: 0 auto;
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-base);
    border-radius: 999px;
    box-shadow: 0 12px 28px -8px rgba(45,58,30,0.22), 0 0 0 1px var(--border-color);
    padding: 6px;
    pointer-events: auto;
}
.pf-save-msg {
    flex: 1; font-size: 12px; color: var(--text-primary);
    padding-left: 12px;
    display: flex; align-items: center; gap: 6px;
}
.pf-save-dot { width: 7px; height: 7px; border-radius: 50%; background: #C68B2E; }
.pf-save-discard {
    height: 36px; padding: 0 14px; border-radius: 999px;
    background: transparent; border: none;
    color: var(--text-secondary); font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.pf-save-discard:hover { color: var(--text-primary); }
.pf-save-primary {
    height: 36px; padding: 0 16px; border-radius: 999px;
    background: var(--accent); color: #fff; border: none;
    font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.pf-save-primary:hover { background: var(--accent-hover); }

/* Dashed empty callout */
.pf-empty-callout {
    padding: 12px; border-radius: 10px;
    background: var(--bg-layer1);
    border: 1px dashed var(--border-color);
    font-size: 12px; color: var(--text-secondary);
    text-align: center;
}

/* Pantry add row */
.pf-add-row { display: flex; gap: 8px; margin-bottom: 10px; }
.pf-add-row .pf-input-wrap { flex: 1; }

/* Responsive: macros to 2-col on narrow */
@media (max-width: 520px) {
    .pf-result-macros { grid-template-columns: repeat(2, 1fr); }
}

/* ═════════════════════════════════════════════════════════════════════════════
   Glass UI — frosted, translucent surfaces over an ambient page background
   ═════════════════════════════════════════════════════════════════════════════ */

:root {
    --glass-bg:        rgba(255, 255, 255, 0.55);
    --glass-bg-strong: rgba(255, 255, 255, 0.72);
    --glass-bg-soft:   rgba(255, 255, 255, 0.35);
    --glass-border:    rgba(255, 255, 255, 0.55);
    --glass-edge:      rgba(255, 255, 255, 0.70);
    --glass-blur:      18px;
    --glass-saturate:  140%;
    --glass-shadow:    0 8px 32px rgba(31,38,49,0.10), inset 0 1px 0 var(--glass-edge);
    --glass-shadow-lg: 0 20px 60px rgba(31,38,49,0.18), inset 0 1px 0 var(--glass-edge);
}

[data-theme="dark"] {
    --glass-bg:        rgba(20, 20, 20, 0.55);
    --glass-bg-strong: rgba(20, 20, 20, 0.78);
    --glass-bg-soft:   rgba(20, 20, 20, 0.32);
    --glass-border:    rgba(255, 255, 255, 0.10);
    --glass-edge:      rgba(255, 255, 255, 0.06);
    --glass-shadow:    0 8px 32px rgba(0,0,0,0.40), inset 0 1px 0 var(--glass-edge);
    --glass-shadow-lg: 0 20px 60px rgba(0,0,0,0.55), inset 0 1px 0 var(--glass-edge);
}

/* Ambient page background — gives backdrop-filter something to blur */
body {
    background-image:
        radial-gradient(at 12% 8%,  rgba(123,142,107,0.18) 0%, transparent 42%),
        radial-gradient(at 90% 18%, rgba(196,210,180,0.22) 0%, transparent 40%),
        radial-gradient(at 78% 92%, rgba(123,142,107,0.14) 0%, transparent 45%),
        radial-gradient(at 5%  88%, rgba(150,172,138,0.14) 0%, transparent 40%);
    background-attachment: fixed;
}
[data-theme="dark"] body {
    background-image: none;
    background-color: var(--bg-base);
}

/* ── Glass utility ────────────────────────────────────────────────────── */
.glass {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}
.glass-strong { background: var(--glass-bg-strong); }
.glass-soft   { background: var(--glass-bg-soft); }

/* ── Apply glass to primary surfaces ──────────────────────────────────── */

.site-nav {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border-bottom: 1px solid var(--glass-border);
}

.bottom-nav {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border-top: 1px solid var(--glass-border);
}

.nav-drawer {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(24px) saturate(var(--glass-saturate));
    backdrop-filter: blur(24px) saturate(var(--glass-saturate));
    border-right: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow-lg);
}

.user-dropdown {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(20px) saturate(var(--glass-saturate));
    backdrop-filter: blur(20px) saturate(var(--glass-saturate));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.more-menu {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(24px) saturate(var(--glass-saturate));
    backdrop-filter: blur(24px) saturate(var(--glass-saturate));
    border-top: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow-lg);
}

.card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(14px) saturate(var(--glass-saturate));
    backdrop-filter: blur(14px) saturate(var(--glass-saturate));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}
.card:hover { box-shadow: var(--glass-shadow-lg); }

.alert {
    -webkit-backdrop-filter: blur(12px) saturate(var(--glass-saturate));
    backdrop-filter: blur(12px) saturate(var(--glass-saturate));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.site-footer {
    background: var(--glass-bg-soft);
    -webkit-backdrop-filter: blur(14px) saturate(var(--glass-saturate));
    backdrop-filter: blur(14px) saturate(var(--glass-saturate));
    border-top: 1px solid var(--glass-border);
}

/* Soften the dimming overlays with a touch of blur */
.nav-overlay,
.more-menu-overlay {
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

/* Fallback — keep solid surfaces where backdrop-filter is unsupported */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    .glass, .glass-strong, .glass-soft,
    .site-nav, .bottom-nav, .nav-drawer, .user-dropdown,
    .more-menu, .card, .site-footer { background: var(--bg-base); }
}

/* =====================================================================
   AIM Restyle (April 2026) — design tokens hoisted to :root so AIM
   chrome (sidebar/nav) can be used outside an .aim-r wrapper.
   .aim-r sets the typography/color baseline for redesigned pages.
   See Documentation/Designs/design_handoff_aim/restyle/.
   ===================================================================== */
:root {
    --aim-bg: #FFFEFB;
    --aim-bg-soft: #F4F0E8;
    --aim-bg-card: #FFFFFF;
    --aim-tint: #E5EBDF;
    --aim-ink: #2A4A3A;
    --aim-ink-2: #345A47;
    --aim-ink-soft: #6F8475;
    --aim-ink-mute: #97A89C;
    --aim-line: #E6E1D6;
    --aim-line-soft: #EFEAE0;
    --aim-accent: #D9A05B;
    --aim-accent-soft: #F2E3CB;
    --aim-danger: #B45A4A;
    --aim-navy: #101f46;
    --aim-navy-hover: #0b1734;
    --aim-serif: 'DM Serif Display', Georgia, serif;
    --aim-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;

    --aim-side-w: 240px;
    --aim-mob-top-h: 56px;
    --aim-mob-nav-h: 64px;
}

.aim-r {
    font-family: var(--aim-sans);
    color: var(--aim-ink);
    background: var(--aim-bg);
    -webkit-font-smoothing: antialiased;
    max-width: 100%;
    overflow-x: hidden;
}
.aim-r * { box-sizing: border-box; min-width: 0; }
.aim-r .serif { font-family: var(--aim-serif); font-weight: 400; }
.aim-r .ital  { font-style: normal; }
.aim-r .label {
    font-family: var(--aim-sans); font-size: 11px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--aim-ink-soft);
}

/* Headings */
.aim-r .h-1   { font-family: var(--aim-serif); font-size: 44px; line-height: 1.02; letter-spacing: -0.01em; margin: 0; color: var(--aim-ink); }
.aim-r .h-2   { font-family: var(--aim-serif); font-size: 32px; line-height: 1.05; margin: 0; color: var(--aim-ink); }
.aim-r .h-3   { font-family: var(--aim-serif); font-size: 22px; line-height: 1.1;  margin: 0; color: var(--aim-ink); }
.aim-r .body  { font-size: 14px; line-height: 1.55; color: var(--aim-ink-2); }

/* Buttons */
.aim-r .btn-pill {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: 999px;
    background: var(--aim-ink); color: var(--aim-bg);
    font-family: var(--aim-sans); font-size: 14px; font-weight: 500;
    border: 1px solid var(--aim-ink); cursor: pointer; text-decoration: none;
    transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.aim-r .btn-pill:hover         { color: var(--aim-bg); opacity: 0.92; text-decoration: none; }
.aim-r .btn-pill-ghost         { background: transparent; color: var(--aim-ink); border-color: var(--aim-ink); }
.aim-r .btn-pill-ghost:hover   { background: var(--aim-ink); color: var(--aim-bg); }
.aim-r .btn-pill-ghost-light   { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.6); }
.aim-r .btn-pill-ghost-light:hover { color: #fff; background: rgba(255,255,255,0.14); }
.aim-r .btn-pill-light         { background: #fff; color: var(--aim-ink); border-color: #fff; }
.aim-r .btn-pill-light:hover   { color: var(--aim-ink); opacity: 0.92; }

/* Chips */
.aim-r .chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 999px;
    background: var(--aim-bg-card); color: var(--aim-ink);
    font-size: 12px; font-weight: 500;
    border: 1px solid var(--aim-line);
    text-decoration: none;
}
.aim-r .chip:hover         { text-decoration: none; color: var(--aim-ink); }
.aim-r .chip-soft          { background: var(--aim-tint); border-color: transparent; }
.aim-r .chip-lunchbox {
    background: #fff8e8;
    border-color: #f0e3c0;
    color: #3d2f10;
    font-weight: 700;
}
.aim-r .chip-dark          { background: rgba(255,255,255,0.16); color: #fff; border-color: rgba(255,255,255,0.24); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.aim-r .chip-ink           { background: var(--aim-ink); color: #fff; border-color: var(--aim-ink); }
.aim-r .chip-ink:hover     { color: #fff; }
.aim-r .chip-dot           { width: 6px; height: 6px; border-radius: 99px; background: var(--aim-accent); display: inline-block; }

/* Cards */
.aim-r .a-card {
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 14px;
}
.aim-r a.a-card { color: var(--aim-ink); text-decoration: none; display: block; transition: border-color .15s ease, box-shadow .15s ease; }
.aim-r a.a-card:hover { border-color: var(--aim-ink-soft); color: var(--aim-ink); text-decoration: none; }
.aim-r .a-card.is-active { border-color: var(--aim-ink); border-width: 1.5px; }
.aim-r .a-card-pad   { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.aim-r .a-card-tags  { display: flex; gap: 6px; flex-wrap: wrap; }
.aim-r .a-card-meta  { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--aim-ink-soft); margin-top: auto; }
.aim-r .a-card-meta strong { color: var(--aim-ink); font-weight: 600; }
.aim-r .a-article { font-size: 14.5px; line-height: 1.65; color: var(--aim-ink-2); }
.aim-r .a-article h2 { font-family: var(--aim-serif); font-size: 24px; line-height: 1.15; color: var(--aim-ink); margin: 22px 0 8px; }
.aim-r .a-article h3 { font-family: var(--aim-serif); font-size: 19px; line-height: 1.2; color: var(--aim-ink); margin: 18px 0 6px; }
.aim-r .a-article h4 { font-family: var(--aim-sans); font-size: 14px; font-weight: 700; color: var(--aim-ink); margin: 16px 0 4px; letter-spacing: 0; }
.aim-r .a-article p  { margin: 0 0 12px; }
.aim-r .a-article ul,
.aim-r .a-article ol { margin: 0 0 12px; padding-left: 20px; }
.aim-r .a-article li { margin: 4px 0; }
.aim-r .a-article > :first-child { margin-top: 0; }
.aim-r .a-article > :last-child  { margin-bottom: 0; }

/* Photographic hero block */
.aim-r .hero-block {
    position: relative; overflow: hidden; border-radius: 18px;
    color: #fff; background-size: cover; background-position: center;
}
.aim-r .hero-block::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(42,74,58,0.55) 0%, rgba(42,74,58,0.85) 100%);
}
.aim-r .hero-block > * { position: relative; z-index: 1; }

/* Segmented progress bar */
.aim-r .seg          { display: flex; gap: 4px; }
.aim-r .seg .s       { flex: 1; height: 7px; border-radius: 999px; background: var(--aim-line-soft); }
.aim-r .seg .s.done  { background: var(--aim-ink); }
.aim-r .seg .s.active{ background: var(--aim-bg-card); border: 1.5px solid var(--aim-ink); }

/* Quick action tile */
.aim-r .qa {
    background: var(--aim-bg-card); border: 1px solid var(--aim-line);
    border-radius: 14px; padding: 16px 12px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    font-size: 12.5px; font-weight: 500; color: var(--aim-ink);
    cursor: pointer; text-decoration: none;
    transition: border-color .15s ease;
}
.aim-r .qa:hover         { border-color: var(--aim-ink-soft); text-decoration: none; color: var(--aim-ink); }
.aim-r .qa-primary       { background: var(--aim-ink); color: #fff; border-color: var(--aim-ink); }
.aim-r .qa-primary:hover { color: #fff; opacity: 0.92; }

/* Hide scrollbar (used on horizontal household scroll) */
.aim-r .no-sb { -ms-overflow-style: none; scrollbar-width: none; }
.aim-r .no-sb::-webkit-scrollbar { display: none; }

/* ----- Marketing landing layout ----- */
.aim-r .m-page    { padding: 16px 16px 32px; }
.aim-r .m-hero    { padding: 28px; min-height: 540px; display: flex; flex-direction: column; justify-content: flex-end; }
.aim-r .m-hero-h1 { font-family: var(--aim-serif); margin: 0; color: #fff; font-size: 56px; line-height: 0.95; letter-spacing: -0.01em; }
.aim-r .m-hero-sub{ margin: 18px 0 22px; font-size: 14.5px; line-height: 1.55; color: rgba(255,254,251,0.86); max-width: 460px; }
.aim-r .m-hero-cta{ display: flex; flex-direction: column; gap: 10px; }
.aim-r .m-hero-cta .btn-pill { padding: 15px 22px; font-size: 15px; }
.aim-r .m-hero-editorial {
    min-height: 640px;
    justify-content: space-between;
    gap: 28px;
    background-color: #dbe8d1;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}
.aim-r .m-hero-editorial::after {
    background:
        linear-gradient(90deg, rgba(20, 42, 31, 0.86) 0%, rgba(20, 42, 31, 0.68) 48%, rgba(20, 42, 31, 0.48) 100%),
        linear-gradient(180deg, rgba(20, 42, 31, 0.28) 0%, rgba(20, 42, 31, 0.72) 100%);
}
.aim-r .m-hero-copy {
    max-width: 760px;
}
.aim-r .m-hero-editorial .m-hero-h1 {
    margin-top: 48px;
    letter-spacing: 0;
}
.aim-r .m-hero-editorial .m-hero-sub {
    color: rgba(255,254,251,0.9);
}
.aim-r .m-hero-preview {
    position: relative;
    z-index: 1;
    align-self: center;
    width: min(100%, 320px);
}
.aim-r .m-phone {
    width: 220px;
    min-height: 372px;
    margin-left: auto;
    border-radius: 28px;
    border: 8px solid rgba(16, 31, 24, 0.92);
    background: #fffefb;
    color: var(--aim-ink);
    box-shadow: 0 22px 70px rgba(0,0,0,0.28);
    padding: 18px 14px;
}
.aim-r .m-phone-top,
.aim-r .m-phone-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.aim-r .m-phone-top {
    font-family: var(--aim-serif);
    font-size: 18px;
    line-height: 1;
}
.aim-r .m-phone-top span:last-child {
    font-family: var(--aim-sans);
    font-size: 11px;
    color: var(--aim-ink-soft);
}
.aim-r .m-phone-chips {
    display: flex;
    gap: 5px;
    margin-top: 16px;
}
.aim-r .m-phone-chips span {
    padding: 5px 8px;
    border-radius: 99px;
    background: var(--aim-ink);
    color: #fff;
    font-size: 9px;
}
.aim-r .m-phone-card {
    margin-top: 16px;
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--aim-bg-soft);
}
.aim-r .m-phone-card img {
    width: 100%;
    height: 112px;
    object-fit: cover;
    display: block;
}
.aim-r .m-phone-card div {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.aim-r .m-phone-card strong {
    font-family: var(--aim-serif);
    font-size: 18px;
    line-height: 1.1;
}
.aim-r .m-phone-card small {
    font-size: 11px;
    line-height: 1.35;
    color: var(--aim-ink-soft);
}
.aim-r .m-phone-row {
    margin-top: 9px;
    padding: 10px 0;
    border-top: 1px solid var(--aim-line-soft);
    font-size: 12px;
}
.aim-r .m-phone-row strong {
    font-size: 11px;
}
.aim-r .m-hero-note {
    position: absolute;
    right: 88px;
    bottom: 28px;
    width: 210px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255,254,251,0.92);
    color: var(--aim-ink);
    box-shadow: 0 18px 44px rgba(0,0,0,0.16);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.aim-r .m-hero-note strong {
    font-family: var(--aim-serif);
    font-size: 18px;
}
.aim-r .m-hero-note span {
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--aim-ink-soft);
}
@media (max-width: 899px) {
    .aim-r .m-hero-editorial {
        min-height: 620px;
        justify-content: flex-end;
        background-size: cover;
        background-position: center;
    }
    .aim-r .m-hero-editorial .m-hero-h1 {
        margin-top: 36px;
        font-size: 58px;
    }
    .aim-r .m-hero-preview {
        display: none;
    }
}

.aim-r .m-stats   { margin-top: 28px; }
.aim-r .m-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.aim-r .m-stat-num { font-family: var(--aim-serif); font-size: 38px; line-height: 1; color: var(--aim-ink); }
.aim-r .m-stat-num small { font-family: var(--aim-sans); font-size: 14px; color: var(--aim-ink-soft); margin-left: 2px; }
.aim-r .m-stat-lbl { font-size: 11.5px; color: var(--aim-ink-soft); margin-top: 6px; font-weight: 500; line-height: 1.3; }

.aim-r .m-story-tiles {
    margin-top: 28px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
.aim-r .m-story-tile {
    overflow: hidden;
    border: 1px solid var(--aim-line);
    border-radius: 18px;
    background: #edf5e7;
    color: var(--aim-ink);
}
.aim-r .m-story-body {
    padding: 28px 24px;
}
.aim-r .m-story-body h2 {
    margin: 0;
    font-family: var(--aim-serif);
    font-size: 28px;
    line-height: 1.05;
    color: var(--aim-ink);
    letter-spacing: 0;
}
.aim-r .m-story-body p {
    margin: 14px 0 22px;
    color: var(--aim-ink-2);
    font-size: 14px;
    line-height: 1.55;
}
.aim-r .m-story-media {
    min-height: 190px;
    background-color: #dbe8d1;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    border-top: 1px solid rgba(42,74,58,0.10);
}
.aim-r .m-section { margin-top: 44px; }
.aim-r .m-section-cream { margin-top: 36px; background: var(--aim-bg-soft); border-radius: 18px; padding: 22px; }

.aim-r .m-step    { padding: 18px; display: flex; gap: 16px; align-items: flex-start; }
.aim-r .m-step-n  { font-family: var(--aim-serif); font-size: 28px; color: var(--aim-ink-mute); min-width: 44px; line-height: 1; }
.aim-r .m-step-t  { font-family: var(--aim-serif); font-size: 19px; line-height: 1.15; }
.aim-r .m-step-d  { margin-top: 4px; font-size: 13.5px; line-height: 1.55; color: var(--aim-ink-2); }

.aim-r .m-conds   { display: flex; flex-wrap: wrap; gap: 7px; }

.aim-r .m-goals   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.aim-r .m-goal-img{ border-radius: 14px; overflow: hidden; position: relative; height: 114px; background-size: cover; background-position: center; }
.aim-r .m-goal-img.tall { height: 240px; grid-row: span 2; }
.aim-r .m-goal-img::after { content:''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.55)); }
.aim-r .m-goal-img-lbl { position: absolute; left: 14px; bottom: 12px; color: #fff; font-family: var(--aim-serif); font-size: 17px; z-index: 1; }
.aim-r .m-goal-card{ height: 114px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; border-radius: 14px; background: #fff; border: 1px solid var(--aim-line); color: var(--aim-ink); }
.aim-r .m-goal-card.tint { background: var(--aim-tint); border-color: transparent; }
.aim-r .m-goal-card-lbl { font-family: var(--aim-serif); font-size: 16px; line-height: 1.1; }

.aim-r .m-section-head {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.aim-r .m-section-copy {
    margin: 0;
    max-width: 560px;
}
.aim-r .m-wellness-layout {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}
.aim-r .m-wellness-visual {
    min-height: 260px;
    border-radius: 18px;
    background-color: var(--aim-bg-soft);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 18px;
}
.aim-r .m-wellness-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 254, 251, 0.08) 0%, rgba(12, 19, 15, 0.80) 100%),
        radial-gradient(circle at 22% 18%, rgba(255, 254, 251, 0.34), transparent 34%);
}
.aim-r .m-wellness-visual-card {
    position: relative;
    z-index: 1;
    max-width: 420px;
}
.aim-r .m-wellness-visual-card h3 {
    margin: 12px 0 0;
    color: #fff;
    font-family: var(--aim-serif);
    font-size: 27px;
    line-height: 1.05;
}
.aim-r .m-wellness-goals {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.aim-r .m-wellness-goal {
    min-height: 92px;
    padding: 14px;
    border-radius: 14px;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    color: var(--aim-ink);
    text-decoration: none;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.aim-r .m-wellness-goal:hover {
    color: var(--aim-ink);
    text-decoration: none;
    border-color: var(--aim-ink-mute);
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(42, 74, 58, 0.08);
}
.aim-r .m-wellness-goal-icon {
    width: 44px;
    height: 44px;
    border-radius: 99px;
    background: var(--aim-tint);
    color: var(--aim-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.aim-r .m-wellness-goal-svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.6;
}
.aim-r .m-wellness-goal-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.aim-r .m-wellness-goal-name {
    font-family: var(--aim-serif);
    font-size: 18px;
    line-height: 1.1;
}
.aim-r .m-wellness-goal-desc {
    color: var(--aim-ink-soft);
    font-size: 12.5px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.aim-r .m-wellness-sidecar {
    min-height: 138px;
    padding: 16px;
    border-radius: 14px;
    background-color: var(--aim-ink);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    color: #fff;
    display: flex;
    align-items: flex-end;
    position: relative;
    overflow: hidden;
}
.aim-r .m-wellness-sidecar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0.68) 100%);
}
.aim-r .m-wellness-sidecar span {
    position: relative;
    z-index: 1;
    font-family: var(--aim-serif);
    font-size: 20px;
    line-height: 1.1;
}

.aim-r .m-cta     { margin-top: 44px; padding: 26px; border-radius: 18px; background: var(--aim-ink); color: #fff; }
.aim-r .m-cta h2  { font-family: var(--aim-serif); font-size: 30px; line-height: 1.05; margin: 0; color: #fff; }
.aim-r .m-cta p   { font-size: 14px; margin: 12px 0 0; color: rgba(255,254,251,0.78); }
.aim-r .m-cta .btn-pill { margin-top: 16px; width: 100%; }

.aim-r .m-feats   { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 18px; }
.aim-r .m-feat    { padding: 22px; background: #fff; border: 1px solid var(--aim-line); border-radius: 14px; }
.aim-r .m-feat-ic { width: 44px; height: 44px; border-radius: 99px; background: var(--aim-tint); display: inline-flex; align-items: center; justify-content: center; color: var(--aim-ink); }
.aim-r .m-feat-t  { font-family: var(--aim-serif); font-size: 22px; margin-top: 18px; }
.aim-r .m-feat-d  { font-size: 14px; margin-top: 8px; line-height: 1.55; color: var(--aim-ink-2); }

/* ----- Dashboard layout ----- */
.aim-r .d-page    { padding: 6px 16px 28px; display: flex; flex-direction: column; gap: 18px;
                    min-width: 0; max-width: 100%; width: 100%; }
.aim-r .d-page > * { min-width: 0; max-width: 100%; }
.aim-r .d-greet   { padding-top: 10px; }
.aim-r .d-greet h1{ font-family: var(--aim-serif); font-size: 34px; line-height: 1.02; letter-spacing: -0.01em; margin: 6px 0 0; color: var(--aim-ink); }

.aim-r .d-stats-strip {
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    padding: 14px 4px; display: grid; grid-template-columns: repeat(4, 1fr);
}
.aim-r .d-stat    { text-align: center; padding: 4px 8px; }
.aim-r .d-stat + .d-stat { border-left: 1px solid var(--aim-line-soft); }
.aim-r .d-stat-num{ font-family: var(--aim-serif); font-size: 24px; line-height: 1; color: var(--aim-ink); }
.aim-r .d-stat-lbl{ font-size: 10px; color: var(--aim-ink-soft); margin-top: 5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

.aim-r .d-next    { overflow: hidden; padding: 0; }
.aim-r .d-next-img{ height: 180px; position: relative; background-size: cover; background-position: center; background-color: var(--aim-bg-soft); }
.aim-r .d-next-chip { position: absolute; top: 14px; left: 14px; }
.aim-r .d-next-swap { position: absolute; top: 14px; right: 14px; background: #fff; }
.aim-r .d-next-body { padding: 18px; }
.aim-r .d-next-title{ font-family: var(--aim-serif); font-size: 24px; margin: 0; line-height: 1.1; color: var(--aim-ink); }
.aim-r .d-next-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12.5px; color: var(--aim-ink-soft); }
.aim-r .d-next-meta strong { color: var(--aim-ink); font-weight: 600; }
.aim-r .d-next-actions { display: flex; gap: 8px; margin-top: 16px; }
.aim-r .d-next-actions .btn-pill { padding: 11px 18px; font-size: 13.5px; }
.aim-r .d-next-actions .grow { flex: 1; }

.aim-r .d-plan    { padding: 18px; }
.aim-r .d-plan-row{ display: flex; justify-content: space-between; align-items: flex-start; }
.aim-r .d-plan-day{ font-family: var(--aim-serif); font-size: 28px; color: var(--aim-ink); line-height: 1; }
.aim-r .d-plan-of { font-size: 13px; color: var(--aim-ink-soft); margin-left: 6px; }
.aim-r .d-plan-pct{ font-family: var(--aim-serif); font-size: 22px; color: var(--aim-ink); }
.aim-r .d-plan-pct small { font-size: 14px; }

.aim-r .d-house-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px; }
.aim-r .d-house-head h3 { font-family: var(--aim-serif); font-size: 20px; margin: 0; color: var(--aim-ink); }
.aim-r .d-house-head .count { color: var(--aim-ink-soft); font-family: var(--aim-sans); font-size: 14px; margin-left: 4px; }
.aim-r .d-house-manage { background: transparent; border: 0; color: var(--aim-ink); font-size: 13px; font-weight: 500; text-decoration: none; }
.aim-r .d-house-manage:hover { color: var(--aim-ink); text-decoration: none; }
.aim-r .d-house-row  { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding-bottom: 6px; min-width: 0; }
.aim-r .d-member     { padding: 10px; display: flex; align-items: center; gap: 10px; flex-shrink: 0;
                       background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
                       text-decoration: none; color: var(--aim-ink); }
.aim-r .d-member:hover { color: var(--aim-ink); text-decoration: none; }
.aim-r .d-member.you { border-color: var(--aim-ink); border-width: 1.5px; }
.aim-r .d-member-av  { width: 36px; height: 36px; border-radius: 99px; background-size: cover; background-position: center; flex-shrink: 0;
                       display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 14px; }
.aim-r .d-member.you .d-member-av { box-shadow: 0 0 0 2px var(--aim-bg), 0 0 0 3.5px var(--aim-ink); }
.aim-r .d-member-name{ font-size: 13.5px; font-weight: 600; color: var(--aim-ink); }
.aim-r .d-member-you-tag { font-size: 9px; padding: 2px 5px; background: var(--aim-ink); color: #fff; border-radius: 99px; font-weight: 700; letter-spacing: 0.04em; margin-left: 6px; }
.aim-r .d-member-kcal{ font-size: 11px; color: var(--aim-ink-soft); margin-top: 1px; }

.aim-r .d-qa-grid    { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.aim-r .d-qa-grid .qa svg { color: currentColor; }

.aim-r .d-ai-nudge   { background: var(--aim-tint); border-radius: 14px; padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.aim-r .d-ai-icon    { width: 32px; height: 32px; border-radius: 99px; background: var(--aim-ink); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.aim-r .d-ai-title   { font-size: 13.5px; font-weight: 600; color: var(--aim-ink); }
.aim-r .d-ai-sub     { font-size: 12.5px; color: var(--aim-ink-soft); margin-top: 2px; }

.aim-r .d-foot       { text-align: center; font-size: 11px; color: var(--aim-ink-mute); margin-top: 4px; }

/* ----- Desktop tweaks (≥900px) ----- */
@media (min-width: 900px) {
    .aim-r .m-page { padding: 24px 56px 56px; }
    .aim-r .m-hero { padding: 56px; min-height: 620px; }
    .aim-r .m-hero-h1  { font-size: 96px; line-height: 0.92; letter-spacing: -0.02em; max-width: 900px; }
    .aim-r .m-hero-sub { font-size: 17px; max-width: 460px; margin: 0; }
    .aim-r .m-hero-foot{ display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-top: 32px; flex-wrap: wrap; }
    .aim-r .m-hero-cta { flex-direction: row; gap: 12px; }
    .aim-r .m-hero-cta .btn-pill { padding: 15px 28px; }
    .aim-r .m-hero-editorial {
        min-height: 680px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(280px, 410px);
        align-items: center;
        gap: 52px;
        background-size: cover;
        background-position: center;
    }
    .aim-r .m-hero-editorial .m-hero-h1 {
        margin-top: 56px;
        max-width: 760px;
        font-size: 82px;
        line-height: 0.95;
        letter-spacing: 0;
    }
    .aim-r .m-hero-editorial .m-hero-sub {
        max-width: 540px;
        margin: 24px 0 28px;
    }
    .aim-r .m-hero-preview {
        justify-self: end;
        width: 410px;
    }
    .aim-r .m-phone {
        width: 270px;
        min-height: 456px;
    }
    .aim-r .m-phone-card img {
        height: 148px;
    }
    .aim-r .m-hero-note {
        right: 360px;
        bottom: 128px;
    }

    .aim-r .m-stats         { margin-top: 28px; }
    .aim-r .m-stats-grid    { gap: 1px; background: var(--aim-line-soft); border: 1px solid var(--aim-line-soft); border-radius: 14px; overflow: hidden; }
    .aim-r .m-stats-grid > div { background: var(--aim-bg); padding: 32px 36px; }
    .aim-r .m-stat-num      { font-size: 60px; line-height: 0.9; }
    .aim-r .m-stat-num small{ font-size: 22px; margin-left: 4px; }
    .aim-r .m-stat-lbl      { font-size: 13px; margin-top: 12px; }

    .aim-r .m-story-tiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
        margin-top: 56px;
    }
    .aim-r .m-story-tile {
        display: flex;
        flex-direction: column;
        min-height: 520px;
    }
    .aim-r .m-story-body {
        padding: 38px 38px 30px;
        min-height: 300px;
    }
    .aim-r .m-story-body h2 {
        font-size: 33px;
    }
    .aim-r .m-story-media {
        margin-top: auto;
        min-height: 220px;
    }

    .aim-r .m-section       { margin-top: 96px; text-align: center; }
    .aim-r .m-section .h-2,
    .aim-r .m-section-cream .h-2 { font-size: 52px; margin-top: 12px; }
    .aim-r .m-steps         { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 56px; text-align: left; }
    .aim-r .m-step          { display: block; padding: 0; padding-top: 28px; border-top: 1px solid var(--aim-line); border-bottom: 0; border-left: 0; border-right: 0; border-radius: 0; background: transparent; }
    .aim-r .m-step-n        { font-size: 56px; }
    .aim-r .m-step-t        { font-size: 26px; margin-top: 24px; }
    .aim-r .m-step-d        { font-size: 14.5px; max-width: 360px; margin-top: 12px; }

    .aim-r .m-section-cream { margin-top: 64px; padding: 96px 56px; text-align: center; border-radius: 0; }
    .aim-r .m-conds         { justify-content: center; max-width: 920px; margin: 40px auto 0; gap: 10px; }

    .aim-r .m-goals         { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, 220px); gap: 14px; margin-top: 48px; }
    .aim-r .m-goal-img      { height: auto; }
    .aim-r .m-goal-img.tall { height: auto; }
    .aim-r .m-goal-img-lbl  { font-size: 22px; left: 22px; bottom: 22px; }
    .aim-r .m-goal-card     { height: auto; padding: 22px; }
    .aim-r .m-goal-card-lbl { font-size: 22px; }

    .aim-r .m-section-head {
        display: grid;
        grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.55fr);
        align-items: end;
        gap: 40px;
        text-align: left;
    }
    .aim-r .m-section-copy {
        font-size: 15px;
        justify-self: end;
    }
    .aim-r .m-wellness-layout {
        grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
        gap: 16px;
        margin-top: 48px;
        align-items: stretch;
        text-align: left;
    }
    .aim-r .m-wellness-visual {
        min-height: 610px;
        padding: 30px;
    }
    .aim-r .m-wellness-visual-card h3 {
        font-size: 42px;
    }
    .aim-r .m-wellness-goals {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: minmax(138px, auto);
        gap: 14px;
    }
    .aim-r .m-wellness-goal {
        min-height: 138px;
        padding: 18px;
        flex-direction: column;
        justify-content: space-between;
    }
    .aim-r .m-wellness-goal-name {
        font-size: 21px;
    }
    .aim-r .m-wellness-sidecar {
        grid-column: 1 / -1;
        min-height: 170px;
        padding: 22px;
    }
    .aim-r .m-wellness-sidecar span {
        font-size: 24px;
        max-width: 220px;
    }

    .aim-r .m-feats         { grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 48px; text-align: left; }

    .aim-r .m-cta           { padding: 72px 56px; display: flex; justify-content: space-between; align-items: center; gap: 40px; border-radius: 22px; }
    .aim-r .m-cta h2        { font-size: 56px; line-height: 0.95; max-width: 700px; }
    .aim-r .m-cta-side      { display: flex; flex-direction: column; gap: 14px; align-items: flex-end; }
    .aim-r .m-cta-side .btn-pill { width: auto; padding: 16px 30px; font-size: 16px; margin: 0; }
    .aim-r .m-cta p         { margin: 0; font-size: 13px; color: rgba(255,254,251,0.7); }

    /* Dashboard desktop */
    .aim-r .d-page          { padding: 24px 48px 56px; gap: 24px; max-width: 1200px; margin: 0 auto; }
    .aim-r .d-greet h1      { font-size: 48px; }
    .aim-r .d-hero-row      { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
    .aim-r .d-next          { display: flex; }
    .aim-r .d-next-img      { width: 320px; flex-shrink: 0; height: auto; min-height: 260px; }
    .aim-r .d-next-body     { padding: 28px; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
    .aim-r .d-next-title    { font-size: 32px; }
    .aim-r .d-next-meta     { font-size: 13px; }
    .aim-r .d-next-actions  { margin-top: 24px; }
    .aim-r .d-stat-num      { font-size: 32px; }
    .aim-r .d-stat-lbl      { font-size: 11px; }
    .aim-r .d-stats-strip   { padding: 0; }
    .aim-r .d-stat          { padding: 24px 28px; text-align: left; display: flex; flex-direction: column; gap: 10px; }
    .aim-r .d-house-row     { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; overflow: visible; }
    .aim-r .d-member        { padding: 16px; }
    .aim-r .d-member-av     { width: 44px; height: 44px; }
    .aim-r .d-house-head h3 { font-size: 24px; }
}

/* =====================================================================
   AIM — Meal plan / View (matches Documentation/Designs/mealplan_handoff)
   These rules override the legacy .mp-*/.cal-* styles for the .aim-r-scoped
   meal-plan page only, so other surfaces using the same classes are unaffected.
   ===================================================================== */
.aim-r.mealplan-page,
.aim-r .mealplan-page { padding: 6px 16px 28px; display: flex; flex-direction: column; gap: 16px;
                        min-width: 0; max-width: 100%; }

body .save-current-modal {
    top: var(--aim-mob-top-h, 0px) !important;
    bottom: calc(var(--aim-mob-nav-h, 0px) + env(safe-area-inset-bottom, 0px)) !important;
    min-height: 0;
    align-items: flex-start !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
body .save-current-modal .save-current-card {
    margin: auto 0;
}

@media (min-width: 900px) {
    body .save-current-modal {
        top: 0 !important;
        bottom: 0 !important;
        left: var(--aim-side-w, 0px) !important;
    }
}

/* Hero */
.aim-r .mp-hero { padding-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.aim-r .mp-hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.aim-r .mp-hero-left { min-width: 0; flex: 1; }
.aim-r .mp-hero-title { font-family: var(--aim-serif); font-size: 36px; line-height: 1.0;
                        letter-spacing: -0.01em; margin: 6px 0 0; color: var(--aim-ink); }
.aim-r .mp-hero-icons { display: flex; gap: 6px; flex-shrink: 0; }
.aim-r .mp-icon-btn   { width: 36px; height: 36px; border-radius: 99px;
                        background: var(--aim-bg-soft); border: 1px solid var(--aim-line);
                        color: var(--aim-ink); display: inline-flex; align-items: center; justify-content: center;
                        cursor: pointer; text-decoration: none; flex-shrink: 0;
                        transition: border-color .15s ease; }
.aim-r .mp-icon-btn:hover { border-color: var(--aim-ink-soft); color: var(--aim-ink); text-decoration: none; }
.aim-r .mp-icon-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}
.aim-r .mp-icon-btn:disabled:hover {
    border-color: var(--aim-line);
    color: var(--aim-ink);
}
.aim-r .mp-icon-btn svg { width: 18px; height: 18px; display: block; }

/* Plan summary row + budget bar */
.aim-r .mp-summary-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px;
                         color: var(--aim-ink-soft); }
.aim-r .mp-summary-cost { font-size: 13px; color: var(--aim-ink-soft); }
.aim-r .mp-summary-kind { order: 1; }
.aim-r .mp-summary-range { order: 2; }
.aim-r .mp-summary-range-dot { order: 3; }
.aim-r .mp-summary-duration { order: 4; }
.aim-r .mp-summary-cost-dot { order: 5; }
.aim-r .mp-summary-cost { order: 6; }
.aim-r .mp-summary-budget-extra { order: 7; }
.aim-r .mp-summary-cost-num { font-family: var(--aim-serif); font-size: 16px; color: var(--aim-ink);
                              margin: 0 2px; }
.aim-r .mp-summary-cost-cap { color: var(--aim-ink); font-weight: 600; }
.aim-r .chip.chip-good   { background: rgba(122,144,114,0.15); color: #3F6244; border-color: transparent; font-weight: 600; }
.aim-r .chip.chip-danger { background: rgba(180, 90, 74, 0.15); color: var(--aim-danger); border-color: transparent; font-weight: 600; }
.aim-r .mp-budget-bar { height: 6px; border-radius: 99px; background: var(--aim-line-soft); overflow: hidden; }
.aim-r .mp-budget-bar-fill { height: 100%; background: var(--aim-ink); border-radius: 99px; transition: width .25s ease; }
.aim-r .mp-budget-bar-fill.over { background: var(--aim-danger); }

.aim-r .mp-expired-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-left: 4px solid var(--aim-ink-soft);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: var(--space-4);
}
.aim-r .mp-expired-banner-text { flex: 1 1 240px; }
.aim-r .mp-expired-banner-text p { margin: 4px 0 0; font-size: 13px; color: var(--aim-ink-soft); }
.aim-r .mp-expired-banner-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.aim-r .mp-expired-banner-actions form { margin: 0; }

/* Quick action grid (3-up) */
.aim-r .mp-qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.aim-r .mp-qa-grid .qa svg { color: currentColor; }

/* Segmented switcher */
.aim-r .cal-toolbar { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; }
.aim-r .cal-tabs.mp-seg { background: var(--aim-bg-soft); border-radius: 99px; padding: 4px;
                          display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 0; }
.aim-r .cal-tabs.mp-seg .cal-tab { flex: initial; height: auto; padding: 9px 0; border: 0;
                                   background: transparent; box-shadow: none;
                                   color: var(--aim-ink); font-size: 12.5px; font-weight: 500;
                                   border-radius: 99px; cursor: pointer; }
.aim-r .cal-tabs.mp-seg .cal-tab:hover  { background: rgba(255,255,255,0.55); color: var(--aim-ink); }
.aim-r .cal-tabs.mp-seg .cal-tab.active { background: var(--aim-bg-card); font-weight: 600;
                                          box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.aim-r .cal-nav { display: flex; align-items: center; gap: 8px; justify-content: center; }
.aim-r .cal-nav .cal-title { font-size: 13px; font-weight: 500; color: var(--aim-ink-soft);
                             min-width: 160px; text-align: center; }
.aim-r .cal-nav .cal-prev,
.aim-r .cal-nav .cal-next { font-size: 18px; line-height: 1; }
.aim-r .cal-nav .cal-today-btn { padding: 6px 12px; font-size: 12px; cursor: pointer; }

/* School-lunches promo */
.aim-r .mp-lunchbox-row { padding: 14px; gap: 12px;
                          background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
                          display: flex; align-items: center; }
.aim-r .mp-lunchbox-icon { width: 44px; height: 44px; border-radius: 12px;
                           background: var(--aim-accent-soft); color: var(--aim-ink);
                           display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.aim-r .mp-lunchbox-text { flex: 1; min-width: 0; }
.aim-r .mp-lunchbox-title { font-size: 17px; line-height: 1.1; color: var(--aim-ink); }
.aim-r .mp-lunchbox-sub { font-size: 12px; color: var(--aim-ink-soft); margin-top: 3px; }
.aim-r .btn-pill.mp-lunchbox-btn { padding: 10px 16px; font-size: 12.5px; flex-shrink: 0; }

/* ─── Day view: week strip ─── */
.aim-r .mp-week-strip { padding: 14px 12px; background: var(--aim-bg-card);
                        border: 1px solid var(--aim-line); border-radius: 14px; margin-top: 4px; }
.aim-r .mp-week-strip-head { display: flex; align-items: center; justify-content: space-between;
                             gap: 8px; padding: 0 4px 12px; }
.aim-r .mp-week-strip-title { flex: 1; text-align: center; font-size: 13px; font-weight: 500;
                              color: var(--aim-ink-soft); letter-spacing: 0; font-family: var(--aim-sans); }
.aim-r .mp-week-strip-nav { width: 28px; height: 28px; border-radius: 99px;
                            background: var(--aim-bg-soft); border: 1px solid var(--aim-line);
                            color: var(--aim-ink); display: inline-flex; align-items: center; justify-content: center;
                            cursor: pointer; flex-shrink: 0; }
.aim-r .mp-week-strip-nav:hover { border-color: var(--aim-ink-soft); background: var(--aim-bg-soft); }
.aim-r .mp-week-strip-nav svg { width: 12px; height: 12px; display: block; }
.aim-r .mp-week-strip-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.aim-r .mp-day-pill { display: flex; flex-direction: column; align-items: center; gap: 4px;
                      padding: 10px 0 8px; border: 0; border-radius: 12px;
                      background: transparent; color: var(--aim-ink); cursor: pointer;
                      text-decoration: none; font-family: inherit; }
.aim-r .mp-day-pill.today { background: transparent; }
.aim-r .mp-day-pill.selected { background: var(--aim-ink); color: #fff; }
.aim-r .mp-day-pill-initial { font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
                              color: var(--aim-ink-mute); }
.aim-r .mp-day-pill.today .mp-day-pill-initial { color: var(--aim-ink-soft); }
.aim-r .mp-day-pill.selected .mp-day-pill-initial { color: rgba(255,255,255,0.7); }
.aim-r .mp-day-pill-date { font-family: var(--aim-serif); font-size: 22px; line-height: 1; font-weight: 400; }
.aim-r .mp-day-pill-dots { display: flex; gap: 2px; height: 4px; margin-top: 2px; }
.aim-r .mp-day-pill-dot { width: 3.5px; height: 3.5px; border-radius: 99px; background: var(--aim-ink-mute); }
.aim-r .mp-day-pill-dot.filled { background: var(--aim-ink-mute); }
.aim-r .mp-day-pill.selected .mp-day-pill-dot,
.aim-r .mp-day-pill.selected .mp-day-pill-dot.filled { background: rgba(255,255,255,0.55); }

/* ─── Day view: today summary card ─── */
.aim-r .mp-today-summary { margin-top: 0; padding: 18px;
                           background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px; }
.aim-r .mp-today-summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.aim-r .mp-today-summary-left { flex: 1; min-width: 0; }
.aim-r .mp-today-summary-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
                                   color: var(--aim-ink-soft); text-transform: uppercase; }
.aim-r .mp-today-summary-date { font-family: var(--aim-serif); font-size: 28px; line-height: 1.05;
                                color: var(--aim-ink); margin-top: 4px; font-weight: 400; }
.aim-r .mp-today-summary-meta { font-size: 12.5px; color: var(--aim-ink-soft); margin-top: 6px; }
.aim-r .mp-today-ring { position: relative; width: 60px; height: 60px; flex-shrink: 0; }
.aim-r .mp-today-ring svg { width: 60px; height: 60px; display: block; }
.aim-r .mp-today-ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
                              font-size: 13px; font-weight: 600; color: var(--aim-ink); }
.aim-r .mp-today-instructions-btn { width: 100%; margin-top: 16px; padding: 11px 18px;
                                    background: transparent; color: var(--aim-ink);
                                    border: 1px solid var(--aim-ink); border-radius: 99px;
                                    font-size: 13.5px; font-weight: 500; cursor: pointer;
                                    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
                                    font-family: var(--aim-sans); transition: background .15s ease, color .15s ease; }
.aim-r .mp-today-instructions-btn:hover { background: var(--aim-ink); color: var(--aim-bg); }
.aim-r .mp-today-instructions-btn .icon-sm { width: 14px; height: 14px; opacity: 0.85; }
.aim-r .mp-day-shopping-status {
    margin-top: 10px;
    min-height: 20px;
    text-align: center;
    font-size: 12.5px;
}
.aim-r .mp-day-shopping-status a,
.aim-r .mp-day-shopping-status a:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--aim-ink);
    font-weight: 500;
    text-decoration: none;
}
.aim-r .mp-day-shopping-status a:hover { text-decoration: underline; }
.aim-r .mp-day-shopping-muted { color: var(--aim-ink-soft); }
.aim-r .mp-day-shopping-ready { color: #3F6244 !important; }

/* ─── Day view: meals header + cards ─── */
.aim-r .mp-day-meals { padding: 0; }
.aim-r .mp-day-meals-head { display: flex; align-items: center; justify-content: space-between;
                            gap: 8px; padding: 0 4px; margin-bottom: 12px; }
.aim-r .mp-day-meals-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
                               color: var(--aim-ink-soft); text-transform: uppercase; }
.aim-r .mp-day-meals-add { display: inline-flex; align-items: center; gap: 6px;
                           padding: 7px 14px; border-radius: 99px;
                           background: var(--aim-bg-card); color: var(--aim-ink);
                           border: 1px solid var(--aim-line); font-size: 12px; font-weight: 500;
                           cursor: pointer; font-family: inherit; }
.aim-r .mp-day-meals-add:hover { border-color: var(--aim-ink-soft); background: var(--aim-bg-card); color: var(--aim-ink); }
.aim-r .mp-day-meals-list { display: flex; flex-direction: column; gap: 12px; }

/* Meal cards */
.aim-r .mp-meal-card { background: var(--aim-bg-card); border: 1px solid var(--aim-line);
                       border-radius: 14px; overflow: hidden; display: flex; padding: 0; }
.aim-r .mp-meal-stripe { width: 5px; flex-shrink: 0; }
.aim-r .mp-meal-stripe.slot-breakfast { background: var(--aim-accent); }
.aim-r .mp-meal-stripe.slot-lunch     { background: #7A9072; }
.aim-r .mp-meal-stripe.slot-snack     { background: #C68E7A; }
.aim-r .mp-meal-stripe.slot-dinner    { background: #5A6F7E; }
.aim-r .mp-meal-body { flex: 1; padding: 16px; min-width: 0; display: flex; gap: 14px; align-items: flex-start; }
.aim-r .mp-meal-content { flex: 1; min-width: 0; }
.aim-r .mp-meal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.aim-r .mp-slot-badge { font-size: 10.5px; font-weight: 600; padding: 3px 11px; border-radius: 99px;
                       letter-spacing: 0.06em; text-transform: uppercase; color: var(--aim-ink); }
.aim-r .mp-slot-badge.slot-breakfast { background: var(--aim-accent-soft); }
.aim-r .mp-slot-badge.slot-lunch     { background: var(--aim-tint); }
.aim-r .mp-slot-badge.slot-snack     { background: #F0DCD0; }
.aim-r .mp-slot-badge.slot-dinner    { background: #D7DCE0; }
.aim-r .mp-meal-actions { display: flex; gap: 4px; }
.aim-r .mp-meal-actions .btn-icon-sm { width: 26px; height: 26px; border-radius: 99px; border: 0;
                                       background: var(--aim-bg-soft); color: var(--aim-ink);
                                       font-size: 13px; cursor: pointer;
                                       display: inline-flex; align-items: center; justify-content: center;
                                       line-height: 1; }
.aim-r .mp-meal-actions .btn-icon-sm:hover { background: var(--aim-tint); }
.aim-r .mp-meal-title { font-family: var(--aim-serif); font-size: 19px; line-height: 1.15;
                       margin: 0; color: var(--aim-ink); text-decoration: none; display: block; font-weight: 400; }
.aim-r .mp-meal-title:hover { color: var(--aim-ink); text-decoration: none; }
.aim-r .mp-meal-meta { font-size: 12px; color: var(--aim-ink-soft); margin-top: 6px;
                       font-variant-numeric: tabular-nums; }
.aim-r .btn-pill.mp-meal-cook-btn { margin: 14px 0 0; padding: 10px 18px; font-size: 13px; width: auto;
                                    align-self: flex-start; height: auto; }
.aim-r .mp-meal-thumb { width: 76px; height: 76px; border-radius: 12px; flex-shrink: 0;
                        background-size: cover; background-position: center;
                        background-color: var(--aim-bg-soft); }
.aim-r .mp-meal-card.done { opacity: 0.65; }
.aim-r .mp-meal-card.done .mp-meal-title { text-decoration: line-through; text-decoration-color: var(--aim-ink-mute); }

/* Add-meal fallback (within-plan but no meals) */
.aim-r .mp-addmeal-btn { width: 100%; margin-top: 12px; padding: 12px;
                         background: var(--aim-bg-card); border: 1px dashed var(--aim-line);
                         border-radius: 14px; color: var(--aim-ink); font-size: 13px; font-weight: 500;
                         cursor: pointer; font-family: inherit; }
.aim-r .mp-addmeal-btn:hover { border-color: var(--aim-ink-soft); }

/* =====================================================================
   Day view — Option D restyle (mealplan_day_handoff)
   Date headline + inline chevrons + 3-stat hairline strip + inline
   school-lunches card + time-gutter timeline.
   ===================================================================== */
.aim-r .mp-day-head { display: flex; flex-direction: column; gap: 0; }
.aim-r .mp-day-head-eyebrow {
    font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--aim-ink-soft);
}
.aim-r .mp-day-head-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 4px;
}
.aim-r .mp-day-head-date {
    font-family: var(--aim-serif); font-weight: 400;
    font-size: 30px; line-height: 1; margin: 0; color: var(--aim-ink);
}
.aim-r .mp-day-head-nav { display: flex; gap: 4px; flex-shrink: 0; }
.aim-r .mp-icon-btn-day {
    width: 28px; height: 28px; border-radius: 99px;
    background: var(--aim-bg-soft); border: 1px solid var(--aim-line);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--aim-ink); cursor: pointer; padding: 0;
}
.aim-r .mp-icon-btn-day:hover { border-color: var(--aim-ink-soft); }
.aim-r .mp-icon-btn-day svg { display: block; }

.aim-r .mp-day-stats {
    display: flex; margin-top: 16px; padding: 14px 0;
    border-top: 1px solid var(--aim-line-soft);
    border-bottom: 1px solid var(--aim-line-soft);
}
.aim-r .mp-day-stat { flex: 1; text-align: center; }
.aim-r .mp-day-stat-label {
    font-size: 9px; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--aim-ink-mute);
}
.aim-r .mp-day-stat-value {
    font-family: var(--aim-serif); font-weight: 400;
    font-size: 19px; color: var(--aim-ink); line-height: 1;
}
.aim-r .mp-day-stat-unit { font-size: 11px; color: var(--aim-ink-mute); margin-left: 3px; }
.aim-r .mp-day-stat-div { width: 1px; align-self: stretch; background: var(--aim-line-soft); }

.aim-r .mp-day-head .mp-day-shopping-status { margin-top: 10px; }

/* Inline school-lunches promo (Day view only) */
.aim-r .mp-day-lunchbox {
    margin-top: 18px; padding: 14px;
    display: flex; gap: 12px; align-items: center;
    background: var(--aim-bg-card); border: 1px solid var(--aim-line);
    border-radius: 14px;
}
.aim-r .mp-day-lunchbox-icon {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--aim-accent-soft); color: var(--aim-ink);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.aim-r .mp-day-lunchbox-text { flex: 1; min-width: 0; }
.aim-r .mp-day-lunchbox-title {
    font-family: var(--aim-serif); font-weight: 400;
    font-size: 17px; line-height: 1.1; color: var(--aim-ink);
}
.aim-r .mp-day-lunchbox-sub { font-size: 12px; color: var(--aim-ink-soft); margin-top: 3px; }
.aim-r .btn-pill.mp-day-lunchbox-btn {
    padding: 10px 16px; font-size: 12.5px; flex-shrink: 0;
    margin: 0; width: auto; height: auto;
}

/* Schedule header (label + Instructions / Add chips) */
.aim-r .mp-day-schedule { margin-top: 20px; }
.aim-r .mp-day-schedule-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 2px; margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}
.aim-r .mp-day-schedule-label {
    font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--aim-ink-soft);
}
.aim-r .mp-day-schedule-actions { display: flex; gap: 6px; }
.aim-r .mp-day-schedule-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--aim-bg-card); color: var(--aim-ink);
    border: 1px solid var(--aim-line); border-radius: 99px;
    padding: 5px 12px; font-size: 11.5px; font-weight: 500; cursor: pointer;
    font-family: inherit;
}
.aim-r .mp-day-schedule-chip:hover { border-color: var(--aim-ink-soft); background: var(--aim-bg-soft); }
.aim-r .mp-day-schedule-chip svg { display: block; }

/* Timeline (time-gutter + ink spine + circular nodes + meal cards) */
.aim-r .mp-timeline {
    --mp-tl-pad-x: 14px;
    --mp-tl-gutter-w: 48px;
    --mp-tl-gap: 12px;
    --mp-tl-node: 16px;
    --mp-tl-node-half: 8px;
    --mp-tl-spine-w: 1.5px;
    --mp-tl-spine-half: 0.75px;
    position: relative; display: flex; flex-direction: column; gap: 18px;
    padding: 8px var(--mp-tl-pad-x) 12px;
}
.aim-r .mp-timeline-spine {
    position: absolute;
    left: calc(var(--mp-tl-pad-x) + var(--mp-tl-gutter-w) + var(--mp-tl-gap) + var(--mp-tl-node-half) - var(--mp-tl-spine-half));
    top: 8px; bottom: 8px;
    width: var(--mp-tl-spine-w); background: var(--aim-line); z-index: 0;
}

.aim-r .mp-tl-row { display: flex; gap: var(--mp-tl-gap); align-items: flex-start; position: relative; }
.aim-r .mp-tl-gutter {
    width: var(--mp-tl-gutter-w); flex-shrink: 0; text-align: right; padding-top: 4px;
}
.aim-r .mp-tl-time {
    font-family: var(--aim-serif); font-weight: 400;
    font-size: 15px; color: var(--aim-ink); line-height: 1;
}
.aim-r .mp-tl-ampm {
    font-size: 9.5px; color: var(--aim-ink-mute); font-weight: 600;
    letter-spacing: 0.08em; margin-top: 3px;
}

.aim-r .mp-tl-node {
    width: var(--mp-tl-node); height: var(--mp-tl-node); border-radius: 99px; flex-shrink: 0;
    margin-top: 6px;
    background: #fff; border: 2px solid var(--aim-ink);
    display: flex; align-items: center; justify-content: center;
    position: relative; z-index: 1;
    box-sizing: border-box;
}
.aim-r .mp-tl-node.next {
    background: var(--aim-accent); border: none;
    box-shadow: 0 0 0 4px rgba(217,160,91,0.22);
}
.aim-r .mp-tl-node.done {
    background: var(--aim-ink); border: none;
}

.aim-r .mp-tl-card {
    flex: 1; min-width: 0; overflow: hidden;
    background: var(--aim-bg-card); border: 1px solid var(--aim-line);
    border-radius: 14px;
}
.aim-r .mp-tl-card.next { border-width: 1.5px; border-color: var(--aim-ink); }
.aim-r .mp-tl-card.done { opacity: 0.6; }
.aim-r .mp-tl-card.done .mp-tl-title { text-decoration: line-through; text-decoration-color: var(--aim-ink-mute); }

.aim-r .mp-tl-body { display: flex; align-items: stretch; }
.aim-r .mp-tl-content { flex: 1; min-width: 0; padding: 12px 14px 14px; }
.aim-r .mp-tl-top {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.aim-r .mp-tl-tag {
    font-size: 9.5px; padding: 2px 8px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase; border-radius: 99px;
    color: var(--aim-ink); border: 1px solid transparent;
    display: inline-flex; align-items: center;
}
.aim-r .mp-tl-tag.slot-breakfast { background: #F2E3CB; }
.aim-r .mp-tl-tag.slot-lunch     { background: #E5EBDF; }
.aim-r .mp-tl-tag.slot-snack     { background: #F0DCD0; }
.aim-r .mp-tl-tag.slot-dinner    { background: #D7DCE0; }
.aim-r .mp-tl-tag.lunchbox-friendly {
    background: #fff8e8;
    border-color: #f0e3c0;
    color: #3d2f10;
}
.aim-r .mp-tl-upnext {
    font-size: 10px; color: var(--aim-accent); font-weight: 700;
    letter-spacing: 0.08em;
}
.aim-r .mp-tl-actions { display: inline-flex; gap: 4px; margin-left: auto; }
.aim-r .mp-tl-actions .btn-icon-sm {
    width: 28px; height: 28px; border-radius: 99px;
    background: var(--aim-bg-soft); border: 1px solid var(--aim-line);
    color: var(--aim-ink); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px;
}
.aim-r .mp-tl-actions .btn-icon-sm:hover { border-color: var(--aim-ink-soft); }

.aim-r .mp-tl-title {
    display: block; font-family: var(--aim-serif); font-weight: 400;
    font-size: 16px; line-height: 1.2; margin-top: 8px;
    color: var(--aim-ink); text-decoration: none;
}
.aim-r .mp-tl-title:hover { text-decoration: underline; }
.aim-r .mp-tl-meta { font-size: 11px; color: var(--aim-ink-soft); margin-top: 4px; }
.aim-r .btn-pill.mp-tl-cook-btn {
    margin: 10px 0 0; padding: 8px 14px; font-size: 12px;
    display: inline-flex; align-items: center; gap: 6px;
    width: auto; height: auto;
}

.aim-r .mp-tl-thumb {
    width: 84px; flex-shrink: 0; align-self: stretch;
    background-size: cover; background-position: center;
    background-color: var(--aim-bg-soft);
}

@media (max-width: 480px) {
    .aim-r .mp-day-head-date { font-size: 24px; }
    .aim-r .mp-day-stat-value { font-size: 17px; }
    .aim-r .mp-tl-thumb { width: 64px; }
    .aim-r .mp-tl-content { padding: 10px 12px 12px; }
}

/* Hide legacy mealplan-hero remnants if any partial still emits them */
.aim-r .mealplan-page > .page-hero,
.aim-r .mealplan-page > .mealplan-hero { display: none; }

@media (min-width: 720px) {
    .aim-r .mp-hero-title { font-size: 44px; }
    .aim-r .mp-today-summary-date { font-size: 32px; }
}


   Replaces the original .site-nav / .nav-drawer / .bottom-nav.
   ===================================================================== */
body.aim-r {
    background: var(--aim-bg);
    color: var(--aim-ink);
    line-height: 1.55;
    letter-spacing: 0;
    padding-bottom: 0;
    overflow-x: hidden;
    max-width: 100%;
}
html { overflow-x: hidden; max-width: 100%; }

/* Wordmark */
.aim-wm {
    font-family: var(--aim-serif); font-weight: 400; font-size: 22px; line-height: 1;
    color: var(--aim-ink); display: inline-flex; align-items: baseline; gap: 4px;
    text-decoration: none;
}
.aim-wm:hover { color: var(--aim-ink); text-decoration: none; }
.aim-wm svg   { color: var(--aim-ink); }

/* App shell — wraps sidebar + main on desktop (authenticated) */
.aim-shell    { min-height: 100vh; display: flex; flex-direction: column; background: var(--aim-bg); overflow-x: hidden; max-width: 100%; }
.aim-main     { flex: 1; min-width: 0; overflow-x: hidden; max-width: 100%;
                padding-top: var(--aim-mob-top-h);
                padding-bottom: calc(var(--aim-mob-nav-h) + env(safe-area-inset-bottom, 0px)); }

/* Mobile top bar */
.aim-mob-top {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    height: var(--aim-mob-top-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px; background: var(--aim-bg);
    border-bottom: 1px solid var(--aim-line-soft);
}
.aim-mob-top-spacer { width: 36px; height: 36px; }
.aim-mob-avatar {
    width: 36px; height: 36px; border-radius: 99px;
    background: var(--aim-bg-soft); border: 1px solid var(--aim-line);
    display: flex; align-items: center; justify-content: center;
    color: var(--aim-ink); cursor: pointer;
    background-size: cover; background-position: center;
}
.aim-mob-avatar:hover { color: var(--aim-ink); }

/* Mobile bottom nav */
.aim-mob-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    height: calc(var(--aim-mob-nav-h) + env(safe-area-inset-bottom, 0px));
    background: var(--aim-ink); color: #fff;
    display: flex; justify-content: space-around; align-items: center;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255,255,255,0.08);
}
.aim-mob-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    flex: 1; padding: 4px 6px; font-size: 10.5px; font-weight: 500;
    background: transparent; border: 0; cursor: pointer;
    color: rgba(255,254,251,0.55); text-decoration: none;
}
.aim-mob-nav-item:hover  { color: rgba(255,254,251,0.85); text-decoration: none; }
.aim-mob-nav-item.active { color: #fff; }

/* Desktop sidebar (hidden by default; shown ≥900px) */
.aim-side { display: none; }

/* Marketing top nav (anonymous) */
.aim-top-nav {
    position: sticky; top: 0; z-index: 60;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    background: var(--aim-bg);
    border-bottom: 1px solid var(--aim-line-soft);
}
.aim-top-nav-links { display: none; gap: 26px; font-size: 14px; }
.aim-top-nav-links a { color: var(--aim-ink); text-decoration: none; font-weight: 500; }
.aim-top-nav-links a:hover { color: var(--aim-ink-2); }
.aim-top-nav-cta { display: flex; align-items: center; gap: 12px; }
.aim-top-nav-signin {
    background: transparent; border: 0;
    color: var(--aim-ink); font-size: 14px; font-weight: 500;
    cursor: pointer; text-decoration: none;
}
.aim-top-nav-signin:hover { color: var(--aim-ink-2); text-decoration: none; }

/* Marketing footer */
.aim-foot {
    border-top: 1px solid var(--aim-line-soft);
    padding: 28px 20px; display: flex; flex-wrap: wrap;
    justify-content: space-between; align-items: center; gap: 12px;
    font-size: 13px; color: var(--aim-ink-soft);
}
.aim-foot a { color: inherit; text-decoration: none; }
.aim-foot a:hover { color: var(--aim-ink); text-decoration: none; }
.aim-foot-links { display: flex; gap: 20px; }

/* Desktop overrides */
@media (min-width: 900px) {
    .aim-mob-top, .aim-mob-nav { display: none; }
    .aim-main { padding-top: 0; padding-bottom: 0; }

    /* Authenticated app shell becomes side-by-side */
    .aim-shell.has-side       { flex-direction: row; }
    .aim-shell.has-side .aim-main { padding-left: var(--aim-side-w); }

    .aim-side {
        display: flex; flex-direction: column; gap: 22px;
        position: fixed; top: 0; left: 0; bottom: 0; width: var(--aim-side-w);
        padding: 24px 18px;
        background: var(--aim-bg);
        border-right: 1px solid var(--aim-line-soft);
        z-index: 40;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .aim-side-cta {
        display: inline-flex; align-items: center; gap: 10px; justify-content: flex-start;
        padding: 11px 18px; border-radius: 999px;
        background: var(--aim-ink); color: var(--aim-bg);
        font-size: 13.5px; font-weight: 500;
        border: 1px solid var(--aim-ink); cursor: pointer; text-decoration: none;
    }
    .aim-side-cta:hover { color: var(--aim-bg); opacity: 0.92; text-decoration: none; }

    .aim-side-nav { display: flex; flex-direction: column; gap: 4px; }
    .aim-side-nav a {
        display: flex; align-items: center; gap: 12px;
        padding: 10px 12px; border-radius: 10px;
        font-size: 13.5px; font-weight: 500; color: var(--aim-ink);
        background: transparent; border: 0; text-decoration: none;
        transition: background .15s ease;
    }
    .aim-side-nav a:hover  { background: var(--aim-bg-soft); color: var(--aim-ink); text-decoration: none; }
    .aim-side-nav a.active { background: var(--aim-bg-soft); }
    .aim-side-nav a .ico   { color: var(--aim-ink-soft); display: inline-flex; }
    .aim-side-nav a.active .ico { color: var(--aim-ink); }
    .aim-side-nav a .lbl   { flex: 1; }
    .aim-side-nav a .badge {
        font-size: 10.5px; padding: 2px 8px; border-radius: 99px;
        background: var(--aim-accent-soft); color: var(--aim-ink); font-weight: 600;
    }

    /* Admin row is a toggle button — match the link styling so it sits flush
       with the rest of the nav. */
    .aim-side-nav .aim-side-nav-toggle {
        display: flex; align-items: center; gap: 12px; width: 100%;
        padding: 10px 12px; border-radius: 10px;
        font-size: 13.5px; font-weight: 500; color: var(--aim-ink);
        background: transparent; border: 0; cursor: pointer;
        font-family: inherit; text-align: left;
        transition: background .15s ease;
    }
    .aim-side-nav .aim-side-nav-toggle:hover  { background: var(--aim-bg-soft); }
    .aim-side-nav .aim-side-nav-toggle.active { background: var(--aim-bg-soft); }
    .aim-side-nav .aim-side-nav-toggle .ico   { color: var(--aim-ink-soft); display: inline-flex; }
    .aim-side-nav .aim-side-nav-toggle.active .ico { color: var(--aim-ink); }
    .aim-side-nav .aim-side-nav-toggle .lbl   { flex: 1; }
    .aim-side-nav .aim-side-nav-toggle .chev  {
        color: var(--aim-ink-soft);
        transition: transform .15s ease;
    }
    .aim-side-nav .aim-side-nav-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }

    /* Sub-nav rendered under the Admin entry. Hidden until the toggle opens it. */
    .aim-side-subnav      { display: none; flex-direction: column; gap: 1px; padding: 2px 0 6px 38px; }
    .aim-side-subnav.open { display: flex; }
    .aim-side-subnav-label {
        margin: 8px 10px 2px;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--aim-ink-mute);
    }
    .aim-side-subnav-label:first-child { margin-top: 4px; }
    .aim-side-subnav a {
        display: block; padding: 6px 10px; border-radius: 8px;
        font-size: 12.5px; font-weight: 500; color: var(--aim-ink-soft);
        text-decoration: none; transition: background .15s ease, color .15s ease;
    }
    .aim-side-subnav a:hover  { background: var(--aim-bg-soft); color: var(--aim-ink); text-decoration: none; }
    .aim-side-subnav a.active { background: var(--aim-bg-soft); color: var(--aim-ink); font-weight: 600; }

    .aim-side-bottom {
        margin-top: auto; display: flex; flex-direction: column; gap: 10px;
    }
    .aim-side-user {
        display: flex; align-items: center; gap: 10px; padding: 10px;
        border-radius: 12px; border: 1px solid var(--aim-line);
        background: var(--aim-bg-card); text-decoration: none; color: var(--aim-ink);
    }
    .aim-side-user:hover { color: var(--aim-ink); text-decoration: none; border-color: var(--aim-ink-soft); }
    .aim-side-user-av {
        width: 36px; height: 36px; border-radius: 99px; flex-shrink: 0;
        background: var(--aim-ink); color: #fff; font-weight: 600; font-size: 14px;
        display: flex; align-items: center; justify-content: center;
        background-size: cover; background-position: center;
    }
    .aim-side-user-name { font-size: 13.5px; font-weight: 600; color: var(--aim-ink); }
    .aim-side-user-sub  { font-size: 11.5px; color: var(--aim-ink-soft); margin-top: 1px; }
    .aim-side-signout   {
        display: inline-flex; align-items: center; gap: 8px;
        padding: 8px 12px; border-radius: 10px;
        background: transparent; border: 0; cursor: pointer;
        font-size: 13px; color: var(--aim-ink-soft); text-decoration: none;
    }
    .aim-side-signout:hover { color: var(--aim-danger); text-decoration: none; }

    /* Marketing top nav widens, shows links */
    .aim-top-nav { padding: 20px 56px; }
    .aim-top-nav-links { display: flex; }

    .aim-foot { padding: 40px 56px 56px; font-size: 13px; }
}

/* More-menu popup: mobile sheet restyled to match the AIM app chrome. */
body.aim-r .more-menu-overlay {
    z-index: 89;
    background: rgba(16, 24, 19, 0.42);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

body.aim-r .more-menu {
    left: 12px;
    right: 12px;
    bottom: calc(var(--aim-mob-nav-h) + env(safe-area-inset-bottom, 0px) + 10px);
    z-index: 90;
    max-height: min(76dvh, 640px);
    padding-bottom: 10px;
    background: rgba(255, 254, 251, 0.96);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(16, 31, 70, 0.18),
                0 10px 26px rgba(42, 74, 58, 0.14),
                inset 0 1px 0 rgba(255,255,255,0.74);
    transform: translateY(calc(100% + 18px));
}

body.aim-r .more-menu.open { transform: translateY(0); }

body.aim-r .more-menu-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 24px 18px 12px 22px;
    background: linear-gradient(180deg, rgba(255,254,251,0.98) 0%, rgba(255,254,251,0.9) 100%);
    border-bottom: 1px solid var(--aim-line-soft);
}

body.aim-r .more-menu-header::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 50%;
    width: 42px;
    height: 4px;
    border-radius: 99px;
    background: rgba(42, 74, 58, 0.16);
    transform: translateX(-50%);
}

body.aim-r .more-menu-title {
    font-family: var(--aim-serif);
    font-size: 26px;
    line-height: 1;
    color: var(--aim-ink);
}

body.aim-r .more-menu-close {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 99px;
    background: var(--aim-bg-soft);
    color: var(--aim-ink-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

body.aim-r .more-menu-close:hover {
    background: var(--aim-line-soft);
    color: var(--aim-ink);
}

body.aim-r .more-menu-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 10px 4px;
}

body.aim-r .more-menu-section {
    padding: 0 0 8px;
    border-bottom: 1px solid var(--aim-line-soft);
}

body.aim-r .more-menu-section:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

body.aim-r .more-menu-section-title {
    padding: 9px 10px 7px;
    color: var(--aim-ink-mute);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

body.aim-r .more-menu-links a,
body.aim-r .more-menu-link-btn {
    min-height: 48px;
    padding: 7px 10px;
    border-radius: 14px;
    color: var(--aim-ink);
    gap: 12px;
    font-size: 14.5px;
    font-weight: 600;
}

body.aim-r .more-menu-links a:hover,
body.aim-r .more-menu-link-btn:hover,
body.aim-r .more-menu-links a.active {
    background: var(--aim-bg-soft);
    color: var(--aim-ink);
}

body.aim-r .more-menu-ico {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--aim-bg-soft);
    color: var(--aim-ink-soft);
}

body.aim-r .more-menu-ico .icon {
    width: 17px;
    height: 17px;
}

body.aim-r .more-menu-links a:hover .more-menu-ico,
body.aim-r .more-menu-links a.active .more-menu-ico {
    background: var(--aim-ink);
    color: #fff;
}

body.aim-r .more-menu-link-danger {
    color: var(--aim-danger);
}

body.aim-r .more-menu-link-danger .more-menu-ico {
    background: rgba(180, 90, 74, 0.12);
    color: var(--aim-danger);
}

body.aim-r .more-menu-link-danger:hover {
    background: rgba(180, 90, 74, 0.10);
    color: var(--aim-danger);
}

body.aim-r .more-menu-divider { background: var(--aim-line-soft); }

@media (max-width: 420px) {
    body.aim-r .more-menu {
        left: 8px;
        right: 8px;
        max-height: 78dvh;
        border-radius: 24px;
    }
}

/* ── A Little Help ────────────────────────────────────────────────────── */
/* Desktop: floating action button anchored to the bottom-right of the
   fixed left sidebar. Hidden on mobile — mobile uses the entry inside
   the More popup menu instead. */
.aim-help-fab {
    --help-fab-green: #3f8f4a;
    --help-fab-green-hover: #4fa95b;
    --help-fab-green-glow: rgba(63, 143, 74, 0.58);
    --help-fab-green-glow-soft: rgba(63, 143, 74, 0.35);
    display: none;
}

.more-menu-help-fab {
    --help-fab-green: #3f8f4a;
    --help-fab-green-hover: #4fa95b;
    --help-fab-green-glow: rgba(63, 143, 74, 0.58);
    --help-fab-green-glow-soft: rgba(63, 143, 74, 0.35);
}

@media (min-width: 900px) {
    .aim-help-fab {
        position: fixed;
        left: calc(var(--aim-side-w, 240px) - 88px);
        bottom: 18px;
        z-index: 250;
        min-width: 60px;
        min-height: 56px;
        padding: 10px 16px;
        border-radius: 28px;
        border: 0;
        background: var(--help-fab-green);
        color: #fff;
        display: flex;
        align-items: center; justify-content: center;
        cursor: pointer;
        overflow: visible;
        box-shadow: 0 0 0 2px rgba(63, 143, 74, 0.35),
                    0 0 18px 4px var(--help-fab-green-glow),
                    0 10px 24px var(--help-fab-green-glow-soft),
                    0 2px 6px rgba(0, 0, 0, 0.12);
        animation: aim-help-fab-glow 2.4s ease-in-out infinite;
        transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
    }
    .aim-help-fab:hover {
        background: var(--help-fab-green-hover);
        transform: translateY(-2px);
        box-shadow: 0 0 0 3px rgba(63, 143, 74, 0.48),
                    0 0 26px 6px rgba(63, 143, 74, 0.68),
                    0 14px 30px rgba(63, 143, 74, 0.42),
                    0 4px 10px rgba(0, 0, 0, 0.14);
    }
    .aim-help-fab:active { transform: translateY(0); }
    .aim-help-fab:focus-visible {
        outline: 3px solid rgba(63, 143, 74, 0.60);
        outline-offset: 2px;
    }
    .aim-help-fab-lbl {
        font-size: 11.5px;
        font-weight: 700;
        letter-spacing: 0.02em;
        line-height: 1.15;
        text-transform: none;
        text-align: center;
        max-width: 92px;
    }
}

/* Mobile: floating help button anchored to the lower-right of the More popup.
   Visible only while the More menu is open — sibling-selector flip means no JS
   wiring is needed. Hidden on desktop (which has its own .aim-help-fab). */
.more-menu-help-fab {
    display: none;
    position: fixed;
    right: 18px;
    bottom: calc(var(--aim-mob-nav-h, 64px) + env(safe-area-inset-bottom, 0px) + 24px);
    z-index: 95;
    min-width: 60px;
    min-height: 56px;
    padding: 10px 16px;
    border: 0;
    border-radius: 28px;
    background: var(--help-fab-green);
    color: #fff;
    align-items: center; justify-content: center;
    cursor: pointer;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.15;
    text-align: center;
    max-width: 100px;
    overflow: visible;
    box-shadow: 0 0 0 2px rgba(63, 143, 74, 0.35),
                0 0 18px 4px var(--help-fab-green-glow),
                0 10px 24px var(--help-fab-green-glow-soft),
                0 2px 6px rgba(0, 0, 0, 0.12);
    animation: aim-help-fab-glow 2.4s ease-in-out infinite;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.more-menu.open ~ .more-menu-help-fab { display: flex; }
.more-menu-help-fab:hover {
    background: var(--help-fab-green-hover);
    box-shadow: 0 0 0 3px rgba(63, 143, 74, 0.48),
                0 0 26px 6px rgba(63, 143, 74, 0.68),
                0 14px 30px rgba(63, 143, 74, 0.42),
                0 4px 10px rgba(0, 0, 0, 0.14);
}
.more-menu-help-fab:active { transform: translateY(1px); }
.more-menu-help-fab:focus-visible {
    outline: 3px solid rgba(63, 143, 74, 0.60);
    outline-offset: 2px;
}

.aim-help-fruit {
    --help-fruit-size: 15px;
    --help-fruit-track: rgba(236, 113, 48, 0.22);
    --help-fruit-trail: rgba(236, 113, 48, 0.26);
    --help-fruit-glow: rgba(236, 113, 48, 0.38);
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(calc(100% + 22px), calc(100% + 16px));
    aspect-ratio: 1;
    border-radius: 999px;
    pointer-events: none;
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--help-fruit-track);
    transform-origin: 50% 50%;
    transform: translate(-50%, -50%);
    animation-name: aim-help-fruit-orbit;
    animation-duration: 2.8s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    z-index: 0;
}

.aim-help-fruit::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    width: var(--help-fruit-size);
    height: var(--help-fruit-size);
    border-radius: 999px;
    background:
        radial-gradient(circle at 34% 28%, rgba(255,255,255,0.85) 0 9%, transparent 10%),
        radial-gradient(circle at 50% 50%, #ffb23f 0 58%, #ec7130 59% 100%);
    box-shadow:
        inset -1px -1px 2px rgba(123, 48, 14, 0.28),
        0 0 0 3px rgba(255, 178, 63, 0.20),
        0 4px 10px var(--help-fruit-glow);
    transform: translate(-50%, -50%);
}

.aim-help-fruit::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid var(--help-fruit-trail);
    border-right-color: transparent;
    border-bottom-color: transparent;
}

.aim-help-fruit-leaf {
    position: absolute;
    width: 5px;
    height: 3px;
    left: calc(50% + 3px);
    top: -8px;
    border-radius: 5px 0 5px 0;
    background: #75b35c;
    transform: rotate(-18deg) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.aim-help-fruit-orange {
    animation-duration: 2.8s;
}

.aim-help-fruit-apple {
    --help-fruit-size: 14px;
    --help-fruit-track: rgba(83, 152, 67, 0.18);
    --help-fruit-trail: rgba(83, 152, 67, 0.22);
    --help-fruit-glow: rgba(83, 152, 67, 0.34);
    width: max(calc(100% + 30px), calc(100% + 20px));
    animation-duration: 3.35s;
    animation-delay: -1.1s;
}

.aim-help-fruit-apple::before {
    border-radius: 48% 52% 54% 46% / 56% 56% 44% 44%;
    background:
        radial-gradient(circle at 34% 27%, rgba(255,255,255,0.82) 0 9%, transparent 10%),
        radial-gradient(circle at 62% 42%, #91c46d 0 43%, #4f9842 44% 100%);
    box-shadow:
        inset -1px -1px 2px rgba(38, 91, 35, 0.26),
        0 0 0 3px rgba(145, 196, 109, 0.16),
        0 4px 10px var(--help-fruit-glow);
}

.aim-help-fruit-apple .aim-help-fruit-leaf {
    background: #6aa655;
}

.aim-help-fruit-strawberry {
    --help-fruit-size: 16px;
    --help-fruit-track: rgba(216, 49, 72, 0.16);
    --help-fruit-trail: rgba(216, 49, 72, 0.20);
    --help-fruit-glow: rgba(216, 49, 72, 0.34);
    width: max(calc(100% + 40px), calc(100% + 24px));
    animation-duration: 3.95s;
    animation-delay: -2.15s;
}

.aim-help-fruit-strawberry::before {
    border-radius: 55% 55% 62% 62% / 48% 48% 78% 78%;
    background:
        radial-gradient(circle at 38% 30%, rgba(255,255,255,0.78) 0 7%, transparent 8%),
        radial-gradient(circle at 38% 40%, #ffd77a 0 5%, transparent 6%),
        radial-gradient(circle at 61% 45%, #ffd77a 0 5%, transparent 6%),
        radial-gradient(circle at 49% 63%, #ffd77a 0 5%, transparent 6%),
        radial-gradient(circle at 50% 48%, #f65f6d 0 55%, #d83148 56% 100%);
    box-shadow:
        inset -1px -1px 2px rgba(115, 24, 35, 0.28),
        0 0 0 3px rgba(246, 95, 109, 0.14),
        0 4px 10px var(--help-fruit-glow);
}

.aim-help-fruit-strawberry .aim-help-fruit-leaf {
    width: 7px;
    height: 4px;
    left: calc(50% + 1px);
    top: -9px;
    border-radius: 6px 6px 0 6px;
    background: #5fa84e;
    transform: rotate(14deg) translate(-50%, -50%);
}

.aim-help-fab-lbl {
    position: relative;
    z-index: 1;
}

@keyframes aim-help-fab-glow {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(63, 143, 74, 0.30),
                    0 0 16px 3px rgba(63, 143, 74, 0.48),
                    0 10px 24px rgba(63, 143, 74, 0.30),
                    0 2px 6px rgba(0, 0, 0, 0.12);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(63, 143, 74, 0.52),
                    0 0 26px 6px rgba(63, 143, 74, 0.72),
                    0 12px 28px rgba(63, 143, 74, 0.45),
                    0 2px 6px rgba(0, 0, 0, 0.12);
    }
}

@keyframes aim-help-fruit-orbit {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .aim-help-fab, .more-menu-help-fab { animation: none; }
    .aim-help-fruit {
        animation-name: aim-help-fruit-orbit !important;
        animation-timing-function: linear !important;
        animation-iteration-count: infinite !important;
    }
    .aim-help-fruit-orange { animation-duration: 2.8s !important; }
    .aim-help-fruit-apple { animation-duration: 3.35s !important; }
    .aim-help-fruit-strawberry { animation-duration: 3.95s !important; }
}
@media (min-width: 900px) {
    /* Desktop has its own pill; never show the mobile floating one. */
    .more-menu-help-fab,
    .more-menu.open ~ .more-menu-help-fab { display: none !important; }
}

/* Mobile: prominent entry at the top of the More popup menu */
.help-menu-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 399;
    background:
        radial-gradient(circle at 50% 44%, rgba(232, 226, 209, 0.20), transparent 34%),
        rgba(28, 34, 29, 0.54);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.help-menu-overlay.open { display: block; }

.help-menu {
    display: none;
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -48%);
    z-index: 400;
    width: min(470px, calc(100vw - 32px));
    background: var(--aim-bg-card);
    border: 1px solid rgba(61, 91, 75, 0.16);
    border-radius: 24px;
    box-shadow:
        0 28px 80px rgba(28, 34, 29, 0.30),
        0 10px 26px rgba(28, 34, 29, 0.12);
    overflow: hidden;
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
    color: var(--aim-ink);
}
.help-menu.open {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%);
}

.help-menu-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px;
    background:
        linear-gradient(135deg, rgba(238, 232, 216, 0.88), rgba(250, 248, 242, 0.96));
    border-bottom: 1px solid rgba(61, 91, 75, 0.10);
}
.help-menu-kicker {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
    color: var(--aim-ink-soft);
}
.help-menu-title {
    display: block;
    font-family: var(--aim-serif);
    font-size: 25px; font-weight: 400;
    line-height: 1.08;
    color: var(--aim-ink);
    letter-spacing: 0;
}
.help-menu-close {
    width: 40px; height: 40px;
    flex: 0 0 40px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(61, 91, 75, 0.12);
    border-radius: 50%;
    cursor: pointer; padding: 0;
    color: var(--aim-ink-soft);
    transition: background .15s ease, color .15s ease, transform .15s ease, border-color .15s ease;
}
.help-menu-close svg {
    width: 18px; height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}
.help-menu-close:hover {
    background: #fff;
    border-color: rgba(61, 91, 75, 0.22);
    color: var(--aim-ink);
    transform: translateY(-1px);
}
.help-menu-close:focus-visible {
    outline: 3px solid rgba(61, 91, 75, 0.22);
    outline-offset: 2px;
}

.help-menu-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    margin: 0;
}
.help-menu-links li { margin: 0; }
.help-menu-links a {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 13px;
    min-height: 72px;
    padding: 12px 14px 12px 12px;
    border: 1px solid transparent;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--aim-ink);
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.help-menu-links a:hover {
    background: rgba(245, 241, 230, 0.92);
    border-color: rgba(61, 91, 75, 0.14);
    color: var(--aim-ink);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(43, 46, 37, 0.08);
}
.help-menu-links a:focus-visible {
    outline: 3px solid rgba(61, 91, 75, 0.22);
    outline-offset: 2px;
}
.help-menu-icon {
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 14px;
    background: #eef4ea;
    color: var(--aim-ink);
}
.help-menu-links li:nth-child(2) .help-menu-icon { background: #f7eded; color: #8b514c; }
.help-menu-links li:nth-child(3) .help-menu-icon { background: #fff3d8; color: #7b5c16; }
.help-menu-links li:nth-child(4) .help-menu-icon { background: #ecf3f5; color: #335c68; }
.help-menu-links li:nth-child(5) .help-menu-icon { background: var(--aim-bg-soft); color: var(--aim-ink-soft); }
.help-menu-icon .icon {
    width: 21px; height: 21px;
}
.help-menu-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 3px;
}
.help-menu-link-title {
    color: var(--aim-ink);
    font-size: 15.5px;
    font-weight: 700;
    line-height: 1.2;
}
.help-menu-link-sub {
    color: var(--aim-ink-soft);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.3;
}
.help-menu-arrow {
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--aim-ink-mute);
    transition: color .15s ease, transform .15s ease;
}
.help-menu-arrow .icon {
    width: 18px; height: 18px;
}
.help-menu-links a:hover .help-menu-arrow {
    color: var(--aim-ink);
    transform: translateX(2px);
}

@media (max-width: 420px) {
    .help-menu {
        width: min(100vw - 20px, 470px);
        border-radius: 22px;
    }
    .help-menu-header {
        padding: 20px 18px 16px;
    }
    .help-menu-title {
        font-size: 23px;
    }
    .help-menu-links {
        padding: 10px;
        gap: 6px;
    }
    .help-menu-links a {
        grid-template-columns: 40px minmax(0, 1fr) 18px;
        gap: 11px;
        min-height: 68px;
        padding: 10px 12px 10px 10px;
        border-radius: 14px;
    }
    .help-menu-icon {
        width: 40px; height: 40px;
        border-radius: 13px;
    }
    .help-menu-link-sub {
        font-size: 12px;
    }
}

[data-theme="dark"] .help-menu {
    background: var(--aim-bg-card);
    border-color: rgba(255,255,255,0.10);
    box-shadow: 0 28px 80px rgba(0,0,0,0.48);
}
[data-theme="dark"] .help-menu-header {
    background: linear-gradient(135deg, rgba(34,34,34,0.96), rgba(25,25,25,0.98));
    border-bottom-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .help-menu-close {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.10);
}
[data-theme="dark"] .help-menu-close:hover {
    background: rgba(255,255,255,0.12);
}
[data-theme="dark"] .help-menu-links a:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.10);
    box-shadow: none;
}
[data-theme="dark"] .help-menu-icon {
    background: rgba(155, 193, 150, 0.14);
}
[data-theme="dark"] .help-menu-links li:nth-child(2) .help-menu-icon { background: rgba(214, 112, 95, 0.16); color: #d6705f; }
[data-theme="dark"] .help-menu-links li:nth-child(3) .help-menu-icon { background: rgba(217, 160, 91, 0.18); color: #d9a05b; }
[data-theme="dark"] .help-menu-links li:nth-child(4) .help-menu-icon { background: rgba(112, 163, 177, 0.16); color: #8ab7c3; }
[data-theme="dark"] .help-menu-links li:nth-child(5) .help-menu-icon { background: rgba(255,255,255,0.06); }

/* =====================================================================
   AIM — Reusable surface kit (May 2026)
   Generic patterns shared across the converted pages: page heads, forms,
   tables, lists, tiles, chat, auth. Mobile-first; desktop overrides at
   ≥900px reuse the same widths as the dashboard (max 1200px centred).
   ===================================================================== */

/* ── Page wrappers ────────────────────────────────────────────────── */
.aim-r .a-page,
.aim-r .a-page-narrow,
.aim-r .a-page-wide {
    padding: 6px 16px 28px; display: flex; flex-direction: column; gap: 18px;
    min-width: 0; max-width: 100%; width: 100%;
}
.aim-r .a-page > *,
.aim-r .a-page-narrow > *,
.aim-r .a-page-wide > * { min-width: 0; max-width: 100%; }

/* ── Page head (eyebrow + title + optional actions) ──────────────── */
.aim-r .a-pagehead { padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.aim-r .a-pagehead-row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.aim-r .a-pagehead-row > div:first-child { min-width: 0; flex: 1; }
.aim-r .a-pagehead h1 {
    font-family: var(--aim-serif); font-size: 32px; line-height: 1.02;
    letter-spacing: -0.01em; margin: 4px 0 0; color: var(--aim-ink); font-weight: 400;
}
.aim-r .a-pagehead p {
    font-size: 14px; line-height: 1.55; color: var(--aim-ink-2); margin: 8px 0 0; max-width: 640px;
}
.aim-r .a-pagehead-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.aim-r .a-pagehead-back {
    display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500;
    color: var(--aim-ink-soft); text-decoration: none; margin-bottom: 4px;
}
.aim-r .a-pagehead-back:hover { color: var(--aim-ink); text-decoration: none; }

/* ── Sections ─────────────────────────────────────────────────────── */
.aim-r .a-section { display: flex; flex-direction: column; gap: 12px; }
.aim-r .a-section-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 4px;
}
.aim-r .a-section-head h2,
.aim-r .a-section-head h3 {
    font-family: var(--aim-serif); font-size: 20px; line-height: 1.1; margin: 0;
    color: var(--aim-ink); font-weight: 400;
}
.aim-r .a-section-head .count { color: var(--aim-ink-soft); font-size: 13px; margin-left: 4px; }
.aim-r .a-section-head a { font-size: 13px; font-weight: 500; color: var(--aim-ink); text-decoration: none; }
.aim-r .a-section-head a:hover { color: var(--aim-ink-2); text-decoration: none; }

/* ── Forms ────────────────────────────────────────────────────────── */
.aim-r .a-form { display: flex; flex-direction: column; gap: 18px; }
.aim-r .a-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.aim-r .a-field-row { display: flex; flex-direction: column; gap: 12px; }
.aim-r .a-field > label,
.aim-r .a-label {
    font-size: 13px; font-weight: 600; color: var(--aim-ink); letter-spacing: 0;
}
.aim-r .a-hint { font-size: 12px; color: var(--aim-ink-soft); line-height: 1.45; }
.aim-r .a-error { font-size: 12px; color: var(--aim-danger); line-height: 1.45; }

.aim-r .a-input,
.aim-r .a-select,
.aim-r .a-textarea,
.aim-r input[type="text"].form-input,
.aim-r input[type="email"].form-input,
.aim-r input[type="password"].form-input,
.aim-r input[type="number"].form-input,
.aim-r input[type="date"].form-input,
.aim-r input[type="search"].form-input,
.aim-r input[type="tel"].form-input,
.aim-r input[type="url"].form-input,
.aim-r select.form-input,
.aim-r textarea.form-input,
.aim-r .form-control {
    width: 100%; padding: 11px 14px; font-size: 14px; font-family: var(--aim-sans);
    color: var(--aim-ink); background: var(--aim-bg-card);
    border: 1px solid var(--aim-line); border-radius: 12px;
    line-height: 1.4; transition: border-color .15s ease, box-shadow .15s ease;
    -webkit-appearance: none; appearance: none;
}
.aim-r .a-input:focus,
.aim-r .a-select:focus,
.aim-r .a-textarea:focus,
.aim-r .form-input:focus,
.aim-r .form-control:focus {
    outline: none; border-color: var(--aim-ink);
    box-shadow: 0 0 0 3px rgba(42, 74, 58, 0.18);
}
.aim-r .a-textarea,
.aim-r textarea.form-input { min-height: 96px; resize: vertical; line-height: 1.55; }
.aim-r .a-select,
.aim-r select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 L6 6.5 L11 1.5' stroke='%236F8475' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
    padding-right: 36px;
}
.aim-r .a-input[disabled],
.aim-r .form-input[disabled],
.aim-r .a-select[disabled] { background: var(--aim-bg-soft); color: var(--aim-ink-soft); cursor: not-allowed; }

/* Suffix-decorated input (e.g. lbs, ft, in, $) */
.aim-r .a-input-suffix { position: relative; }
.aim-r .a-input-suffix input,
.aim-r .a-input-suffix .form-input { padding-right: 44px; }
.aim-r .a-input-suffix .suffix {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    font-size: 12px; color: var(--aim-ink-soft); pointer-events: none; font-weight: 500;
}
.aim-r .a-input-prefix { position: relative; }
.aim-r .a-input-prefix input,
.aim-r .a-input-prefix .form-input { padding-left: 32px; }
.aim-r .a-input-prefix .prefix {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    font-size: 13px; color: var(--aim-ink-soft); pointer-events: none; font-weight: 500;
}

/* Checkbox / radio */
.aim-r .a-check,
.aim-r .checkbox-label {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px;
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 12px;
    font-size: 13.5px; color: var(--aim-ink); cursor: pointer; user-select: none;
    transition: border-color .15s ease, background .15s ease;
}
.aim-r .a-check:hover,
.aim-r .checkbox-label:hover { border-color: var(--aim-ink-soft); }
.aim-r .a-check input,
.aim-r .checkbox-label input { margin: 0; accent-color: var(--aim-ink); }
.aim-r .a-check.is-checked,
.aim-r .a-check:has(input:checked),
.aim-r .checkbox-label:has(input:checked) {
    border-color: var(--aim-ink); background: var(--aim-tint);
}
.aim-r .a-checkgrid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 520px) { .aim-r .a-checkgrid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .aim-r .a-checkgrid { grid-template-columns: repeat(3, 1fr); } }

.aim-r .health-condition-scroll {
    max-height: min(180px, 24vh);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 10px 12px 14px;
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    background: var(--aim-bg-card);
}
.aim-r .health-condition-scroll .condition-group + .condition-group { margin-top: 14px; }
.aim-r .health-condition-scroll .condition-group-title {
    margin: 0 0 8px;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}
.aim-r .health-condition-scroll .condition-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Radio cards (selectable card with hidden radio) */
.aim-r .a-radio-card {
    display: flex; gap: 12px; align-items: flex-start; padding: 14px;
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    cursor: pointer; user-select: none; transition: border-color .15s ease, background .15s ease;
}
.aim-r .a-radio-card:hover { border-color: var(--aim-ink-soft); }
.aim-r .a-radio-card input[type="radio"],
.aim-r .a-radio-card input[type="checkbox"] {
    margin-top: 2px; accent-color: var(--aim-ink); flex-shrink: 0;
}
.aim-r .a-radio-card.selected,
.aim-r .a-radio-card:has(input:checked) {
    border-color: var(--aim-ink); border-width: 1.5px; background: var(--aim-tint);
}
.aim-r .a-radio-card-title { font-weight: 600; font-size: 14px; color: var(--aim-ink); }
.aim-r .a-radio-card-desc  { font-size: 12.5px; color: var(--aim-ink-soft); margin-top: 2px; line-height: 1.45; }

/* Form actions footer */
.aim-r .a-form-actions {
    display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap;
    margin-top: 4px;
}
.aim-r .a-form-actions.center { justify-content: center; }
.aim-r .a-form-actions.full .btn-pill { flex: 1; min-width: 0; }
.aim-r .a-form-actions .btn-pill { padding: 12px 22px; font-size: 14px; }

/* Field group on a card (titled box with internal spacing) */
.aim-r .a-fieldset {
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    padding: 18px; display: flex; flex-direction: column; gap: 14px;
}
.aim-r .a-fieldset-title {
    font-family: var(--aim-serif); font-size: 18px; line-height: 1.15; color: var(--aim-ink); margin: 0;
}
.aim-r .a-collapsible-fieldset summary {
    cursor: pointer;
}
.aim-r .a-collapsible-fieldset summary::marker {
    color: var(--aim-ink-soft);
}
.aim-r .a-fieldset-sub { font-size: 12.5px; color: var(--aim-ink-soft); margin-top: -8px; line-height: 1.5; }

/* ── Tables ───────────────────────────────────────────────────────── */
.aim-r .a-table-wrap {
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    overflow: hidden;
}
.aim-r .a-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.aim-r .a-table thead th {
    text-align: left; padding: 12px 14px; background: var(--aim-bg-soft);
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--aim-ink-soft); border-bottom: 1px solid var(--aim-line);
}
.aim-r .a-table tbody td {
    padding: 12px 14px; border-bottom: 1px solid var(--aim-line-soft);
    color: var(--aim-ink); vertical-align: middle;
}
.aim-r .a-table tbody tr:last-child td { border-bottom: 0; }
.aim-r .a-table tbody tr:hover { background: var(--aim-bg-soft); }
.aim-r .a-table .num { font-variant-numeric: tabular-nums; }
.aim-r .a-table .actions { text-align: right; white-space: nowrap; }

/* Mobile: collapse table rows to stacked card layout */
@media (max-width: 640px) {
    .aim-r .a-table thead { display: none; }
    .aim-r .a-table,
    .aim-r .a-table tbody,
    .aim-r .a-table tr,
    .aim-r .a-table td { display: block; width: 100%; }
    .aim-r .a-table tr {
        padding: 12px 14px; margin: 0;
        border-bottom: 1px solid var(--aim-line-soft);
    }
    .aim-r .a-table tr:last-child { border-bottom: 0; }
    .aim-r .a-table td {
        padding: 4px 0; border: 0; text-align: left;
    }
    .aim-r .a-table td[data-label]::before {
        content: attr(data-label) " · ";
        font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
        color: var(--aim-ink-soft); margin-right: 4px;
    }
    .aim-r .a-table td.actions { text-align: right; padding-top: 8px; }
}

/* ── Tile grids (recipes, foods, conditions, members) ─────────────── */
.aim-r .a-grid       { display: grid; grid-template-columns: 1fr; gap: 12px; }
.aim-r .a-grid-2     { display: grid; grid-template-columns: 1fr; gap: 12px; }
.aim-r .a-grid-tight { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
@media (min-width: 520px) {
    .aim-r .a-grid    { grid-template-columns: repeat(2, 1fr); }
    .aim-r .a-grid-2  { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
    .aim-r .a-grid    { grid-template-columns: repeat(3, 1fr); gap: 18px; }
    .aim-r .a-grid-2  { grid-template-columns: repeat(2, 1fr); gap: 18px; }
    .aim-r .a-grid-4  { grid-template-columns: repeat(4, 1fr); gap: 18px; }
}

.aim-r .a-tile {
    display: flex; flex-direction: column; min-width: 0;
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    overflow: hidden; text-decoration: none; color: var(--aim-ink);
    transition: border-color .15s ease, transform .15s ease;
}
.aim-r .a-tile:hover {
    border-color: var(--aim-ink-soft); color: var(--aim-ink); text-decoration: none;
    transform: translateY(-1px);
}
.aim-r .a-tile-img {
    height: 140px; background-size: cover; background-position: center;
    background-color: var(--aim-bg-soft); position: relative;
}
.aim-r .a-tile-img-chip { position: absolute; top: 10px; left: 10px; }
.aim-r .a-tile-img-fav  { position: absolute; top: 10px; right: 10px; }
.aim-r .a-tile-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.aim-r .a-tile-title {
    font-family: var(--aim-serif); font-size: 17px; line-height: 1.15; color: var(--aim-ink);
    font-weight: 400; margin: 0;
}
.aim-r .a-tile-meta { font-size: 12px; color: var(--aim-ink-soft); display: flex; gap: 10px; flex-wrap: wrap; }
.aim-r .a-tile-meta strong { color: var(--aim-ink); font-weight: 600; }
.aim-r .a-tile-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* Compact "icon tile" (no image, like .qa but bigger / left-aligned) */
.aim-r .a-icon-tile {
    display: flex; flex-direction: column; gap: 14px; padding: 18px;
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    text-decoration: none; color: var(--aim-ink); min-width: 0;
    transition: border-color .15s ease;
}
.aim-r .a-icon-tile:hover { border-color: var(--aim-ink-soft); color: var(--aim-ink); text-decoration: none; }
.aim-r .a-icon-tile-ic {
    width: 40px; height: 40px; border-radius: 99px; background: var(--aim-tint); color: var(--aim-ink);
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.aim-r .a-icon-tile-title { font-family: var(--aim-serif); font-size: 18px; line-height: 1.15; }
.aim-r .a-icon-tile-desc  { font-size: 13px; color: var(--aim-ink-2); line-height: 1.5; }

/* ── Lists / rows ─────────────────────────────────────────────────── */
.aim-r .a-list {
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    overflow: hidden;
}
.aim-r .a-list > * + * { border-top: 1px solid var(--aim-line-soft); }
.aim-r .a-row {
    display: flex; align-items: center; gap: 12px; padding: 14px;
    text-decoration: none; color: var(--aim-ink); min-width: 0;
}
.aim-r .a-row:hover { background: var(--aim-bg-soft); color: var(--aim-ink); text-decoration: none; }
.aim-r .a-row-main { flex: 1; min-width: 0; }
.aim-r .a-row-title { font-size: 14px; font-weight: 600; color: var(--aim-ink); }
.aim-r .a-row-sub   { font-size: 12px; color: var(--aim-ink-soft); margin-top: 2px; }
.aim-r .a-row-end   { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }

/* ── Empty state ──────────────────────────────────────────────────── */
.aim-r .a-empty {
    text-align: center; padding: 32px 16px; display: flex; flex-direction: column;
    gap: 10px; align-items: center;
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
}
.aim-r .a-empty-icon {
    width: 56px; height: 56px; border-radius: 99px; background: var(--aim-tint);
    color: var(--aim-ink); display: inline-flex; align-items: center; justify-content: center;
}
.aim-r .a-empty-title { font-family: var(--aim-serif); font-size: 22px; color: var(--aim-ink); }
.aim-r .a-empty-sub   { font-size: 13.5px; color: var(--aim-ink-soft); line-height: 1.5; max-width: 380px; }
.aim-r .a-empty .btn-pill { margin-top: 6px; }

/* ── Tabs (segmented) ─────────────────────────────────────────────── */
.aim-r .a-tabs {
    background: var(--aim-bg-soft); border-radius: 99px; padding: 4px;
    display: inline-flex; gap: 0; max-width: 100%; overflow-x: auto;
}
.aim-r .a-tabs .a-tab {
    flex: 0 0 auto; padding: 9px 18px; border: 0; background: transparent;
    color: var(--aim-ink); font-size: 12.5px; font-weight: 500; border-radius: 99px;
    cursor: pointer; font-family: inherit; text-decoration: none; white-space: nowrap;
}
.aim-r .a-tabs .a-tab:hover { background: rgba(255,255,255,0.55); color: var(--aim-ink); text-decoration: none; }
.aim-r .a-tabs .a-tab.active {
    background: var(--aim-bg-card); font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.aim-r .a-tab-panel { display: none; }
.aim-r .a-tab-panel.active { display: block; }

/* ── Search bar ───────────────────────────────────────────────────── */
.aim-r .a-search { position: relative; width: 100%; }
.aim-r .a-search input {
    width: 100%; padding: 11px 14px 11px 40px; font-size: 14px; font-family: var(--aim-sans);
    color: var(--aim-ink); background: var(--aim-bg-card);
    border: 1px solid var(--aim-line); border-radius: 99px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.aim-r .a-search input:focus {
    outline: none; border-color: var(--aim-ink-soft);
    box-shadow: 0 0 0 3px rgba(122,144,114,0.15);
}
.aim-r .a-search-ic {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--aim-ink-soft); pointer-events: none;
}

/* ── Admin screens ───────────────────────────────────────────────── */
.aim-r .admin-page { max-width: 1200px; margin: 0 auto; }
.aim-r .admin-page-narrow { max-width: 760px; margin: 0 auto; }
.aim-r .admin-head-actions {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 8px; flex-wrap: wrap;
}
.aim-r .admin-toolbar {
    display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
    padding: 14px;
}
.aim-r .admin-toolbar .form-group { margin: 0; flex: 1 1 220px; }
.aim-r .admin-toolbar .form-control { min-width: 0; }
.aim-r .admin-table-wrap {
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    overflow-x: auto;
    box-shadow: none;
}
.aim-r .admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    color: var(--aim-ink);
}
.aim-r .admin-table th {
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--aim-ink-soft);
    background: var(--aim-bg-soft);
    border-bottom: 1px solid var(--aim-line);
    white-space: nowrap;
}
.aim-r .admin-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--aim-line-soft);
    vertical-align: middle;
}
.aim-r .admin-table tbody tr:last-child td { border-bottom: 0; }
.aim-r .admin-table tbody tr:hover { background: var(--aim-bg-soft); }
.aim-r .admin-table code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--aim-bg-soft);
    color: var(--aim-ink);
    font-size: 12px;
}
.aim-r .admin-actions {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 6px; flex-wrap: nowrap; white-space: nowrap;
}
.aim-r .admin-actions form { margin: 0; display: inline-flex; }
.aim-r .admin-nav {
    display: inline-flex;
    gap: 0;
    max-width: 100%;
    overflow-x: auto;
    padding: 4px;
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: var(--aim-bg-soft);
}
.aim-r .admin-nav-tab,
.aim-r .admin-nav-tab:visited {
    flex: 0 0 auto;
    padding: 9px 18px;
    border: 0;
    border-radius: 999px;
    color: var(--aim-ink);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.aim-r .admin-nav-tab:hover {
    background: rgba(255,255,255,0.55);
    color: var(--aim-ink);
    text-decoration: none;
}
.aim-r .admin-nav-tab.active {
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.aim-r .admin-media {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}
.aim-r .admin-thumb,
.aim-r .admin-thumb-empty {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex: 0 0 auto;
    object-fit: cover;
    border: 1px solid var(--aim-line);
    background: var(--aim-bg-soft);
}
.aim-r .admin-thumb-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--aim-ink-mute);
    font-size: 12px;
}
.aim-r .admin-status-ok { color: #3F6244; font-weight: 600; }
.aim-r .admin-status-warn { color: #8B6F00; font-weight: 600; }
.aim-r .admin-status-danger,
.aim-r .admin-danger { color: var(--aim-danger) !important; }
.aim-r .admin-progress {
    display: none;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    font-size: 12.5px;
}
.aim-r .admin-progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.aim-r .admin-progress-counter {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    color: var(--aim-ink-soft);
}
.aim-r .admin-progress-track {
    height: 6px;
    margin-bottom: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--aim-line-soft);
}
.aim-r .admin-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: var(--aim-ink);
    transition: width .25s ease;
}
.aim-r .admin-progress-log {
    margin: 0;
    padding-left: 18px;
    max-height: 120px;
    overflow: hidden;
    color: var(--aim-ink-soft);
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
}
.aim-r .admin-image-panel {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}
.aim-r .admin-image-preview,
.aim-r .admin-image-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 14px;
    flex: 0 0 auto;
    object-fit: cover;
    border: 1px solid var(--aim-line);
    background: var(--aim-bg-soft);
}
.aim-r .admin-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--aim-ink-soft);
    font-size: 13px;
}
.aim-r .admin-copy-note {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--aim-ink-soft);
}
.aim-r .admin-inline-form { margin: 0; display: inline-flex; }
.aim-r .admin-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    vertical-align: middle;
    white-space: nowrap;
}
.aim-r .admin-badge-review {
    background: #fdf0d8;
    color: #92600b;
    border: 1px solid #f0d9a8;
}
.aim-r .admin-review-banner {
    border-left: 4px solid #d9a73a;
    background: #fdf0d8;
    margin-bottom: 12px;
}
.aim-r .admin-review-banner p { margin: 0; color: #6b4a08; }
.aim-r .admin-review-banner a { font-weight: 600; }
.aim-r .admin-edit-sticky-actions {
    position: sticky;
    top: 10px;
    z-index: 20;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: -4px -4px 12px;
    padding: 8px;
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--aim-bg-card) 92%, transparent);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(40, 36, 30, 0.08);
}
.aim-r .ingredient-workbench {
    gap: 10px;
}
.aim-r .ingredient-workbench-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.aim-r .ingredient-count {
    flex: 0 0 auto;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--aim-bg-soft);
    border: 1px solid var(--aim-line);
    color: var(--aim-ink-soft);
    font-size: 12px;
    font-weight: 500;
}
.aim-r .ingredient-add-row {
    display: grid;
    grid-template-columns: minmax(170px, 1.7fr) minmax(70px, .65fr) minmax(82px, .8fr) minmax(120px, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}
.aim-r .ingredient-add-row label {
    margin: 0;
    min-width: 0;
}
.aim-r .ingredient-add-row .form-control {
    min-width: 0;
}
.aim-r .ingredient-optional {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 0 2px;
    color: var(--aim-ink);
    font-size: 12.5px;
    white-space: nowrap;
}
.aim-r .ingredient-optional input {
    margin: 0;
    accent-color: var(--aim-ink);
}
.aim-r .ingredient-add-btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}
.aim-r .ingredient-list {
    max-height: min(260px, 34vh);
    overflow-y: auto;
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    background: var(--aim-bg-card);
}
.aim-r .ingredient-list-empty {
    padding: 14px;
    color: var(--aim-ink-soft);
    font-size: 13px;
}
.aim-r .ingredient-row {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(72px, .75fr) minmax(90px, 1fr) auto 32px;
    gap: 8px;
    align-items: center;
    min-height: 38px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--aim-line-soft);
    font-size: 13px;
}
.aim-r .ingredient-row:last-child {
    border-bottom: 0;
}
.aim-r .ingredient-row:hover {
    background: var(--aim-bg-soft);
}
.aim-r .ingredient-row-invalid {
    grid-template-columns: minmax(0, 1fr) auto 32px;
}
.aim-r .ingredient-name,
.aim-r .ingredient-qty,
.aim-r .ingredient-category,
.aim-r .ingredient-meta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.aim-r .ingredient-name {
    color: var(--aim-ink);
    font-weight: 600;
}
.aim-r .ingredient-qty {
    color: var(--aim-ink);
    font-variant-numeric: tabular-nums;
}
.aim-r .ingredient-category,
.aim-r .ingredient-meta {
    color: var(--aim-ink-soft);
}
.aim-r .ingredient-meta {
    font-size: 12px;
}
.aim-r .ingredient-row-remove {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--aim-ink-soft);
    font-size: 20px;
    line-height: 1;
}
.aim-r .ingredient-row-remove:hover {
    border-color: var(--aim-line);
    background: var(--aim-bg-card);
    color: var(--aim-danger);
}
.aim-r .ingredient-raw-editor {
    margin-top: 2px;
}
.aim-r .ingredient-raw-editor summary {
    cursor: pointer;
    width: max-content;
    max-width: 100%;
    color: var(--aim-ink-soft);
    font-size: 12.5px;
    font-weight: 500;
}
.aim-r .ingredient-raw-editor textarea {
    margin-top: 8px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px;
}
.aim-r .form-group > input[type="checkbox"] + label {
    display: inline-flex;
    margin-left: 8px;
    margin-bottom: 0;
    vertical-align: middle;
}
.aim-r .csv-sample {
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--aim-bg-soft);
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    padding: 14px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--aim-ink);
}
.aim-r .admin-section {
    margin-top: 28px;
    padding: 20px;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 14px;
}
.aim-r .admin-section-title {
    margin: 0 0 6px;
    font-size: 17px;
    color: var(--aim-ink);
}
.aim-r .admin-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 720px;
}
.aim-r .admin-form-row { display: block; }
.aim-r .admin-form-row label { display: block; }
.aim-r .admin-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--aim-ink-soft);
    margin-bottom: 4px;
}
.aim-r .admin-form-input {
    width: 100%;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--aim-line);
    background: var(--aim-bg);
    font-size: 14px;
    color: var(--aim-ink);
    font-family: inherit;
}
.aim-r .admin-form-input:focus {
    outline: none;
    border-color: var(--aim-ink);
}
.aim-r .admin-form-input-sm {
    padding: 6px 9px;
    font-size: 13px;
    width: auto;
    min-width: 90px;
}
.aim-r .admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: end;
}
.aim-r .admin-form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    margin-top: 14px;
}
.aim-r .admin-form-inline > label { flex: 1 1 140px; }
.aim-r .admin-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.aim-r .admin-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}
.aim-r .admin-checkbox input { width: 18px; height: 18px; }
.aim-r .admin-checkbox .admin-form-label { margin-bottom: 0; }
.aim-r .admin-validation { color: var(--aim-danger); font-size: 12.5px; }

.aim-r .admin-tier-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}
.aim-r .admin-tier-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    padding: 12px;
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    background: var(--aim-bg);
}
.aim-r .admin-tier-edit,
.aim-r .admin-tier-delete {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin: 0;
}
.aim-r .admin-tier-edit > label { display: flex; flex-direction: column; }

.aim-r .admin-slot-grid .admin-slot-day {
    background: var(--aim-bg-soft);
    font-weight: 600;
    white-space: nowrap;
}
.aim-r .admin-slot-cell {
    min-width: 200px;
    vertical-align: top;
}
.aim-r .admin-slot-cell .admin-form-input-sm { width: 100%; }
.aim-r .admin-slot-notes { margin-top: 6px; font-size: 12px; }

@media (max-width: 680px) {
    .aim-r .admin-head-actions,
    .aim-r .admin-toolbar { align-items: stretch; flex-direction: column; }
    .aim-r .admin-head-actions .btn,
    .aim-r .admin-head-actions .btn-pill,
    .aim-r .admin-toolbar .btn,
    .aim-r .admin-toolbar .btn-pill { width: 100%; }
    .aim-r .admin-actions { justify-content: flex-start; flex-wrap: wrap; }
    .aim-r .admin-form-grid { grid-template-columns: 1fr; }
    .aim-r .ingredient-add-row {
        grid-template-columns: 1fr 84px;
    }
    .aim-r .ingredient-add-row label:first-child,
    .aim-r .ingredient-add-row label:nth-child(4),
    .aim-r .ingredient-add-btn {
        grid-column: 1 / -1;
    }
    .aim-r .ingredient-row {
        grid-template-columns: minmax(0, 1fr) 32px;
        align-items: start;
        gap: 2px 8px;
    }
    .aim-r .ingredient-row .ingredient-name,
    .aim-r .ingredient-row .ingredient-qty,
    .aim-r .ingredient-row .ingredient-category,
    .aim-r .ingredient-row .ingredient-meta {
        grid-column: 1;
    }
    .aim-r .ingredient-row-remove {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}

/* ── Wizard step bar ──────────────────────────────────────────────── */
.aim-r .a-stepbar {
    display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 12px;
    color: var(--aim-ink-soft); font-weight: 500; letter-spacing: 0.04em;
}
.aim-r .a-stepbar-track {
    flex: 1; height: 4px; background: var(--aim-line-soft); border-radius: 99px; overflow: hidden;
}
.aim-r .a-stepbar-fill {
    height: 100%; background: var(--aim-ink); border-radius: 99px; transition: width .25s ease;
}

/* ── Banners / alerts (within aim-r) ──────────────────────────────── */
.aim-r .a-banner {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px; border-radius: 12px;
    background: var(--aim-bg-card); border: 1px solid var(--aim-line);
    font-size: 13.5px; color: var(--aim-ink); line-height: 1.5;
}
.aim-r .a-banner-ic { flex-shrink: 0; color: var(--aim-ink-soft); margin-top: 2px; }
.aim-r .a-banner-body { flex: 1; min-width: 0; }
.aim-r .a-banner-title { font-weight: 600; color: var(--aim-ink); margin-bottom: 2px; }
.aim-r .a-banner.success { background: rgba(122,144,114,0.10); border-color: rgba(122,144,114,0.35); }
.aim-r .a-banner.success .a-banner-ic { color: #3F6244; }
.aim-r .a-banner.warn    { background: rgba(217,160,91,0.12); border-color: rgba(217,160,91,0.40); }
.aim-r .a-banner.warn    .a-banner-ic { color: #8C6322; }
.aim-r .a-banner.error   { background: rgba(180,90,74,0.10); border-color: rgba(180,90,74,0.35); }
.aim-r .a-banner.error   .a-banner-ic { color: var(--aim-danger); }

/* ── Lunchbox planner: compact mobile summary ───────────────────── */
@media (max-width: 700px) {
    .aim-r .lunchbox-page {
        padding-top: 0;
        gap: 12px;
    }

    .aim-r .lunchbox-hero {
        padding-top: 2px;
        gap: 4px;
    }

    .aim-r .lunchbox-hero h1 {
        font-size: 30px;
        margin-top: 2px;
    }

    .aim-r .lunchbox-hero p {
        margin-top: 5px;
        font-size: 13px;
        line-height: 1.4;
    }

    .aim-r .lunchbox-plan-banner {
        margin-bottom: 0 !important;
        padding: 12px 14px;
    }

    .aim-r .lunchbox-plan-banner .a-banner-title {
        margin-bottom: 3px;
        font-size: 13.5px;
        line-height: 1.25;
    }

    .aim-r .lunchbox-plan-banner .a-banner-body {
        font-size: 12.5px;
        line-height: 1.35;
    }

    .aim-r .lunchbox-packed,
    .aim-r .lunchbox-people {
        padding: 14px;
    }

    .aim-r .lunchbox-packed {
        gap: 12px;
    }

    .aim-r .lunchbox-packed-head {
        align-items: center !important;
        gap: 8px !important;
    }

    .aim-r .lunchbox-packed .a-fieldset-title,
    .aim-r .lunchbox-people .a-fieldset-title {
        font-size: 20px;
        line-height: 1.05;
    }

    .aim-r .lunchbox-packed .a-fieldset-sub,
    .aim-r .lunchbox-people .a-fieldset-sub {
        margin-top: 3px;
        font-size: 12px;
        line-height: 1.35;
    }

    .aim-r .lunchbox-packed .btn-pill {
        padding: 9px 14px;
        font-size: 12.5px;
    }

    .aim-r .lunchbox-empty-banner {
        margin-top: 0 !important;
        padding: 10px 12px;
    }

    .aim-r .lunchbox-empty-banner .a-banner-body {
        font-size: 12.5px;
        line-height: 1.35;
    }
}

/* ── Accordion (categories) ───────────────────────────────────────── */
.aim-r .a-acc {
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    overflow: hidden;
}
.aim-r .a-acc + .a-acc { margin-top: 10px; }
.aim-r .a-acc-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 14px 16px; background: transparent; border: 0; width: 100%;
    color: var(--aim-ink); font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; text-align: left;
}
.aim-r .a-acc-head:hover { background: var(--aim-bg-soft); }
.aim-r .a-acc-head .chev { transition: transform .15s ease; flex-shrink: 0; color: var(--aim-ink-soft); }
.aim-r .a-acc-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.aim-r .a-acc-body { padding: 0 16px 14px; display: none; }
.aim-r .a-acc.open .a-acc-body,
.aim-r .a-acc-head[aria-expanded="true"] + .a-acc-body { display: block; }

/* ── Progress bar ─────────────────────────────────────────────────── */
.aim-r .a-progress {
    height: 6px; border-radius: 99px; background: var(--aim-line-soft); overflow: hidden;
}
.aim-r .a-progress-fill {
    height: 100%; background: var(--aim-ink); border-radius: 99px; transition: width .25s ease;
}
.aim-r .a-progress-fill.done    { background: #3F6244; }
.aim-r .a-progress-fill.warn    { background: var(--aim-accent); }
.aim-r .a-progress-fill.danger  { background: var(--aim-danger); }

/* ── Settings sticky nav (Profile-style) ──────────────────────────── */
.aim-r .a-stickynav {
    position: sticky; top: var(--aim-mob-top-h); z-index: 5;
    background: var(--aim-bg);
    margin: 0 -16px; padding: 8px 16px;
    border-bottom: 1px solid var(--aim-line-soft);
    overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none;
}
.aim-r .a-stickynav::-webkit-scrollbar { display: none; }
.aim-r .a-stickynav-row { display: inline-flex; gap: 4px; }
.aim-r .a-stickynav a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 99px;
    font-size: 12.5px; font-weight: 500; color: var(--aim-ink-soft); text-decoration: none;
    background: transparent; border: 1px solid transparent; white-space: nowrap;
}
.aim-r .a-stickynav a:hover  { color: var(--aim-ink); text-decoration: none; }
.aim-r .a-stickynav a.active {
    color: var(--aim-ink); background: var(--aim-bg-card); border-color: var(--aim-line);
}

/* ── Save bar (floating bottom) ───────────────────────────────────── */
.aim-r .a-savebar {
    position: fixed; left: 16px; right: 16px;
    bottom: calc(var(--aim-mob-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    background: var(--aim-ink); color: #fff;
    border-radius: 14px; padding: 12px 16px; z-index: 30;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    box-shadow: 0 12px 32px rgba(42,74,58,0.25);
    transform: translateY(120%); opacity: 0; transition: transform .25s ease, opacity .25s ease;
}
.aim-r .a-savebar.visible { transform: translateY(0); opacity: 1; }
.aim-r .a-savebar .btn-pill { background: #fff; color: var(--aim-ink); border-color: #fff; padding: 9px 18px; font-size: 13px; }
.aim-r .a-savebar .btn-pill-ghost { background: transparent; color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.5); }

/* ── Chat ─────────────────────────────────────────────────────────── */
.aim-r .ai-chat-page {
    height: calc(100vh - var(--aim-mob-top-h) - var(--aim-mob-nav-h) - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - var(--aim-mob-top-h) - var(--aim-mob-nav-h) - env(safe-area-inset-bottom, 0px));
    overflow: hidden;
    box-sizing: border-box;
}
.aim-r .ai-chat-page .a-pagehead,
.aim-r .ai-chat-page .a-chat-composer,
.aim-r .ai-chat-page .a-chat-disclaimer {
    flex-shrink: 0;
}
.aim-r .a-chat {
    display: flex; flex-direction: column;
    min-height: calc(100vh - var(--aim-mob-top-h) - var(--aim-mob-nav-h) - 80px);
    gap: 12px;
}
.aim-r .ai-chat-page .a-chat {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.aim-r .a-chat-stream {
    flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 4px 0 12px;
}
.aim-r .ai-chat-page .a-chat-stream {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.aim-r .a-chat-msg {
    max-width: 86%; padding: 12px 14px; border-radius: 16px;
    font-size: 14px; line-height: 1.5; color: var(--aim-ink);
    background: var(--aim-bg-card); border: 1px solid var(--aim-line);
    word-wrap: break-word; overflow-wrap: break-word;
}
.aim-r .a-chat-msg.me {
    align-self: flex-end; background: var(--aim-ink); color: #fff; border-color: var(--aim-ink);
    border-bottom-right-radius: 6px;
}
.aim-r .a-chat-msg.you { align-self: flex-start; border-bottom-left-radius: 6px; }
.aim-r .a-chat-msg p:first-child { margin-top: 0; }
.aim-r .a-chat-msg p:last-child  { margin-bottom: 0; }
.aim-r .a-chat-msg h1,
.aim-r .a-chat-msg h2,
.aim-r .a-chat-msg h3,
.aim-r .a-chat-msg h4 {
    margin: 10px 0 6px;
    font-family: var(--aim-serif);
    font-weight: 400;
    line-height: 1.15;
    color: inherit;
}
.aim-r .a-chat-msg h1 { font-size: 22px; }
.aim-r .a-chat-msg h2 { font-size: 19px; }
.aim-r .a-chat-msg h3 { font-size: 17px; }
.aim-r .a-chat-msg h4 { font-size: 15px; }
.aim-r .a-chat-msg p,
.aim-r .a-chat-msg ul,
.aim-r .a-chat-msg ol,
.aim-r .a-chat-msg blockquote,
.aim-r .a-chat-msg pre,
.aim-r .a-chat-msg table {
    margin: 8px 0;
}
.aim-r .a-chat-msg ul,
.aim-r .a-chat-msg ol {
    padding-left: 20px;
}
.aim-r .a-chat-msg li + li {
    margin-top: 3px;
}
.aim-r .a-chat-msg a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.aim-r .a-chat-msg code {
    padding: 1px 5px;
    border-radius: 6px;
    background: var(--aim-bg-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
}
.aim-r .a-chat-msg pre {
    overflow-x: auto;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--aim-bg-soft);
}
.aim-r .a-chat-msg pre code {
    padding: 0;
    background: transparent;
}
.aim-r .a-chat-msg blockquote {
    padding-left: 12px;
    border-left: 3px solid var(--aim-line);
    color: var(--aim-ink-soft);
}
.aim-r .a-chat-msg table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.aim-r .a-chat-msg th,
.aim-r .a-chat-msg td {
    padding: 6px 8px;
    border: 1px solid var(--aim-line);
    text-align: left;
    vertical-align: top;
}
.aim-r .a-chat-msg.me code,
.aim-r .a-chat-msg.me pre {
    background: rgba(255,255,255,0.14);
}
.aim-r .a-chat-msg.me blockquote,
.aim-r .a-chat-msg.me th,
.aim-r .a-chat-msg.me td {
    border-color: rgba(255,255,255,0.24);
}
.aim-r .a-chat-typing {
    align-self: flex-start; padding: 12px 14px; border-radius: 16px; border-bottom-left-radius: 6px;
    background: var(--aim-bg-card); border: 1px solid var(--aim-line);
    display: inline-flex; gap: 4px; align-items: center;
}
.aim-r .a-chat-typing span {
    width: 6px; height: 6px; border-radius: 99px; background: var(--aim-ink-soft);
    animation: aim-chat-blink 1.2s infinite;
}
.aim-r .a-chat-typing span:nth-child(2) { animation-delay: .15s; }
.aim-r .a-chat-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes aim-chat-blink { 0%,80%,100%{opacity:.3} 40%{opacity:1} }

.aim-r .a-chat-suggest {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--aim-tint);
    border: 1px solid var(--aim-line);
    display: flex; gap: 12px; align-items: center; justify-content: space-between;
    flex-wrap: wrap;
}
.aim-r .a-chat-suggest-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aim-r .a-chat-suggest-title { font-size: 13.5px; color: var(--aim-ink); }
.aim-r .a-chat-suggest-meta { font-size: 12px; color: var(--aim-ink-soft); }
.aim-r .a-chat-suggest-meta a { color: var(--aim-ink); font-weight: 600; text-decoration: none; }
.aim-r .a-chat-suggest-actions { display: flex; gap: 8px; }
.aim-r .a-chat-apply {
    border: 0; border-radius: 999px; padding: 8px 16px;
    background: var(--aim-ink); color: #fff; font-size: 13px; font-weight: 600;
    cursor: pointer;
}
.aim-r .a-chat-apply:disabled { opacity: .6; cursor: default; }
.aim-r .a-chat-suggest.applied { background: var(--aim-bg-card); }
.aim-r .a-chat-suggest-error { width: 100%; font-size: 12px; color: #b00020; margin-top: 4px; }

.aim-r .a-chat-composer {
    position: sticky;
    bottom: calc(var(--aim-mob-nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
    display: flex; gap: 8px; align-items: flex-end;
    padding: 12px; background: var(--aim-bg-card);
    border: 1px solid var(--aim-line); border-radius: 16px;
    box-shadow: 0 12px 32px rgba(42,74,58,0.10);
}
.aim-r .ai-chat-page .a-chat-composer {
    position: relative;
    bottom: auto;
    margin-bottom: 8px;
}
.aim-r .a-chat-composer textarea {
    flex: 1; border: 0; outline: 0; resize: none;
    font-family: var(--aim-sans); font-size: 14px; line-height: 1.5;
    color: var(--aim-ink); background: transparent;
    min-height: 56px; max-height: 220px; padding: 8px;
}
.aim-r .a-chat-composer .send {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 99px; border: 0;
    background: var(--aim-ink); color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.aim-r .a-chat-composer .send:disabled { opacity: 0.35; cursor: not-allowed; }
.aim-r .a-chat-disclaimer { font-size: 11px; color: var(--aim-ink-soft); text-align: center; padding: 0 8px; }

/* ── Auth pages (centred card on cream backdrop) ─────────────────── */
.aim-r .a-auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px 16px; background: var(--aim-bg-soft);
}
.aim-r .a-auth-card {
    width: 100%; max-width: 440px;
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 18px;
    padding: 28px 22px; display: flex; flex-direction: column; gap: 18px;
}
.aim-r .a-auth-card.wide { max-width: 720px; }
.aim-r .a-auth-head { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.aim-r .a-auth-head h1 {
    font-family: var(--aim-serif); font-size: 32px; line-height: 1.05; margin: 0; color: var(--aim-ink);
    font-weight: 400;
}
.aim-r .a-auth-head p { font-size: 13.5px; color: var(--aim-ink-soft); margin: 0; line-height: 1.5; }
.aim-r .a-auth-foot { text-align: center; font-size: 13px; color: var(--aim-ink-soft); }
.aim-r .a-auth-foot a { color: var(--aim-ink); font-weight: 500; }

/* ── Stats strip variants (1, 2, 3, 4 columns) ───────────────────── */
.aim-r .a-stats {
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    padding: 14px 4px; display: grid;
}
.aim-r .a-stats.cols-2 { grid-template-columns: repeat(2, 1fr); }
.aim-r .a-stats.cols-3 { grid-template-columns: repeat(3, 1fr); }
.aim-r .a-stats.cols-4 { grid-template-columns: repeat(4, 1fr); }
.aim-r .a-stat        { text-align: center; padding: 4px 8px; }
.aim-r .a-stat + .a-stat { border-left: 1px solid var(--aim-line-soft); }
.aim-r .a-stat-num    { font-family: var(--aim-serif); font-size: 24px; line-height: 1; color: var(--aim-ink); }
.aim-r .a-stat-num small { font-family: var(--aim-sans); font-size: 12px; color: var(--aim-ink-soft); margin-left: 2px; }
.aim-r .a-stat-lbl    { font-size: 10px; color: var(--aim-ink-soft); margin-top: 5px;
                        font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

/* ── Avatar helper ────────────────────────────────────────────────── */
.aim-r .a-av {
    width: 36px; height: 36px; border-radius: 99px; flex-shrink: 0;
    background: var(--aim-ink); color: #fff; font-weight: 600; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    background-size: cover; background-position: center;
}
.aim-r .a-av.lg { width: 64px; height: 64px; font-size: 22px; }
.aim-r .a-av.xl { width: 96px; height: 96px; font-size: 32px; }

/* ── Legacy in-aim-r overrides ───────────────────────────────────────
   These let pages wrapped in .aim-r restyle naturally even when their
   markup still uses old .btn-primary / .badge / .card / .text-muted etc.,
   so the conversion does not have to touch every legacy class. */

/* Buttons */
.aim-r .btn,
.aim-r .btn-primary,
.aim-r .btn-accent,
.aim-r .btn-secondary,
.aim-r .btn-outline,
.aim-r .btn-ghost,
.aim-r .btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: 999px;
    font-family: var(--aim-sans); font-size: 14px; font-weight: 500; line-height: 1.2;
    border: 1px solid var(--aim-ink); background: var(--aim-ink); color: var(--aim-bg);
    cursor: pointer; text-decoration: none;
    transition: opacity .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
    box-shadow: none;
}
.aim-r .btn:hover,
.aim-r .btn-primary:hover,
.aim-r .btn-accent:hover { opacity: 0.92; color: var(--aim-bg); text-decoration: none; }
.aim-r .btn-secondary,
.aim-r .btn-outline,
.aim-r .btn-ghost {
    background: transparent; color: var(--aim-ink); border-color: var(--aim-ink);
}
.aim-r .btn-secondary:hover,
.aim-r .btn-outline:hover,
.aim-r .btn-ghost:hover { background: var(--aim-ink); color: var(--aim-bg); text-decoration: none; }
.aim-r .btn-danger { background: var(--aim-danger); border-color: var(--aim-danger); color: #fff; }
.aim-r .btn-danger:hover { color: #fff; opacity: 0.92; }
.aim-r .btn-sm { padding: 8px 14px; font-size: 12.5px; }
.aim-r .btn-lg { padding: 14px 26px; font-size: 15px; }
.aim-r .btn:disabled,
.aim-r .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cards */
.aim-r .card,
.aim-r .auth-card,
.aim-r .pf-card,
.aim-r .review-card,
.aim-r .program-card,
.aim-r .assignment-card,
.aim-r .recommendation-card,
.aim-r .education-card,
.aim-r .history-card,
.aim-r .learn-card,
.aim-r .article-callout {
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line); border-radius: 14px;
    box-shadow: none; padding: 18px;
    -webkit-backdrop-filter: none; backdrop-filter: none;
}
.aim-r .card:hover { box-shadow: none; }
.aim-r .stat-card {
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    padding: 18px;
}

/* Badges (legacy) → chip style */
.aim-r .badge,
.aim-r .badge-success,
.aim-r .badge-goal,
.aim-r .badge-condition,
.aim-r .badge-lunchbox,
.aim-r .badge-dietary-pattern {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    background: var(--aim-bg-soft); color: var(--aim-ink);
    font-size: 11.5px; font-weight: 500; line-height: 1.4;
    border: 1px solid var(--aim-line);
}
.aim-r .badge-success    { background: rgba(122,144,114,0.15); color: #3F6244; border-color: transparent; }
.aim-r .badge-goal       { background: var(--aim-tint); border-color: transparent; }
.aim-r .badge-condition  { background: var(--aim-accent-soft); color: var(--aim-ink); border-color: transparent; }
.aim-r .badge-lunchbox   { background: #dce9f2; color: #2a4a63; border-color: transparent; }
.aim-r .badge-dietary-pattern { background: var(--aim-tint); border-color: transparent; }

/* Form group + hint */
.aim-r .form-group { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; }
.aim-r .form-group > label,
.aim-r .form-label { font-size: 13px; font-weight: 600; color: var(--aim-ink); }
.aim-r .form-hint  { font-size: 12px; color: var(--aim-ink-soft); line-height: 1.45; }

/* Text helpers */
.aim-r .text-muted,
.aim-r .text-secondary { color: var(--aim-ink-soft); }
.aim-r .text-danger    { color: var(--aim-danger); }

/* Page header (legacy h1 + p combo) → looks like .a-pagehead */
.aim-r .page-header,
.aim-r .page-hero {
    padding-top: 10px; display: flex; flex-direction: column; gap: 8px;
    background: transparent; border: 0; box-shadow: none;
}
.aim-r .page-header h1,
.aim-r .page-hero h1 {
    font-family: var(--aim-serif); font-size: 32px; line-height: 1.02;
    letter-spacing: -0.01em; margin: 0; color: var(--aim-ink); font-weight: 400;
}
.aim-r .page-header p,
.aim-r .page-hero p { font-size: 14px; color: var(--aim-ink-2); margin: 0; line-height: 1.55; max-width: 640px; }

/* Article pages (Privacy/Terms/Learn) typography */
.aim-r .article-page,
.aim-r .article-body { font-size: 14.5px; line-height: 1.65; color: var(--aim-ink-2); }
.aim-r .article-page h1,
.aim-r .article-header h1 { font-family: var(--aim-serif); color: var(--aim-ink); font-weight: 400;
                            letter-spacing: -0.01em; line-height: 1.05; font-size: 36px; margin: 0; }
.aim-r .article-page h2,
.aim-r .article-body h2 { font-family: var(--aim-serif); color: var(--aim-ink); font-weight: 400;
                          margin-top: 28px; margin-bottom: 10px; font-size: 24px; line-height: 1.15; }
.aim-r .article-page h3,
.aim-r .article-body h3 { font-family: var(--aim-serif); color: var(--aim-ink); font-weight: 400;
                          margin-top: 20px; margin-bottom: 8px; font-size: 19px; line-height: 1.2; }
.aim-r .article-page a,
.aim-r .article-body a  { color: var(--aim-ink); text-decoration: underline; text-underline-offset: 3px; }
.aim-r .article-callout { background: var(--aim-tint); border: 0; }

/* Anim utilities (used by many old pages) — keep simple fade-up */
.aim-r .anim-fade-up { animation: aim-fade-up .35s ease both; }
.aim-r .anim-d1 { animation-delay: .04s; }
.aim-r .anim-d2 { animation-delay: .08s; }
.aim-r .anim-d3 { animation-delay: .12s; }
.aim-r .anim-d4 { animation-delay: .16s; }
.aim-r .anim-d5 { animation-delay: .20s; }
@keyframes aim-fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Hide legacy .container.page-container padding when inside aim-r since
   our .a-page already provides it; keeps converted pages from getting
   double-indented on screens we restyle but didn't fully rewrite. */
.aim-r.container.page-container,
.aim-r .container.page-container { max-width: 100%; padding: 0; margin: 0; }

/* ── Desktop overrides (≥900px) ──────────────────────────────────── */
@media (min-width: 900px) {
    .aim-r .a-page         { padding: 24px 48px 56px; gap: 24px; max-width: 1200px; margin: 0 auto; }
    .aim-r .a-page-narrow  { padding: 24px 48px 56px; gap: 22px; max-width: 720px; margin: 0 auto; }
    .aim-r .a-page-wide    { padding: 24px 48px 56px; gap: 24px; max-width: 1320px; margin: 0 auto; }

    .aim-r .a-pagehead h1  { font-size: 44px; }
    .aim-r .a-pagehead-row { align-items: center; }

    .aim-r .a-section-head h2,
    .aim-r .a-section-head h3 { font-size: 24px; }

    .aim-r .a-fieldset     { padding: 24px; }
    .aim-r .a-fieldset-title { font-size: 22px; }

    .aim-r .a-form-actions { justify-content: flex-end; }
    .aim-r .a-form-actions.full .btn-pill { flex: 0 0 auto; min-width: 180px; }

    .aim-r .a-field-row    { flex-direction: row; }
    .aim-r .a-field-row > .a-field { flex: 1; }

    .aim-r .a-tile-img     { height: 180px; }
    .aim-r .a-tile-title   { font-size: 19px; }

    .aim-r .a-empty        { padding: 56px 24px; }
    .aim-r .a-empty-title  { font-size: 28px; }

    .aim-r .a-stats.cols-2,
    .aim-r .a-stats.cols-3,
    .aim-r .a-stats.cols-4 { padding: 0; }
    .aim-r .a-stat         { padding: 24px 28px; text-align: left;
                             display: flex; flex-direction: column; gap: 8px; }
    .aim-r .a-stat-num     { font-size: 32px; }
    .aim-r .a-stat-lbl     { font-size: 11px; }

    .aim-r .a-stickynav    { top: 0; margin: 0 -48px; padding: 12px 48px; }
    .aim-r .a-savebar      { left: var(--aim-side-w); right: 0; bottom: 16px;
                             margin: 0 24px; max-width: 1200px;
                             padding: 14px 22px; }

    .aim-r .a-auth-card    { padding: 36px 32px; }
    .aim-r .a-auth-head h1 { font-size: 36px; }

    .aim-r .a-chat         { min-height: calc(100vh - 120px); }
    .aim-r .ai-chat-page   { height: calc(100vh - 48px); height: calc(100dvh - 48px); }

    .aim-r .article-page h1,
    .aim-r .article-header h1 { font-size: 52px; }
    .aim-r .article-page h2,
    .aim-r .article-body h2  { font-size: 28px; margin-top: 40px; }
}

/* ── Dashboard timeline handoff ─────────────────────────────────────────── */
.aim-r .dash-tl-page {
    padding: 14px 16px 28px;
}
.aim-r .dash-tl-grid {
    display: grid;
    gap: 22px;
}
.aim-r .dash-tl-primary,
.aim-r .dash-tl-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.aim-r .dash-tl-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.aim-r .dash-tl-head h1 {
    margin: 0;
    font-family: var(--aim-serif);
    font-size: 30px;
    line-height: 1.05;
    letter-spacing: -0.01em;
    font-weight: 400;
}
.aim-r .dash-tl-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.aim-r .dash-tl-head-row .mp-icon-btn { align-self: flex-start; }

/* Day instructions modal — AIM look on top of the shared swap-modal shell */
.aim-r .dash-tl-instr-modal { background: rgba(43, 46, 37, 0.45); }
.aim-r .dash-tl-instr-modal .swap-modal {
    background: var(--aim-bg, #FBF8F1);
    border: 1px solid var(--aim-line);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(43, 46, 37, 0.18);
    overflow: hidden;
}
.aim-r .dash-tl-instr-modal .swap-modal-header {
    background: var(--aim-bg-soft);
    border-bottom: 1px solid var(--aim-line);
    padding: 16px 20px;
}
.aim-r .dash-tl-instr-modal .swap-modal-header h3 {
    font-family: var(--aim-serif);
    font-weight: 400;
    color: var(--aim-ink);
    font-size: 20px;
    margin: 0;
}
.aim-r .dash-tl-instr-modal .swap-modal-body { padding: 20px; }
.dash-tl-instr-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.aim-r .dash-tl-instr-modal .dash-tl-instr-actions .mp-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    color: var(--aim-ink);
    background: transparent;
    border: none;
}
.aim-r .dash-tl-instr-modal .dash-tl-instr-actions .mp-icon-btn:hover {
    background: var(--aim-line-soft);
    color: var(--aim-ink);
}
.aim-r .dash-tl-instr-modal .dash-tl-instr-actions .mp-icon-btn svg {
    width: 18px;
    height: 18px;
}

/* Swap picker modal — dashboard timeline styling */
.aim-r .dash-tl-swap-modal {
    background: rgba(43, 46, 37, 0.45);
    backdrop-filter: blur(8px);
}
.aim-r .dash-tl-swap-modal .swap-modal {
    max-width: 560px;
    background: var(--aim-bg, #FBF8F1);
    border: 1px solid var(--aim-line);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(43, 46, 37, 0.18);
}
.aim-r .dash-tl-swap-modal .swap-modal-header {
    background: var(--aim-bg-soft);
    border-bottom: 1px solid var(--aim-line);
    padding: 16px 20px;
}
.aim-r .dash-tl-swap-modal .swap-modal-header h3 {
    margin: 0;
    font-family: var(--aim-serif);
    font-size: 22px;
    line-height: 1.15;
    font-weight: 400;
    color: var(--aim-ink);
}
.aim-r .dash-tl-swap-modal #swap-modal-close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--aim-line);
    border-radius: 999px;
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    box-shadow: none;
}
.aim-r .dash-tl-swap-modal #swap-modal-close:hover {
    border-color: var(--aim-ink-soft);
    background: var(--aim-bg);
}
.aim-r .dash-tl-swap-modal .swap-modal-body {
    padding: 18px;
    background: var(--aim-bg);
}
.aim-r .dash-tl-swap-modal .swap-tabs {
    display: flex;
    gap: 4px;
    margin: 0 0 16px;
    padding: 4px;
    border: 0;
    border-radius: 999px;
    background: var(--aim-bg-soft);
    overflow-x: auto;
}
.aim-r .dash-tl-swap-modal .swap-tab {
    flex: 1 0 auto;
    min-height: 36px;
    padding: 8px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--aim-ink);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
}
.aim-r .dash-tl-swap-modal .swap-tab:hover {
    background: rgba(255,255,255,0.55);
}
.aim-r .dash-tl-swap-modal .swap-tab.active {
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    border-bottom-color: transparent;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    font-weight: 600;
}
.aim-r .dash-tl-swap-modal .swap-options {
    gap: 10px;
}
.aim-r .dash-tl-swap-modal .swap-option {
    display: block;
    width: 100%;
    padding: 14px;
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    box-shadow: none;
    text-align: left;
}
.aim-r .dash-tl-swap-modal .swap-option:hover {
    background: var(--aim-bg-soft);
    border-color: var(--aim-accent);
    box-shadow: none;
}
.aim-r .dash-tl-swap-modal .swap-option-name {
    margin: 0 0 4px;
    font-family: var(--aim-serif);
    font-size: 17px;
    line-height: 1.2;
    font-weight: 400;
    color: var(--aim-ink);
}
.aim-r .dash-tl-swap-modal .swap-option-meta {
    font-size: 12px;
    line-height: 1.45;
    color: var(--aim-ink-soft);
}
.aim-r .dash-tl-swap-modal .swap-empty,
.aim-r .dash-tl-swap-modal .swap-loading,
.aim-r .dash-tl-swap-modal .build-meal-hint {
    color: var(--aim-ink-soft);
    font-size: 13px;
    line-height: 1.5;
}
.aim-r .dash-tl-swap-modal .build-meal {
    padding: 4px 0 0;
}
.aim-r .dash-tl-swap-modal .build-meal-label {
    color: var(--aim-ink);
    font-size: 12px;
    font-weight: 600;
}
.aim-r .dash-tl-swap-modal .form-control {
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    font-family: inherit;
}
.aim-r .dash-tl-swap-modal .form-control:focus {
    border-color: var(--aim-ink-soft);
    box-shadow: 0 0 0 3px rgba(122,144,114,0.15);
}
.aim-r .dash-tl-swap-modal #build-generate-btn {
    min-height: 38px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--aim-ink);
    background: var(--aim-ink);
    color: var(--aim-bg);
    font-size: 12.5px;
    font-weight: 500;
}
.aim-r .dash-tl-swap-modal .ai-suggestion {
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
}
.aim-r .dash-tl-swap-modal .ai-suggestion-name {
    font-family: var(--aim-serif);
    font-weight: 400;
    color: var(--aim-ink);
}
.aim-r .dash-tl-swap-modal .ai-suggestion-meta,
.aim-r .dash-tl-swap-modal .ai-suggestion-section strong,
.aim-r .dash-tl-swap-modal .ai-suggestion-target {
    color: var(--aim-ink-soft);
}
@media (max-width: 640px) {
    .aim-r .dash-tl-swap-modal {
        align-items: flex-start;
        padding-top: calc(var(--aim-mob-top-h, 74px) + 10px);
        padding-bottom: calc(var(--aim-mob-nav-h, 72px) + env(safe-area-inset-bottom, 0px) + 12px);
    }
    .aim-r .dash-tl-swap-modal .swap-modal {
        max-height: calc(100dvh - var(--aim-mob-top-h, 74px) - var(--aim-mob-nav-h, 72px) - env(safe-area-inset-bottom, 0px) - 22px);
        margin: 0;
    }
}
.aim-r .dash-tl-progress {
    display: flex;
    gap: 4px;
}
.aim-r .dash-tl-progress .s {
    flex: 1;
    height: 7px;
    border-radius: 999px;
    background: var(--aim-line-soft);
}
.aim-r .dash-tl-progress .s.done { background: var(--aim-ink); }
.aim-r .dash-tl-progress .s.active {
    background: var(--aim-bg-card);
    border: 1.5px solid var(--aim-ink);
}
.aim-r .dash-tl-flow {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-left: 28px;
}
.aim-r .dash-tl-rail {
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--aim-line);
}
.aim-r .dash-tl-item {
    position: relative;
}
.aim-r .dash-tl-item.menu-open {
    z-index: 80;
}
.aim-r .dash-tl-dot {
    position: absolute;
    left: -28px;
    top: 12px;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--aim-bg-card);
    border: 2px solid var(--aim-ink-mute);
}
.aim-r .dash-tl-item.is-done .dash-tl-dot {
    background: var(--aim-ink);
    border-color: var(--aim-ink);
}
.aim-r .dash-tl-item.is-now .dash-tl-dot {
    background: var(--aim-accent);
    border-color: var(--aim-accent);
    box-shadow: 0 0 0 4px rgba(217,160,91,0.2);
}
.aim-r .dash-tl-item-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}
.aim-r .dash-tl-item.is-now .dash-tl-item-top .label {
    color: var(--aim-accent);
}
.aim-r .dash-tl-status {
    font-size: 11px;
    color: var(--aim-ink-soft);
}
/* Lunchbox badge beside the lunch row — amber, matching the lunchbox strips
   used across the meal-plan calendar. margin-right:auto keeps it next to the
   label and pushes any status ("Logged") to the far right. */
.aim-r .dash-tl-lb-badge {
    margin-right: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    background: #f0c75a;
    color: #3d2f10;
    border: 1px solid #e6b94a;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
}
.aim-r .dash-tl-lb-badge:hover {
    background: #ecbf45;
}

/* Blue lunchbox: opens a popover listing the day's packed lunchboxes. Lives in
   the dashboard header (next to the day-instructions button) so it shows even
   on days with no household lunch slot — e.g. a family where everyone packs. */
.aim-r .dash-tl-head-actions { display: inline-flex; align-items: center; gap: 8px; }
.aim-r .dash-tl-head-actions .mp-icon-btn { align-self: center; }
.aim-r .dash-tl-lb {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.aim-r .dash-tl-lb > summary { list-style: none; }
.aim-r .dash-tl-lb > summary::-webkit-details-marker { display: none; }
.aim-r .dash-tl-lb-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e7f0ff;
    color: #1d4ed8;
    border: 1px solid #bcd4ff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}
.aim-r .dash-tl-lb-toggle:hover { background: #d8e6ff; }
.aim-r .dash-tl-lb[open] .dash-tl-lb-toggle {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}
.aim-r .dash-tl-lb-ico { width: 14px; height: 14px; flex: 0 0 auto; }
.aim-r .dash-tl-lb-count { font-size: 10.5px; font-weight: 700; }
.aim-r .dash-tl-item.lb-open { z-index: 80; }
.aim-r .dash-tl-lb-pop {
    position: absolute;
    z-index: 90;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    min-width: 210px;
    max-width: 280px;
    padding: 8px;
    background: var(--aim-bg-card, #fff);
    border: 1px solid var(--aim-line, #e3e3da);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(43, 46, 37, 0.16);
}
.aim-r .dash-tl-lb-pop-head {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--aim-ink-soft, #8a8e7b);
    padding: 2px 6px 6px;
}
.aim-r .dash-tl-lb-entry {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 6px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}
.aim-r .dash-tl-lb-entry:hover { background: #f1f5ff; }
.aim-r .dash-tl-lb-who { font-size: 11px; font-weight: 700; color: #1d4ed8; }
.aim-r .dash-tl-lb-what {
    font-size: 13px;
    font-weight: 600;
    color: var(--aim-ink, #2b2e25);
    line-height: 1.25;
}
.aim-r .dash-tl-lb-all {
    display: block;
    margin-top: 4px;
    padding: 6px;
    border-top: 1px solid var(--aim-line, #eee);
    font-size: 11px;
    font-weight: 700;
    color: #1d4ed8;
    text-decoration: none;
}
.aim-r .dash-tl-lb-all:hover { text-decoration: underline; }
.aim-r .dash-tl-card {
    margin-top: 8px;
    padding: 14px;
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
    display: grid;
    grid-template-columns: 1fr 60px;
    gap: 12px;
    align-items: start;
}
.aim-r .dash-tl-card-no-thumb {
    grid-template-columns: 1fr;
}
.aim-r .dash-tl-log-form { display: none; }
.aim-r .dash-tl-item.is-now .dash-tl-card { border-color: var(--aim-accent); }
.aim-r .dash-tl-item.is-done:not(.menu-open) .dash-tl-card { opacity: 0.62; }
.aim-r .dash-tl-card-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.aim-r .dash-tl-card h2 {
    margin: 0;
    font-family: var(--aim-serif);
    font-size: 17px;
    line-height: 1.2;
    font-weight: 400;
}
.aim-r .dash-tl-card p {
    margin: 0;
    font-size: 12px;
    color: var(--aim-ink-soft);
    line-height: 1.45;
}
.aim-r .dash-tl-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px 6px;
    min-width: 0;
}
.aim-r .dash-tl-meta-text {
    color: var(--aim-ink-soft);
    font-size: 12px;
    line-height: 1.45;
}
.aim-r .dash-tl-tag {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 20px;
    padding: 2px 7px;
    border: 1px solid var(--aim-line);
    border-radius: 999px;
    background: var(--aim-bg-soft);
    color: var(--aim-ink);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
.aim-r .dash-tl-thumb {
    width: 60px;
    min-height: 60px;
    border-radius: 10px;
    background: var(--aim-bg-soft);
    background-size: cover;
    background-position: center;
}
.aim-r .dash-tl-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.aim-r .dash-tl-btn,
.aim-r .dash-tl-btn:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--aim-ink);
    background: transparent;
    color: var(--aim-ink);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
}
.aim-r .dash-tl-btn-primary,
.aim-r .dash-tl-btn-primary:visited {
    background: var(--aim-ink);
    color: var(--aim-bg);
}
.aim-r .dash-tl-btn:hover,
.aim-r .dash-tl-btn-primary:hover,
.aim-r .dash-tl-btn-ghost:hover,
.aim-r .dash-tl-btn-icon:hover {
    text-decoration: none;
    opacity: 0.94;
}
.aim-r .dash-tl-btn-icon {
    width: 38px;
    padding: 0;
}
.aim-r .dash-tl-menu {
    position: relative;
    z-index: 1;
}
.aim-r .dash-tl-menu[open] { z-index: 90; }
.aim-r .dash-tl-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-height: 38px;
    border-radius: 999px;
    border: 1px solid var(--aim-line);
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    list-style: none;
}
.aim-r .dash-tl-menu-toggle::-webkit-details-marker {
    display: none;
}
.aim-r .dash-tl-menu-toggle:hover,
.aim-r .dash-tl-menu[open] .dash-tl-menu-toggle {
    border-color: var(--aim-ink-soft);
    text-decoration: none;
}
.aim-r .dash-tl-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 100;
    min-width: 148px;
    padding: 6px;
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    background: var(--aim-bg-card);
    box-shadow: 0 14px 36px rgba(42, 35, 29, 0.14);
}
.aim-r .dash-tl-menu.open-up .dash-tl-menu-panel {
    top: auto;
    bottom: calc(100% + 6px);
}
@media (max-width: 899px) {
    .aim-r .dash-tl-menu-panel {
        top: auto;
        bottom: calc(100% + 6px);
    }
}
.aim-r .dash-tl-menu-form {
    margin: 0;
}
.aim-r .dash-tl-menu-item,
.aim-r .dash-tl-menu-item:visited {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 34px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--aim-ink);
    font: inherit;
    font-size: 12.5px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.aim-r .dash-tl-menu-item:hover {
    background: var(--aim-bg-soft);
    color: var(--aim-ink);
    text-decoration: none;
}
.aim-r .dash-tl-menu-item-danger {
    color: #8b2f24;
}
.aim-r .dash-tl-empty,
.aim-r .dash-tl-side-card {
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 18px;
    padding: 20px 18px;
}
.aim-r .dash-tl-empty {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}
.aim-r .dash-tl-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.aim-r .dash-tl-expired-actions {
    width: 100%;
    flex-wrap: nowrap;
    gap: 6px;
}
.aim-r .dash-tl-expired-actions form {
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
}
.aim-r .dash-tl-expired-actions > .dash-tl-btn,
.aim-r .dash-tl-expired-actions form .dash-tl-btn {
    flex: 1 1 0;
    min-width: 0;
    padding-right: 6px;
    padding-left: 6px;
    font-size: 11.5px;
    white-space: nowrap;
}
.aim-r .dash-tl-empty h2,
.aim-r .dash-tl-plan-day {
    margin: 0;
    font-family: var(--aim-serif);
    font-size: 30px;
    line-height: 1;
    font-weight: 400;
}
.aim-r .dash-tl-empty p,
.aim-r .dash-tl-side-meta {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--aim-ink-soft);
}
.aim-r .dash-tl-side-meta {
    margin-top: 12px;
}
.aim-r .dash-tl-plan-row,
.aim-r .dash-tl-side-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.aim-r .dash-tl-plan-of {
    margin-top: 4px;
    font-size: 13px;
    color: var(--aim-ink-soft);
}
.aim-r .dash-tl-plan-pct {
    font-family: var(--aim-serif);
    font-size: 28px;
    line-height: 1;
}
.aim-r .dash-tl-plan-pct span {
    font-family: var(--aim-sans);
    font-size: 13px;
    color: var(--aim-ink-soft);
}
.aim-r .dash-tl-progress-compact {
    margin-top: 14px;
}
.aim-r .dash-tl-side-link {
    margin-top: 16px;
}
.aim-r .dash-tl-side-head a {
    font-size: 12.5px;
    color: var(--aim-ink-soft);
    text-decoration: none;
}
.aim-r .dash-tl-members {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-top: 2px;
}
.aim-r .dash-tl-member {
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    text-decoration: none;
    color: var(--aim-ink);
}
.aim-r .dash-tl-member-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    background: var(--aim-ink);
}
.aim-r .dash-tl-member.is-you .dash-tl-member-avatar {
    box-shadow: 0 0 0 2px var(--aim-bg), 0 0 0 3.5px var(--aim-ink);
}
.aim-r .dash-tl-member-name {
    font-size: 11px;
    font-weight: 600;
}
.aim-r .dash-tl-member-meta {
    font-size: 11px;
    color: var(--aim-ink-soft);
    line-height: 1.25;
}
.aim-r .dash-tl-qa-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}
.aim-r .dash-tl-qa {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 84px;
    padding: 16px 12px;
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 500;
    text-align: center;
}
.aim-r .dash-tl-qa:hover { text-decoration: none; border-color: var(--aim-ink-soft); }
.aim-r .dash-tl-qa-primary,
.aim-r .dash-tl-qa-primary:visited {
    background: var(--aim-ink);
    border-color: var(--aim-ink);
    color: var(--aim-bg);
}
.aim-r .dash-tl-qa.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}
.aim-r .dash-tl-tip {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--aim-tint);
}
.aim-r .dash-tl-tip-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--aim-ink);
    color: #fff;
}
.aim-r .dash-tl-tip-title {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--aim-ink);
}
.aim-r .dash-tl-tip-actions {
    display: flex;
    gap: 14px;
    margin-top: 8px;
}
.aim-r .dash-tl-tip-actions a {
    font-size: 12.5px;
    text-decoration: none;
}
.aim-r .dash-tl-tip-actions a:first-child {
    color: var(--aim-ink);
    font-weight: 600;
}
.aim-r .dash-tl-tip-actions a:last-child {
    color: var(--aim-ink-soft);
}
.aim-r .dash-tl-tip-inline-form {
    display: inline;
    margin: 0;
}
.aim-r .dash-tl-tip-link {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 12.5px;
    color: var(--aim-ink);
    font-weight: 600;
    cursor: pointer;
}
.aim-r .dash-tl-tip-dismiss {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 12.5px;
    color: var(--aim-ink-soft);
    cursor: pointer;
}
.aim-r .dash-tl-tip-top {
    margin-bottom: 20px;
}
.aim-r .dash-tl-desktop-only { display: none; }
@media (min-width: 1024px) {
    .aim-r .dash-tl-page {
        padding: 40px 56px 56px;
    }
    .aim-r .dash-tl-grid {
        grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
        gap: 40px;
    }
    .aim-r .dash-tl-head h1 { font-size: 44px; }
    .aim-r .dash-tl-flow {
        padding-left: 32px;
        gap: 22px;
    }
    .aim-r .dash-tl-rail { left: 7px; }
    .aim-r .dash-tl-side {
        position: sticky;
        top: 40px;
        align-self: start;
    }
    .aim-r .dash-tl-desktop-only { display: block; }
}

/* ── Onboarding handoff ─────────────────────────────────────────────────── */
.aim-r.onb-body {
    background: var(--aim-bg);
}
.aim-r .onb-shell {
    min-height: 100vh;
    background: var(--aim-bg);
}
.aim-r .onb-story {
    display: none;
}
.aim-r .onb-story-panel,
.aim-r .onb-mobile-hero {
    position: relative;
    background-size: cover;
    background-position: center;
}
.aim-r .onb-mobile-hero {
    display: none;
    height: 320px;
}
.aim-r .onb-mobile-hero.active {
    display: block;
}
.aim-r .onb-mobile-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(42,74,58,0.25) 0%, rgba(42,74,58,0) 35%, rgba(255,254,251,0.85) 88%, var(--aim-bg) 100%);
}
.aim-r .onb-mobile-top {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
}
.aim-r .onb-brand,
.aim-r .onb-brand:visited {
    font-family: var(--aim-serif);
    font-size: 30px;
    line-height: 1;
    color: var(--aim-ink);
    text-decoration: none;
}
.aim-r .onb-brand-light,
.aim-r .onb-brand-light:visited {
    color: #fff;
}
.aim-r .onb-glass-link,
.aim-r .onb-glass-link:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}
.aim-r .onb-main {
    position: relative;
}
.aim-r .onb-card {
    position: relative;
    z-index: 1;
    margin: -120px 16px 24px;
    padding: 24px 22px 26px;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(42,74,58,0.10);
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.aim-r .onb-header,
.aim-r .onb-actions,
.aim-r .onb-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.aim-r .onb-header-link,
.aim-r .onb-footer {
    font-size: 12.5px;
    color: var(--aim-ink-soft);
}
.aim-r .onb-header-link a,
.aim-r .onb-footer a {
    color: var(--aim-ink);
    text-decoration: none;
    font-weight: 600;
}
.aim-r .onb-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}
.aim-r .onb-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--aim-line);
    cursor: pointer;
    transition: width .3s ease, background .15s ease;
}
.aim-r .onb-dot.active {
    width: 28px;
    background: var(--aim-ink);
}
.aim-r .onb-dot.visited {
    background: var(--aim-ink);
}
.aim-r .onb-dot.skipped {
    opacity: 0.35;
    cursor: default;
}
.aim-r .onb-step {
    display: none;
    flex-direction: column;
    gap: 12px;
}
.aim-r .onb-step.active { display: flex; }
.aim-r .onb-step h1 {
    margin: 0;
    font-family: var(--aim-serif);
    font-size: 32px;
    line-height: 1.05;
    letter-spacing: -0.01em;
    font-weight: 400;
}
.aim-r .onb-step > p {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--aim-ink-2);
}
.aim-r .onb-step-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 6px;
}
.aim-r .onb-primary-name label,
.aim-r .onb-field label,
.aim-r .onb-surface > label,
.aim-r .onb-member-health > label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--aim-ink-soft);
}
.aim-r .onb-name-input {
    position: relative;
}
.aim-r .onb-email-input {
    position: relative;
}
.aim-r .onb-email-input .form-input {
    padding-right: 46px;
}
.aim-r .onb-email-check-state {
    position: absolute;
    top: calc(50% - 8px);
    right: 14px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: none;
}
.aim-r [data-email-check-status] .onb-email-check-state {
    display: block;
}
.aim-r [data-email-check-status="pending"] .onb-email-check-state {
    border: 2px solid var(--aim-line);
    border-top-color: var(--aim-ink);
    animation: bulk-spin .75s linear infinite;
}
.aim-r [data-email-check-status="valid"] .onb-email-check-state {
    background: var(--aim-accent);
    box-shadow: inset 0 0 0 4px var(--aim-bg-card);
}
.aim-r [data-email-check-status="invalid"] .onb-email-check-state {
    background: #d13438;
    box-shadow: inset 0 0 0 4px var(--aim-bg-card);
}
.aim-r .onb-email-check-message {
    display: block;
    min-height: 16px;
    margin-top: 4px;
    color: var(--aim-ink-soft);
    font-size: 12px;
    line-height: 1.35;
}
.aim-r [data-email-check-status="valid"] ~ .onb-email-check-message {
    color: var(--aim-accent);
}

/* ── Meal plan peek ─────────────────────────────────────────────────────── */
.aim-r .meal-peek-card,
.dash-tl-page .meal-peek-card {
    margin: 18px 0;
    padding: 24px;
    border: 1px solid var(--aim-line, #E6E1D6);
    border-radius: 18px;
    background: var(--aim-bg-card, #FFFEFB);
    box-shadow: 0 16px 40px rgba(42, 74, 58, 0.08);
}
.aim-r .meal-peek-head,
.dash-tl-page .meal-peek-head {
    padding-bottom: 18px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--aim-line, #E6E1D6);
}
.aim-r .meal-peek-head h2,
.dash-tl-page .meal-peek-head h2 {
    margin: 0 0 8px;
    font-family: var(--aim-serif);
    font-size: 28px;
    line-height: 1.1;
    font-weight: 500;
    color: var(--aim-ink, #2A4A3A);
}
.aim-r .meal-peek-head p,
.dash-tl-page .meal-peek-head p {
    max-width: 520px;
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 600;
    color: var(--aim-ink-soft, #6F8475);
}
.aim-r .meal-peek-days,
.dash-tl-page .meal-peek-days {
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.aim-r .meal-peek-day-top,
.dash-tl-page .meal-peek-day-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.aim-r .meal-peek-day-name,
.dash-tl-page .meal-peek-day-name {
    font-family: var(--aim-serif);
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    color: var(--aim-ink, #2A4A3A);
    text-decoration: none;
}
.aim-r a.meal-peek-day-name:hover,
.dash-tl-page a.meal-peek-day-name:hover {
    text-decoration: underline;
}
.aim-r .meal-peek-kcal,
.dash-tl-page .meal-peek-kcal {
    font-size: 13px;
    font-weight: 700;
    color: var(--aim-ink-soft, #6F8475);
}
.aim-r .meal-peek-meals,
.dash-tl-page .meal-peek-meals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.aim-r .meal-peek-meal,
.dash-tl-page .meal-peek-meal {
    display: flex;
    min-width: 0;
    min-height: 156px;
    overflow: hidden;
    flex-direction: column;
    text-decoration: none;
    color: var(--aim-ink-2, #506156);
    border: 1px solid var(--aim-line-soft, #EEE9DD);
    border-radius: 10px;
    background: var(--aim-bg-soft, #F3F0E8);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.aim-r .meal-peek-meal:hover,
.dash-tl-page .meal-peek-meal:hover {
    transform: translateY(-1px);
    border-color: var(--aim-line, #E6E1D6);
    box-shadow: 0 10px 22px rgba(42, 74, 58, 0.12);
}
.aim-r .meal-peek-thumb,
.dash-tl-page .meal-peek-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 1.8 / 1;
    background-position: center;
    background-size: cover;
}
.aim-r .meal-peek-thumb-empty,
.dash-tl-page .meal-peek-thumb-empty {
    background:
        linear-gradient(135deg, rgba(42, 74, 58, 0.08), rgba(217, 160, 91, 0.16)),
        var(--aim-bg-soft, #F3F0E8);
}
.aim-r .meal-peek-meal-body,
.dash-tl-page .meal-peek-meal-body {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px 12px;
}
.aim-r .meal-peek-type,
.dash-tl-page .meal-peek-type {
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    color: var(--aim-ink-soft, #6F8475);
}
.aim-r .meal-peek-name,
.dash-tl-page .meal-peek-name {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.22;
    color: var(--aim-ink-2, #506156);
}
@media (max-width: 760px) {
    .aim-r .meal-peek-card,
    .dash-tl-page .meal-peek-card {
        padding: 18px;
        border-radius: 16px;
    }
    .aim-r .meal-peek-head h2,
    .dash-tl-page .meal-peek-head h2 {
        font-size: 24px;
    }
    .aim-r .meal-peek-meals,
    .dash-tl-page .meal-peek-meals {
        grid-template-columns: repeat(3, minmax(92px, 1fr));
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .aim-r .meal-peek-meal,
    .dash-tl-page .meal-peek-meal {
        min-height: 142px;
    }
    .aim-r .meal-peek-meal-body,
    .dash-tl-page .meal-peek-meal-body {
        padding: 9px 10px 10px;
    }
    .aim-r .meal-peek-name,
    .dash-tl-page .meal-peek-name {
        font-size: 13px;
    }
}
.aim-r .onb-name-field {
    padding: 15px 48px 15px 18px;
    background: var(--aim-bg-soft);
    border: 1.5px solid var(--aim-ink);
    border-radius: 14px;
    font-family: var(--aim-serif);
    font-size: 22px;
}
.aim-r .onb-name-check {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    color: var(--aim-accent);
    opacity: 0;
    transition: opacity .15s ease;
}
.aim-r .onb-name-check.visible { opacity: 1; }
.aim-r .onb-pill {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--aim-tint);
    color: var(--aim-ink-2);
    font-size: 12.5px;
    line-height: 1.5;
}
.aim-r .onb-field-grid {
    display: grid;
    gap: 12px;
}
.aim-r .onb-field-grid.cols-2 { grid-template-columns: 1fr; }
.aim-r .onb-field-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.aim-r .onb-health-journey-field {
    margin-top: 12px;
}
.aim-r .onb-goal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.aim-r .onb-goal-card,
.aim-r .onb-goal-other {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1.5px solid var(--aim-line);
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    text-align: left;
    cursor: pointer;
}
.aim-r .onb-goal-card.selected,
.aim-r .onb-goal-other.selected {
    border-color: var(--aim-ink);
    background: var(--aim-tint);
    box-shadow: 0 4px 18px rgba(42,74,58,0.08);
}
.aim-r .onb-goal-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--aim-bg-soft);
}
.aim-r .onb-goal-card.selected .onb-goal-icon,
.aim-r .onb-goal-other.selected span:first-child {
    background: var(--aim-ink);
    color: #fff;
}
.aim-r .onb-goal-card strong,
.aim-r .onb-goal-other {
    font-family: var(--aim-serif);
    font-size: 19px;
    font-weight: 400;
}
.aim-r .onb-goal-card small,
.aim-r .onb-goal-panel p,
.aim-r .onb-surface-copy {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--aim-ink-soft);
}
.aim-r .onb-goal-panel {
    display: none;
    padding: 16px;
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
}
.aim-r .onb-goal-panel.active { display: block; }
.aim-r .onb-detail-panel {
    display: none;
    flex-direction: column;
    gap: 14px;
}
.aim-r .onb-detail-panel.active { display: flex; }
.aim-r .onb-detail-panel > p {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--aim-ink-2);
}
.aim-r .onb-goal-panel h2 {
    margin: 0 0 12px;
    font-family: var(--aim-serif);
    font-size: 22px;
    font-weight: 400;
}
.aim-r .onb-option-list,
.aim-r .onb-condition-scroll {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.aim-r .onb-condition-scroll {
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}
.aim-r .onb-option-card,
.aim-r .onb-condition-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    background: var(--aim-bg-card);
    cursor: pointer;
}
.aim-r .onb-option-card.selected,
.aim-r .onb-condition-card.selected {
    border-color: var(--aim-ink);
    background: var(--aim-tint);
}
.aim-r .onb-option-card input,
.aim-r .onb-condition-card input {
    margin-top: 4px;
    accent-color: var(--aim-ink);
}
.aim-r .onb-option-card strong,
.aim-r .onb-condition-card strong {
    display: block;
    font-size: 14px;
}
.aim-r .onb-option-card small,
.aim-r .onb-condition-card small {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: var(--aim-ink-soft);
    line-height: 1.4;
}
.aim-r .onb-condition-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.aim-r .onb-surface,
.aim-r .onb-household-you,
.aim-r .onb-member-card {
    padding: 16px;
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
}
.aim-r .onb-account-surface {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.aim-r .onb-surface-header {
    margin: -2px 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--aim-line-soft);
}
.aim-r .onb-account-surface .onb-surface-header {
    margin-bottom: 0;
}
.aim-r .onb-surface-header .onb-section-title,
.aim-r .onb-surface-header .onb-surface-copy {
    margin: 0;
}
.aim-r .onb-surface-header .onb-surface-copy {
    margin-top: 5px;
}
.aim-r .onb-household-you {
    display: flex;
    gap: 12px;
    align-items: center;
}
.aim-r .onb-household-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--aim-ink);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}
.aim-r .onb-household-you strong {
    display: block;
    font-size: 14px;
}
.aim-r .onb-household-you strong span {
    display: inline-flex;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--aim-tint);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.aim-r .onb-household-you small {
    font-size: 12px;
    color: var(--aim-ink-soft);
}
.aim-r .onb-family-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.aim-r .onb-member-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.aim-r .onb-member-card-head strong {
    font-size: 14px;
    color: var(--aim-ink);
}
.aim-r .onb-member-remove {
    border: 0;
    background: transparent;
    color: var(--aim-danger);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.aim-r .onb-member-health {
    margin-top: 14px;
}
.aim-r .onb-member-health > .onb-member-health-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--aim-ink);
}
.aim-r .onb-member-health-panel {
    margin-top: 10px;
}
.aim-r .onb-secondary-btn,
.aim-r .onb-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 13px 20px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}
.aim-r .onb-secondary-btn {
    border: 1px solid var(--aim-ink);
    background: transparent;
    color: var(--aim-ink);
}
.aim-r .onb-primary-btn {
    border: 1px solid var(--aim-ink);
    background: var(--aim-ink);
    color: var(--aim-bg);
    flex: 1;
}
.aim-r .onb-actions .hidden {
    display: none;
}
.aim-r .onb-proof-grid {
    display: grid;
    gap: 14px;
}
.aim-r .onb-proof-grid-mobile {
    grid-template-columns: repeat(3, 1fr);
    padding: 0 4px;
}
.aim-r .onb-proof-grid div strong {
    display: block;
    font-family: var(--aim-serif);
    font-size: 22px;
    line-height: 1;
    font-weight: 400;
}
.aim-r .onb-proof-grid div small {
    display: block;
    margin-top: 2px;
    font-size: 10.5px;
    line-height: 1.3;
    color: var(--aim-ink-soft);
}
.aim-r .onb-proof-grid-light {
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.2);
}
.aim-r .onb-proof-grid-light div strong {
    color: #fff;
    font-size: 28px;
}
.aim-r .onb-proof-grid-light div small {
    color: rgba(255,255,255,0.75);
    font-size: 11.5px;
    max-width: 130px;
}
.aim-r .onb-story-panel {
    display: none;
}
.aim-r .onb-story-panel.active {
    display: block;
}
.aim-r .onb-story-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(42,74,58,0.45) 0%, rgba(42,74,58,0.55) 50%, rgba(42,74,58,0.85) 100%);
}
.aim-r .onb-story-inner {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 40px 56px;
    display: flex;
    flex-direction: column;
    color: #fff;
}
.aim-r .onb-story-copy {
    margin-top: auto;
    max-width: 500px;
}
.aim-r .onb-story-copy .label {
    color: rgba(255,255,255,0.7);
}
.aim-r .onb-story-copy p {
    margin: 18px 0;
    font-family: var(--aim-serif);
    font-size: 30px;
    line-height: 1.2;
    color: #fff;
}
.aim-r .onb-story-copy span {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
}
.aim-r .onb-shell .med-tag {
    background: var(--aim-ink);
}
.aim-r .onb-shell .med-suggestions {
    border-color: var(--aim-line);
    border-radius: 12px;
}
.aim-r .onb-shell .med-suggestions .med-suggestion:hover,
.aim-r .onb-shell .med-suggestions .med-suggestion.active {
    background: var(--aim-tint);
}
.aim-r .onb-shell .form-input:focus,
.aim-r .onb-shell select.form-input:focus,
.aim-r .onb-shell textarea.form-input:focus {
    outline: none;
    border-color: var(--aim-ink);
    box-shadow: 0 0 0 4px var(--aim-ink);
}
.aim-r .onb-name-input:focus-within .onb-name-field {
    outline: none;
    border-color: var(--aim-ink);
    box-shadow: 0 0 0 4px var(--aim-ink);
}
@media (max-width: 520px) {
    .aim-r .onb-mobile-hero {
        height: 270px;
    }
    .aim-r .onb-card {
        margin: -92px 8px 16px;
        padding: 18px 14px 20px;
        gap: 14px;
        border-radius: 16px;
    }
    .aim-r .onb-header {
        align-items: flex-start;
    }
    .aim-r .onb-header-link {
        max-width: 190px;
        text-align: right;
        line-height: 1.35;
    }
    .aim-r .onb-step {
        gap: 10px;
    }
    .aim-r .onb-step h1 {
        font-size: 29px;
    }
    .aim-r .onb-step-body {
        gap: 14px;
        margin-top: 2px;
    }
    .aim-r .onb-surface,
    .aim-r .onb-household-you,
    .aim-r .onb-member-card {
        padding: 13px;
    }
    .aim-r .onb-account-surface {
        gap: 12px;
    }
    .aim-r .onb-surface-header {
        margin-top: 0;
        margin-bottom: 12px;
        padding-bottom: 10px;
    }
    .aim-r .onb-account-surface .onb-surface-header {
        margin-bottom: 0;
    }
    .aim-r .onb-primary-name label,
    .aim-r .onb-field label,
    .aim-r .onb-surface > label,
    .aim-r .onb-member-health > label {
        margin-bottom: 6px;
    }
    .aim-r .onb-field-grid {
        gap: 10px;
    }
    .aim-r .onb-name-field {
        padding: 13px 44px 13px 15px;
        font-size: 21px;
    }
    .aim-r .onb-shell .form-input:not(.onb-name-field) {
        padding: 10px 13px;
    }
    .aim-r .onb-pill {
        padding: 10px 12px;
    }
}
@media (max-width: 520px) {
    .aim-r .onb-field-grid.cols-3 {
        gap: 10px;
    }
    .aim-r .onb-field-grid.cols-3 .onb-field label {
        white-space: nowrap;
        font-size: 11px;
        letter-spacing: 0.025em;
    }
}
@media (min-width: 390px) and (max-width: 1023px) {
    .aim-r .onb-field-grid.cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (min-width: 1024px) {
    .aim-r .onb-shell {
        display: flex;
    }
    .aim-r .onb-story {
        display: block;
        width: 620px;
        flex-shrink: 0;
        position: relative;
    }
    .aim-r .onb-story-panel {
        position: absolute;
        inset: 0;
    }
    .aim-r .onb-main {
        flex: 1;
        padding: 32px 56px 40px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .aim-r .onb-mobile-hero {
        display: none !important;
    }
    .aim-r .onb-card {
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
        max-width: 580px;
        width: 100%;
        gap: 24px;
    }
    .aim-r .onb-header {
        margin-bottom: 6px;
    }
    .aim-r .onb-step h1 {
        font-size: 56px;
        line-height: 1;
    }
    .aim-r .onb-step > p {
        font-size: 16px;
    }
    .aim-r .onb-name-field {
        padding: 18px 52px 18px 22px;
        font-size: 28px;
    }
    .aim-r .onb-field-grid.cols-2 {
        grid-template-columns: 1fr 1fr;
    }
    .aim-r .onb-goal-grid {
        grid-template-columns: 1fr 1fr;
    }
    .aim-r .onb-condition-scroll {
        max-height: 420px;
    }
    .aim-r .onb-proof-grid-mobile {
        display: none;
    }
}

/* Section heading inside an .onb-step (e.g. "About your body", "Food preferences") */
.aim-r .onb-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.aim-r .onb-section.onb-section-first {
    margin-top: 0;
}
.aim-r .onb-section-title {
    font-family: var(--aim-serif);
    font-size: 17px;
    font-weight: 400;
    color: var(--aim-ink);
    margin: 0;
}
.aim-r .onb-section-help {
    margin: -8px 0 4px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--aim-ink-soft);
}

/* Multi-select chip rows used for dietary preferences + allergies. */
.aim-r .onb-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.aim-r .onb-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--aim-line);
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    font-family: var(--aim-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}
.aim-r .onb-chip input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--aim-ink);
    cursor: pointer;
}
.aim-r .onb-chip:hover {
    border-color: var(--aim-ink-soft);
}
.aim-r .onb-chip.selected {
    border-color: var(--aim-ink);
    background: var(--aim-tint);
}
.aim-r .onb-chip-check {
    display: none;
}
@media (max-width: 520px) {
    .aim-r .onb-chip-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 12px;
    }
    .aim-r .onb-chip {
        width: 100%;
        min-height: 40px;
        white-space: nowrap;
    }
}

/* Gives related collection areas a clear break without introducing nested cards. */
.aim-r .onb-surface .onb-section + .onb-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--aim-line-soft);
}
.aim-r .onb-terms-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--aim-ink-2);
}
.aim-r .onb-terms-row input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--aim-ink);
}
.aim-r .onb-terms-row a {
    color: var(--aim-ink);
    font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────────────────
   Global search (sidebar input + mobile fullscreen overlay + results panel)
   ───────────────────────────────────────────────────────────────────────── */
.aim-search { position: relative; }
.aim-search-side { width: 100%; }

.aim-search-input-wrap {
    display: flex; align-items: center; gap: 8px;
    background: var(--aim-bg-soft, #F6F2E8);
    border: 1px solid var(--aim-line);
    border-radius: 999px;
    padding: 7px 12px;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
    cursor: text;
}
.aim-search-input-wrap:focus-within {
    border-color: var(--aim-ink);
    background: var(--aim-bg-card, #fff);
    box-shadow: 0 0 0 3px rgba(42,74,58,0.08);
}
.aim-search-ico { color: var(--aim-ink-soft); flex: 0 0 auto; }
.aim-search-input {
    flex: 1; min-width: 0;
    background: transparent; border: 0; outline: 0; padding: 0;
    font-family: inherit; font-size: 13.5px; color: var(--aim-ink);
}
.aim-search-input::placeholder { color: var(--aim-ink-mute); }
.aim-search-kbd {
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px; color: var(--aim-ink-soft);
    background: var(--aim-bg-card, #fff);
    border: 1px solid var(--aim-line);
    border-radius: 4px;
    padding: 1px 5px; line-height: 1;
}
.aim-search-input-wrap:focus-within .aim-search-kbd { display: none; }

/* Results panel — anchors below the input on desktop, fills mobile overlay */
.aim-search-panel {
    margin-top: 8px;
    background: var(--aim-bg-card, #fff);
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(42,74,58,0.10);
    max-height: min(60vh, 520px);
    overflow-y: auto;
    padding: 6px;
    z-index: 60;
}
.aim-search-side .aim-search-panel {
    position: absolute; top: 100%; left: 0; right: 0;
    margin-top: 6px;
}

.aim-search-empty {
    padding: 14px 12px;
    font-size: 13px; color: var(--aim-ink-soft);
}

.aim-search-group { padding: 4px 2px 6px; }
.aim-search-group + .aim-search-group {
    border-top: 1px solid var(--aim-line-soft);
    margin-top: 4px;
}
.aim-search-group-label {
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--aim-ink-mute);
    padding: 8px 10px 4px;
}

.aim-search-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    color: var(--aim-ink); text-decoration: none;
    cursor: pointer;
}
.aim-search-row:hover,
.aim-search-row.active {
    background: var(--aim-line-soft);
    color: var(--aim-ink); text-decoration: none;
}
.aim-search-row-ico {
    width: 18px; height: 18px; flex: 0 0 auto;
    border-radius: 6px;
    background: var(--aim-line-soft);
    border: 1px solid var(--aim-line);
    display: inline-flex; align-items: center; justify-content: center;
    background-repeat: no-repeat; background-position: center; background-size: 12px 12px;
}
/* Lightweight inline SVG glyphs per result type — currentColor keeps them on-brand. */
.aim-search-ico-recipe    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M5 4 a2 2 0 0 1 2 -2 h11 a1 1 0 0 1 1 1 v18 a1 1 0 0 1 -1 1 H7 a2 2 0 0 1 -2 -2 z'/><path d='M9 7 H15'/><path d='M9 11 H15'/><path d='M9 15 H13'/></svg>"); }
.aim-search-ico-food      { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='8'/><path d='M8 12 a4 4 0 0 1 8 0'/></svg>"); }
.aim-search-ico-condition { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 12 H7 L9 6 L12 18 L14 10 L17 12 H21'/></svg>"); }
.aim-search-ico-learn     { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 5 a1 1 0 0 1 1 -1 h6 a3 3 0 0 1 3 3 v13 a2 2 0 0 0 -2 -2 H4 z'/><path d='M20 5 a1 1 0 0 0 -1 -1 h-6 a3 3 0 0 0 -3 3 v13 a2 2 0 0 1 2 -2 h8 z'/></svg>"); }
.aim-search-ico-calendar  { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='5' width='18' height='16' rx='2'/><path d='M3 10 H21'/><path d='M8 3 V7'/><path d='M16 3 V7'/></svg>"); }
.aim-search-ico-cart      { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='20' r='1.5'/><circle cx='17' cy='20' r='1.5'/><path d='M3 4 H6 L8 16 H19 L21 8 H7'/></svg>"); }
.aim-search-ico-pantry    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M6 2 L3 6 V20 a2 2 0 0 0 2 2 H19 a2 2 0 0 0 2 -2 V6 L18 2 Z'/><path d='M3 6 H21'/></svg>"); }
.aim-search-ico-leftover  { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 9 H20 L18 21 H6 Z'/><path d='M3 6 H21 V9 H3 Z'/></svg>"); }
.aim-search-ico-user      { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='9' r='3.5'/><path d='M5 20 a7 7 0 0 1 14 0'/></svg>"); }
.aim-search-ico-page      { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M6 3 H14 L19 8 V21 H6 Z'/><path d='M14 3 V8 H19'/></svg>"); }
.aim-search-ico-dot       { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232A4A3A'><circle cx='12' cy='12' r='3'/></svg>"); }
.aim-search-ico-note      { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232A4A3A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M5 3 H15 L19 7 V21 H5 Z'/><path d='M14 3 V8 H19'/><path d='M8 12 H16'/><path d='M8 16 H16'/></svg>"); }

.aim-search-row-body {
    display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1;
}
.aim-search-row-title {
    font-size: 13.5px; font-weight: 500; color: var(--aim-ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.aim-search-row-title mark {
    background: var(--aim-accent-soft, #F2E3CB);
    color: inherit; padding: 0 1px; border-radius: 2px;
}
.aim-search-row-sub {
    font-size: 11.5px; color: var(--aim-ink-soft);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Mobile search button in the top bar */
.aim-mob-search-btn {
    width: 36px; height: 36px; border-radius: 99px;
    background: transparent; border: 0; padding: 0;
    color: var(--aim-ink); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.aim-mob-search-btn:hover { background: var(--aim-line-soft); }

/* Mobile fullscreen overlay */
.aim-search-mobile {
    position: fixed; inset: 0; z-index: 70;
    background: var(--aim-bg);
    display: none; flex-direction: column;
}
.aim-search-mobile.open { display: flex; }
.aim-search-mobile-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--aim-line-soft);
}
.aim-search-mobile-back {
    width: 36px; height: 36px; flex: 0 0 auto;
    background: transparent; border: 0; padding: 0; border-radius: 99px;
    color: var(--aim-ink); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.aim-search-mobile-back:hover { background: var(--aim-line-soft); }
.aim-search-input-wrap-mobile { flex: 1; }
.aim-search-mobile .aim-search-panel {
    margin: 8px 12px 16px;
    border: 0; box-shadow: none; max-height: none;
    flex: 1; overflow-y: auto;
}

/* Hide the desktop sidebar search box on small screens — the mobile top bar
   button + overlay handle search there. */
@media (max-width: 899px) {
    .aim-search-side { display: none; }
}
@media (min-width: 900px) {
    .aim-mob-search-btn,
    .aim-search-mobile { display: none; }
}

/* =====================================================================
   AIM handoff refresh — Meal Plan + Grocery List
   Mirrors Documentation/Designs/mealplan_handoff and grocery_handoff.
   ===================================================================== */

/* Meal plan header/action model */
.aim-r.mealplan-page,
.aim-r .mealplan-page {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 16px 32px;
    gap: 18px;
}

.aim-r .mp-hero {
    padding-top: 0;
    gap: 14px;
}

.aim-r .mp-hero-row {
    align-items: flex-start;
}

.aim-r .mp-hero-title {
    margin-top: 12px;
    font-size: 36px;
    font-weight: 400;
    white-space: nowrap;
}

.aim-r .mp-summary-row {
    margin-top: 10px;
    gap: 8px;
}

.aim-r .mp-summary-duration {
    font-size: 12px;
    color: var(--aim-ink-soft);
    white-space: nowrap;
}

.aim-r .mp-hero-icons {
    position: relative;
    gap: 6px;
}

.aim-r .mp-actions-menu {
    position: relative;
}

.aim-r .mp-actions-menu summary {
    list-style: none;
}

.aim-r .mp-actions-menu summary::-webkit-details-marker {
    display: none;
}

.aim-r .mp-actions-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    min-width: 210px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(42,74,58,0.13);
}

.aim-r .mp-actions-menu-item,
.aim-r .mp-actions-menu-item:visited {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--aim-ink);
    font-family: var(--aim-sans);
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.aim-r .mp-actions-menu-item:hover {
    background: var(--aim-bg-soft);
    color: var(--aim-ink);
    text-decoration: none;
}

.aim-r .mp-actions-menu-item svg {
    width: 16px;
    height: 16px;
    color: var(--aim-ink-soft);
    flex: 0 0 auto;
}

.aim-r .mp-qa-grid {
    display: none;
}

.aim-r #weekly-tips-card {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--aim-line);
    box-shadow: none;
    margin-bottom: 0 !important;
}

.aim-r #weekly-tips-card h2 {
    font-family: var(--aim-serif);
    font-size: 18px !important;
    line-height: 1.1;
    font-weight: 400;
    color: var(--aim-ink);
}

.aim-r #weekly-tips-load,
.aim-r #weekly-tips-refresh {
    padding: 7px 14px;
    border-radius: 99px;
    border-color: var(--aim-line);
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    font-size: 12px;
}

.aim-r #weekly-tips-toggle {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 99px;
}

.aim-r .cal-toolbar {
    gap: 12px;
}

.aim-r .cal-tabs.mp-seg {
    width: 100%;
}

.aim-r .mp-lunchbox-row {
    margin: 0;
}

.aim-r .mp-week-strip {
    margin-top: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.aim-r .mp-week-strip-head {
    padding: 0 4px 10px;
}

.aim-r .mp-week-strip-title {
    font-size: 12.5px;
}

.aim-r .mp-week-strip-nav {
    background: transparent;
    border-color: transparent;
}

.aim-r .mp-week-strip-days {
    gap: 4px;
}

.aim-r .mp-day-pill {
    gap: 6px;
    padding: 10px 0;
    border-radius: 99px;
}

.aim-r .mp-day-pill.selected {
    border-radius: 999px;
}

.aim-r .mp-day-pill-date {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 18px;
}

.aim-r .mp-day-pill.selected {
    background: transparent;
    color: var(--aim-ink);
}

.aim-r .mp-day-pill.selected .mp-day-pill-date {
    background: var(--aim-ink);
    color: #fff;
}

.aim-r .mp-day-pill.selected .mp-day-pill-initial {
    color: var(--aim-ink);
}

.aim-r .mp-day-pill-dots {
    display: none;
}

.aim-r .mp-today-summary {
    padding: 18px;
}

.aim-r .mp-today-summary-date {
    font-size: 26px;
}

.aim-r .mp-meal-card {
    border-radius: 14px;
}

.aim-r .mp-meal-stripe {
    width: 5px;
}

.aim-r .mp-slot-badge.slot-breakfast {
    background: var(--aim-accent-soft);
}

.aim-r .mp-slot-badge.slot-lunch {
    background: var(--aim-tint);
}

.aim-r .mp-slot-badge.slot-snack {
    background: #F0DCD0;
}

.aim-r .mp-slot-badge.slot-dinner {
    background: #D7DCE0;
}

@media (min-width: 900px) {
    .aim-r.mealplan-page,
    .aim-r .mealplan-page {
        padding: 40px 56px 56px;
        gap: 28px;
    }

    .aim-r .mp-hero-title {
        font-size: 56px;
        line-height: 1;
    }

    .aim-r .cal-tabs.mp-seg {
        width: auto;
        align-self: flex-start;
        grid-template-columns: repeat(4, 110px);
    }

    .aim-r #cal-day {
        display: grid;
        grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
        gap: 20px 28px;
        align-items: start;
    }

    .aim-r #cal-day .mp-week-strip {
        grid-column: 1 / -1;
    }

    .aim-r #cal-day .mp-today-summary,
    .aim-r #cal-day .mp-day-meals,
    .aim-r #cal-day .mp-lb-tracks,
    .aim-r #cal-day .mp-addmeal-btn {
        grid-column: 1;
    }

    .aim-r .mp-lunchbox-row {
        max-width: 380px;
        align-self: start;
    }

    .aim-r .mp-meal-body {
        padding: 20px;
        align-items: center;
        gap: 18px;
    }

    .aim-r .mp-meal-title {
        font-size: 22px;
    }

    .aim-r .mp-meal-thumb {
        width: 110px;
        height: 110px;
        border-radius: 14px;
    }

    .aim-r .mp-today-summary {
        padding: 28px;
    }

    .aim-r .mp-today-summary-date {
        font-size: 36px;
    }

    .aim-r .mp-today-ring,
    .aim-r .mp-today-ring svg {
        width: 76px;
        height: 76px;
    }
}

@media (max-width: 520px) {
    .aim-r .mp-hero-title {
        font-size: 34px;
    }

    .aim-r .mp-summary-row .chip-good,
    .aim-r .mp-summary-row .chip-danger {
        display: none;
    }

    .aim-r .mp-meal-body {
        padding: 16px;
    }

    .aim-r .btn-pill.mp-meal-cook-btn {
        padding: 10px 18px;
    }
}

/* Grocery handoff */
.aim-r .grocery-page {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.aim-r .grocery-hero {
    margin: 0;
    padding: 18px 20px 22px;
    border-radius: 18px;
    background: var(--aim-ink);
    color: #fff;
}

.aim-r .grocery-hero-bg {
    top: -90px;
    right: -90px;
    width: 220px;
    height: 220px;
    background: rgba(255,255,255,0.06);
}

.aim-r .grocery-hero-back,
.aim-r .grocery-hero-back:visited {
    display: inline-flex;
    width: max-content;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.24);
    background: rgba(255,255,255,0.16);
    color: #fff;
    font-size: 11.5px;
}

.aim-r .grocery-hero-title {
    font-family: var(--aim-serif);
    font-size: 34px;
    line-height: 1.02;
    font-weight: 400;
    color: #fff;
}

.aim-r .grocery-hero-cost {
    font-family: var(--aim-serif);
    font-size: 32px;
    line-height: 1;
    font-weight: 400;
}

.aim-r .grocery-hero-cost-label {
    display: block;
    margin: 4px 0 0;
    font-size: 11px;
    color: rgba(255,255,255,0.7);
}

.aim-r .grocery-hero-date {
    margin-top: 8px;
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

.aim-r .grocery-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    color: rgba(255,255,255,0.92);
    font-size: 13px;
}

.aim-r .grocery-hero-stats b {
    font-size: 13px;
    font-weight: 600;
}

.aim-r .grocery-hero-bar {
    height: 4px;
    margin-top: 10px;
}

.aim-r .grocery-hero-bar-fill {
    background: #fff;
}

.aim-r .grocery-toolbar {
    margin: 0;
    gap: 8px;
}

.aim-r .grocery-tb-btn,
.aim-r .grocery-tb-btn:visited {
    height: auto;
    min-height: 38px;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    color: var(--aim-ink);
    font-size: 13px;
    font-weight: 500;
}

.aim-r .grocery-tb-btn:hover {
    background: var(--aim-bg-card);
    border-color: var(--aim-ink-soft);
    color: var(--aim-ink);
    text-decoration: none;
}

.aim-r .grocery-tb-btn-primary {
    background: var(--aim-ink);
    border-color: var(--aim-ink);
    color: var(--aim-bg);
}

.aim-r .grocery-tb-btn-primary:hover {
    background: var(--aim-ink);
    color: var(--aim-bg);
    opacity: 0.92;
}

.aim-r .grocery-tb-reset {
    color: var(--aim-ink);
    font-size: 13px;
    font-weight: 500;
}

.aim-r .grocery-connect-banner {
    margin: 0;
    background: var(--aim-accent-soft);
    border-color: transparent;
    border-radius: 14px;
}

.aim-r .grocery-connect-btn {
    background: var(--aim-ink);
    color: var(--aim-bg);
}

.aim-r .grocery-categories {
    gap: 14px;
}

.aim-r .grocery-category {
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 14px;
}

.aim-r .grocery-cat-toggle {
    padding: 16px 18px 14px;
    color: var(--aim-ink);
}

.aim-r .grocery-cat-name {
    font-family: var(--aim-serif);
    font-size: 22px;
    line-height: 1.1;
    font-weight: 400;
    color: var(--aim-ink);
}

.aim-r .grocery-cat-meta {
    font-size: 12.5px;
    color: var(--aim-ink-soft);
}

.aim-r .grocery-cat-meta b {
    color: var(--aim-ink);
    font-weight: 600;
}

.aim-r .grocery-cat-progress {
    width: 220px;
    max-width: 100%;
    height: 3px;
    margin-top: 8px;
    background: var(--aim-line-soft);
}

.aim-r .grocery-cat-progress-fill {
    background: var(--aim-ink);
}

.aim-r .grocery-cat-count,
.aim-r .grocery-cat-chevron {
    color: var(--aim-ink-soft);
}

.aim-r .grocery-item-row {
    padding: 12px 18px;
    border-top-color: var(--aim-line-soft);
    gap: 12px;
}

.aim-r .grocery-item-check {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border-color: var(--aim-ink-mute);
}

.aim-r .grocery-item-check:checked {
    background: var(--aim-ink);
    border-color: var(--aim-ink);
}

.aim-r .grocery-item-name {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--aim-ink);
}

.aim-r .grocery-item-qty {
    font-size: 12.5px;
    color: var(--aim-ink-soft);
}

.aim-r .grocery-item-price {
    color: var(--aim-ink);
    font-weight: 600;
}

.aim-r .grocery-gotit {
    border-top-color: var(--aim-line-soft);
}

.aim-r .grocery-gotit-toggle {
    background: var(--aim-bg-soft);
}

.aim-r .grocery-gotit-label,
.aim-r .grocery-gotit-chevron {
    color: var(--aim-ink);
}

.aim-r .grocery-footnote {
    margin-top: 0;
    padding: 6px 4px;
    color: var(--aim-ink-soft);
    text-align: left;
    font-size: 12px;
}

@media (min-width: 900px) {
    .aim-r .grocery-page {
        padding: 40px 56px 56px;
        gap: 28px;
    }

    .aim-r .grocery-hero {
        padding: 36px 44px 38px;
        border-radius: 22px;
    }

    .aim-r .grocery-hero-bg {
        top: -120px;
        right: -120px;
        width: 320px;
        height: 320px;
    }

    .aim-r .grocery-hero-row {
        align-items: flex-end;
        margin-top: 18px;
    }

    .aim-r .grocery-hero-title {
        font-size: 64px;
        white-space: nowrap;
    }

    .aim-r .grocery-hero-cost {
        font-size: 56px;
    }

    .aim-r .grocery-hero-date {
        font-size: 13px;
        margin-top: 12px;
    }

    .aim-r .grocery-hero-stats {
        margin-top: 24px;
        gap: 14px;
        font-size: 14px;
    }

    .aim-r .grocery-categories {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .aim-r .grocery-category {
        align-self: start;
    }

    .aim-r .grocery-cat-toggle {
        padding: 18px 20px 16px;
    }

    .aim-r .grocery-cat-name {
        font-size: 24px;
    }

    .aim-r .grocery-item-row {
        padding: 12px 20px;
    }

    .aim-r .grocery-footnote {
        grid-column: 1 / -1;
    }
}

@media (max-width: 420px) {
    .aim-r .grocery-hero-title {
        max-width: 150px;
    }

    .aim-r .grocery-toolbar {
        align-items: flex-start;
    }

    .aim-r .grocery-tb-spacer {
        display: none;
    }

    .aim-r .grocery-item-row {
        padding: 12px 14px;
    }

    .aim-r .grocery-item-price {
        min-width: auto;
    }
}

@media (min-width: 900px) {
    .aim-r #cal-day {
        display: block;
    }
}

/* Meal plan day view refinements to match the mobile day-view handoff. */
.aim-r.mealplan-page.is-day-view,
.aim-r.mealplan-page.is-week-view {
    gap: 18px;
}

.aim-r.mealplan-page.is-day-view .mp-hero,
.aim-r.mealplan-page.is-week-view .mp-hero {
    padding-top: 10px;
    gap: 0;
}

.aim-r.mealplan-page.is-day-view .mp-hero-row,
.aim-r.mealplan-page.is-week-view .mp-hero-row {
    align-items: flex-start;
}

.aim-r.mealplan-page.is-day-view .mp-hero-title,
.aim-r.mealplan-page.is-day-view .mp-budget-bar,
.aim-r.mealplan-page.is-day-view .mp-hero > .a-hint,
.aim-r.mealplan-page.is-day-view .mp-hero-instructions-btn,
.aim-r.mealplan-page.is-week-view .mp-hero-title,
.aim-r.mealplan-page.is-week-view .mp-budget-bar,
.aim-r.mealplan-page.is-week-view .mp-hero > .a-hint,
.aim-r.mealplan-page.is-week-view .mp-hero-instructions-btn {
    display: none;
}

.aim-r .mp-summary-range {
    display: none;
    color: var(--aim-ink);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.aim-r .mp-summary-dot {
    display: none;
    color: var(--aim-ink-soft);
    font-size: 12px;
    line-height: 1;
}

.aim-r.mealplan-page.is-day-view .mp-summary-range,
.aim-r.mealplan-page.is-day-view .mp-summary-dot,
.aim-r.mealplan-page.is-week-view .mp-summary-range,
.aim-r.mealplan-page.is-week-view .mp-summary-dot {
    display: inline-flex;
}

.aim-r.mealplan-page.is-day-view .mp-summary-row,
.aim-r.mealplan-page.is-week-view .mp-summary-row {
    margin-top: 8px;
    gap: 8px;
}

.aim-r.mealplan-page.is-day-view .mp-summary-row .chip,
.aim-r.mealplan-page.is-week-view .mp-summary-row .chip {
    padding: 4px 10px;
    font-size: 11.5px;
}

.aim-r.mealplan-page.is-day-view .mp-summary-cost-dot,
.aim-r.mealplan-page.is-week-view .mp-summary-cost-dot {
    display: none;
}

.aim-r.mealplan-page.is-day-view .mp-summary-cost,
.aim-r.mealplan-page.is-week-view .mp-summary-cost {
    flex-basis: 100%;
    margin-top: 8px;
}

.aim-r.mealplan-page.is-day-view .mp-summary-cost-num,
.aim-r.mealplan-page.is-week-view .mp-summary-cost-num {
    font-size: 14px;
}

.aim-r.mealplan-page.is-day-view .mp-summary-budget-extra,
.aim-r.mealplan-page.is-week-view .mp-summary-budget-extra {
    display: none;
}

.aim-r.mealplan-page.is-day-view .cal-tabs.mp-seg,
.aim-r.mealplan-page.is-week-view .cal-tabs.mp-seg,
.aim-r.mealplan-page.is-recipes-view .cal-tabs.mp-seg {
    display: flex;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border-top: 1px solid var(--aim-line-soft);
    border-bottom: 1px solid var(--aim-line-soft);
}

.aim-r.mealplan-page.is-day-view .cal-tabs.mp-seg .cal-tab,
.aim-r.mealplan-page.is-week-view .cal-tabs.mp-seg .cal-tab,
.aim-r.mealplan-page.is-recipes-view .cal-tabs.mp-seg .cal-tab {
    position: relative;
    flex: 1;
    min-height: 44px;
    padding: 14px 0 16px;
    border-radius: 0;
    border-right: 1px solid var(--aim-line-soft);
    color: var(--aim-ink-mute);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.aim-r.mealplan-page.is-day-view .cal-tabs.mp-seg .cal-tab:last-child,
.aim-r.mealplan-page.is-week-view .cal-tabs.mp-seg .cal-tab:last-child,
.aim-r.mealplan-page.is-recipes-view .cal-tabs.mp-seg .cal-tab:last-child {
    border-right: 0;
}

.aim-r.mealplan-page.is-day-view .cal-tabs.mp-seg .cal-tab:hover,
.aim-r.mealplan-page.is-day-view .cal-tabs.mp-seg .cal-tab.active,
.aim-r.mealplan-page.is-week-view .cal-tabs.mp-seg .cal-tab:hover,
.aim-r.mealplan-page.is-week-view .cal-tabs.mp-seg .cal-tab.active,
.aim-r.mealplan-page.is-recipes-view .cal-tabs.mp-seg .cal-tab:hover,
.aim-r.mealplan-page.is-recipes-view .cal-tabs.mp-seg .cal-tab.active {
    background: transparent;
    box-shadow: none;
    color: var(--aim-ink);
}

.aim-r.mealplan-page.is-day-view .cal-tabs.mp-seg .cal-tab.active::after,
.aim-r.mealplan-page.is-week-view .cal-tabs.mp-seg .cal-tab.active::after,
.aim-r.mealplan-page.is-recipes-view .cal-tabs.mp-seg .cal-tab.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 11px;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--aim-ink);
    transform: translateX(-50%);
}

.aim-r.mealplan-page.is-month-view {
    gap: 18px;
}

.aim-r.mealplan-page.is-month-view .mp-hero {
    padding-top: 10px;
    gap: 0;
}

.aim-r.mealplan-page.is-month-view .mp-hero-row {
    align-items: flex-start;
}

.aim-r.mealplan-page.is-month-view .mp-hero-title,
.aim-r.mealplan-page.is-month-view .mp-budget-bar,
.aim-r.mealplan-page.is-month-view .mp-hero > .a-hint,
.aim-r.mealplan-page.is-month-view .mp-hero-instructions-btn {
    display: none;
}

.aim-r.mealplan-page.is-month-view .mp-summary-range,
.aim-r.mealplan-page.is-month-view .mp-summary-dot {
    display: inline-flex;
}

.aim-r.mealplan-page.is-month-view .mp-summary-row {
    margin-top: 8px;
    gap: 8px;
}

.aim-r.mealplan-page.is-month-view .mp-summary-row .chip {
    padding: 4px 10px;
    font-size: 11.5px;
}

.aim-r.mealplan-page.is-month-view .mp-summary-cost-dot {
    display: none;
}

.aim-r.mealplan-page.is-month-view .mp-summary-cost {
    flex-basis: 100%;
    margin-top: 8px;
}

.aim-r.mealplan-page.is-month-view .mp-summary-cost-num {
    font-size: 14px;
}

.aim-r.mealplan-page.is-month-view .mp-summary-budget-extra {
    display: none;
}

.aim-r.mealplan-page.is-month-view .cal-tabs.mp-seg {
    display: flex;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border-top: 1px solid var(--aim-line-soft);
    border-bottom: 1px solid var(--aim-line-soft);
}

.aim-r.mealplan-page.is-month-view .cal-tabs.mp-seg .cal-tab {
    position: relative;
    flex: 1;
    min-height: 44px;
    padding: 14px 0 16px;
    border-radius: 0;
    border-right: 1px solid var(--aim-line-soft);
    color: var(--aim-ink-mute);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.aim-r.mealplan-page.is-month-view .cal-tabs.mp-seg .cal-tab:last-child {
    border-right: 0;
}

.aim-r.mealplan-page.is-month-view .cal-tabs.mp-seg .cal-tab:hover,
.aim-r.mealplan-page.is-month-view .cal-tabs.mp-seg .cal-tab.active {
    background: transparent;
    box-shadow: none;
    color: var(--aim-ink);
}

.aim-r.mealplan-page.is-month-view .cal-tabs.mp-seg .cal-tab.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 11px;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--aim-ink);
    transform: translateX(-50%);
}

.aim-r .mp-weekly-tips-calendar-slot {
    display: none;
}

.aim-r.mealplan-page.is-month-view .mp-weekly-tips-calendar-slot,
.aim-r.mealplan-page.is-week-view .mp-weekly-tips-calendar-slot {
    display: block;
}

.aim-r.mealplan-page.is-month-view .mp-weekly-tips-calendar-slot:empty,
.aim-r.mealplan-page.is-week-view .mp-weekly-tips-calendar-slot:empty {
    display: none;
}

.aim-r.mealplan-page.is-month-view .mp-weekly-tips-calendar-slot #weekly-tips-card,
.aim-r.mealplan-page.is-week-view .mp-weekly-tips-calendar-slot #weekly-tips-card {
    margin-bottom: 0 !important;
}

.aim-r.mealplan-page.is-day-view .mp-day-head .mp-day-shopping-status {
    display: none;
}

.aim-r.mealplan-page.is-day-view .mp-day-lunchbox {
    border-radius: 12px;
}

.aim-r.mealplan-page.is-day-view .mp-weekly-tips-day-slot {
    margin-top: 12px;
}

.aim-r.mealplan-page.is-day-view .mp-weekly-tips-day-slot #weekly-tips-card {
    margin-bottom: 0 !important;
}

.aim-r.mealplan-page.is-day-view .mp-day-schedule {
    margin-top: 22px;
}

.aim-r.mealplan-page.is-day-view .mp-day-schedule-actions {
    margin-left: auto;
}

.aim-r.mealplan-page.is-day-view .mp-tl-card {
    border-radius: 12px;
}

.aim-r.mealplan-page.is-day-view .mp-tl-card.next {
    border-width: 1px;
}

.aim-r.mealplan-page.is-day-view .mp-tl-body {
    min-height: 104px;
}

.aim-r.mealplan-page.is-day-view .mp-tl-card.next .mp-tl-body {
    min-height: 146px;
}

.aim-r.mealplan-page.is-day-view .mp-tl-thumb {
    width: 82px;
}

.aim-r.mealplan-page.is-day-view .btn-pill.mp-tl-cook-btn {
    padding: 8px 14px;
    font-weight: 600;
}

@media (max-width: 480px) {
    .aim-r.mealplan-page.is-day-view .mp-tl-thumb {
        width: 82px;
    }

    .aim-r.mealplan-page.is-day-view .mp-day-head-date {
        font-size: 30px;
    }
}

@media (max-width: 370px) {
    .aim-r.mealplan-page.is-day-view .mp-day-head-date {
        font-size: 26px;
    }

    .aim-r.mealplan-page.is-day-view .mp-tl-thumb {
        width: 70px;
    }
}

@media (min-width: 900px) {
    .aim-r.container.page-container.mealplan-page {
        width: min(100%, 1280px);
        max-width: 1280px;
        margin: 0 auto;
        padding: 48px 48px 64px;
    }

    .aim-r.mealplan-page.is-day-view .mp-hero,
    .aim-r.mealplan-page.is-day-view .cal-toolbar,
    .aim-r.mealplan-page.is-day-view #weekly-tips-calendar-slot,
    .aim-r.mealplan-page.is-day-view #mp-lunchbox-card,
    .aim-r.mealplan-page.is-day-view #mp-track-filters,
    .aim-r.mealplan-page.is-day-view #cal-day,
    .aim-r.mealplan-page.is-recipes-view .mp-hero,
    .aim-r.mealplan-page.is-recipes-view .cal-toolbar,
    .aim-r.mealplan-page.is-recipes-view #cal-recipes {
        width: 100%;
        max-width: 1120px;
        margin-left: auto;
        margin-right: auto;
    }

    .aim-r.mealplan-page.is-day-view .mp-hero {
        padding-top: 0;
        gap: 14px;
    }

    .aim-r.mealplan-page.is-day-view .cal-toolbar,
    .aim-r.mealplan-page.is-recipes-view .cal-toolbar {
        align-items: center;
    }

    .aim-r.mealplan-page.is-day-view .cal-tabs.mp-seg,
    .aim-r.mealplan-page.is-recipes-view .cal-tabs.mp-seg {
        width: auto;
        min-width: 440px;
        display: grid;
        grid-template-columns: repeat(4, 110px);
        padding: 4px;
        border: 0;
        border-radius: 999px;
        background: var(--aim-bg-soft);
    }

    .aim-r.mealplan-page.is-day-view .cal-tabs.mp-seg .cal-tab,
    .aim-r.mealplan-page.is-recipes-view .cal-tabs.mp-seg .cal-tab {
        min-height: 0;
        padding: 9px 0;
        border: 0;
        border-radius: 999px;
        font-size: 12.5px;
        letter-spacing: 0;
        text-transform: none;
    }

    .aim-r.mealplan-page.is-day-view .cal-tabs.mp-seg .cal-tab.active,
    .aim-r.mealplan-page.is-recipes-view .cal-tabs.mp-seg .cal-tab.active {
        background: var(--aim-bg-card);
        box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    }

    .aim-r.mealplan-page.is-day-view .cal-tabs.mp-seg .cal-tab.active::after,
    .aim-r.mealplan-page.is-recipes-view .cal-tabs.mp-seg .cal-tab.active::after {
        display: none;
    }

    .aim-r.mealplan-page.is-day-view .mp-day-head-date {
        font-size: 36px;
    }

    .aim-r.mealplan-page.is-day-view .mp-day-lunchbox,
    .aim-r.mealplan-page.is-day-view .mp-weekly-tips-day-slot,
    .aim-r.mealplan-page.is-day-view .mp-day-schedule {
        width: 100%;
    }

    .aim-r.mealplan-page.is-day-view .mp-timeline {
        padding-right: 0;
    }
}

/* ── Meal plan create handoff ───────────────────────────────────────────── */
.aim-r .mpc-page {
    min-height: calc(100vh - var(--aim-mob-top-h));
    background: var(--aim-bg);
}

.aim-r .mpc-story {
    display: none;
}

.aim-r .mpc-main {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 4px 22px 28px;
}

.aim-r .mpc-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.aim-r .mpc-progress span {
    flex: 0 0 auto;
    font-size: 12.5px;
    color: var(--aim-ink-soft);
    font-weight: 500;
}

.aim-r .mpc-progress div {
    flex: 1;
    height: 3px;
    border-radius: 999px;
    background: var(--aim-line-soft);
    overflow: hidden;
}

.aim-r .mpc-progress i {
    display: block;
    height: 100%;
    background: var(--aim-ink);
}

.aim-r .mpc-form,
.aim-r .mpc-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aim-r .mpc-head h1 {
    margin: 6px 0 0;
    font-family: var(--aim-serif);
    font-size: 34px;
    line-height: 1.02;
    letter-spacing: 0;
    color: var(--aim-ink);
    font-weight: 400;
    white-space: nowrap;
}

.aim-r .mpc-head p {
    margin: 10px 0 0;
    max-width: 580px;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--aim-ink-2);
}

.aim-r .mpc-profile-pill,
.aim-r .mpc-budget-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--aim-tint);
    color: var(--aim-ink-2);
}

.aim-r .mpc-profile-pill strong,
.aim-r .mpc-budget-row strong {
    display: block;
    font-size: 13px;
    color: var(--aim-ink);
}

.aim-r .mpc-profile-pill span,
.aim-r .mpc-budget-row small {
    display: block;
    font-size: 12px;
    color: var(--aim-ink-soft);
    line-height: 1.35;
}

.aim-r .mpc-profile-pill a {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--aim-ink);
    text-decoration: none;
}

.aim-r .mpc-checkmark,
.aim-r .mpc-focus-icon,
.aim-r .mpc-date-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.aim-r .mpc-checkmark {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--aim-ink);
    color: #fff;
}

.aim-r .mpc-label {
    margin-bottom: 10px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--aim-ink);
}

.aim-r .mpc-section {
    display: flex;
    flex-direction: column;
}

.aim-r .mpc-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.aim-r .mpc-section-head .mpc-label {
    margin: 0;
}

.aim-r .mpc-section-head span {
    font-size: 11px;
    color: var(--aim-ink-soft);
}

.aim-r .mpc-family-list,
.aim-r .mpc-review-card {
    overflow: hidden;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 14px;
}

.aim-r .mpc-family-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    background: var(--aim-bg-card);
    border-bottom: 1px solid var(--aim-line-soft);
}

.aim-r .mpc-family-row:last-child {
    border-bottom: 0;
}

.aim-r .mpc-family-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.aim-r .mpc-family-row.selected,
.aim-r .mpc-family-row:has(input:checked) {
    background: var(--aim-bg-soft);
}

.aim-r .mpc-box {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1.5px solid var(--aim-ink-mute);
    color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.aim-r .mpc-family-row.selected .mpc-box,
.aim-r .mpc-family-row:has(input:checked) .mpc-box,
.aim-r .mpc-toggle-row.selected .mpc-box,
.aim-r .mpc-toggle-row:has(input:checked) .mpc-box,
.aim-r .mpc-box.checked {
    background: var(--aim-ink);
    border-color: var(--aim-ink);
    color: #fff;
}

.aim-r .mpc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--aim-tint);
    color: var(--aim-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex: 0 0 auto;
}

.aim-r .mpc-avatar.you {
    background: var(--aim-ink);
    color: #fff;
}

.aim-r .mpc-family-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.aim-r .mpc-family-copy strong {
    font-size: 14.5px;
    color: var(--aim-ink);
}

.aim-r .mpc-family-copy em {
    display: inline-flex;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--aim-ink);
    color: #fff;
    font-size: 9.5px;
    font-style: normal;
    letter-spacing: 0.04em;
}

.aim-r .mpc-family-copy small,
.aim-r .mpc-help,
.aim-r .mpc-footnote {
    font-size: 11.5px;
    color: var(--aim-ink-soft);
    line-height: 1.45;
}

.aim-r .mpc-help {
    margin: 8px 0 0 4px;
}

.aim-r .mpc-when-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.aim-r .mpc-date-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
}

.aim-r .mpc-date-icon,
.aim-r .mpc-focus-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--aim-bg-soft);
    color: var(--aim-ink);
}

.aim-r .mpc-date-card small,
.aim-r .mpc-duration-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11.5px;
    color: var(--aim-ink-soft);
    font-weight: 500;
}

.aim-r .mpc-date-card input {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    font-family: var(--aim-sans);
    font-size: 15.5px;
    font-weight: 600;
    color: var(--aim-ink);
}

.aim-r .mpc-date-card input:focus {
    outline: 0;
}

.aim-r .mpc-duration-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.aim-r .mpc-duration {
    min-height: 78px;
    padding: 12px 6px 9px;
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.aim-r .mpc-duration input {
    position: absolute;
    opacity: 0;
}

.aim-r .mpc-duration.selected,
.aim-r .mpc-duration:has(input:checked) {
    background: var(--aim-ink);
    border-color: var(--aim-ink);
    color: #fff;
}

.aim-r .mpc-duration .serif {
    font-size: 22px;
    line-height: 1;
}

.aim-r .mpc-duration small {
    font-size: 10px;
    font-weight: 500;
    color: currentColor;
    opacity: .75;
}

.aim-r .mpc-duration em {
    font-size: 7.8px;
    font-style: normal;
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1;
    color: var(--aim-accent);
    text-transform: uppercase;
    white-space: nowrap;
}

.aim-r .mpc-duration.selected em,
.aim-r .mpc-duration:has(input:checked) em {
    color: #fff;
}

.aim-r .mpc-focus-list,
.aim-r .mpc-extra-grid,
.aim-r .mpc-advanced-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aim-r .mpc-focus-row,
.aim-r .mpc-toggle-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    background: var(--aim-bg-card);
    cursor: pointer;
}

.aim-r .mpc-focus-row input,
.aim-r .mpc-toggle-row input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.aim-r .mpc-focus-row.selected,
.aim-r .mpc-focus-row:has(input:checked),
.aim-r .mpc-toggle-row.selected,
.aim-r .mpc-toggle-row:has(input:checked) {
    border-color: var(--aim-ink);
    background: var(--aim-tint);
}

.aim-r .mpc-focus-row.selected .mpc-focus-icon,
.aim-r .mpc-focus-row:has(input:checked) .mpc-focus-icon {
    background: var(--aim-ink);
    color: #fff;
}

.aim-r .mpc-radio {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1.5px solid var(--aim-ink-mute);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.aim-r .mpc-focus-row.selected .mpc-radio,
.aim-r .mpc-focus-row:has(input:checked) .mpc-radio {
    border-color: var(--aim-ink);
    background: var(--aim-ink);
    box-shadow: inset 0 0 0 5px var(--aim-bg-card);
}

.aim-r .mpc-focus-row strong,
.aim-r .mpc-toggle-row strong {
    display: block;
    font-size: 14.5px;
    color: var(--aim-ink);
}

.aim-r .mpc-focus-row small,
.aim-r .mpc-toggle-row small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--aim-ink-soft);
    line-height: 1.4;
}

.aim-r .mpc-toggle-row-compact {
    padding: 12px 14px;
}

.aim-r .mpc-lunchbox-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    background: var(--aim-bg-soft);
}

.aim-r .mpc-lunchbox-panel[hidden] {
    display: none;
}

.aim-r .mpc-lunchbox-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.aim-r .mpc-lunchbox-head strong {
    color: var(--aim-ink);
    font-size: 13.5px;
}

.aim-r .mpc-lunchbox-head span {
    color: var(--aim-ink-soft);
    font-size: 12px;
    line-height: 1.4;
}

.aim-r .mpc-lunchbox-pickers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aim-r .mpc-mini-check {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--aim-line);
    border-radius: 999px;
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.aim-r .mpc-mini-check input {
    width: 14px;
    height: 14px;
    accent-color: var(--aim-ink);
}

.aim-r .mpc-mini-check:has(input:checked) {
    border-color: var(--aim-ink);
    background: var(--aim-tint);
}

.aim-r .mpc-condition-panel {
    margin-top: -2px;
}
.aim-r .mpc-condition-panel .health-condition-scroll {
    max-height: 260px;
}

.aim-r .mpc-budget-row {
    margin-top: 14px;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
}
.aim-r .mpc-budget-panel {
    margin-top: -2px;
    padding: 12px 14px;
    border-radius: 12px;
}

.aim-r .mpc-budget-row > span:nth-child(2) {
    flex: 1;
}

.aim-r .mpc-money {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    color: var(--aim-ink);
    font-size: 14px;
    font-weight: 600;
}

.aim-r .mpc-money span {
    color: var(--aim-ink-soft);
}

.aim-r .mpc-money input {
    width: 70px;
    padding: 8px 10px;
    border: 1px solid var(--aim-line);
    border-radius: 8px;
    background: var(--aim-bg);
    color: var(--aim-ink);
    font-family: var(--aim-sans);
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}

.aim-r .mpc-advanced {
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
    padding: 14px 16px;
}

.aim-r .mpc-advanced summary {
    cursor: pointer;
    color: var(--aim-ink);
    font-size: 13.5px;
    font-weight: 600;
}

.aim-r .mpc-advanced-grid {
    margin-top: 14px;
}

.aim-r .mpc-advanced-grid > label:not(.mpc-toggle-row) {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.aim-r .mpc-advanced-grid > label > span {
    font-size: 12px;
    font-weight: 600;
    color: var(--aim-ink);
}

.aim-r .mpc-review-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.aim-r .mpc-review-card {
    padding: 6px 18px 12px;
}

.aim-r .mpc-review-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 16px;
    align-items: baseline;
    padding: 14px 0;
    border-bottom: 1px solid var(--aim-line-soft);
}

.aim-r .mpc-review-row:last-child {
    border-bottom: 0;
}

.aim-r .mpc-review-row > span {
    font-size: 12px;
    color: var(--aim-ink-soft);
    font-weight: 500;
}

.aim-r .mpc-review-row strong {
    display: block;
    font-size: 14.5px;
    color: var(--aim-ink);
}

.aim-r .mpc-review-row small {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: var(--aim-ink-soft);
}

@media (max-width: 575px) {
    .aim-r .mpc-review-card {
        padding: 4px 14px 8px;
    }

    .aim-r .mpc-review-row {
        grid-template-columns: 78px minmax(0, 1fr);
        gap: 10px;
        padding: 11px 0;
    }
}

.aim-r .mpc-output-card {
    align-self: start;
    padding: 16px 20px;
    border-radius: 14px;
    background: var(--aim-tint);
}

.aim-r .mpc-output-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-top: 8px;
}

.aim-r .mpc-output-row strong {
    width: 38px;
    flex: 0 0 auto;
    font-size: 28px;
    line-height: 1;
    color: var(--aim-ink);
    font-weight: 400;
}

.aim-r .mpc-output-row span {
    font-size: 13.5px;
    color: var(--aim-ink-2);
}

@media (max-width: 575px) {
    .aim-r .mpc-output-card {
        padding: 14px 18px;
    }

    .aim-r .mpc-output-row {
        margin-top: 6px;
    }

    .aim-r .mpc-output-row strong {
        font-size: 25px;
    }
}

.aim-r .mpc-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.aim-r .mpc-actions .btn-pill:last-child {
    flex: 1;
}

.aim-r .mpc-footnote {
    text-align: center;
}

.aim-r .mpc-footnote a,
.aim-r .mpc-footnote strong {
    color: var(--aim-ink);
    font-weight: 600;
    text-decoration: none;
}

.aim-r .mpc-renew {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aim-r .mpc-renew-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--aim-line);
    border-radius: 12px;
    background: var(--aim-bg-card);
}

.aim-r .mpc-renew-row > div {
    flex: 1;
    min-width: 0;
}

.aim-r .mpc-renew-row strong {
    display: block;
    font-size: 13.5px;
    color: var(--aim-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aim-r .mpc-renew-row span {
    display: block;
    font-size: 11.5px;
    color: var(--aim-ink-soft);
}

.aim-r .mpc-renew-row form {
    margin: 0;
    flex: 0 0 auto;
}

.aim-r .mpc-templates {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--aim-line);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.aim-r .mpc-templates-head .mpc-label {
    margin-bottom: 6px;
}

.aim-r .mpc-template-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.aim-r .mpc-template-card {
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aim-r .mpc-template-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aim-r .mpc-template-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--aim-bg-soft, #f4efe2);
    color: var(--aim-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.aim-r .mpc-template-img {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
}

.aim-r .mpc-template-head strong {
    display: block;
    font-size: 14.5px;
    color: var(--aim-ink);
}

.aim-r .mpc-template-head small {
    display: block;
    font-size: 11.5px;
    color: var(--aim-ink-soft);
    margin-top: 2px;
}

.aim-r .mpc-template-desc {
    margin: 0;
    font-size: 13px;
    color: var(--aim-ink-soft);
    line-height: 1.5;
}

.aim-r .mpc-template-tiers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (min-width: 760px) {
    .aim-r .mpc-template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .aim-r .mpc-when-grid {
        grid-template-columns: minmax(260px, .85fr) 1.15fr;
        align-items: end;
    }

    .aim-r .mpc-extra-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        display: grid;
    }

    .aim-r .mpc-review-grid {
        grid-template-columns: minmax(0, 1.3fr) minmax(260px, .8fr);
    }
}

@media (min-width: 1100px) {
    .aim-r .mpc-page {
        min-height: 100vh;
        display: grid;
        grid-template-columns: 420px minmax(0, 1fr);
    }

    .aim-r .mpc-story {
        display: block;
        position: sticky;
        top: 0;
        min-height: 100vh;
        overflow: hidden;
        background-size: cover;
        background-position: center;
    }

    .aim-r .mpc-story-step1 {
        background-image: url("https://images.unsplash.com/photo-1490645935967-10de6ba17061?auto=format&fit=crop&w=1200&q=80");
    }

    .aim-r .mpc-story-step2 {
        background-image: url("https://images.unsplash.com/photo-1512621776951-a57141f2eefd?auto=format&fit=crop&w=1200&q=80");
    }

    .aim-r .mpc-story-step3 {
        background-image: url("https://images.unsplash.com/photo-1467003909585-2f8a72700288?auto=format&fit=crop&w=1200&q=80");
    }

    .aim-r .mpc-story-overlay {
        position: absolute;
        inset: 0;
        background: linear-gradient(180deg, rgba(42,74,58,0.40) 0%, rgba(42,74,58,0.55) 50%, rgba(42,74,58,0.85) 100%);
    }

    .aim-r .mpc-story-inner {
        position: relative;
        z-index: 1;
        min-height: 100vh;
        padding: 40px 48px;
        color: #fff;
        display: flex;
        flex-direction: column;
    }

    .aim-r .mpc-story-brand,
    .aim-r .mpc-story-brand:visited,
    .aim-r .mpc-story-brand:hover {
        color: #fff;
    }

    .aim-r .mpc-story-quote {
        margin-top: auto;
        max-width: 360px;
    }

    .aim-r .mpc-story-quote .label {
        color: rgba(255,255,255,.7);
    }

    .aim-r .mpc-story-quote p {
        margin: 16px 0;
        font-family: var(--aim-serif);
        font-size: 26px;
        line-height: 1.25;
        color: #fff;
    }

    .aim-r .mpc-story-quote span {
        font-size: 13px;
        color: rgba(255,255,255,.85);
    }

    .aim-r .mpc-main {
        max-width: 820px;
        margin: 0;
        padding: 36px 56px 46px;
    }

    .aim-r .mpc-head h1 {
        font-size: 52px;
        line-height: 1;
    }
}

/* ── Meal plan week/month handoff views ─────────────────────────────────── */
.aim-r .mp-week-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.aim-r .mp-week-day-card {
    overflow: hidden;
    border-color: var(--aim-line);
    background: var(--aim-bg-card);
}

.aim-r .mp-week-day-card.today {
    border-color: var(--aim-ink);
}

.aim-r .mp-week-day-card.out-of-plan {
    opacity: .62;
}

.aim-r .mp-week-day-head {
    width: 100%;
    min-height: 64px;
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid var(--aim-line-soft);
    background: var(--aim-bg-soft);
    color: var(--aim-ink);
    font-family: inherit;
    text-align: left;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
}

.aim-r .mp-week-day-card.today .mp-week-day-head {
    background: var(--aim-ink);
    color: #fff;
}

.aim-r .mp-week-day-head span {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--aim-ink-mute);
}

.aim-r .mp-week-day-card.today .mp-week-day-head span,
.aim-r .mp-week-day-card.today .mp-week-day-head em {
    color: rgba(255,255,255,.72);
}

.aim-r .mp-week-day-head strong {
    font-size: 24px;
    line-height: 1;
    font-weight: 400;
}

.aim-r .mp-week-day-head em {
    margin-left: auto;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--aim-ink-soft);
}

.aim-r .mp-week-day-meals {
    min-height: 0;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aim-r .mp-week-meal {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--aim-line-soft);
    color: var(--aim-ink);
    text-decoration: none;
}

.aim-r .mp-week-meal:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.aim-r .mp-week-meal:hover {
    color: var(--aim-ink);
    text-decoration: none;
}

.aim-r .mp-week-meal.done strong {
    text-decoration: line-through;
    text-decoration-color: var(--aim-ink-mute);
}

.aim-r .mp-week-meal-badge {
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--aim-ink);
}

.aim-r .mp-week-meal-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.aim-r .mp-week-meal-badge.slot-breakfast { background: var(--aim-accent-soft); }
.aim-r .mp-week-meal-badge.slot-lunch { background: var(--aim-tint); }
.aim-r .mp-week-meal-badge.slot-snack { background: #F0DCD0; }
.aim-r .mp-week-meal-badge.slot-dinner { background: #D7DCE0; }
.aim-r .mp-week-meal-badge.lunchbox-friendly {
    background: #fff8e8;
    border: 1px solid #f0e3c0;
    color: #3d2f10;
    font-weight: 700;
}

.aim-r .mp-week-meal strong {
    font-size: 15px;
    line-height: 1.2;
    font-weight: 400;
    color: var(--aim-ink);
}

.aim-r .mp-week-meal small {
    font-size: 11px;
    line-height: 1.3;
    color: var(--aim-ink-soft);
}

.aim-r .mp-week-empty {
    width: 100%;
    min-height: 44px;
    padding: 12px;
    border: 1px dashed var(--aim-line);
    border-radius: 12px;
    background: var(--aim-bg);
    color: var(--aim-ink-soft);
    font-size: 12.5px;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.aim-r .mp-week-empty.muted {
    cursor: default;
    background: transparent;
}

.aim-r .mp-week-day-foot {
    padding: 10px 14px;
    border-top: 1px solid var(--aim-line-soft);
    color: var(--aim-ink-soft);
    font-size: 11.5px;
    text-align: center;
}

.aim-r .mp-month-view {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.aim-r .mp-month-calendar {
    padding: 14px 10px 12px;
}

.aim-r .mp-month-weekdays,
.aim-r .mp-month-cells {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.aim-r .mp-month-weekdays {
    margin-bottom: 8px;
}

.aim-r .mp-month-weekdays div {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--aim-ink-mute);
    text-transform: uppercase;
}

.aim-r .mp-month-cells {
    gap: 4px;
}

.aim-r .mp-month-cell {
    position: relative;
    min-height: 48px;
    padding: 6px 3px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--aim-ink);
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
}

.aim-r .mp-month-cell.muted {
    color: var(--aim-ink-mute);
}

.aim-r .mp-month-cell.active-plan {
    background: var(--aim-ink);
    color: #fff;
}

.aim-r .mp-month-cell.muted.active-plan {
    background: rgba(42,74,58,.12);
    color: var(--aim-ink-soft);
}

.aim-r .mp-month-cell.today {
    box-shadow: inset 0 0 0 2px var(--aim-accent);
}

.aim-r .mp-month-num {
    font-size: 15px;
    line-height: 1;
    font-weight: 400;
}

.aim-r .mp-month-dots {
    display: flex;
    gap: 2px;
    min-height: 3px;
}

.aim-r .mp-month-dots i {
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    opacity: .55;
}

.aim-r .mp-month-rail {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.aim-r .mp-month-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 0 4px;
}

.aim-r .mp-month-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--aim-ink-soft);
}

.aim-r .mp-month-legend i {
    width: 12px;
    height: 12px;
    display: inline-block;
}

.aim-r .mp-month-legend i.active {
    border-radius: 4px;
    background: var(--aim-ink);
}

.aim-r .mp-month-legend i.today {
    border-radius: 999px;
    border: 2px solid var(--aim-accent);
}

.aim-r .mp-month-plan {
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: center;
}

.aim-r .mp-month-plan-date {
    width: 54px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
}

.aim-r .mp-month-plan-date strong {
    font-size: 30px;
    line-height: 1;
    font-weight: 400;
    color: var(--aim-ink);
}

.aim-r .mp-month-plan-date small {
    font-size: 10px;
    color: var(--aim-ink-mute);
    line-height: 1.2;
}

.aim-r .mp-month-plan-copy {
    min-width: 0;
    padding-left: 14px;
    border-left: 1px solid var(--aim-line-soft);
}

.aim-r .mp-month-plan-title {
    margin-top: 4px;
    font-size: 18px;
    line-height: 1.15;
    color: var(--aim-ink);
}

.aim-r .mp-month-plan-copy p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--aim-ink-soft);
}

.aim-r .mp-month-history {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--aim-ink);
    text-decoration: none;
}

.aim-r .mp-month-history:hover {
    color: var(--aim-ink);
    text-decoration: none;
    border-color: var(--aim-ink-soft);
}

.aim-r .mp-month-history div {
    flex: 1;
    min-width: 0;
}

.aim-r .mp-month-history strong {
    display: block;
    font-size: 14px;
}

.aim-r .mp-month-history span {
    display: block;
    color: var(--aim-ink-soft);
    font-size: 12px;
    line-height: 1.35;
}

.aim-r .mp-month-history > span {
    flex: 0 0 auto;
    color: var(--aim-ink-mute);
    font-size: 22px;
}

@media (min-width: 900px) {
    .aim-r .mp-week-view {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 14px;
    }

    .aim-r .mp-week-day-card {
        min-height: 420px;
        display: flex;
        flex-direction: column;
    }

    .aim-r .mp-week-day-head {
        min-height: 76px;
        align-items: flex-end;
    }

    .aim-r .mp-week-day-head strong {
        font-size: 26px;
    }

    .aim-r .mp-week-day-meals {
        flex: 1;
    }

    .aim-r .mp-week-meal strong {
        font-size: 13.5px;
    }

    .aim-r .mp-month-view {
        grid-template-columns: minmax(0, 2fr) minmax(280px, .85fr);
        gap: 28px;
        align-items: start;
    }

    .aim-r .mp-month-calendar {
        padding: 24px;
    }

    .aim-r .mp-month-cells {
        gap: 6px;
    }

    .aim-r .mp-month-cell {
        min-height: 84px;
        align-items: flex-start;
        justify-content: space-between;
        padding: 10px;
    }

    .aim-r .mp-month-num {
        font-size: 17px;
    }
}

/* ═════════════════════════════════════════════════════════════════════════════
   Dark Mode — Comprehensive Overrides
   These rules ONLY apply when [data-theme="dark"] is set on <html>; light mode
   is unaffected. Two problem zones are addressed:
     1. The AIM redesign tokens (--aim-*) had no dark variants.
     2. Pre-AIM components hardcoded #fff card backgrounds + dark ink text.
   Intentional light surfaces (white buttons sitting on accent/hero, white text
   on colored hero CTAs) are left alone — those are not theme-dependent.
   ═════════════════════════════════════════════════════════════════════════════ */

/* AIM design-system tokens — dark variant */
[data-theme="dark"] {
    --aim-bg:         #0d0d0d;
    --aim-bg-soft:    #141414;
    --aim-bg-card:    #1a1a1a;
    --aim-tint:       #1f2a22;
    --aim-ink:        #e8e6e1;
    --aim-ink-2:      #c8c6c1;
    --aim-ink-soft:   #a8a6a1;
    --aim-ink-mute:   #6e6c68;
    --aim-line:       rgba(255,255,255,0.10);
    --aim-line-soft:  rgba(255,255,255,0.06);
    --aim-accent-soft:#3a2a14;
    --aim-danger:     #d6705f;
}

[data-theme="dark"] body.aim-r .more-menu {
    background: rgba(26, 26, 26, 0.96);
    border-color: rgba(255,255,255,0.10);
    box-shadow: 0 24px 60px rgba(0,0,0,0.48),
                inset 0 1px 0 rgba(255,255,255,0.05);
}

[data-theme="dark"] body.aim-r .more-menu-header {
    background: linear-gradient(180deg, rgba(26,26,26,0.98) 0%, rgba(26,26,26,0.9) 100%);
}

[data-theme="dark"] body.aim-r .more-menu-header::before {
    background: rgba(255,255,255,0.16);
}

/* The .aim-r wrapper itself uses `background: var(--aim-bg)` so the redesigned
   pages adopt the dark surface as soon as the token flips. Text color too. */

/* AIM components that hardcode #fff instead of var(--aim-bg-card) */
[data-theme="dark"] .aim-r .m-goal-card,
[data-theme="dark"] .aim-r .m-wellness-goal,
[data-theme="dark"] .aim-r .m-story-tile,
[data-theme="dark"] .aim-r .m-feat {
    background: var(--aim-bg-card);
}

/* ── Inverse-surface fix ─────────────────────────────────────────────────────
   In light mode, --aim-ink (dark green) is used as BOTH the body text colour
   AND as the background of "inverse" surfaces (CTA pills, the bottom nav, the
   grocery-list hero, chips, selected day pills, etc.) — those surfaces have
   white text on a dark green ground. Once --aim-ink flips to a near-white in
   dark mode, those surfaces also flip light and their #fff text disappears.
   These overrides keep the inverse surfaces dark in dark mode so the white
   text remains legible. */
[data-theme="dark"] .aim-mob-nav,
[data-theme="dark"] .aim-r .grocery-hero,
[data-theme="dark"] .aim-r .m-cta,
[data-theme="dark"] .aim-r .m-wellness-sidecar,
[data-theme="dark"] .aim-r .qa-primary,
[data-theme="dark"] .aim-r .chip-ink,
[data-theme="dark"] .aim-r .btn-pill,
[data-theme="dark"] .aim-r .btn-pill-ghost:hover,
[data-theme="dark"] .aim-r .mp-day-pill.selected,
[data-theme="dark"] .aim-r .d-member-you-tag,
[data-theme="dark"] .aim-r .d-ai-icon,
[data-theme="dark"] .aim-r .seg .s.done,
[data-theme="dark"] .aim-r .grocery-cat-progress-fill,
[data-theme="dark"] .aim-r .a-savebar {
    background: #262626;
    border-color: #262626;
}

/* Checked items get the accent color (not the inverse-surface dark) so the
   check state is visible against the dark page */
[data-theme="dark"] .aim-r .grocery-item-check:checked {
    background: var(--accent);
    border-color: var(--accent);
}

/* Borders / outlines that referenced --aim-ink on these inverse surfaces */
[data-theme="dark"] .aim-r .seg .s.active {
    border-color: #262626;
    background: var(--aim-bg-card);
}
[data-theme="dark"] .aim-r .a-card.is-active,
[data-theme="dark"] .aim-r .d-member.you {
    border-color: var(--text-secondary);
}
[data-theme="dark"] .aim-r .d-member.you .d-member-av {
    box-shadow: 0 0 0 2px var(--aim-bg), 0 0 0 3.5px var(--text-secondary);
}

/* btn-pill text uses var(--aim-bg) which is now dark — keep it light against
   the dark inverse surface */
[data-theme="dark"] .aim-r .btn-pill,
[data-theme="dark"] .aim-r .btn-pill:hover,
[data-theme="dark"] .aim-r .btn-pill-ghost:hover {
    color: var(--aim-ink);
}

/* Ghost pill in default state uses --aim-ink as border + text → it's *meant*
   to read as inked-on-bg. In dark mode our --aim-ink is light, which is what
   we want for visibility on the dark page — leave as-is. */

/* Button on accent/dark surface — stays white in light, but in dark mode the
   .a-savebar / hero is darker still, so a slightly tinted button reads better */
[data-theme="dark"] .aim-r .a-savebar .btn-pill {
    background: var(--aim-bg-card);
    color: var(--aim-ink);
    border-color: var(--aim-line);
}

/* ── Marketing dark-mode tuning ─────────────────────────────────────────────
   The marketing hero intentionally mixes a light "phone" mockup with dark page
   tokens. Keep that mockup light with dark ink, and restore green CTAs so the
   page does not flatten into grey-on-black. */
[data-theme="dark"] .aim-r .m-hero-editorial::after {
    background:
        linear-gradient(90deg, rgba(3, 14, 9, 0.90) 0%, rgba(7, 24, 15, 0.72) 48%, rgba(7, 24, 15, 0.46) 100%),
        linear-gradient(180deg, rgba(3, 14, 9, 0.24) 0%, rgba(3, 14, 9, 0.84) 100%);
}
[data-theme="dark"] .aim-r .m-phone {
    background: #fbf7ef;
    color: #173528;
    border-color: #101a14;
    box-shadow: 0 26px 78px rgba(0,0,0,0.55);
}
[data-theme="dark"] .aim-r .m-phone-top,
[data-theme="dark"] .aim-r .m-phone-card strong,
[data-theme="dark"] .aim-r .m-phone-row,
[data-theme="dark"] .aim-r .m-phone-row strong {
    color: #173528;
}
[data-theme="dark"] .aim-r .m-phone-top span:last-child,
[data-theme="dark"] .aim-r .m-phone-card small {
    color: #5f6d63;
}
[data-theme="dark"] .aim-r .m-phone-chips span {
    background: #1f563d;
    color: #fffefb;
}
[data-theme="dark"] .aim-r .m-phone-card {
    background: #f1eadf;
    border-color: rgba(23, 53, 40, 0.18);
}
[data-theme="dark"] .aim-r .m-phone-row {
    border-color: rgba(23, 53, 40, 0.14);
}
[data-theme="dark"] .aim-r .m-hero-note {
    background: rgba(251,247,239,0.96);
    color: #173528;
    box-shadow: 0 20px 56px rgba(0,0,0,0.32);
}
[data-theme="dark"] .aim-r .m-hero-note strong {
    color: #173528;
}
[data-theme="dark"] .aim-r .m-hero-note span {
    color: #5f6d63;
}
[data-theme="dark"] .aim-r .m-hero-cta .btn-pill-light {
    background: #fffefb;
    color: #173528;
    border-color: #fffefb;
}
[data-theme="dark"] .aim-r .m-hero-cta .btn-pill-ghost-light {
    background: rgba(255,254,251,0.06);
    color: #fffefb;
    border-color: rgba(255,254,251,0.62);
}
[data-theme="dark"] .aim-r .m-stats-grid {
    gap: 1px;
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.14);
    border-radius: 14px;
    overflow: hidden;
}
[data-theme="dark"] .aim-r .m-stats-grid > div {
    background: #101411;
    padding: 16px 14px;
}
[data-theme="dark"] .aim-r .m-stat-num {
    color: #f3f0ea;
}
[data-theme="dark"] .aim-r .m-stat-num small,
[data-theme="dark"] .aim-r .m-stat-lbl {
    color: #c0c9bf;
}
[data-theme="dark"] .aim-r .m-story-tile {
    background: #141a15;
    border-color: rgba(255,255,255,0.13);
}
[data-theme="dark"] .aim-r .m-story-body h2 {
    color: #f3f0ea;
}
[data-theme="dark"] .aim-r .m-story-body p {
    color: #c4cec3;
}
[data-theme="dark"] .aim-r .m-story-body .btn-pill {
    background: #24573f;
    border-color: #24573f;
    color: #fffefb;
}
[data-theme="dark"] .aim-r .m-story-body .btn-pill:hover {
    background: #2c684b;
    border-color: #2c684b;
    color: #fffefb;
}

/* The "Swap" overlay button sits on top of a meal hero image — white is fine */

/* Pale-stripe meal slot badges hardcode warm pastels — soften for dark */
[data-theme="dark"] .aim-r .mp-slot-badge.slot-snack,
[data-theme="dark"] .aim-r .mp-week-meal-badge.slot-snack,
[data-theme="dark"] .aim-r .mp-tl-tag.slot-snack {
    background: #3a2418; color: #f0c8a8;
}
[data-theme="dark"] .aim-r .mp-slot-badge.slot-dinner,
[data-theme="dark"] .aim-r .mp-week-meal-badge.slot-dinner,
[data-theme="dark"] .aim-r .mp-tl-tag.slot-dinner {
    background: #1c2530; color: #b8c4d0;
}
[data-theme="dark"] .aim-r .mp-tl-tag.slot-breakfast {
    background: #3a2e18; color: #f0d8a8;
}
[data-theme="dark"] .aim-r .mp-tl-tag.slot-lunch {
    background: #1f2a1c; color: #c4d4b4;
}
[data-theme="dark"] .aim-r .mp-tl-card.next {
    border-color: var(--aim-ink-soft);
}
[data-theme="dark"] .aim-r .mp-tl-node {
    background: var(--aim-bg-card); border-color: var(--aim-ink-soft);
}
[data-theme="dark"] .aim-r .mp-tl-node.done {
    background: var(--aim-ink-soft); border: none;
}

/* Status text colors used inside .aim-r that hardcode mid-tone greens/ambers */
[data-theme="dark"] .aim-r .chip.chip-good,
[data-theme="dark"] .aim-r .badge-success,
[data-theme="dark"] .aim-r .a-banner.success .a-banner-ic,
[data-theme="dark"] .aim-r .admin-status-ok,
[data-theme="dark"] .aim-r .a-progress-fill.done,
[data-theme="dark"] .aim-r .mp-day-shopping-ready {
    /* keep accent tone but lift saturation/lightness for dark surfaces */
    color: #9bc196 !important;
}
[data-theme="dark"] .aim-r .a-progress-fill.done { background: #9bc196; color: var(--aim-bg); }
[data-theme="dark"] .aim-r .admin-status-warn,
[data-theme="dark"] .aim-r .a-banner.warn .a-banner-ic { color: #e6b673; }
[data-theme="dark"] .aim-r .badge-lunchbox { background: #16293a; color: #8fbce0; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
[data-theme="dark"] .alert-success {
    background: #14321f; color: #a8d8b8; border-color: rgba(168,216,184,0.25);
}
[data-theme="dark"] .alert-error {
    background: #3a1414; color: #f5a5a5; border-color: rgba(245,165,165,0.25);
}
[data-theme="dark"] .alert-info {
    background: #122039; color: #a5c0f5; border-color: rgba(165,192,245,0.25);
}

/* ── Calendar tabs / month + week cells ─────────────────────────────────── */
[data-theme="dark"] .cal-tab {
    color: var(--text-primary);
}
[data-theme="dark"] .cal-tab:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .cal-tab.active {
    background: var(--bg-layer2); color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
[data-theme="dark"] .cal-month-cell { background: var(--bg-layer1); }
[data-theme="dark"] .cal-month-cell.cal-outside { background: var(--bg-base); }
[data-theme="dark"] .cal-month-empty,
[data-theme="dark"] .cal-week-empty { background: rgba(255,255,255,0.02); }

/* ── Meal-plan card surfaces (legacy, non-AIM) ──────────────────────────── */
[data-theme="dark"] .mp-action-tile {
    background: var(--bg-layer2);
    color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .mp-action-tile:hover {
    background: rgba(255,255,255,0.04); color: var(--text-primary);
}
[data-theme="dark"] .mp-lunchbox-row,
[data-theme="dark"] .mp-daycard,
[data-theme="dark"] .mp-daycard-summary,
[data-theme="dark"] .mp-daycard-meals,
[data-theme="dark"] .mp-daycard-notes,
[data-theme="dark"] .mp-day-meals,
[data-theme="dark"] .mp-day-recipe-card,
[data-theme="dark"] .mp-day-recipe-card.alt,
[data-theme="dark"] .mp-meal-card,
[data-theme="dark"] .mp-recipes-grid > * {
    background: var(--bg-layer2);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .mp-day-pill {
    background: var(--bg-layer2); color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .mp-day-pill.today {
    background: var(--bg-layer2); color: var(--text-primary);
    box-shadow: inset 0 0 0 1.5px var(--accent);
}

/* ── Dashboard cards ────────────────────────────────────────────────────── */
[data-theme="dark"] .dash-nextmeal,
[data-theme="dark"] .dash-actions-card,
[data-theme="dark"] .dash-newplan-card-v2,
[data-theme="dark"] .dash-today-meals,
[data-theme="dark"] .dash-plan-v2-meals {
    background: var(--bg-layer2);
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: 0 10px 24px -16px rgba(0,0,0,0.6);
}
[data-theme="dark"] .dash-nextmeal-link:hover,
[data-theme="dark"] .dash-actions-item:hover { background: rgba(255,255,255,0.05); }
[data-theme="dark"] .dash-nextmeal-title,
[data-theme="dark"] .dash-actions-item,
[data-theme="dark"] .dash-actions-item span { color: var(--text-primary); }
[data-theme="dark"] .dash-nextmeal-eyebrow,
[data-theme="dark"] .dash-nextmeal-kcal { color: var(--text-secondary); }
[data-theme="dark"] .dash-nextmeal-swap {
    background: rgba(20,20,20,0.85); color: var(--text-primary);
    border-color: rgba(255,255,255,0.18);
}
[data-theme="dark"] .dash-nextmeal-swap:hover {
    background: var(--bg-layer2); color: var(--text-primary);
    border-color: var(--accent);
}
[data-theme="dark"] .dash-actions-item + .dash-actions-item { border-left-color: var(--border-color); }

/* ── Misc legacy surfaces ───────────────────────────────────────────────── */
[data-theme="dark"] .instr-favorite:hover { background: var(--bg-layer2); }
[data-theme="dark"] .grocery-qty-badge { background-color: var(--bg-layer2); color: var(--text-primary); }
[data-theme="dark"] .grocery-sheet-item { background: var(--bg-layer2); color: var(--text-primary); }
[data-theme="dark"] .grocery-item-check {
    background: var(--bg-layer2);
    border-color: rgba(255,255,255,0.2);
}
[data-theme="dark"] .grocery-item-check:checked {
    background: var(--accent);
    border-color: var(--accent);
}

/* ── Missing food-category badge dark variants ──────────────────────────── */
/* Existing dark rules cover most categories; these were missed. */
[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-cruciferous { background: #0d2e15; color: #81c784; }
[data-theme="dark"] .badge-cat-beverage    { background: #0a2e2a; color: #80cbc4; }
[data-theme="dark"] .badge-cat-legume      { background: #151a3d; color: #9fa8da; }

/* ── Inline-style overrides in views (badges/pills hardcode colors) ─────── */
/* Inline styles win on specificity; use !important to retint for dark mode. */
[data-theme="dark"] .badge[style*="#fde8e8"] {
    background: #3a1414 !important; color: #f5a5a5 !important;
}
[data-theme="dark"] .badge[style*="#e8eaf6"] {
    background: #1a1f3d !important; color: #9fa8da !important;
}
[data-theme="dark"] [style*="#eef3e3"] {
    background: #1a2d18 !important; color: #b8d0a0 !important;
}
[data-theme="dark"] [style*="#fff8e8"] {
    background: #2a2310 !important; color: #e6c87a !important;
}
[data-theme="dark"] [style*="#f0c75a"][style*="#3d2f10"] {
    background: #5a4318 !important; color: #f5dba3 !important;
}

/* JS-injected status messages in Kroger Index */
[data-theme="dark"] [style*="background:#e8f5ee"],
[data-theme="dark"] [style*="background: #e8f5ee"] {
    background: #14321f !important; color: #a8d8b8 !important;
}

/* Recipe Detail AI-image placeholder fallback color */
[data-theme="dark"] #ai-image-placeholder {
    background: var(--bg-layer2) !important;
    border-color: var(--border-color) !important;
}
[data-theme="dark"] #ai-image-placeholder p { color: var(--text-secondary) !important; }

/* =====================================================================
   Profile redesign (May 2026) — tabbed layout, snapshot card, autosave.
   See Documentation/Designs/profile_handoff/.
   ===================================================================== */
.pfx-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 20px 64px;
    display: flex; flex-direction: column; gap: 16px;
}

/* Top bar — back, breadcrumb, save status */
.pfx-topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
}
.pfx-crumb {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--aim-ink-soft); font-weight: 500;
}
.pfx-crumb .sep { color: var(--aim-ink-mute); }
.pfx-status-pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; color: var(--aim-ink-soft); font-weight: 500;
    padding: 4px 10px; border-radius: 999px;
}
.pfx-status-pill .dot {
    width: 6px; height: 6px; border-radius: 99px;
    background: #5C9876;
    transition: background .2s, box-shadow .2s;
}
.pfx-status-pill[data-state="saving"] .dot {
    background: var(--aim-accent);
    box-shadow: 0 0 0 3px rgba(217,160,91,0.18);
}
.pfx-status-pill[data-state="error"] .dot { background: var(--aim-danger); }
.pfx-status-pill[data-state="idle"] .dot { background: var(--aim-ink-mute); }
.pfx-status-pill[data-state="error"] { color: var(--aim-danger); }

/* Snapshot card */
.pfx-snapshot {
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 16px;
    padding: 18px 20px;
    display: flex; flex-direction: column; gap: 14px;
}
.pfx-snapshot-row {
    display: flex; align-items: center; gap: 14px;
}
.pfx-avatar-lg {
    width: 56px; height: 56px; border-radius: 99px; flex-shrink: 0;
    background: var(--aim-ink); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--aim-serif); font-size: 24px;
    background-size: cover; background-position: center;
    border: none; cursor: pointer;
    position: relative;
}
.pfx-avatar-lg .badge {
    position: absolute; bottom: -2px; right: -2px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--aim-accent);
    border: 2px solid var(--aim-bg-card);
    display: flex; align-items: center; justify-content: center; color: #fff;
}
.pfx-snapshot-name {
    font-family: var(--aim-serif); font-size: 24px; line-height: 1;
    margin: 0; color: var(--aim-ink);
}
.pfx-snapshot-email {
    font-size: 12.5px; color: var(--aim-ink-soft); margin-top: 5px;
    overflow-wrap: anywhere;
}
.pfx-snapshot-meta { flex: 1; min-width: 0; }
.pfx-stat-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
    background: var(--aim-line-soft);
    border-radius: 12px; overflow: hidden;
    border: 1px solid var(--aim-line-soft);
}
.pfx-stat {
    background: var(--aim-bg-card); padding: 10px 8px; text-align: center;
}
.pfx-stat .n {
    font-family: var(--aim-serif); font-size: 19px; color: var(--aim-ink); line-height: 1;
}
.pfx-stat .l {
    font-size: 10.5px; color: var(--aim-ink-soft); margin-top: 4px;
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500;
}

/* Tabs — mobile segmented bar */
.pfx-tabs {
    display: flex;
    gap: 0;
    padding: 0;
    background: transparent;
    border-top: 1px solid var(--aim-line-soft);
    border-bottom: 1px solid var(--aim-line-soft);
    border-radius: 0;
    overflow: visible;
    -ms-overflow-style: none; scrollbar-width: none;
}
.pfx-tabs::-webkit-scrollbar { display: none; }
.pfx-tab {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    min-height: 50px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 14px 4px 17px;
    border-radius: 0;
    cursor: pointer; background: transparent; border: 0;
    border-right: 1px solid var(--aim-line-soft);
    color: var(--aim-ink-mute);
    font-size: 9.5px; font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
    white-space: nowrap; font-family: inherit;
    text-decoration: none;
}
.pfx-tab:last-child { border-right: 0; }
.pfx-tab:hover { color: var(--aim-ink); background: transparent; }
.pfx-tab.active {
    background: transparent;
    color: var(--aim-ink);
    font-weight: 600;
    box-shadow: none;
}
.pfx-tab.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 11px;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--aim-ink);
    transform: translateX(-50%);
}
.pfx-tab svg { display: none; }

/* Body layout — single column on mobile, sidebar + main on desktop */
.pfx-body {
    display: flex; flex-direction: column; gap: 0;
}

.pfx-sidebar { display: none; }

.pfx-panel { display: none; flex-direction: column; gap: 18px; }
.pfx-panel.active { display: flex; }

.pfx-section-title {
    margin: 0;
}
.pfx-section-title h2 {
    font-family: var(--aim-serif); font-size: 22px; line-height: 1.1;
    margin: 0; color: var(--aim-ink);
}
.pfx-section-title p {
    font-size: 12.5px; color: var(--aim-ink-soft);
    margin: 4px 0 0; line-height: 1.4;
}

.pfx-card {
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    padding: 22px;
}
.pfx-card-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 18px;
}
.pfx-card-head h3 {
    font-family: var(--aim-serif); font-size: 19px; line-height: 1.1;
    margin: 0; color: var(--aim-ink);
}
.pfx-card-head p {
    font-size: 12.5px; color: var(--aim-ink-soft);
    margin: 4px 0 0;
}

/* Field primitives */
.pfx-field-label {
    font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--aim-ink-soft);
    margin-bottom: 7px; display: flex; align-items: center; gap: 6px;
}
.pfx-field-label .req { color: var(--aim-danger); }
.pfx-field-label .opt {
    color: var(--aim-ink-mute); font-weight: 500;
    text-transform: none; letter-spacing: 0;
}
.pfx-field-sub {
    font-size: 11px; color: var(--aim-ink-soft); margin-bottom: 4px;
}

.pfx-input,
.pfx-select {
    width: 100%; padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--aim-line);
    background: var(--aim-bg);
    font-size: 14.5px; font-weight: 500;
    color: var(--aim-ink);
    font-family: var(--aim-sans);
    outline: none;
}
.pfx-input:focus,
.pfx-select:focus { border-color: var(--aim-ink-soft); }
.pfx-select {
    padding-right: 36px;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236F8475' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat; background-position: right 12px center;
    cursor: pointer;
}
.pfx-input-suffix {
    position: relative; display: flex; align-items: center;
}
.pfx-input-suffix > input { padding-right: 38px; }
.pfx-input-suffix > .suffix {
    position: absolute; right: 12px;
    font-size: 12px; color: var(--aim-ink-soft); font-weight: 500;
    pointer-events: none;
}
.pfx-input[disabled],
.pfx-input:disabled { background: var(--aim-bg-soft); color: var(--aim-ink-mute); cursor: not-allowed; }

.pfx-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pfx-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pfx-preferences-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px 14px;
}
.pfx-preferences-grid > * { min-width: 0; }
.pfx-stack { display: flex; flex-direction: column; gap: 10px; }
.pfx-section { display: flex; flex-direction: column; gap: 7px; }

/* Health journey slider */
.pfx-journey {
    --pfx-journey-stage: 1;
    --pfx-journey-fill: calc((var(--pfx-journey-stage) - 1) / 4 * 100%);
    display: flex; flex-direction: column; gap: 14px;
    padding: 16px 16px 14px;
    background: var(--aim-bg-soft, #f3f6ec);
    border: 1px solid var(--aim-line);
    border-radius: 12px;
}
.pfx-journey[data-stage="1"] { --pfx-journey-stage: 1; }
.pfx-journey[data-stage="2"] { --pfx-journey-stage: 2; }
.pfx-journey[data-stage="3"] { --pfx-journey-stage: 3; }
.pfx-journey[data-stage="4"] { --pfx-journey-stage: 4; }
.pfx-journey[data-stage="5"] { --pfx-journey-stage: 5; }

.pfx-journey-range {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 6px; margin: 0; padding: 0;
    background: linear-gradient(to right,
        var(--aim-ink) 0%,
        var(--aim-ink) var(--pfx-journey-fill),
        var(--aim-line) var(--pfx-journey-fill),
        var(--aim-line) 100%);
    border-radius: 999px;
    outline: none; cursor: pointer;
}
.pfx-journey-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--aim-ink); border: 3px solid var(--aim-bg, #fff);
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
    cursor: pointer; transition: transform .1s;
}
.pfx-journey-range::-webkit-slider-thumb:hover { transform: scale(1.08); }
.pfx-journey-range::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--aim-ink); border: 3px solid var(--aim-bg, #fff);
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
    cursor: pointer;
}
.pfx-journey-range:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px var(--aim-accent-soft, rgba(132,168,90,.35));
}

.pfx-journey-ticks {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}
.pfx-journey-tick {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: none; border: 0; padding: 4px 2px 0;
    cursor: pointer; color: var(--aim-ink-soft);
    font-family: inherit; text-align: center;
    min-width: 0;
}
.pfx-journey-tick .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--aim-line);
    border: 2px solid var(--aim-bg, #fff);
    box-shadow: 0 0 0 1px var(--aim-line);
    transition: background .12s, box-shadow .12s, transform .12s;
}
.pfx-journey-tick .label {
    font-size: 10.5px; font-weight: 600;
    letter-spacing: 0;
    line-height: 1.2;
    color: var(--aim-ink-soft);
    text-transform: none;
    display: block;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}
.pfx-journey-tick:hover .label { color: var(--aim-ink); }
.pfx-journey-tick.reached .dot {
    background: var(--aim-ink);
    box-shadow: 0 0 0 1px var(--aim-ink);
}
.pfx-journey-tick.active .dot {
    background: var(--aim-ink);
    box-shadow: 0 0 0 1px var(--aim-ink), 0 0 0 4px var(--aim-accent-soft, rgba(132,168,90,.35));
    transform: scale(1.15);
}
.pfx-journey-tick.active .label {
    color: var(--aim-ink);
}

.pfx-journey-meta {
    background: var(--aim-bg-card, #fff);
    border: 1px solid var(--aim-line);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex; flex-direction: column; gap: 4px;
}
.pfx-journey-meta .stage-label {
    font-family: var(--aim-serif);
    font-size: 15px;
    color: var(--aim-ink);
    line-height: 1.1;
}
.pfx-journey-meta .stage-criteria {
    font-size: 12.5px;
    color: var(--aim-ink-soft);
    line-height: 1.4;
}

/* On the smallest screens, drop tick label size so they don't wrap awkwardly. */
@media (max-width: 480px) {
    .pfx-journey {
        gap: 12px;
        padding: 14px 12px;
    }

    .pfx-journey-ticks {
        gap: 2px;
    }

    .pfx-journey-tick {
        gap: 5px;
        padding-inline: 1px;
    }

    .pfx-journey-tick .label {
        font-size: 9px;
        line-height: 1.05;
    }
}

/* Chip toggles */
.pfx-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.pfx-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px; border-radius: 99px; cursor: pointer;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    color: var(--aim-ink);
    font-size: 13px; font-weight: 500;
    user-select: none;
    transition: background .12s, color .12s, border-color .12s;
}
.pfx-chip input { display: none; }
.pfx-chip.checked,
.pfx-chip:has(input:checked) {
    background: var(--aim-ink);
    border-color: var(--aim-ink);
    color: #fff;
}

/* Condition groups */
.pfx-condition-group { margin-bottom: 14px; }
.pfx-condition-group:last-child { margin-bottom: 0; }
.pfx-condition-group-title {
    font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--aim-ink-2);
    margin-bottom: 8px;
}

/* Calorie tile (dark gradient) */
.pfx-calorie-tile {
    background: linear-gradient(180deg, var(--aim-ink) 0%, #243f33 100%);
    border-radius: 16px; padding: 20px 22px; color: #fff;
}
.pfx-calorie-tile .eyebrow {
    font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: rgba(255,255,255,0.55);
}
.pfx-calorie-tile .num {
    font-family: var(--aim-serif); font-size: 48px; line-height: 1; color: #fff;
}
.pfx-calorie-tile .num-row {
    display: flex; align-items: baseline; gap: 8px; margin-top: 6px;
}
.pfx-calorie-tile .num-unit { font-size: 14px; color: rgba(255,255,255,0.7); }
.pfx-calorie-tile .macros {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px;
}
.pfx-calorie-tile .macro {
    background: rgba(255,255,255,0.08); border-radius: 10px;
    padding: 10px 8px; text-align: center;
}
.pfx-calorie-tile .macro .bar {
    width: 18px; height: 3px; border-radius: 99px; margin: 0 auto 6px;
}
.pfx-calorie-tile .macro .v {
    font-family: var(--aim-serif); font-size: 15px; color: #fff;
}
.pfx-calorie-tile .macro .l {
    font-size: 9px; color: rgba(255,255,255,0.55);
    letter-spacing: 0.06em; font-weight: 600; margin-top: 3px;
}
.pfx-calorie-tile .foot {
    font-size: 10.5px; color: rgba(255,255,255,0.45); margin-top: 12px;
}

/* Appearance segmented (light/dark/auto) */
.pfx-segmented {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6;
    gap: 6px; padding: 4px;
    background: var(--aim-bg-soft); border-radius: 12px;
}
.pfx-segmented button {
    padding: 10px 8px; border-radius: 8px;
    cursor: pointer; font-size: 13px; font-weight: 500;
    border: 0; color: var(--aim-ink-soft);
    background: transparent; font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.pfx-segmented button.active {
    color: var(--aim-ink); background: var(--aim-bg-card);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

@media (max-width: 700px) {
    .pfx-preferences-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 460px) {
    .pfx-preferences-grid {
        grid-template-columns: 1fr;
    }

    .pfx-preferences-grid .pfx-select,
    .pfx-preferences-grid .pfx-input {
        min-height: 48px;
        font-size: 16px;
    }

    .pfx-segmented button {
        min-width: 0;
        white-space: nowrap;
    }
}

/* Household member rows */
.pfx-member-list {
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    overflow: hidden;
}
.pfx-member-row {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--aim-line-soft);
}
.pfx-member-row:last-of-type { border-bottom: 0; }
.pfx-member-av {
    width: 40px; height: 40px; border-radius: 99px; flex-shrink: 0;
    background: var(--aim-tint); color: var(--aim-ink);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--aim-serif); font-size: 17px;
    background-size: cover; background-position: center;
}
.pfx-member-row.is-you .pfx-member-av { background: var(--aim-ink); color: #fff; }
.pfx-member-meta { flex: 1; min-width: 0; }
.pfx-member-name-row {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.pfx-member-name {
    font-size: 14.5px; font-weight: 600; color: var(--aim-ink);
}
.pfx-you-tag {
    font-size: 9px; padding: 2px 6px; background: var(--aim-ink);
    color: #fff; border-radius: 99px; font-weight: 700; letter-spacing: 0.04em;
}
.pfx-member-age { font-size: 11.5px; color: var(--aim-ink-soft); }
.pfx-member-tags {
    font-size: 11.5px; color: var(--aim-ink-soft); margin-top: 3px;
    overflow-wrap: anywhere;
}
.pfx-member-add {
    width: 100%; padding: 14px 16px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: var(--aim-bg-soft); border: 0;
    border-top: 1px solid var(--aim-line-soft);
    color: var(--aim-ink); cursor: pointer;
    font-size: 14px; font-weight: 600; font-family: inherit;
    text-decoration: none;
}
.pfx-member-add:hover { color: var(--aim-ink); text-decoration: none; }

/* Pantry chips (removable) */
.pfx-pantry-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 8px 7px 12px; border-radius: 99px;
    background: var(--aim-tint);
    font-size: 12.5px; color: var(--aim-ink);
    border: 0;
}
.pfx-pantry-chip button {
    width: 18px; height: 18px; border-radius: 99px; border: 0;
    background: rgba(0,0,0,0.06); color: var(--aim-ink);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
}
.pfx-pantry-chip button:hover { background: rgba(0,0,0,0.12); }
.pfx-pantry-add {
    display: flex; gap: 8px;
}
.pfx-pantry-add .pfx-input { flex: 1; }

/* Grocery provider cards */
.pfx-provider-list { display: flex; flex-direction: column; gap: 8px; }
.pfx-provider-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 12px;
}
.pfx-provider-tile {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
}
.pfx-provider-meta { flex: 1; min-width: 0; }
.pfx-provider-name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pfx-provider-name { font-size: 14px; font-weight: 600; color: var(--aim-ink); }
.pfx-provider-sub { font-size: 11.5px; color: var(--aim-ink-soft); margin-top: 2px; }
.pfx-connected-badge {
    font-size: 9.5px; padding: 2px 6px;
    background: var(--aim-tint); color: var(--aim-ink);
    border-radius: 99px; font-weight: 600; letter-spacing: 0.04em;
}

/* Plan card + plan options */
.pfx-plan-current {
    background: var(--aim-tint);
    border-radius: 16px; padding: 20px 22px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pfx-plan-current-eyebrow {
    font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--aim-ink-soft); margin-bottom: 4px;
}
.pfx-plan-current-name {
    font-family: var(--aim-serif); font-size: 26px; color: var(--aim-ink);
}
.pfx-plan-current-meta {
    font-size: 12px; color: var(--aim-ink-soft); margin-top: 4px;
}
.pfx-plan-grid {
    display: flex; flex-direction: column; gap: 10px;
}
.pfx-plan-card {
    padding: 16px 18px; background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 14px; position: relative;
}
.pfx-plan-card.best { border-color: var(--aim-ink); }
.pfx-plan-card .badge {
    position: absolute; top: -10px; right: 14px;
    font-size: 9.5px; padding: 4px 10px;
    background: var(--aim-ink); color: #fff;
    border-radius: 99px; font-weight: 700; letter-spacing: 0.06em;
}
.pfx-plan-card-row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.pfx-plan-card-name {
    font-family: var(--aim-serif); font-size: 18px; color: var(--aim-ink);
}
.pfx-plan-card-price {
    display: flex; align-items: baseline; gap: 2px; margin-top: 4px;
}
.pfx-plan-card-price .p {
    font-family: var(--aim-serif); font-size: 28px; color: var(--aim-ink);
}
.pfx-plan-card-price .s { font-size: 13px; color: var(--aim-ink-soft); }
.pfx-plan-card-desc { font-size: 12.5px; color: var(--aim-ink-soft); margin-top: 6px; }

.pfx-foot { font-size: 11.5px; color: var(--aim-ink-soft); text-align: center; }

/* Buttons (re-uses aim-r .btn-pill but we expose unscoped variants) */
.pfx-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: 999px;
    background: var(--aim-ink); color: #fff;
    font-family: var(--aim-sans); font-size: 13px; font-weight: 500;
    border: 1px solid var(--aim-ink); cursor: pointer; text-decoration: none;
}
.pfx-btn:hover { color: #fff; opacity: 0.92; text-decoration: none; }
.pfx-btn-ghost {
    background: transparent; color: var(--aim-ink); border-color: var(--aim-ink);
}
.pfx-btn-ghost:hover { background: var(--aim-ink); color: #fff; }
.pfx-btn-sm { padding: 6px 14px; font-size: 12px; }
.pfx-btn-link {
    background: transparent; border: 0; padding: 0;
    color: var(--aim-ink-soft); font-size: 12.5px; font-weight: 500; cursor: pointer;
    font-family: inherit;
}
.pfx-btn-link:hover { color: var(--aim-ink); text-decoration: underline; }
.pfx-btn-link.danger { color: var(--aim-danger); }

/* Account / sign-out row */
.pfx-account-list {
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    overflow: hidden;
}
.pfx-account-row {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; width: 100%;
    background: var(--aim-bg-card); border: 0;
    cursor: pointer; text-align: left;
    border-bottom: 1px solid var(--aim-line-soft);
    color: var(--aim-ink); font-family: inherit;
    text-decoration: none;
}
.pfx-account-row:last-of-type { border-bottom: 0; }
.pfx-account-row:hover { background: var(--aim-bg-soft); color: var(--aim-ink); text-decoration: none; }
.pfx-account-row.danger { color: var(--aim-danger); }
.pfx-account-row .ico {
    color: var(--aim-ink-soft);
    display: inline-flex; align-items: center; justify-content: center;
}
.pfx-account-row.danger .ico { color: var(--aim-danger); }
.pfx-account-row .meta { flex: 1; min-width: 0; }
.pfx-account-row .t { font-size: 14px; font-weight: 500; }
.pfx-account-row .s { font-size: 11.5px; color: var(--aim-ink-soft); margin-top: 2px; }
.pfx-account-row .chev { color: var(--aim-ink-mute); }

/* Desktop layout (≥900px) — sidebar + main grid */
@media (min-width: 900px) {
    .pfx-shell { padding: 24px 32px 64px; }
    .pfx-snapshot {
        padding: 24px 28px;
    }
    .pfx-snapshot-row { gap: 20px; }
    .pfx-avatar-lg { width: 72px; height: 72px; font-size: 30px; }
    .pfx-snapshot-name { font-size: 32px; }
    .pfx-stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .pfx-stat .n { font-size: 22px; }

    .pfx-tabs { display: none; }

    .pfx-body {
        display: grid;
        grid-template-columns: 240px 1fr;
        gap: 28px;
        align-items: start;
    }
    .pfx-sidebar {
        display: flex; flex-direction: column; gap: 2px;
        position: sticky; top: 84px;
    }
    .pfx-sidebar-item {
        display: flex; align-items: center; gap: 10px;
        padding: 10px 14px; border-radius: 10px;
        cursor: pointer; background: transparent; border: 0;
        color: var(--aim-ink-soft); font-size: 14px; font-weight: 500;
        font-family: inherit; text-align: left; text-decoration: none;
    }
    .pfx-sidebar-item:hover { color: var(--aim-ink); text-decoration: none; }
    .pfx-sidebar-item.active {
        background: var(--aim-tint); color: var(--aim-ink); font-weight: 600;
    }
    .pfx-sidebar-item.danger { color: var(--aim-danger); }
    .pfx-sidebar-divider {
        height: 1px; background: var(--aim-line-soft); margin: 14px 0;
    }
    .pfx-sidebar-item svg { width: 16px; height: 16px; }

    .pfx-grid-2-cards {
        display: grid;
        grid-template-columns: 1.1fr 1fr;
        gap: 18px;
    }
    .pfx-calorie-tile .num { font-size: 56px; }
    .pfx-plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .pfx-plan-top {
        display: grid; grid-template-columns: 1fr 1.6fr; gap: 18px; align-items: stretch;
    }
    .pfx-member-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
    .pfx-member-row {
        border-bottom: 1px solid var(--aim-line-soft);
    }
    .pfx-provider-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* Avatar upload form helper — invisible file input */
.pfx-file-input { display: none; }

/* Dark mode adjustments — keep ink contrast */
[data-theme="dark"] .pfx-card,
[data-theme="dark"] .pfx-snapshot,
[data-theme="dark"] .pfx-member-list,
[data-theme="dark"] .pfx-account-list,
[data-theme="dark"] .pfx-provider-card {
    background: var(--bg-layer1);
    border-color: var(--border-color);
}
[data-theme="dark"] .pfx-input,
[data-theme="dark"] .pfx-select {
    background: var(--bg-layer2);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .pfx-chip {
    background: var(--bg-layer2);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .pfx-chip.checked,
[data-theme="dark"] .pfx-chip:has(input:checked) {
    background: var(--accent); border-color: var(--accent); color: #fff;
}
[data-theme="dark"] .pfx-sidebar-item.active {
    background: var(--bg-layer2); color: var(--text-primary);
}
[data-theme="dark"] .pfx-tab.active {
    background: transparent;
    color: var(--text-primary);
}
[data-theme="dark"] .pfx-tab.active::after {
    background: var(--text-primary);
}

/* ── Admin tips ─────────────────────────────────────────────────────── */
.badge-warning { background: #f4d35e; color: #5b3a00; }
.badge-muted   { background: var(--bg-layer2); color: var(--text-tertiary); }

.admin-tip-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: var(--font-size-s);
    max-width: 360px;
}
.admin-tip-meta { color: var(--text-tertiary); font-size: var(--font-size-xs); }

.admin-coverage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-top: var(--space-3);
}
.admin-coverage-cell {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: var(--space-3);
    background: var(--bg-layer1);
}
.admin-coverage-pct {
    font-size: 28px;
    font-weight: 700;
    margin: 4px 0 6px;
    color: var(--text-primary);
}

.admin-form-grid { display: flex; flex-direction: column; gap: var(--space-4); }
.admin-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
}
.admin-form-preview { padding: var(--space-3); background: var(--bg-layer1); border-radius: 8px; }
.admin-preview-card {
    margin-top: 6px;
    padding: var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: var(--font-size-s);
    color: var(--text-primary);
    min-height: 1.6em;
}
.admin-form-actions {
    margin-top: var(--space-4);
    display: flex;
    gap: var(--space-2);
}
.admin-audit {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--border-color);
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* ── Import Foods validation preview ────────────────────────────────── */
.import-preview-summary {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-top: var(--space-2);
}
.import-preview-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 999px;
    font-size: var(--font-size-xs); font-weight: 600;
    border: 1px solid transparent;
    line-height: 1.6;
}
.import-preview-pill strong { font-weight: 700; }
.import-preview-pill-create   { background: rgba(122,144,114,0.15); color: #3F6244; }
.import-preview-pill-update   { background: rgba(217,160,91,0.18); color: #8C6322; }
.import-preview-pill-nochange { background: var(--bg-layer1); color: var(--text-tertiary); }
.import-preview-pill-skip     { background: rgba(180,90,74,0.15); color: #B45A4A; }

.import-preview-changes,
.import-preview-warnings {
    list-style: none; padding: 0; margin: 0;
    font-size: var(--font-size-s);
}
.import-preview-changes li { padding: 3px 0; line-height: 1.45; }
.import-preview-warnings   { margin-top: 6px; color: #8C6322; }
.import-preview-warnings li::before { content: "⚠ "; }

.import-preview-from {
    color: var(--text-tertiary); text-decoration: line-through;
    margin-right: 6px;
}
.import-preview-arrow { color: var(--text-tertiary); margin-right: 6px; }
.import-preview-to {
    color: var(--text-primary); font-weight: 500;
    overflow-wrap: anywhere;
}

/* =====================================================================
   AIM — Recipe browse + detail (matches Documentation/Designs/recipe_handoff)
   Scoped under .aim-r so it reuses the existing token system.
   ===================================================================== */

/* ── Page wrapper (shared by browse + detail) ─────────────────────── */
.aim-r .r-page {
    padding: 6px 16px 28px; display: flex; flex-direction: column; gap: 18px;
    min-width: 0; max-width: 100%; width: 100%;
}
.aim-r .r-page > * { min-width: 0; max-width: 100%; }

.aim-r .r-back {
    background: transparent; border: 0; padding: 0; cursor: pointer;
    color: var(--aim-ink-soft); font-size: 13px; text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
}
.aim-r .r-back:hover { color: var(--aim-ink); text-decoration: none; }

/* ────────────────────────────────────────────────────────────────────
   DETAIL
   ──────────────────────────────────────────────────────────────────── */

.aim-r .r-detail .r-page { padding-bottom: 96px; }   /* leave room for sticky footer */

/* Layout — mobile = flex column; desktop = 2-col grid (handled below). */
.aim-r .r-layout {
    display: flex; flex-direction: column; gap: 22px;
}
.aim-r .r-aside { display: contents; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.aim-r .r-hero {
    position: relative; overflow: hidden; border-radius: 18px;
    background: var(--aim-bg-soft);
    aspect-ratio: 4 / 3; max-height: 420px;
}
.aim-r .r-hero-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; display: block;
}
.aim-r .r-hero-placeholder {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    color: var(--aim-ink-mute); padding: 24px;
}
.aim-r .r-hero-placeholder-icon { opacity: 0.5; }

.aim-r .r-hero-chip {
    position: absolute; left: 14px; bottom: 14px; z-index: 1;
}

/* ── Title block ──────────────────────────────────────────────────── */
.aim-r .r-title { display: flex; flex-direction: column; gap: 10px; }
.aim-r .r-title-h     { margin: 4px 0 0; font-size: 32px; line-height: 1.05; }
.aim-r .r-title-sub   { margin: 0; }
.aim-r .r-title-tags  { display: flex; flex-wrap: wrap; gap: 6px; }
.aim-r .r-title-fav   {
    cursor: pointer; background: var(--aim-bg-card);
    border: 1px solid var(--aim-line); color: var(--aim-ink);
}
.aim-r .r-title-fav.favorited { background: var(--aim-ink); color: #fff; border-color: var(--aim-ink); }
.aim-r .r-title-fav svg { fill: currentColor; }
.aim-r .r-title-banner { margin-top: 4px; }

/* ── Vitals row + actions card ────────────────────────────────────── */
.aim-r .r-vitals-card {
    display: flex; flex-direction: column; gap: 14px;
    background: transparent; border: 0; padding: 0;
}
.aim-r .r-vitals {
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding: 14px 0;
    border-top: 1px solid var(--aim-line-soft);
    border-bottom: 1px solid var(--aim-line-soft);
}
.aim-r .r-stat { text-align: left; padding: 0 10px; }
.aim-r .r-stat + .r-stat { border-left: 1px solid var(--aim-line-soft); }
.aim-r .r-stat-num {
    font-family: var(--aim-serif); font-size: 22px; line-height: 1; color: var(--aim-ink);
    font-variant-numeric: tabular-nums;
}
.aim-r .r-stat-num small {
    font-family: var(--aim-sans); font-size: 12px; color: var(--aim-ink-soft);
    margin-left: 3px; font-weight: 400;
}
.aim-r .r-stat-num.r-stat-muted { color: var(--aim-ink-mute); }
.aim-r .r-stat .label { margin-top: 6px; }

.aim-r .r-vitals-actions { display: none; }   /* mobile uses sticky footer; desktop reveals this */

.aim-r .r-vitals-save.favorited { background: var(--aim-ink); color: #fff; border-color: var(--aim-ink); }

/* ── Card head (shared by Macros, Ingredients, Method) ────────────── */
.aim-r .r-card-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.aim-r .r-card-title { margin: 4px 0 0; }
.aim-r .r-card-meta  { font-size: 12px; color: var(--aim-ink-soft); }

/* ── Macros card ─────────────────────────────────────────────────── */
.aim-r .r-macros-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.aim-r .r-macros-rows { display: flex; flex-direction: column; gap: 10px; }
.aim-r .r-macro-row {
    display: grid; grid-template-columns: 92px 1fr 56px; gap: 12px; align-items: center;
}
.aim-r .r-macro-lbl { font-size: 12.5px; color: var(--aim-ink); font-weight: 500; }
.aim-r .r-macro-val {
    font-size: 12px; color: var(--aim-ink-soft); text-align: right;
    font-variant-numeric: tabular-nums;
}
.aim-r .r-macro-val span { margin-left: 2px; }
.aim-r .r-bar { height: 6px; border-radius: 99px; background: var(--aim-line-soft); overflow: hidden; }
.aim-r .r-bar-fill { height: 100%; background: var(--aim-ink); width: var(--r-bar-pct, 0%); }

/* ── Tabs (mobile only) ──────────────────────────────────────────── */
.aim-r .r-tabs-bar { display: block; }
.aim-r .r-tabs { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.aim-r .r-tabs .a-tab { text-align: center; }

.aim-r .r-panel { display: none; }
.aim-r .r-panel.is-active { display: block; }

/* ── Ingredients card ────────────────────────────────────────────── */
.aim-r .r-ingredients { padding: 18px; flex-direction: column; gap: 14px; }
.aim-r .r-ingredients.is-active { display: flex; }
.aim-r .r-add-grocery {
    font-size: 11px; padding: 4px 10px; cursor: pointer;
    background: var(--aim-bg-card); color: var(--aim-ink); border: 1px solid var(--aim-line);
}
.aim-r .r-add-grocery[disabled] { opacity: 0.6; cursor: not-allowed; }

.aim-r .r-servings {
    background: var(--aim-bg-soft); border-radius: 12px; padding: 12px 14px;
    display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center;
}
.aim-r .r-servings-lbl { font-size: 12.5px; font-weight: 600; color: var(--aim-ink); margin: 0; }
.aim-r .r-servings-controls {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 14px; font-weight: 600; color: var(--aim-ink);
}
.aim-r .r-servings-controls #servings-value {
    min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums;
}
.aim-r .r-step-btn { padding: 4px 12px; font-size: 14px; line-height: 1; }
.aim-r .r-servings-range { grid-column: 1 / -1; width: 100%; }

.aim-r .r-ingredient-list { list-style: none; padding: 0; margin: 0; }
.aim-r .r-ingredient-row {
    display: grid;
    grid-template-columns: 20px 70px 1fr auto;
    gap: 12px; align-items: center;
    padding: 11px 0;
    border-top: 1px solid var(--aim-line-soft);
}
.aim-r .r-ingredient-row:first-child { border-top: 0; }
.aim-r .r-ingredient-check { width: 16px; height: 16px; accent-color: var(--aim-ink); margin: 0; }
.aim-r .r-ingredient-qty {
    font-size: 13.5px; font-weight: 600; color: var(--aim-ink);
    text-align: right; font-variant-numeric: tabular-nums;
}
.aim-r .r-ingredient-name { font-size: 13.5px; color: var(--aim-ink-2); }
.aim-r .r-ingredient-cost { font-size: 12px; color: var(--aim-ink-soft); white-space: nowrap; }

.aim-r .r-cost-foot {
    margin-top: 4px; padding-top: 12px;
    border-top: 1px solid var(--aim-line-soft);
    display: flex; flex-direction: column; gap: 4px;
}
.aim-r .r-cost-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--aim-ink-2); padding: 2px 0; }
.aim-r .r-cost-row strong { color: var(--aim-ink); }
.aim-r .r-cost-hint { font-size: 11.5px; color: var(--aim-ink-soft); margin-top: 4px; line-height: 1.4; }

/* ── Why this fits ───────────────────────────────────────────────── */
.aim-r .r-fits { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.aim-r .r-fits-rows { display: flex; flex-direction: column; gap: 4px; }
.aim-r .r-fits-row {
    display: flex; gap: 12px; align-items: flex-start; padding: 8px 0;
    text-decoration: none; color: var(--aim-ink);
    border-top: 1px solid var(--aim-line-soft);
}
.aim-r .r-fits-row:first-child { border-top: 0; }
.aim-r .r-fits-row:hover { color: var(--aim-ink); text-decoration: none; }
.aim-r .r-fits-check {
    width: 22px; height: 22px; flex-shrink: 0; border-radius: 99px;
    background: var(--aim-tint); color: var(--aim-ink);
    display: inline-flex; align-items: center; justify-content: center;
    margin-top: 1px;
}
.aim-r .r-fits-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.aim-r .r-fits-name { font-size: 13.5px; font-weight: 600; color: var(--aim-ink); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.aim-r .r-fits-primary { font-size: 10.5px; padding: 2px 8px; }
.aim-r .r-fits-sub  { font-size: 12.5px; color: var(--aim-ink-soft); line-height: 1.45; }
.aim-r .r-fits-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── Method section ─────────────────────────────────────────────── */
.aim-r .r-method { flex-direction: column; gap: 14px; }
.aim-r .r-method.is-active { display: flex; }
.aim-r .r-method-head { align-items: flex-start; }
.aim-r .r-cookalong { font-size: 11.5px; padding: 5px 12px; cursor: pointer; flex-shrink: 0; }
.aim-r .r-method-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.aim-r .r-method-step {
    padding: 16px; display: flex; gap: 16px; align-items: flex-start;
}
.aim-r .r-method-num {
    font-family: var(--aim-serif); font-size: 24px; line-height: 1;
    color: var(--aim-ink-mute); min-width: 36px; flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.aim-r .r-method-body { font-size: 14px; line-height: 1.55; color: var(--aim-ink-2); flex: 1; min-width: 0; }
.aim-r .r-method-fallback {
    background: var(--aim-bg-card); border: 1px solid var(--aim-line); border-radius: 14px;
    padding: 16px; line-height: 1.7; color: var(--aim-ink-2); font-size: 14px;
}

/* ── Notes section ──────────────────────────────────────────────── */
.aim-r .r-notes {
    padding: 20px; background: var(--aim-tint); border-color: transparent;
    display: flex; flex-direction: column; gap: 10px;
}
.aim-r .r-notes-body { margin: 0; color: var(--aim-ink-2); }
.aim-r .r-notes-body.r-notes-empty { color: var(--aim-ink-soft); font-style: italic; }

/* ── Sticky footer actions (mobile) ─────────────────────────────── */
.aim-r .r-sticky-foot {
    position: sticky; bottom: 0; left: 0; right: 0; z-index: 5;
    background: var(--aim-bg);
    border-top: 1px solid var(--aim-line-soft);
    padding: 12px 16px;
    margin: 0 -16px -28px;
    display: flex; gap: 10px;
}
.aim-r .r-foot-save { flex: 1; padding: 13px; font-size: 13.5px; }
.aim-r .r-foot-save.favorited { background: var(--aim-ink); color: #fff; border-color: var(--aim-ink); }
.aim-r .r-foot-add  { flex: 2; padding: 13px; font-size: 13.5px; }

/* ── Desktop layout (≥900px) ────────────────────────────────────── */
@media (min-width: 900px) {
    .aim-r .r-detail .r-page { padding: 24px 48px 56px; max-width: 1200px; margin: 0 auto; gap: 24px; }
    .aim-r .r-detail .r-page { padding-bottom: 56px; }

    .aim-r .r-layout {
        display: grid;
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        column-gap: 32px;
        row-gap: 0;
        align-items: start;
    }

    /* Place explicit children of .r-layout */
    .aim-r .r-layout > .r-hero  { grid-column: 1; grid-row: 1; }
    .aim-r .r-layout > .r-title { grid-column: 1; grid-row: 2; padding-top: 24px; }
    .aim-r .r-layout > .r-tabs-bar { display: none; }
    .aim-r .r-layout > .r-method { grid-column: 1; grid-row: 3; padding-top: 28px; }
    .aim-r .r-layout > .r-notes  { grid-column: 1; grid-row: 4; margin-top: 28px; }

    /* Right column wrapper becomes sticky */
    .aim-r .r-layout > .r-aside {
        display: flex; flex-direction: column; gap: 18px;
        grid-column: 2; grid-row: 1 / span 4;
        position: sticky; top: 24px;
    }

    /* On desktop the vitals card gets its full card chrome */
    .aim-r .r-vitals-card {
        background: var(--aim-bg-card); border: 1px solid var(--aim-line);
        border-radius: 14px; padding: 22px;
    }
    .aim-r .r-vitals {
        border-top: 0; border-bottom: 0; padding: 0 0 16px;
    }
    .aim-r .r-vitals-actions {
        display: flex; gap: 8px; padding-top: 16px;
        border-top: 1px solid var(--aim-line-soft);
    }
    .aim-r .r-vitals-save { flex: 1; padding: 11px; font-size: 13px; }
    .aim-r .r-vitals-add  { flex: 1.6; padding: 11px; font-size: 13px; }

    /* On desktop all panels are visible */
    .aim-r .r-panel { display: block; }
    .aim-r .r-ingredients,
    .aim-r .r-method { display: flex; }

    /* Hide sticky footer on desktop */
    .aim-r .r-sticky-foot { display: none; }

    /* Bigger title on desktop */
    .aim-r .r-title-h { font-size: 44px; }

    /* Method/Notes spacing on desktop */
    .aim-r .r-method-num { font-size: 30px; min-width: 48px; }
    .aim-r .r-method-step { padding: 20px; gap: 18px; }
    .aim-r .r-method-body { font-size: 15px; }
}

/* ────────────────────────────────────────────────────────────────────
   BROWSE
   ──────────────────────────────────────────────────────────────────── */

.aim-r .r-browse-head { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; }
.aim-r .r-browse-h    { margin: 4px 0 0; font-size: 30px; line-height: 1.05; }
.aim-r .r-browse-sub  { margin: 6px 0 0; }

/* Search + chips form */
.aim-r .r-browse-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}
.aim-r .r-browse-search { grid-column: 1; }
.aim-r .r-browse-search-btn { grid-column: 2; padding: 11px 18px; font-size: 13.5px; }
.aim-r .r-meal-chips {
    grid-column: 1 / -1;
    display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px;
    -ms-overflow-style: none; scrollbar-width: none;
}
.aim-r .r-meal-chips::-webkit-scrollbar { display: none; }
.aim-r .r-meal-chips .chip { flex-shrink: 0; text-decoration: none; }
.aim-r .r-meal-chips .chip:hover { text-decoration: none; }

/* Coach's pick hero */
.aim-r .r-coach-hero {
    display: flex; flex-direction: column; justify-content: flex-end;
    min-height: 240px; padding: 20px;
    background-size: cover; background-position: center;
    background-color: var(--aim-bg-soft);
    text-decoration: none;
}
.aim-r .r-coach-hero:hover { color: #fff; text-decoration: none; }
.aim-r .r-coach-top { margin-bottom: auto; }
.aim-r .r-coach-title {
    margin: 0; color: #fff; font-size: 28px; line-height: 1.05;
}
.aim-r .r-coach-meta {
    display: flex; gap: 10px; margin-top: 10px;
    font-size: 12px; color: rgba(255,255,255,0.86);
}

/* Matches header */
.aim-r .r-browse-matches-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 12px; flex-wrap: wrap;
}
.aim-r .r-browse-matches-h { margin: 4px 0 0; font-size: 22px; }
.aim-r .r-browse-matches-meta { font-size: 12.5px; color: var(--aim-ink-soft); }

/* Pager */
.aim-r .r-browse-pager {
    display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 6px;
}
.aim-r .r-browse-pager-meta { font-size: 12.5px; color: var(--aim-ink-soft); }
.aim-r .r-browse-pager .btn-pill.is-disabled { opacity: 0.4; pointer-events: none; }

/* Desktop tweaks for browse */
@media (min-width: 900px) {
    .aim-r .r-browse .r-page { padding: 24px 48px 56px; max-width: 1320px; margin: 0 auto; gap: 24px; }
    .aim-r .r-browse-h { font-size: 48px; }
    .aim-r .r-browse-controls {
        grid-template-columns: minmax(0, 480px) 1fr auto;
        align-items: center;
    }
    .aim-r .r-browse-search { grid-column: 1; }
    .aim-r .r-meal-chips    { grid-column: 2; padding-bottom: 0; }
    .aim-r .r-browse-search-btn { grid-column: 3; }
    .aim-r .r-coach-hero {
        min-height: 360px; padding: 32px; border-radius: 20px;
    }
    .aim-r .r-coach-title { font-size: 44px; line-height: 1; }
    .aim-r .r-browse-matches-h { font-size: 28px; }
}

/* ── Getting-started checklist (dashboard card) ─────────────────────────────
   Lives at the top of /Home/Dashboard above the tip banner. Visual language
   mirrors .dash-tl-empty / .dash-tl-side-card so the card sits naturally next
   to the meal timeline. Distinct from the signup `.onb-*` namespace. */
.aim-r .gs-card {
    background: var(--aim-bg-card);
    border: 1px solid var(--aim-line);
    border-radius: 18px;
    overflow: hidden;
}
.aim-r .gs-card-complete {
    background: var(--aim-bg-soft);
}
.aim-r .gs-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.aim-r .gs-summary::-webkit-details-marker {
    display: none;
}
.aim-r .gs-summary:hover {
    background: var(--aim-bg-soft);
}
.aim-r .gs-card[open] .gs-summary {
    border-bottom: 1px solid var(--aim-line);
}
.aim-r .gs-summary-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}
.aim-r .gs-summary-title {
    font-family: var(--aim-serif);
    font-size: 22px;
    line-height: 1.15;
    font-weight: 400;
    color: var(--aim-ink);
}
.aim-r .gs-summary-title .ital {
    font-style: italic;
}
.aim-r .gs-summary-meta {
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--aim-ink-soft);
}
.aim-r .gs-summary-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--aim-ink);
    border-radius: 999px;
    background: var(--aim-ink);
    color: var(--aim-bg);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
.aim-r .gs-card[open] .gs-summary-cta {
    background: transparent;
    color: var(--aim-ink);
}
.aim-r .gs-summary-cta-open {
    display: none;
}
.aim-r .gs-card[open] .gs-summary-cta-closed {
    display: none;
}
.aim-r .gs-card[open] .gs-summary-cta-open {
    display: inline;
}
.aim-r .gs-summary-chev {
    transition: transform .15s ease;
}
.aim-r .gs-card[open] .gs-summary-chev {
    transform: rotate(180deg);
}
.aim-r .gs-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.aim-r .gs-progress {
    display: flex;
    gap: 4px;
}
.aim-r .gs-progress .s {
    flex: 1;
    height: 7px;
    border-radius: 999px;
    background: var(--aim-line-soft);
}
.aim-r .gs-progress .s.done {
    background: var(--aim-ink);
}
.aim-r .gs-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.aim-r .gs-step {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 14px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-card);
}
.aim-r .gs-card-complete .gs-step {
    background: var(--aim-bg);
}
.aim-r .gs-step.is-next {
    border-color: var(--aim-accent);
    box-shadow: 0 0 0 3px rgba(217,160,91,0.12);
}
.aim-r .gs-step.is-done {
    opacity: 0.78;
}
.aim-r .gs-step-marker {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1.5px solid var(--aim-ink-mute);
    background: var(--aim-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    margin-top: 2px;
}
.aim-r .gs-step.is-next .gs-step-marker {
    border-color: var(--aim-accent);
    background: var(--aim-bg-card);
}
.aim-r .gs-step.is-done .gs-step-marker {
    background: var(--aim-ink);
    border-color: var(--aim-ink);
    color: var(--aim-bg);
}
.aim-r .gs-step-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.aim-r .gs-step-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.aim-r .gs-step-title {
    margin: 0;
    font-family: var(--aim-serif);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.2;
    color: var(--aim-ink);
}
.aim-r .gs-step.is-done .gs-step-title {
    text-decoration: line-through;
    text-decoration-color: var(--aim-line);
    text-decoration-thickness: 1.5px;
}
.aim-r .gs-step-tag {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 1px 7px;
    border: 1px solid var(--aim-line);
    border-radius: 999px;
    background: var(--aim-bg-soft);
    color: var(--aim-ink-soft);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.aim-r .gs-step-status {
    font-size: 11px;
    color: var(--aim-ink-soft);
    font-weight: 600;
}
.aim-r .gs-step-blurb {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--aim-ink-soft);
}
.aim-r .gs-step-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}
.aim-r .gs-step-learn,
.aim-r .gs-step-learn:visited {
    color: var(--aim-ink-soft);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
}
.aim-r .gs-step-learn:hover {
    color: var(--aim-ink);
    text-decoration: underline;
}

/* ── Getting-started reference page (/Help/GettingStarted) ───────────────── */
.aim-r .gs-page-toc {
    margin: 8px 0 0;
    padding: 16px 18px;
    border: 1px solid var(--aim-line);
    border-radius: 14px;
    background: var(--aim-bg-soft);
}
.aim-r .gs-page-toc ul {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
.aim-r .gs-page-toc a,
.aim-r .gs-page-toc a:visited {
    color: var(--aim-ink);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
}
.aim-r .gs-page-toc a:hover {
    text-decoration: underline;
}
.aim-r .gs-page-section {
    scroll-margin-top: 80px;
    padding: 22px 20px;
    border: 1px solid var(--aim-line);
    border-radius: 16px;
    background: var(--aim-bg-card);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.aim-r .gs-page-section h2 {
    margin: 4px 0 0;
    font-family: var(--aim-serif);
    font-weight: 400;
    font-size: 28px;
    line-height: 1.1;
    color: var(--aim-ink);
}
.aim-r .gs-page-section p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--aim-ink-2);
}
.aim-r .gs-page-why {
    padding: 10px 12px;
    border-left: 3px solid var(--aim-accent);
    background: var(--aim-bg-soft);
    border-radius: 0 10px 10px 0;
    color: var(--aim-ink) !important;
    font-size: 13px !important;
}
.aim-r .gs-page-section .dash-tl-btn {
    align-self: flex-start;
    margin-top: 4px;
}
.aim-r .gs-page-outro {
    background: var(--aim-bg-soft);
}

@media (min-width: 720px) {
    .aim-r .gs-page-toc ul {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 900px) {
    .aim-r .gs-summary {
        padding: 22px 24px;
    }
    .aim-r .gs-summary-title {
        font-size: 26px;
    }
    .aim-r .gs-body {
        padding: 20px 24px 24px;
    }
    .aim-r .gs-steps {
        gap: 14px;
    }
    .aim-r .gs-step {
        padding: 16px 18px;
    }
    .aim-r .gs-step-title {
        font-size: 20px;
    }
    .aim-r .gs-page-section {
        padding: 28px 26px;
    }
    .aim-r .gs-page-section h2 {
        font-size: 32px;
    }
}

