/* ── Design tokens ─────────────────────────────────────────── */
:root {
    --white:         #FFFFFF;
    --off-white:     #FAFAF8;
    --light-gray:    #F2F2F0;
    --border:        #D8D8D4;
    --border-light:  #EAEAE6;
    --text-main:     #1A1A1A;
    --text-soft:     #4A4A4A;
    --text-muted:    #8A8A88;

    --font-heading:  'Playfair Display', Georgia, serif;
    --font-body:     'Lato', 'Helvetica Neue', sans-serif;

    --shadow-soft:   0 1px 8px rgba(0, 0, 0, 0.06);
    --shadow-card:   0 2px 16px rgba(0, 0, 0, 0.09);
    --radius:        4px;
    --radius-sm:     2px;
}

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--text-main);
    background-color: var(--off-white);
    min-height: 100vh;
    line-height: 1.6;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 2.5rem;
}

.site-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 6vw, 3rem);
    font-weight: 400;
    color: var(--text-main);
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-transform: uppercase;
}

.site-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.75rem;
}

.site-nav-link {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-nav-link:hover { color: var(--text-main); }

.subtitle {
    font-family: var(--font-heading);
    font-style: italic;
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 0.5rem;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Layout ────────────────────────────────────────────────── */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.25rem 4rem;
}

/* ── Category sections ─────────────────────────────────────── */
.category-section {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.2s ease;
}

.category-section:hover {
    box-shadow: var(--shadow-card);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.4rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.category-header:hover {
    background: var(--light-gray);
}

.category-name {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-main);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.category-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--light-gray);
    border-radius: 20px;
    padding: 2px 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.category-toggle-icon {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-left: 0.75rem;
    transition: transform 0.25s ease;
    display: inline-block;
}

.category-section.collapsed .category-toggle-icon {
    transform: rotate(-90deg);
}

/* ── Recipe list ───────────────────────────────────────────── */
.recipe-list {
    list-style: none;
    border-top: 1px solid var(--border-light);
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-section.collapsed .recipe-list {
    max-height: 0;
}

.recipe-item {
    border-bottom: 1px solid var(--border-light);
}

.recipe-item:last-child {
    border-bottom: none;
}

.recipe-link {
    display: block;
    padding: 0.7rem 1.4rem;
    color: var(--text-soft);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 400;
    transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.recipe-link:hover {
    background: var(--light-gray);
    color: var(--text-main);
    padding-left: 1.8rem;
}

.recipe-link.active {
    color: var(--text-main);
    font-weight: 700;
    background: var(--light-gray);
}

/* ── Recipe detail panel ───────────────────────────────────── */
.recipe-detail {
    background: var(--off-white);
    border-top: 1px solid var(--border-light);
    padding: 1.5rem 1.4rem;
    animation: fadeSlideIn 0.2s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Macro panel */
.macro-panel {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 0.75rem;
    margin-bottom: 1.5rem;
}

.macro-item {
    text-align: center;
    padding: 0.25rem 0.5rem;
    border-right: 1px solid var(--border-light);
}

.macro-item:last-child {
    border-right: none;
}

.macro-value {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--text-main);
    display: block;
    line-height: 1.2;
}

.macro-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-top: 2px;
}

/* Serving adjuster */
.serving-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.serving-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.serving-input {
    width: 64px;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-main);
    text-align: center;
    outline: none;
    transition: border-color 0.15s ease;
}

.serving-input:focus {
    border-color: var(--text-soft);
}

.serving-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Ingredients */
.section-label {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 0.6rem;
    margin-top: 1.25rem;
}

.ingredient-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.ingredient-list li {
    font-size: 0.9rem;
    color: var(--text-main);
    display: flex;
    gap: 0.4rem;
}

.ingredient-amount {
    color: var(--text-soft);
    font-weight: 700;
    min-width: 60px;
    text-align: right;
    flex-shrink: 0;
}

.ingredient-name {
    color: var(--text-main);
}

/* Instructions */
.instructions-list {
    list-style: none;
    counter-reset: steps;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.instructions-list li {
    counter-increment: steps;
    display: flex;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
}

.instructions-list li::before {
    content: counter(steps);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    min-width: 20px;
    margin-top: 1px;
}

/* Log hint */
.mf-hint {
    margin-top: 1.5rem;
    padding: 0.85rem 1rem;
    background: var(--light-gray);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-soft);
    line-height: 1.5;
}

.mf-hint strong {
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}

.mf-url {
    font-family: monospace;
    font-size: 0.78rem;
    background: var(--white);
    padding: 1px 5px;
    border-radius: 2px;
    word-break: break-all;
    cursor: pointer;
    color: var(--text-soft);
    border: 1px solid var(--border);
    display: inline;
}

.mf-url:hover {
    background: var(--off-white);
}

.copy-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: 0.3rem;
}

/* ── App open buttons ──────────────────────────────────────── */
.app-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.btn-app {
    font-size: 0.75rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-soft);
    text-decoration: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: background 0.15s ease;
}

.btn-app:hover { background: var(--light-gray); color: var(--text-main); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
    display: inline-block;
    padding: 0.55rem 1.25rem;
    background: var(--text-main);
    color: var(--white);
    border: 1px solid var(--text-main);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: background 0.15s ease;
}
.btn-primary:hover { background: var(--text-soft); border-color: var(--text-soft); }

.btn-secondary {
    display: inline-block;
    padding: 0.55rem 1.25rem;
    background: transparent;
    color: var(--text-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: background 0.15s ease;
}
.btn-secondary:hover { background: var(--light-gray); color: var(--text-main); }

.btn-danger {
    display: inline-block;
    padding: 0.55rem 1.25rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: all 0.15s ease;
}
.btn-danger:hover { color: #c0392b; border-color: rgba(192,57,43,0.3); background: rgba(192,57,43,0.04); }

/* ── Recipe page nav ───────────────────────────────────────── */
.recipe-page-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recipe-actions {
    display: flex;
    gap: 0.5rem;
}

.back-link {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.back-link:hover { color: var(--text-main); }

/* ── Form styles ───────────────────────────────────────────── */
.form-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow-soft);
}

.form-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 1.5rem;
}

.form-errors {
    background: rgba(192, 57, 43, 0.05);
    border: 1px solid rgba(192, 57, 43, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    color: #c0392b;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.form-group-sm { max-width: 160px; }

.form-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.form-input {
    padding: 0.45rem 0.65rem;
    background: var(--off-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-main);
    width: 100%;
    outline: none;
    transition: border-color 0.15s ease;
    resize: vertical;
}
.form-input:focus { border-color: var(--text-soft); }

.form-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-group { margin-bottom: 1rem; }

.form-section-label {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin: 1.5rem 0 0.6rem;
}

.macro-form-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ingredient-row, .instruction-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.ingredient-row .ing-name { flex: 2; }
.ingredient-row .ing-amount { flex: 0 0 80px; }
.ingredient-row .ing-unit { flex: 1; }

.instruction-row textarea { flex: 1; }

.remove-row-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.3rem 0.4rem;
    line-height: 1;
    transition: color 0.15s ease;
    flex-shrink: 0;
}
.remove-row-btn:hover { color: #c0392b; }

.btn-add-row {
    background: none;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: var(--font-body);
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-add-row:hover { border-color: var(--text-soft); color: var(--text-main); }

.tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-soft);
    cursor: pointer;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: all 0.15s ease;
}

.tag-checkbox:hover { border-color: var(--text-soft); color: var(--text-main); }
.tag-checkbox input { display: none; }
.tag-checkbox:has(input:checked) {
    background: var(--text-main);
    color: var(--white);
    border-color: var(--text-main);
}

.recipe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.recipe-tag {
    font-size: 0.72rem;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 2px 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.75rem;
    align-items: center;
}

/* ── Picker ────────────────────────────────────────────────── */
.picker-auto-row {
    display: flex;
    gap: 2rem;
    padding: 0.75rem 1rem;
    background: var(--light-gray);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.picker-auto-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.picker-auto-value {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-main);
}

.picker-result-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
    position: relative;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.picker-result-card:hover {
    box-shadow: var(--shadow-card);
    border-color: var(--border);
}

.picker-result-card.top-pick {
    border-color: var(--text-main);
}

.top-pick-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--text-main);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: 0.5rem;
}

.picker-result-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.picker-result-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Grocery ───────────────────────────────────────────────── */
.grocery-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

.grocery-panel {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.25rem 1.25rem 1rem;
}

.grocery-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.grocery-panel-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-main);
}

.btn-from-plan {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-from-plan:hover { background: var(--light-gray); color: var(--text-main); }
.btn-from-plan:disabled { opacity: 0.5; cursor: default; }

.btn-move-pantry {
    width: 100%;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #4a7a4a;
    background: #f0f7f0;
    border: 1px solid #c0dcc0;
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    margin-bottom: 0.75rem;
    transition: background 0.15s ease;
    text-align: left;
}
.btn-move-pantry:hover { background: #e2f0e2; }
.btn-move-pantry:disabled { opacity: 0.5; cursor: default; }

.btn-uncheck-all {
    width: 100%;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    margin-bottom: 0.75rem;
    transition: all 0.15s ease;
    text-align: left;
}
.btn-uncheck-all:hover { background: var(--light-gray); color: var(--text-main); }

.from-plan-msg {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.75rem;
}

.spoiling-alert {
    background: #fff8f0;
    border: 1px solid #f0c080;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #8a5c00;
    margin-bottom: 0.75rem;
}

.grocery-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 1rem;
}

.grocery-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    background: var(--off-white);
    transition: opacity 0.15s ease;
}

.grocery-item-checked {
    opacity: 0.45;
}

.grocery-item-checked .grocery-item-name {
    text-decoration: line-through;
}

.grocery-check-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.grocery-checkbox {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--text-main);
}

.grocery-item-main {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.grocery-item-name {
    font-size: 0.88rem;
    color: var(--text-main);
}

.grocery-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.grocery-item-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

.expiry-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 20px;
}

.expiry-badge.ok      { background: #f0f7f0; color: #4a7a4a; }
.expiry-badge.spoiling { background: #fff3e0; color: #8a5c00; }
.expiry-badge.expired  { background: #fdf0f0; color: #a00; }

.grocery-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.1s ease;
}
.grocery-remove:hover { color: #c0392b; }

.grocery-empty-li {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.25rem 0;
}

.grocery-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

.grocery-add-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-top: 1px solid var(--border-light);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.grocery-input-name { font-size: 0.88rem; }

.grocery-add-row {
    display: flex;
    gap: 0.4rem;
}

.grocery-input-sm {
    flex: 1;
    font-size: 0.82rem;
    min-width: 0;
}

.grocery-input-date {
    flex: 1.4;
    font-size: 0.82rem;
    min-width: 0;
}

@media (max-width: 600px) {
    .grocery-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.modal-close:hover { color: var(--text-main); }

.modal-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.6rem 1.25rem 0;
    flex-shrink: 0;
}

.modal-list {
    list-style: none;
    overflow-y: auto;
    padding: 0.5rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-item {
    border-radius: 4px;
    padding: 0.35rem 0.5rem;
}

.modal-item:hover { background: var(--off-white); }

.modal-item-muted { opacity: 0.6; }

.modal-item-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    width: 100%;
}

.modal-item-check {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--text-main);
}

.modal-item-name {
    font-size: 0.88rem;
    color: var(--text-main);
    flex: 1;
}

.modal-item-amt {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-item-status {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1px 6px;
    border-radius: 20px;
}

.modal-item-status.pantry  { background: #f0f7f0; color: #4a7a4a; }
.modal-item-status.on-list { background: #f0f4ff; color: #4a5a8a; }

.modal-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem 1.1rem;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.modal-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* ── Surprise spinner ──────────────────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spin-wheel {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--text-main);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 0.75rem;
}

.spin-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Meal planner ──────────────────────────────────────────── */
.planner-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.planner-week-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.planner-week-label {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-main);
    min-width: 180px;
    text-align: center;
}

.planner-week-btn {
    padding: 0.3rem 0.7rem;
    font-size: 1rem;
}

.planner-loading {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1rem 0;
}

.planner-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    min-width: 0;
}

.planner-day {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    min-width: 110px;
}

.planner-day-header {
    padding: 0.6rem 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.planner-day-name {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.planner-day-num {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-main);
}

.planner-slot {
    padding: 0.5rem 0.5rem 0.4rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.planner-slot:last-of-type {
    border-bottom: none;
}

.planner-slot-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.1rem;
}

.planner-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.25rem;
    background: var(--off-white);
    border-radius: 3px;
    padding: 0.2rem 0.35rem;
}

.planner-item-name {
    font-size: 0.75rem;
    color: var(--text-main);
    line-height: 1.3;
    flex: 1;
}

.planner-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.1s ease;
}
.planner-remove:hover { color: #c0392b; }

.planner-select {
    font-family: var(--font-body);
    font-size: 0.72rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 3px;
    padding: 0.2rem 0.3rem;
    width: 100%;
    cursor: pointer;
    outline: none;
}
.planner-select:focus { border-color: var(--text-soft); color: var(--text-main); }

.planner-day-totals {
    padding: 0.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    background: var(--light-gray);
    border-top: 1px solid var(--border-light);
    border-radius: 0 0 var(--radius) var(--radius);
    margin-top: auto;
}

.macro-pill {
    font-size: 0.67rem;
    color: var(--text-soft);
    white-space: nowrap;
}

.macro-pill strong {
    color: var(--text-main);
    font-weight: 700;
}

.week-totals-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.week-totals-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-right: 0.25rem;
}

/* ── Notes / ratings ───────────────────────────────────────── */
.notes-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
}

.star-row {
    display: flex;
    gap: 0.2rem;
    margin-bottom: 0.75rem;
}

.star {
    font-size: 1.4rem;
    color: #bbb;
    cursor: pointer;
    transition: color 0.1s ease;
    line-height: 1;
    user-select: none;
}

.star.filled {
    color: var(--text-main);
}

.notes-textarea {
    min-height: 80px;
    resize: vertical;
    margin-bottom: 0.75rem;
}

.notes-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notes-saved-msg {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Inline note display (in recipe list panel) */
.inline-note {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.inline-stars {
    font-size: 1rem;
    letter-spacing: 0.05em;
    color: var(--text-main);
    margin-bottom: 0.3rem;
}

.inline-note-text {
    font-size: 0.82rem;
    color: var(--text-soft);
    line-height: 1.4;
    font-style: italic;
    margin: 0;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .macro-panel {
        grid-template-columns: repeat(3, 1fr);
    }

    .macro-item:nth-child(3) {
        border-right: none;
    }

    .macro-item:nth-child(4),
    .macro-item:nth-child(5) {
        border-top: 1px solid var(--border-light);
    }

    .macro-item:nth-child(5) {
        border-right: none;
    }

    .site-header {
        padding: 2rem 1rem 1.5rem;
    }

    .macro-form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}
