/* ── Design tokens ────────────────────────────────────────────────────── */
:root {
    --green:        #2e7d32;
    --green-dark:   #1b5e20;
    --green-mid:    #388e3c;
    --green-light:  #a5d6a7;
    --green-pale:   #e8f5e9;
    --yellow:       #f9a825;
    --yellow-bg:    #fff8e1;
    --yellow-text:  #8d6e00;   /* yellow readable as text on white */
    --red:          #c62828;
    --red-bg:       #ffebee;
    --bg:           #f1f4f1;
    --surface:      #ffffff;
    --border:       #dde6dd;
    --text:         #1a1a1a;
    --text-muted:   #6b7280;
    --radius:       10px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
    --shadow-md:    0 4px 12px rgba(0,0,0,.1);
    --header-h:     60px;
}

/* ── Reset & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
#printView { display: none; } /* shown by print.css when printing */
body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
button { cursor: pointer; }
input[type=number], input[type=search], input[type=text] {
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding:16px;
    outline: none;
    width: 100%;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(46,125,50,.15); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--green);  color: #fff; }
.btn-primary:hover  { background: var(--green-dark); }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--green);
    color: var(--green);
    padding: 6px 14px;
    border-radius: 8px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
}
.btn-outline:hover { background: var(--green-pale); }
.btn-text { background: none; border: none; color: var(--green); font: inherit; font-size: 13px; padding: 0; text-decoration: underline; }
.btn-icon {
    background: none;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 15px;
    transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--red-bg); color: var(--red); }

/* ── Header ───────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: var(--green-dark);
    box-shadow: var(--shadow-md);
}
.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
}
.logo { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 17px; font-weight: 700; flex: 1; }
.logo-icon { font-size: 22px; }
a.logo { text-decoration: none; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 400;
    background: var(--surface);
    color: var(--green-dark);
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
}
.skip-link:focus { left: 8px; }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav-link {
    color: rgba(255,255,255,.8);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background .15s, color .15s;
}
.site-nav-link:hover { background: rgba(255,255,255,.15); color: #fff; }
.site-nav-link.active { background: rgba(255,255,255,.2); color: #fff; }
a.btn, a.btn-outline { text-decoration: none; }

.week-nav { display: flex; align-items: center; gap: 10px; }
.week-label { color: #fff; font-size: 14px; font-weight: 600; min-width: 200px; text-align: center; }
.nav-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.nav-btn:hover { background: rgba(255,255,255,.3); }
.btn-outline { color: #fff; border-color: rgba(255,255,255,.6); }
.btn-outline:hover { background: rgba(255,255,255,.15); }

/* ── Day tabs ─────────────────────────────────────────────────────────── */
.day-tabs-wrapper {
    background: var(--green);
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    position: sticky;
    top: var(--header-h);
    z-index: 99;
    overflow-x: auto;
}
.day-tabs {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    padding: 0 16px;
}
.day-tab {
    flex: 1;
    min-width: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 4px;
    border: none;
    background: none;
    color: rgba(255,255,255,.75);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s;
    gap: 3px;
    position: relative;
}
.day-tab:hover { color: #fff; }
.day-tab.active { color: #fff; border-color: #fff; }
.day-tab .tab-day { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.day-tab .tab-date { font-size: 18px; font-weight: 700; line-height: 1; }
.day-tab .tab-cal {
    font-size: 10px;
    background: rgba(255,255,255,.2);
    border-radius: 12px;
    padding: 1px 7px;
}
.day-tab.goal-met .tab-cal { background: rgba(165,214,167,.4); }
.day-tab.goal-over .tab-cal { background: rgba(198,40,40,.4); }

/* ── Main layout ──────────────────────────────────────────────────────── */
.planner-main {
    max-width: 1280px;
    margin: 20px auto;
    padding: 0 16px 40px;
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
}

/* ── Meal grid ────────────────────────────────────────────────────────── */
.meal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.meal-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.meal-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--green-pale);
    border-bottom: 1px solid var(--border);
}
.meal-icon { font-size: 18px; }
.meal-name { font-weight: 700; font-size: 14px; color: var(--green-dark); flex: 1; }
.meal-cal-total { font-size: 12px; color: var(--text-muted); }
.meal-card-body { padding: 8px 12px; min-height: 60px; }

.food-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 4px;
    border-bottom: 1px solid #f3f4f6;
}
.food-item:last-child { border-bottom: none; }
.food-info { flex: 1; }
.food-name  { font-weight: 600; font-size: 13px; }
.food-brand { font-size: 11px; color: var(--text-muted); }
.food-macros {
    display: flex;
    gap: 10px;
    margin-top: 3px;
    flex-wrap: wrap;
}
.macro-badge {
    font-size: 11px;
    color: var(--text-muted);
    background: #f3f4f6;
    border-radius: 4px;
    padding: 1px 6px;
}
.macro-badge.cal { background: var(--green-pale); color: var(--green-dark); font-weight: 600; }

.meal-add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 12px;
    padding: 16px;
    background: none;
    border: 1.5px dashed var(--green-light);
    border-radius: 8px;
    color: var(--green);
    font: inherit;
    font-size: 13px;
    width: calc(100% - 24px);
    transition: border-color .15s, background .15s;
}
.meal-add-btn:hover { border-color: var(--green); background: var(--green-pale); }

/* ── Nutrition panel ──────────────────────────────────────────────────── */
.nutrition-panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px;
    position: sticky;
    top: calc(var(--header-h) + 52px + 12px);
}
.panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.nutrient-row {
    margin-bottom: 14px;
}
.nutrient-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
}
.nutrient-name { font-weight: 600; }
.nutrient-value { color: var(--text-muted); }
.progress-bar-track {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .4s ease;
    background: var(--green);
}
.progress-bar-fill.warning { background: var(--yellow); }
.progress-bar-fill.over    { background: var(--red); }
.calories-display {
    text-align: center;
    padding: 14px 0 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.calories-num { font-size: 30px; font-weight: 800; color: var(--green-dark); line-height: 1; }
.calories-goal { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.calories-status { font-size: 11px; font-weight: 600; margin-top: 4px; }
.calories-status.ok   { color: var(--green); }
.calories-status.low  { color: var(--yellow-text); }
.calories-status.over { color: var(--red); }

/* ── Week summary ─────────────────────────────────────────────────────── */
.week-summary-section {
    max-width: 1280px;
    margin: 0 auto 40px;
    padding: 0 16px;
}
.week-summary-toggle {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 18px;
    text-align: left;
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    color: var(--green-dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    transition: background .15s;
}
.week-summary-toggle:hover { background: var(--green-pale); }
.week-summary-body {
    margin-top: 8px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: auto;
}
.week-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.week-table th, .week-table td {
    padding: 10px 14px;
    text-align: right;
    border-bottom: 1px solid #f3f4f6;
}
.week-table th { font-weight: 700; color: var(--text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: .5px; background: #fafafa; }
.week-table td:first-child, .week-table th:first-child { text-align: left; }
.week-table tr:last-child td { border-bottom: none; }
.week-table .cell-good { color: var(--green); font-weight: 600; }
.week-table .cell-low  { color: var(--yellow-text); font-weight: 600; }
.week-table .cell-over { color: var(--red); font-weight: 600; }
.week-table .day-active { background: var(--green-pale); }

/* ── Small button variant ────────────────────────────────────────────── */
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Search modal ─────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal {
    background: var(--surface);
    border-radius: 14px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    animation: modalIn .2s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    display: flex;
    align-items: center;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.modal-title { font-size: 16px; font-weight: 700; flex: 1; color: var(--green-dark); }
.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #f3f4f6; color: var(--text); }
.modal-body { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.search-row { position: relative; }
.search-input { padding-right: 36px; font-size: 14px; }
.search-spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    animation: spin 1s linear infinite;
    color: var(--green);
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

.search-results { border: 1px solid var(--border); border-radius: 8px; overflow-y: auto; max-height: 260px; }
.search-hint, .search-empty { padding: 16px; color: var(--text-muted); font-size: 13px; text-align: center; }
.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background .12s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item.selected { background: var(--green-pale); }
.result-info { flex: 1; }
.result-name { font-weight: 600; font-size: 13px; }
.result-brand { font-size: 11px; color: var(--text-muted); }
.result-type  { font-size: 10px; background: #f3f4f6; border-radius: 4px; padding: 1px 6px; color: var(--text-muted); }
.result-cal   { font-size: 13px; font-weight: 700; color: var(--green-dark); white-space: nowrap; }

/* ── Modal tabs ───────────────────────────────────────────────────────── */
.modal-tab-bar {
    display: flex;
    border-bottom: 2px solid var(--border);
    gap: 0;
}
.modal-tab-btn {
    flex: 1;
    padding: 10px 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: color .15s, border-color .15s;
}
.modal-tab-btn:hover { color: var(--green); }
.modal-tab-btn.active { color: var(--green-dark); border-color: var(--green); }
.modal-tab-btn:disabled { opacity: .4; cursor: default; }

/* ── My Foods header ──────────────────────────────────────────────────── */
.mf-header { display: flex; justify-content: flex-end; padding-bottom: 6px; }

/* ── Custom food badge ────────────────────────────────────────────────── */
.badge-custom {
    display: inline-block;
    background: #e8f5e9;
    color: var(--green-dark);
    border: 1px solid var(--green-light);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    vertical-align: middle;
}

/* ── Custom food form ─────────────────────────────────────────────────── */
.cf-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.cf-row { display: flex; flex-direction: column; gap: 4px; }
.cf-row label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.cf-row input { font-size: 13px; }
.cf-row-full { grid-column: span 2; }
.cf-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cf-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    padding-top: 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}
.cf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cf-req { color: var(--red); }
.cf-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* Selected food panel */
.selected-panel {
    background: var(--green-pale);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.selected-header { display: flex; justify-content: space-between; align-items: flex-start; }
.selected-name { font-weight: 700; font-size: 14px; }
.selected-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.servings-row  { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.servings-label { font-size: 13px; font-weight: 600; flex: 1; }
.serving-unit { font-weight: 400; color: var(--text-muted); }
.servings-field { width: 90px; text-align: center; }
.nutrient-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.np-cell {
    background: var(--surface);
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
}
.np-val  { font-size: 16px; font-weight: 800; color: var(--green-dark); line-height: 1; }
.np-name { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── Goals form ───────────────────────────────────────────────────────── */
.usda-callout {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--green-pale);
    border: 1px solid var(--green-light);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--green-dark);
    line-height: 1.5;
}
.usda-badge {
    flex-shrink: 0;
    background: var(--green);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .5px;
    border-radius: 4px;
    padding: 2px 6px;
    margin-top: 1px;
}
.goals-form  { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.goal-row    { display: flex; align-items: center; gap: 12px; }
.goal-row--calories { padding-bottom: 4px; }
.goal-row label {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.unit, .goal-unit { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.goal-hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--green-mid);
}
.goal-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.goal-input-wrap input { width: 90px; text-align: right; }
.goals-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 2px;
}
.goals-divider span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    white-space: nowrap;
}
.goals-divider::before, .goals-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.goals-divider::before { display: none; }

/* ── Fitness profile ──────────────────────────────────────────────────── */
.fitness-form { display: flex; flex-direction: column; gap: 10px; }
.fitness-form .goals-divider::after { display: none; }
.fitness-form .goals-divider { justify-content: space-between; }
.unit-toggle { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); }
.unit-toggle label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.unit-toggle input { width: auto; accent-color: var(--green); }
.fitness-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.fitness-grid .cf-row { display: flex; flex-direction: column; gap: 4px; }
.fitness-grid .cf-row-full { grid-column: 1 / -1; }
.fitness-grid label { font-size: 13px; font-weight: 600; }
.fitness-grid .goal-input-wrap input { width: 80px; padding: 10px; }
.fit-pair { display: flex; gap: 10px; }
.fit-select {
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    background: var(--surface);
    width: 100%;
}
.fit-select:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px rgba(46,125,50,.15); }
#calcFitnessBtn { align-self: flex-start; }
.fitness-grid .goal-input-wrap input { width: 96px; -moz-appearance: textfield; appearance: textfield; }
.fitness-grid input::-webkit-outer-spin-button,
.fitness-grid input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fitness-form input::placeholder {
    color: #b0b7bf;
    font-style: italic;
    opacity: 1;
}
.fitness-form .field-missing {
    border-color: var(--red);
    background: var(--red-bg);
}
.fitness-form .field-missing:focus { box-shadow: 0 0 0 3px rgba(198,40,40,.15); }

.fitness-results { display: flex; flex-direction: column; gap: 10px; }
.bmi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    border-left: 4px solid;
}
.bmi-value { font-size: 28px; font-weight: 800; line-height: 1; }
.bmi-label { font-size: 14px; font-weight: 700; }
.bmi-meta  { font-size: 12px; color: var(--text-muted); }
.bmi-good    { background: var(--green-pale); border-color: var(--green); }
.bmi-good    .bmi-value { color: var(--green); }
.bmi-caution { background: var(--yellow-bg);  border-color: var(--yellow); }
.bmi-caution .bmi-value { color: var(--yellow-text); }
.bmi-warning { background: var(--red-bg);     border-color: var(--red); }
.bmi-warning .bmi-value { color: var(--red); }

.plan-prompt { font-size: 12px; color: var(--text-muted); }
.plan-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.plan-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font: inherit;
    text-align: left;
    transition: border-color .15s, background .15s;
}
.plan-option:hover { border-color: var(--green-light); background: var(--green-pale); }
.plan-option.selected { border-color: var(--green); background: var(--green-pale); box-shadow: 0 0 0 2px rgba(46,125,50,.2); }
.plan-label { font-size: 12px; font-weight: 700; }
.plan-cal   { font-size: 16px; font-weight: 800; color: var(--green-dark); }
.plan-rate  { font-size: 11px; color: var(--text-muted); }
.plan-floor { font-size: 11px; color: var(--yellow-text); font-weight: 600; }

/* ── Profile card & modal ─────────────────────────────────────────────── */
.profile-card {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.profile-card--empty { background: var(--green-pale); border-color: var(--green-light); }
.profile-card--empty .btn { align-self: flex-start; }
.profile-card-title { font-size: 13px; font-weight: 700; color: var(--green-dark); }
.profile-card-text  { font-size: 12px; color: var(--text-muted); }
.profile-card-text strong { color: var(--text); }
.profile-card-head { display: flex; align-items: center; gap: 8px; }
.profile-card-head .btn-text { margin-left: auto; font-size: 12px; }
.profile-card-cat { font-size: 13px; font-weight: 700; }
.bmi-chip {
    font-size: 12px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1.5px solid;
}
.bmi-chip.bmi-good    { color: var(--green);       background: var(--green-pale); border-color: var(--green); }
.bmi-chip.bmi-caution { color: var(--yellow-text); background: var(--yellow-bg);  border-color: var(--yellow); }
.bmi-chip.bmi-warning { color: var(--red);         background: var(--red-bg);     border-color: var(--red); }
.profile-intro { font-size: 13px; color: var(--text-muted); }
.profile-callout {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    border: 1px dashed var(--green-light);
    border-radius: 8px;
}
.profile-callout .btn-text { font-size: 12px; }

/* ── Vitamins & minerals ──────────────────────────────────────────────── */
.micro-title { margin-top: 22px; }
.micro-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 13px; }
.micro-count strong { font-size: 16px; color: var(--green-dark); }
.micro-over { color: var(--red); font-weight: 700; font-size: 12px; }
.micro-basis { font-size: 11px; color: var(--text-muted); margin: 2px 0 8px; }
.micro-basis .btn-text { font-size: 11px; }
.micro-note {
    font-size: 11px;
    color: var(--yellow-text);
    background: var(--yellow-bg);
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 8px;
}
.micro-group { margin-top: 6px; }
.micro-group summary {
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    padding: 4px 0;
}
.micro-row { padding: 5px 0; }
.micro-row .progress-bar-track { height: 5px; }
.micro-label { display: flex; align-items: baseline; gap: 6px; font-size: 12px; margin-bottom: 3px; }
.micro-icon {
    flex: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 800;
    line-height: 14px;
    text-align: center;
    color: #fff;
    align-self: center;
}
.micro-good    .micro-icon { background: var(--green); }
.micro-caution .micro-icon { background: var(--yellow); color: #5c4700; }
.micro-warning .micro-icon { background: var(--red); }
.micro-name  { font-weight: 600; flex: 1; min-width: 0; }
.micro-value { color: var(--text-muted); white-space: nowrap; }
.micro-pct   { font-weight: 700; min-width: 38px; text-align: right; }
.micro-good    .micro-pct { color: var(--green); }
.micro-caution .micro-pct { color: var(--yellow-text); }
.micro-warning .micro-pct { color: var(--red); }
.micro-partial { color: var(--yellow-text); font-weight: 800; cursor: help; }
.micro-footnote { font-size: 10px; color: var(--text-muted); margin-top: 8px; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    z-index: 300;
    animation: toastIn .25s ease;
    white-space: nowrap;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Header actions ───────────────────────────────────────────────────── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.auth-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-greeting {
    color: rgba(255,255,255,.9);
    font-size: 13px;
    font-weight: 600;
}
.auth-logout { color: rgba(255,255,255,.75); font-size: 12px; }
.auth-logout:hover { color: #fff; }
.auth-links { display: flex; align-items: center; gap: 8px; }

/* ── Inline form errors (profile modal) ───────────────────────────────── */
.auth-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
}

/* ── Site-wide flash messages (after login, logout…) ──────────────────── */
.site-flash {
    max-width: 1280px;
    margin: 12px auto 0;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid;
    width: calc(100% - 32px);
}
.site-flash--success { background: var(--green-pale); border-color: var(--green-light); color: var(--green-dark); }
.site-flash--info    { background: #eef4fb; border-color: #bcd3ee; color: #1d4f86; }
.site-flash--error   { background: var(--red-bg); border-color: #f5b5b5; color: var(--red); }

/* ── Home page ────────────────────────────────────────────────────────── */
.home-main {
    max-width: 760px;
    margin: 0 auto;
    padding: 56px 20px 24px;
    text-align: center;
}
.home-main h1 { font-size: 28px; line-height: 1.25; color: var(--green-dark); margin-bottom: 14px; }
.home-intro { font-size: 15px; color: var(--text-muted); margin-bottom: 24px; }
.home-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
a.btn-primary, a.btn-secondary { text-decoration: none; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.site-footer {
    margin-top: 40px;
    background: var(--surface);
    border-top: 3px solid var(--green);
    color: var(--text);
}
.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 20px;
    display: grid;
    grid-template-columns: 1.4fr 1fr auto;
    gap: 32px;
}
.footer-heading {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--green-dark);
    margin-bottom: 10px;
}
.footer-about p { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.footer-about a, .footer-nav a { color: var(--green); }
.footer-disclaimer { font-style: italic; }
.footer-nav { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.footer-nav a { text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; }

.legend-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.legend-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 4px solid;
    font-size: 13px;
}
.legend-swatch { flex: none; width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; }
.legend-good    { background: var(--green-pale); border-color: var(--green); }
.legend-good    .legend-swatch { background: var(--green); }
.legend-caution { background: var(--yellow-bg);  border-color: var(--yellow); }
.legend-caution .legend-swatch { background: var(--yellow); }
.legend-warning { background: var(--red-bg);     border-color: var(--red); }
.legend-warning .legend-swatch { background: var(--red); }

.footer-copy {
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 12px 20px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .planner-main { grid-template-columns: 1fr; }
    .nutrition-panel { position: static; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .footer-legend { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
    .meal-grid { grid-template-columns: 1fr; }
    .header-inner { gap: 8px; }
    .week-label { min-width: 140px; font-size: 12px; }
    .site-nav { display: none; }
    .fitness-grid { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; gap: 20px; }
}
