/* ============================================
   My Recipe Book — Warm Cookbook Theme v2
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Inter:wght@400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
    --bg: #faf7f2;
    --bg-warm: #f5efe6;
    --nav: #ede6db;
    --primary: #c08b5c;
    --primary-hover: #a97845;
    --primary-light: rgba(192, 139, 92, 0.12);
    --accent: #7b9e6b;
    --accent-light: #dde8d5;
    --text: #2d2a26;
    --text-muted: #8a8078;
    --text-secondary: #6b6560;
    --veggie-bg: #dde8d5;
    --veggie-text: #4a6a3a;
    --card-bg: #fff;
    --card-shadow: 0 1px 3px rgba(45, 42, 38, 0.06), 0 1px 2px rgba(45, 42, 38, 0.04);
    --card-shadow-hover: 0 8px 24px rgba(45, 42, 38, 0.10), 0 2px 8px rgba(45, 42, 38, 0.06);
    --border: #ddd6cc;
    --border-light: #e8e2d8;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'DM Serif Display', Georgia, serif;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --transition: 0.2s ease;
    --danger: #d94f3d;
    --danger-hover: #c0392b;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; min-height: 100vh; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* --- Typography --- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
h1 { font-size: 2rem; line-height: 1.2; }
h2 { font-size: 1.4rem; line-height: 1.3; }
h3 { font-size: 1.15rem; line-height: 1.3; }

/* --- Main Navigation --- */
.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--nav);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 60px;
    backdrop-filter: blur(8px);
}

.nav-logo {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.3rem;
    color: var(--primary-hover);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.nav-logo:hover { color: var(--primary); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    transition: color var(--transition), background var(--transition);
}

.nav-links a:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
}

.nav-links a.active {
    color: var(--primary-hover);
    background: var(--primary-light);
}

.nav-btn-primary {
    display: inline-flex;
    align-items: center;
    background: var(--primary) !important;
    color: white !important;
    border: none;
    padding: 8px 18px !important;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 600;
    transition: background var(--transition), transform var(--transition);
}

.nav-btn-primary:hover {
    background: var(--primary-hover) !important;
    color: white !important;
    transform: translateY(-1px);
}

/* --- Content Container --- */
.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px;
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header h1 { margin: 0; }

.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* --- Flash Messages --- */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 4px solid;
}

.flash-success {
    background: #edf7ee;
    color: #2e6b32;
    border-left-color: #4caf50;
}

.flash-error {
    background: #fef2f2;
    color: #b91c1c;
    border-left-color: #ef4444;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.empty-state p + p { margin-top: 8px; }
.empty-state a { color: var(--primary); font-weight: 500; }
.empty-state a:hover { text-decoration: underline; }

/* --- Recipe Grid --- */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* --- Recipe Card --- */
.recipe-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
    border: 1px solid var(--border-light);
}

.recipe-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-3px);
}

.recipe-card-image {
    background: var(--bg-warm);
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border);
    font-size: 2.5rem;
    position: relative;
    overflow: hidden;
}

.recipe-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.recipe-card:hover .recipe-card-image img {
    transform: scale(1.03);
}

.recipe-card-body {
    padding: 14px 16px 16px;
}

.recipe-card-body h3 {
    font-size: 1.05rem;
    margin-bottom: 8px;
    line-height: 1.3;
}

.recipe-card-body h3 a {
    transition: color var(--transition);
}

.recipe-card-body h3 a:hover {
    color: var(--primary);
}

.recipe-card-meta {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 10px;
    font-weight: 500;
}

/* --- Variant Badges --- */
.variant-badge {
    display: inline-block;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    line-height: 1.4;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.variant-regular {
    background: var(--bg-warm);
    color: var(--text-secondary);
}

.variant-veggie {
    background: var(--veggie-bg);
    color: var(--veggie-text);
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.filter-pill:hover {
    background: var(--bg-warm);
    color: var(--text);
    border-color: var(--border);
}

.filter-pill.active {
    background: var(--primary-light);
    color: var(--primary-hover);
    border-color: var(--primary);
}

.search-input {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 0.88rem;
    min-width: 240px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* --- Week Grid (Meal Plan) --- */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.day-slot {
    background: var(--card-bg);
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    min-height: 160px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: border-color var(--transition), background var(--transition);
}

.day-slot:hover {
    border-color: var(--primary);
    background: rgba(192, 139, 92, 0.03);
}

.day-slot .day-label {
    font-family: var(--font);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border-light);
    width: 100%;
}

.day-slot .day-add-icon {
    font-size: 1.4rem;
    color: var(--border);
    margin-bottom: 4px;
    background: none;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    width: 100%;
    padding: 4px 0;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.day-slot .day-add-icon:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.picker-arrow {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: background 0.15s;
}

.picker-arrow:hover:not(:disabled) {
    background: var(--bg-warm);
}

.picker-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

/* --- Meal Plan Entry Cards --- */
.day-entry-card {
    position: relative;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.day-entry-card:hover {
    border-color: var(--primary);
}

.day-entry-link {
    display: block;
    position: relative;
    text-decoration: none;
    color: inherit;
    aspect-ratio: 4 / 3;
}

.day-entry-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.day-entry-placeholder {
    background: var(--bg-warm, #f5f0eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.day-entry-title {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 5px 6px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 100%);
    color: #fff;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.7rem;
    line-height: 1.25;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.day-entry-servings {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 100%);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    gap: 4px;
}

.day-entry-batch {
    background: rgba(255,255,255,0.2);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.6rem;
}

.day-entry-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 2;
}

.day-entry-remove .btn-icon {
    background: rgba(0,0,0,0.35);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}

.day-entry-card:hover .day-entry-remove .btn-icon {
    opacity: 1;
}

.day-entry-remove .btn-icon:hover {
    background: rgba(200,50,50,0.7);
}

.day-add-form {
    margin-top: 6px;
    width: 100%;
}

.day-add-form summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.3rem;
    text-align: center;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
    list-style: none;
}

.day-add-form summary::-webkit-details-marker { display: none; }

.day-add-form summary:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.day-add-form form {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.day-add-form select,
.day-add-form input[type="number"] {
    font-size: 0.8rem;
    padding: 4px 6px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: white;
}

.day-add-form .btn-sm {
    font-size: 0.78rem;
    padding: 4px 10px;
}

/* --- Week nav --- */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.week-nav h2 {
    margin: 0;
    font-size: 1.2rem;
}

/* --- Macro Summary (Meal Plan & Recipe Detail) --- */
.macro-summary {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px 20px;
}

.macro-summary .macro-item {
    text-align: center;
    min-width: 72px;
}

.macro-summary .macro-value {
    font-family: var(--font);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.macro-summary .macro-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Shopping List --- */
.shopping-category {
    margin-bottom: 24px;
}

.shopping-category h2 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-light);
    color: var(--text);
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.93rem;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

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

.shopping-item:hover {
    background: rgba(0, 0, 0, 0.015);
}

.shopping-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
}

.shopping-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.shopping-item.checked {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* --- Pantry --- */
.pantry-add-form {
    margin-bottom: 24px;
}

.pantry-add-form .form-inline {
    display: flex;
    gap: 10px;
    align-items: end;
}

.pantry-add-form .form-input,
.pantry-add-form select {
    flex: 1;
    min-width: 0;
}

.pantry-category-group {
    margin-bottom: 24px;
}

.pantry-category-group h2 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-light);
}

.pantry-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.pantry-item:hover {
    background: rgba(0, 0, 0, 0.015);
}

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

.pantry-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    font-size: 0.93rem;
}

.pantry-check input[type="checkbox"] {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.pantry-out-of-stock {
    opacity: 0.5;
    text-decoration: line-through;
}

.pantry-category-badge {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--bg-warm);
    color: var(--text-muted);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: all var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

.btn-danger-icon:hover {
    background: #fef2f2;
    color: var(--danger);
}

/* --- Form Styles --- */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text);
    letter-spacing: 0.01em;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select { appearance: auto; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(192, 139, 92, 0.3);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-warm);
    border-color: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 24px;
    gap: 0;
}

.tab {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
    background: none;
}

.tab:hover { color: var(--text); }

.tab.active {
    color: var(--primary-hover);
    border-bottom-color: var(--primary);
}

/* --- Suggestions (Meal Plan) --- */
.suggestions-section h3 {
    margin-bottom: 4px;
}

.suggestions-grid .card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    transition: box-shadow var(--transition);
}

.suggestions-grid .card:hover {
    box-shadow: var(--card-shadow);
}

.suggestions-grid .badge {
    background: var(--primary-light) !important;
    color: var(--primary-hover) !important;
}

/* --- Recipe Detail --- */
.recipe-detail { max-width: 900px; margin: 0 auto; }

.recipe-detail h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.recipe-detail .recipe-detail-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
    font-weight: 500;
}

/* Hero */
.recipe-hero {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--card-shadow);
}

.recipe-hero-media {
    position: relative;
    background: var(--bg-warm);
    line-height: 0;
}

.recipe-hero-media img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}

.recipe-hero-media video {
    max-width: 100%;
    max-height: 500px;
    display: block;
    margin: 0 auto;
}

.recipe-hero-media .carousel-toggle {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 6px;
    border-radius: 16px;
    backdrop-filter: blur(4px);
}

.recipe-hero-body {
    padding: 24px 28px;
}

.recipe-hero-body h1 {
    font-size: 2rem;
    margin-bottom: 6px;
}

.recipe-hero-body .recipe-detail-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.recipe-detail .ingredient-list { list-style: none; padding: 0; }

.recipe-detail .ingredient-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.93rem;
}

.recipe-detail .ingredient-list li:last-child { border-bottom: none; }

.recipe-detail .instruction-steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
}

.recipe-detail .instruction-steps li {
    counter-increment: step;
    padding: 14px 0 14px 52px;
    position: relative;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.93rem;
    line-height: 1.65;
}

.recipe-detail .instruction-steps li:last-child { border-bottom: none; }

.recipe-detail .instruction-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font);
    font-weight: 700;
    font-size: 0.82rem;
}

/* --- Edit Hero --- */
.edit-hero {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

.edit-hero-media {
    position: relative;
    background: var(--bg-warm);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 0;
}

.edit-hero-media img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
}

.edit-hero-media video {
    max-width: 100%;
    max-height: 400px;
    display: block;
    margin: 0 auto;
}

.edit-hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(45, 42, 38, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.edit-hero-media:hover .edit-hero-overlay { opacity: 1; }

.edit-hero-overlay span {
    color: #fff;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.6;
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.edit-hero-placeholder {
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    cursor: pointer;
    text-align: center;
}

.edit-hero-placeholder:hover {
    background: var(--primary-light);
}

.edit-hero .carousel-toggle {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 6px;
    border-radius: 16px;
    backdrop-filter: blur(4px);
}

/* --- Thumbnail modal --- */
.thumb-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(45, 42, 38, 0.5);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.thumb-modal-backdrop.open { display: flex; }

.thumb-modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(45, 42, 38, 0.2);
}

.thumb-modal h3 { margin: 0 0 16px; }

.thumb-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 20px;
}

.thumb-tabs button {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font);
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: none;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.thumb-tabs button:hover { color: var(--text); }

.thumb-tabs button.active {
    color: var(--primary-hover);
    border-bottom-color: var(--primary);
}

.thumb-search-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.thumb-search-grid > div {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 1;
    background: var(--bg-warm);
    transition: border-color 0.15s, transform 0.15s;
}

.thumb-search-grid > div:hover {
    border-color: var(--primary);
    transform: scale(1.02);
}

.thumb-search-grid > div img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Split View --- */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.split-view > section {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 20px;
}

.split-view > section h3 { margin-bottom: 12px; }

/* --- Card section (used in detail page) --- */
.recipe-detail section {
    transition: box-shadow var(--transition);
}

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

/* --- Utility Classes --- */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 32px; }

/* --- Responsive: Tablet --- */
@media (max-width: 768px) {
    .recipe-grid { grid-template-columns: repeat(2, 1fr); }
    .week-grid { grid-template-columns: repeat(3, 1fr); }
    .split-view { grid-template-columns: 1fr; }
    .nav-links { gap: 4px; }
    .content { padding: 20px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-input { min-width: unset; width: 100%; }
    .pantry-add-form .form-inline { flex-direction: column; }
}

/* --- Responsive: Mobile --- */
@media (max-width: 480px) {
    .recipe-grid { grid-template-columns: 1fr; }
    .week-grid { grid-template-columns: repeat(2, 1fr); }
    .main-nav { flex-direction: column; height: auto; padding: 12px 16px; gap: 8px; }
    .nav-links { flex-wrap: wrap; justify-content: center; gap: 4px; }
    .nav-links a { padding: 6px 10px; font-size: 0.82rem; }
    .macro-summary { gap: 12px; padding: 12px 16px; }
    .tabs { overflow-x: auto; }
    h1 { font-size: 1.6rem; }
    .recipe-hero-body { padding: 16px 20px; }
    .recipe-hero-body h1 { font-size: 1.6rem; }
}

/* --- Step ingredient pills --- */
.step-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.step-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-secondary, #f0ebe3);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.78rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.step-pill .step-qty {
    font-weight: 600;
}

.step-pill .pill-name {
    color: var(--text-secondary);
}
