/* ==========================================================================
   Recipe Vault - Stylesheet
   Warm Culinary Aesthetic
   ========================================================================== */

:root {
    --bg-page: #faf8f5;
    --bg-gradient: radial-gradient(ellipse at 50% 0%, #fffbf5 0%, #faf8f5 60%, #f4eee6 100%);
    --surface-card: #ffffff;
    --surface-subtle: #f8f6f0;
    --surface-inset: #f1ede4;
    --surface-hover: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-strong: rgba(0, 0, 0, 0.14);
    --glass-header-bg: rgba(255, 255, 255, 0.92);
    --glass-header-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.06), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
    --panel-bg: #ffffff;
    --panel-border: rgba(0, 0, 0, 0.09);
    --panel-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.18), 0 12px 24px -4px rgba(0, 0, 0, 0.08);
    --modal-overlay-bg: rgba(15, 23, 42, 0.6);
    
    --text-main: #1e293b;
    --text-heading: #0f172a;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    
    --accent: #e0533c; /* warm culinary terracotta / coral inspired by RecipeTin Eats */
    --accent-hover: #c2410c;
    --accent-subtle: rgba(224, 83, 60, 0.08);
    --accent-border: rgba(224, 83, 60, 0.25);
    --accent-gradient: linear-gradient(135deg, #ea580c 0%, #e0533c 100%);
    --title-gradient: linear-gradient(135deg, #0f172a 30%, #c2410c 100%);
    
    --secondary-accent: #10b981; /* fresh herb green */
    --secondary-hover: #059669;
    
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-text: #1e293b;
    --input-placeholder: #94a3b8;
    
    --btn-default-bg: #ffffff;
    --btn-default-border: #cbd5e1;
    --btn-default-text: #334155;
    --btn-default-hover: #f1f5f9;
    
    --card-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --card-shadow-hover: 0 20px 35px -5px rgba(224, 83, 60, 0.14), 0 10px 20px -2px rgba(15, 23, 42, 0.06);
    --card-border-hover: rgba(224, 83, 60, 0.35);

    --callout-bg: #fff7ed;
    --callout-border: #fed7aa;
    --callout-text: #7c2d12;
    --callout-title: #9a3412;
    
    --scaler-bg: #f8fafc;
    --scaler-border: #e2e8f0;
    
    --toast-bg: rgba(30, 41, 59, 0.96);
    --toast-text: #ffffff;
    
    --scrollbar-thumb: rgba(0, 0, 0, 0.2);
    --scrollbar-track: rgba(0, 0, 0, 0.04);

    /* Culinary Header & Toolbar Tokens */
    --mh-surface: #ffffff;
    --mh-border: #e7e2dc;
    --mh-border-subtle: rgba(231, 226, 220, 0.75);
    --mh-border-strong: #d6cfc7;
    --mh-hover: #f5f1ec;
    --mh-inset: #f2ede6;
    --mh-ink: #1f2937;
    --mh-muted: #6b6560;
    --mh-accent: #ea580c;
    --mh-accent-hover: #c2410c;
    --mh-accent-active: #9a3412;
    --mh-danger: #dc2626;
    --mh-danger-hover: #b91c1c;
    --mh-danger-subtle: rgba(220, 38, 38, 0.08);
    --mh-danger-subtle-hover: rgba(220, 38, 38, 0.14);
    --mh-danger-border: rgba(220, 38, 38, 0.32);
    --mh-danger-text: #b91c1c;
    --mh-radius-control: 10px;
    --mh-radius-group: 12px;
    --mh-control-h: 38px;
    --mh-btn-h-sm: 30px;
    --mh-btn-h-md: 38px;
    --mh-btn-h-lg: 46px;
    --mh-btn-radius-sm: 8px;
    --mh-btn-radius-md: var(--mh-radius-control);
    --mh-btn-radius-lg: var(--mh-radius-control);
    --mh-focus: 2px solid var(--mh-accent);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

body {
    background: var(--bg-gradient);
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* ==========================================================================
   Unified Button System (.mh-btn)
   Semantic variants: primary, secondary, ghost, destructive(-outline/-ghost),
   toggle / segmented, and status pills.
   Sizing tokens: sm (30px), md (38px, default), lg (46px).
   ========================================================================== */
.mh-btn {
    --mh-btn-gap: 0.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--mh-btn-gap);
    height: var(--mh-btn-h-md);
    padding: 0 1rem;
    border: 1px solid transparent;
    border-radius: var(--mh-btn-radius-md);
    background: transparent;
    color: var(--mh-ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.mh-btn svg {
    flex-shrink: 0;
    pointer-events: none;
}

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

.mh-btn:disabled,
.mh-btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.mh-btn[aria-disabled="true"] {
    pointer-events: none;
}

.mh-btn.is-loading {
    opacity: 0.72;
    cursor: wait;
    pointer-events: none;
}

.mh-btn-spinner {
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: mhBtnSpin 0.65s linear infinite;
    flex-shrink: 0;
}

@keyframes mhBtnSpin {
    to { transform: rotate(360deg); }
}

/* Size Tokens */
.mh-btn--sm {
    --mh-btn-gap: 0.35rem;
    height: var(--mh-btn-h-sm);
    padding: 0 0.7rem;
    font-size: 0.8rem;
    border-radius: var(--mh-btn-radius-sm);
}

.mh-btn--md {
    --mh-btn-gap: 0.45rem;
    height: var(--mh-btn-h-md);
    padding: 0 1rem;
    font-size: 0.88rem;
    border-radius: var(--mh-btn-radius-md);
}

.mh-btn--lg {
    --mh-btn-gap: 0.55rem;
    height: var(--mh-btn-h-lg);
    padding: 0 1.4rem;
    font-size: 0.96rem;
    border-radius: var(--mh-btn-radius-lg);
}

.mh-btn--icon {
    width: var(--mh-btn-h-md);
    padding: 0;
}

.mh-btn--sm.mh-btn--icon {
    width: var(--mh-btn-h-sm);
    padding: 0;
}

.mh-btn--lg.mh-btn--icon {
    width: var(--mh-btn-h-lg);
    padding: 0;
}

.mh-btn--block {
    width: 100%;
}

/* Variant 1: Primary (single main action in a view or modal) */
.mh-btn--primary {
    background: var(--mh-accent);
    border-color: var(--mh-accent);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(194, 65, 12, 0.25), 0 4px 12px rgba(234, 88, 12, 0.18);
}

.mh-btn--primary:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-accent-hover);
    border-color: var(--mh-accent-hover);
    color: #ffffff;
}

.mh-btn--primary:active:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-accent-active);
    border-color: var(--mh-accent-active);
}

/* Variant 2: Secondary (supporting actions: Cancel, Edit, Print, Share, Export) */
.mh-btn--secondary {
    background: var(--mh-surface);
    border-color: var(--mh-border);
    color: var(--mh-ink);
    box-shadow: 0 1px 2px rgba(120, 80, 40, 0.04);
}

.mh-btn--secondary:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-hover);
    border-color: var(--mh-border-strong);
    color: var(--mh-ink);
}

.mh-btn--secondary:active:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-inset);
}

.mh-btn--secondary.mh-btn--muted {
    background: var(--mh-inset);
}

.mh-btn--secondary.mh-btn--muted:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-hover);
}

/* Variant 3: Ghost / Tertiary (borderless subtle hover: close X, toolbar & icon controls) */
.mh-btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--mh-muted);
    font-weight: 500;
    box-shadow: none;
}

.mh-btn--ghost:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-hover);
    color: var(--mh-ink);
}

.mh-btn--ghost:active:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-inset);
}

.mh-btn--ghost.mh-btn--on-media {
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-color: rgba(255, 255, 255, 0.22);
    color: #f8fafc;
    font-weight: 600;
}

.mh-btn--ghost.mh-btn--on-media:hover:not(:disabled):not([aria-disabled="true"]) {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(255, 255, 255, 0.45);
    color: #ffffff;
}

/* Variant 4: Destructive (irreversible actions only) */
.mh-btn--destructive {
    background: var(--mh-danger);
    border-color: var(--mh-danger);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(185, 28, 28, 0.25);
}

.mh-btn--destructive:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-danger-hover);
    border-color: var(--mh-danger-hover);
    color: #ffffff;
}

.mh-btn--destructive-outline {
    background: var(--mh-danger-subtle);
    border-color: var(--mh-danger-border);
    color: var(--mh-danger-text);
    box-shadow: none;
}

.mh-btn--destructive-outline:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-danger);
    border-color: var(--mh-danger);
    color: #ffffff;
}

.mh-btn--destructive-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--mh-danger-text);
    font-weight: 500;
    box-shadow: none;
}

.mh-btn--destructive-ghost:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-danger-subtle-hover);
    color: var(--mh-danger-hover);
}

/* Variant 5: Toggle / Segmented & Status Pills */
.mh-segment-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--mh-inset);
    border: 1px solid var(--mh-border);
    padding: 3px;
    border-radius: var(--mh-radius-group);
    height: var(--mh-btn-h-md);
    box-sizing: border-box;
}

.mh-btn--toggle {
    background: transparent;
    border-color: transparent;
    color: var(--mh-muted);
    font-weight: 500;
    box-shadow: none;
}

.mh-segment-group .mh-btn--toggle.mh-btn--sm {
    height: 30px;
    border-radius: 9px;
}

.mh-btn--toggle:hover:not(:disabled):not([aria-disabled="true"]) {
    background: rgba(255, 255, 255, 0.65);
    color: var(--mh-ink);
}

.mh-btn--toggle.is-active,
.mh-btn--toggle[aria-pressed="true"],
.mh-btn--toggle[aria-selected="true"] {
    background: var(--mh-surface);
    border-color: rgba(234, 88, 12, 0.22);
    color: var(--mh-ink);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(31, 41, 55, 0.1);
}

.mh-btn--toggle-solid {
    background: var(--mh-surface);
    border-color: var(--mh-border);
    color: var(--mh-ink);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(120, 80, 40, 0.04);
}

.mh-btn--toggle-solid:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-hover);
    border-color: var(--mh-border-strong);
}

.mh-btn--toggle-solid.is-active,
.mh-btn--toggle-solid[aria-pressed="true"] {
    background: var(--mh-ink);
    border-color: var(--mh-ink);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(31, 41, 55, 0.18);
}

.mh-btn--toggle-solid.is-active:hover:not(:disabled):not([aria-disabled="true"]),
.mh-btn--toggle-solid[aria-pressed="true"]:hover:not(:disabled):not([aria-disabled="true"]) {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
}

.mh-btn--toggle-accent.is-active,
.mh-btn--toggle-accent[aria-pressed="true"] {
    background: var(--mh-accent);
    border-color: var(--mh-accent);
    color: #ffffff;
}

.mh-btn--toggle-accent.is-active:hover:not(:disabled):not([aria-disabled="true"]),
.mh-btn--toggle-accent[aria-pressed="true"]:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--mh-accent-hover);
    border-color: var(--mh-accent-hover);
    color: #ffffff;
}

.mh-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: var(--mh-btn-h-sm);
    padding: 0 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--mh-border);
    background: var(--mh-inset);
    color: var(--mh-ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 0;
}

.mh-status-pill--warning {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
    pointer-events: none;
    user-select: none;
}

.mh-status-pill--live {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #059669;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

button.mh-status-pill--live:hover {
    background: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.6);
    color: #047857;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.glass-header {
    background: var(--mh-surface);
    border: 1px solid var(--mh-border);
    border-radius: 16px;
    padding: 1.35rem 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-bottom: 2.25rem;
    box-shadow: 0 1px 2px rgba(120, 80, 40, 0.06), 0 8px 24px rgba(120, 80, 40, 0.06);
    transition: background-color 120ms ease, border-color 120ms ease;
    position: relative;
    z-index: 40;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.015em;
}

.search-bar input {
    background: var(--mh-surface);
    border: 1px solid var(--mh-border);
    height: var(--mh-control-h);
    padding: 0 2.25rem 0 2.45rem;
    border-radius: var(--mh-radius-control);
    color: var(--mh-ink);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    width: 100%;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    box-shadow: 0 1px 2px rgba(120, 80, 40, 0.04);
}

.search-bar input::placeholder {
    color: var(--mh-muted);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--mh-accent);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.14);
}

.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.search-tags:empty {
    display: none;
}

.search-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
}

.search-tag .remove-tag {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    font-size: 0.95rem;
    line-height: 1;
}

.recipe-grid {
    --grid-columns: 4;
    display: grid;
    grid-template-columns: repeat(var(--grid-columns, 4), minmax(0, 1fr));
    gap: clamp(1rem, 2vw, 1.75rem);
    transition: all 0.25s ease;
}

.recipe-grid[data-columns="1"] {
    grid-template-columns: minmax(0, 1fr);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.recipe-grid[data-columns="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.recipe-grid[data-columns="3"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.recipe-grid[data-columns="4"] {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.recipe-grid[data-columns="5"] {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 960px) {
    .recipe-grid[data-columns="4"],
    .recipe-grid[data-columns="5"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .recipe-grid[data-columns="3"],
    .recipe-grid[data-columns="4"],
    .recipe-grid[data-columns="5"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.recipe-grid[data-columns="1"] .recipe-title {
    font-size: 1.5rem;
}

.recipe-grid[data-columns="2"] .recipe-title {
    font-size: 1.35rem;
}

.recipe-grid[data-columns="5"] .recipe-title {
    font-size: 1.1rem;
}

.recipe-grid[data-columns="5"] .recipe-content {
    padding: 2rem 0.9rem 0.75rem;
}

.recipe-card {
    position: relative;
    aspect-ratio: 3 / 4;
    background: var(--surface-card);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.35s ease, border-color 0.35s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: var(--card-shadow);
}

.recipe-card:hover {
    transform: translateY(-6px) scale(1.015);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--card-border-hover);
}

.recipe-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-bottom: none;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), filter 0.5s ease;
}

.recipe-card:hover .recipe-image {
    transform: scale(1.06);
    filter: brightness(1.03);
}

.recipe-placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f2eb 0%, #e8e2d5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-size: 5rem;
    color: rgba(0, 0, 0, 0.15);
    border-bottom: none;
    transition: transform 0.5s ease;
}

.recipe-card:hover .recipe-placeholder {
    transform: scale(1.04);
}

.recipe-content {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2.4rem 1.15rem 0.9rem;
    background: linear-gradient(
        to top,
        rgba(5, 8, 16, 0.88) 0%,
        rgba(5, 8, 16, 0.65) 45%,
        rgba(5, 8, 16, 0.15) 80%,
        transparent 100%
    );
    z-index: 2;
    pointer-events: none;
}

.recipe-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 1px 12px rgba(0, 0, 0, 0.85);
    margin-bottom: 0.4rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #f8fafc;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.meta-pill.source-pill {
    color: #7dd3fc;
    background: rgba(14, 116, 144, 0.45);
    border-color: rgba(56, 189, 248, 0.45);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recipe-desc {
    color: #cbd5e1;
    font-size: 0.82rem;
    line-height: 1.4;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease, margin-top 0.35s ease;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.recipe-card:hover .recipe-desc {
    max-height: 60px;
    opacity: 0.95;
    margin-top: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Modal Base System & Unified Shell */
.modal-overlay,
.confirm-dialog-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(28, 25, 23, 0.48);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.modal-overlay.modal-stacked {
    z-index: 1500;
}

.modal-overlay.active,
.confirm-dialog-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.modal-scroll-locked {
    overflow: hidden;
}

.glass-panel {
    background: var(--mh-surface);
    border: 1px solid var(--mh-border);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    position: relative;
    opacity: 0;
    transform: scale(0.97) translateY(10px);
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;
    box-shadow: 0 24px 60px rgba(28, 25, 23, 0.22);
    color: var(--mh-ink);
    box-sizing: border-box;
}

.modal-overlay.active .glass-panel,
.confirm-dialog-overlay.active .glass-panel {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.glass-panel.modal-shell {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.glass-panel.modal-sm {
    max-width: 460px;
}

.glass-panel.modal-md {
    max-width: 580px;
}

.glass-panel.modal-lg {
    max-width: 680px;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--mh-border-subtle);
    flex-shrink: 0;
}

.modal-header-text {
    min-width: 0;
    flex: 1;
}

.modal-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--mh-ink);
    margin: 0;
    line-height: 1.25;
}

.modal-subtitle {
    font-size: 0.88rem;
    color: var(--mh-muted);
    margin: 0.3rem 0 0;
    line-height: 1.45;
}

.close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 20;
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    box-sizing: border-box;
}

.modal-body-flex {
    display: flex;
    flex-direction: column;
}

.modal-body-tabbed {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-body-tabbed .import-tabs {
    padding: 0 1.5rem;
    margin-bottom: 0;
    flex-shrink: 0;
}

.modal-body-tabbed .import-tab-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-body-tabbed .import-tab-content.hidden {
    display: none;
}

.modal-tab-scroll {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-form-shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    padding: 0.95rem 1.5rem 1.25rem;
    border-top: 1px solid var(--mh-border-subtle);
    background: var(--mh-inset);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.modal-footer-split {
    justify-content: space-between;
}

.modal-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

/* Shared Modal Body Utilities */
.modal-stack-sm {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-stack-md {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.modal-field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--mh-ink);
    margin: 0;
}

.modal-field-input,
.modal-textarea {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

.modal-textarea {
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.modal-inline-error {
    color: #dc2626;
    font-size: 0.84rem;
    margin-top: 0.25rem;
}

.modal-callout {
    border-radius: 10px;
    padding: 0.85rem 1rem;
    font-size: 0.86rem;
    line-height: 1.45;
    margin-bottom: 0.9rem;
}

.modal-callout:last-child {
    margin-bottom: 0;
}

.modal-callout-neutral {
    background: var(--mh-inset);
    border: 1px solid var(--mh-border);
    color: var(--mh-ink);
}

.modal-callout-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.modal-callout-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.modal-callout-title {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.modal-callout-text {
    margin: 0;
    font-size: 0.84rem;
}

.modal-callout-subtext {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    opacity: 0.88;
}

.modal-inline-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 0.65rem;
}

.modal-link-btn {
    width: auto;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.84rem;
}

.modal-btn-subtle {
    font-size: 0.82rem;
    color: var(--mh-muted);
}

.modal-quick-row {
    display: flex;
    gap: 0.6rem;
}

.modal-quick-btn {
    flex: 1;
}

.modal-picker-search-wrap {
    margin-bottom: 0.85rem;
    flex-shrink: 0;
}

.modal-scroll-list {
    overflow-y: auto;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 46vh;
    padding-right: 0.2rem;
}

.modal-invite-form {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.65rem;
    align-items: center;
}

.modal-invite-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
}

.modal-invite-btn {
    flex-shrink: 0;
}

.modal-helper-note {
    font-size: 0.8rem;
    color: var(--mh-muted);
    margin: 0 0 0.85rem;
    line-height: 1.4;
}

.modal-section-heading {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.6rem;
    color: var(--mh-ink);
}

.modal-alert {
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.84rem;
}

.modal-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.modal-alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.modal-account-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.modal-account-label {
    color: var(--mh-muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
}

.modal-account-email {
    font-weight: 600;
    color: var(--mh-ink);
    font-size: 0.96rem;
    word-break: break-all;
}

.modal-account-badge {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 6px;
    background: var(--mh-surface);
    border: 1px solid var(--mh-border);
    color: var(--mh-muted);
    font-weight: 600;
    white-space: nowrap;
}

.modal-danger-zone {
    margin-top: 1.35rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--mh-border-subtle);
}

.modal-danger-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: #b91c1c;
    margin-bottom: 0.3rem;
}

.modal-danger-text {
    color: var(--mh-muted);
    font-size: 0.82rem;
    line-height: 1.45;
    margin: 0 0 0.85rem;
}

.upload-progress-container {
    margin-top: 1rem;
    background: var(--mh-inset);
    border: 1px solid var(--mh-border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

.upload-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.45rem;
    gap: 0.5rem;
}

.upload-progress-status {
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--mh-accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-progress-details {
    color: var(--mh-muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.upload-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(28, 25, 23, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress-bar {
    width: 0%;
    height: 100%;
    background: var(--mh-accent);
    border-radius: 4px;
    transition: width 0.15s ease;
}

/* ==========================================================================
   Recipe Details - Elevated Cookbook Reading Spread
   ========================================================================== */
.glass-panel.recipe-modal-panel {
    max-width: 1160px;
    width: 95%;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--mh-surface);
    border: 1px solid var(--mh-border);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(28, 25, 23, 0.22);
}

.recipe-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    margin-block: 10px;
    margin-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(28, 25, 23, 0.22) transparent;
}

.recipe-modal-body::-webkit-scrollbar {
    width: 8px;
}

.recipe-modal-body::-webkit-scrollbar-track {
    background: transparent;
    margin-block: 4px;
}

.recipe-modal-body::-webkit-scrollbar-thumb {
    background: rgba(28, 25, 23, 0.22);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.recipe-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(28, 25, 23, 0.38);
    border: 2px solid transparent;
    background-clip: content-box;
}

.recipe-modal-panel .close-btn {
    top: 1.5rem;
    right: 1.5rem;
}

.recipe-modal-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 2.5rem;
    padding: calc(2.5rem - 10px) 2.5rem;
    align-items: start;
}

.recipe-modal-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
}

.recipe-modal-main {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    min-width: 0;
}

@media (max-width: 960px) {
    .recipe-modal-layout {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .recipe-modal-sidebar,
    .recipe-modal-main {
        display: contents;
    }

    .recipe-modal-media {
        order: 1;
        width: 100%;
    }

    .recipe-modal-header {
        order: 2;
        width: 100%;
    }

    .cookbook-callout {
        order: 3;
        width: 100%;
        box-sizing: border-box;
    }

    .recipe-ingredients-section {
        order: 4;
        width: 100%;
    }

    .recipe-steps-section {
        order: 5;
        width: 100%;
    }

    .edit-recipe-layout {
        padding: 1.75rem;
        gap: 1.5rem;
    }

    .edit-recipe-columns {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .edit-form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .recipe-modal-panel .close-btn {
        top: 1.25rem;
        right: 1.25rem;
    }

    .modal-header-row {
        padding-right: 0;
    }
}

.recipe-modal-media {
    width: 100%;
}

.modal-hero-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-hero-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 460px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface-subtle);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 960px) {
    .modal-hero-container {
        aspect-ratio: 4 / 3;
        max-height: 280px;
        border-radius: 8px;
    }
}

.modal-hero-container.no-image {
    background: var(--surface-inset);
}

.modal-hero {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.modal-hero-placeholder {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-size: 4.5rem;
    color: var(--text-faint);
}

.modal-image-overlay-actions {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    pointer-events: none;
}

.modal-image-overlay-actions > * {
    pointer-events: auto;
}

.img-badge-btn {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.recipe-modal-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.modal-header-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-right: 3.5rem;
}

.modal-header-row > div:first-child {
    width: 100%;
    min-width: 0;
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.4rem;
    color: var(--text-heading);
    letter-spacing: -0.015em;
    word-break: normal;
    overflow-wrap: break-word;
}

.recipe-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-style: italic;
    margin-bottom: 0.5rem;
    word-break: normal;
    overflow-wrap: anywhere;
}

.recipe-subtitle a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.recipe-subtitle a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Quick-Meta Ribbon */
.recipe-quick-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
}

.recipe-quick-meta .meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--surface-subtle);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.recipe-quick-meta .meta-badge a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.recipe-quick-meta .meta-badge a:hover {
    text-decoration: underline;
}

/* Interactive Servings Scaler */
.servings-scaler {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    row-gap: 0.45rem;
    background: var(--scaler-bg);
    border: 1px solid var(--scaler-border);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.servings-scaler-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.servings-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.servings-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
}

.servings-count {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-heading);
    min-width: 1.5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.servings-presets {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.25rem;
    border-left: 1px solid var(--glass-border);
    padding-left: 0.5rem;
}

.servings-presets .servings-preset-btn {
    height: 26px;
    padding: 0 0.55rem;
    font-size: 0.78rem;
}

.servings-mode-btn {
    height: 26px;
    padding: 0 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    margin-left: auto;
    border-radius: 6px;
    border: 1px solid var(--btn-default-border);
    background: var(--btn-default-bg);
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.servings-mode-btn:hover {
    background: var(--btn-default-hover);
    color: var(--text-main);
    border-color: var(--accent-border);
}

/* Chef's Notes / Description Callout */
.cookbook-callout {
    background: var(--callout-bg);
    border: 1px solid var(--callout-border);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.cookbook-callout-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--callout-title);
    margin-bottom: 0.4rem;
}

.cookbook-callout-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--callout-text);
    margin: 0;
    font-style: normal;
}

/* Recipe Sidebar & Main Content Sections */
.recipe-ingredients-section {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ingredients-header-block {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.ingredients-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.ingredients-scaler-row {
    display: flex;
    align-items: center;
}

.ingredients-scaler-row .servings-scaler {
    width: 100%;
    justify-content: space-between;
    box-sizing: border-box;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
}

.recipe-meta-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.recipe-meta-badges .meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--surface-subtle);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
}

.recipe-steps-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.steps-title-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

/* Backwards compatibility for recipe-details */
.recipe-details {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(260px, 1.4fr);
    gap: 2.5rem;
}

@media (max-width: 1140px) {
    .recipe-details {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.tap-hint {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* Ingredients */
.ingredients-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ingredients-list li.checkable-ingredient {
    padding: 0.75rem 0.65rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    line-height: 1.5;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.ingredients-list li.checkable-ingredient:hover {
    background: var(--surface-subtle);
}

.ingredients-list li.checkable-ingredient::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid var(--input-border);
    border-radius: 4px;
    margin-top: 2px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: transparent;
    transition: all 0.15s ease;
}

.ingredients-list li.checkable-ingredient:hover::before {
    border-color: var(--accent);
}

.ingredients-list li.checkable-ingredient.checked {
    color: var(--text-muted);
    opacity: 0.55;
}

.ingredients-list li.checkable-ingredient.checked span {
    text-decoration: line-through;
}

.ingredients-list li.checkable-ingredient.checked::before {
    background: var(--secondary-accent);
    border-color: var(--secondary-accent);
    color: #ffffff;
    content: '✓';
}

.ingredients-list li.checkable-ingredient .scale-adj-badge {
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 600;
    color: var(--accent);
    background: rgba(224, 83, 60, 0.08);
    border: 1px solid rgba(224, 83, 60, 0.22);
    border-radius: 999px;
    padding: 0.05rem 0.42rem;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
    align-self: center;
}

.ingredients-list li.checkable-ingredient.checked .scale-adj-badge {
    opacity: 0.65;
    text-decoration: none;
}

.ingredients-list li.list-header,
.steps-list li.list-header {
    list-style-type: none;
    font-weight: 700;
    color: var(--accent);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: none;
}

/* Steps */
.steps-list {
    list-style: none;
    counter-reset: step-counter;
    margin: 0;
    padding: 0;
}

.steps-list li:not(.list-header) {
    margin-bottom: 1.35rem;
    line-height: 1.65;
    position: relative;
    padding-left: 2.75rem;
    cursor: pointer;
    transition: opacity 0.2s ease, background 0.15s ease;
    border-radius: 6px;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    padding-right: 0.5rem;
}

.steps-list li:not(.list-header):hover {
    background: var(--surface-subtle);
}

.steps-list li:not(.list-header)::before {
    counter-increment: step-counter;
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0.25rem;
    background: var(--accent);
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    box-sizing: border-box;
    font-variant-numeric: tabular-nums;
    text-align: center;
    box-shadow: 0 2px 6px var(--accent-subtle);
    transition: all 0.2s ease;
}

.steps-list li:not(.list-header).step-completed {
    opacity: 0.5;
}

.steps-list li:not(.list-header).step-completed::before {
    background: var(--secondary-accent);
    content: '✓';
    box-shadow: none;
}

/* Modal Actions Buttons */
.modal-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
}

.mh-segment-group.unit-toggle-group {
    height: var(--mh-btn-h-sm);
    padding: 2px;
    border-radius: 10px;
}

.unit-toggle-group .mh-btn--toggle.mh-btn--sm {
    height: calc(var(--mh-btn-h-sm) - 6px);
    padding: 0 10px;
    font-size: 0.78rem;
    border-radius: 7px;
}

/* Keyboard focus styles */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.confirm-dialog-overlay {
    z-index: 2100;
}

.confirm-dialog-message {
    color: var(--mh-muted);
    margin: 0;
    line-height: 1.55;
    font-size: 0.94rem;
}

.confirm-dialog-footer-stack {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
}

/* ==========================================================================
   Print Stylesheet - Clean Physical Recipe Card Layout
   ========================================================================== */
@media print {
    @page {
        margin: 1.2cm 1.5cm;
        size: auto;
    }

    body {
        background: white !important;
        color: #1e293b !important;
        font-size: 11pt;
    }
    
    /* Hide all main app interface, background widgets, and non-printable overlays */
    .app-container,
    .bg-job-widget,
    .toast,
    #bulkActionToolbar,
    .welcome-screen,
    .confirm-dialog-overlay,
    .modal-overlay {
        display: none !important;
    }

    /* Only display the recipe modal when active */
    #recipeModal.active {
        display: block !important;
        position: static !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }

    #recipeModal.active .glass-panel.recipe-modal-panel {
        background: white !important;
        box-shadow: none !important;
        border: none !important;
        transform: none !important;
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #recipeModal.active #modalBody {
        overflow: visible !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .recipe-modal-layout {
        display: flex !important;
        flex-direction: column !important;
        padding: 0 !important;
    }

    .recipe-modal-sidebar,
    .recipe-modal-main {
        display: contents !important;
    }

    .recipe-modal-header {
        order: 1 !important;
        width: 100% !important;
    }

    .cookbook-callout {
        order: 2 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .recipe-modal-media {
        order: 3 !important;
        float: right !important;
        width: 180px !important;
        margin: 0 0 1rem 1.5rem !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .recipe-ingredients-section {
        order: 4 !important;
        width: 100% !important;
        margin-bottom: 1.5rem !important;
    }

    .recipe-steps-section {
        order: 5 !important;
        width: 100% !important;
    }

    .modal-hero-card {
        position: static !important;
    }

    .modal-hero-container {
        aspect-ratio: auto !important;
        max-height: 190px !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        box-shadow: none !important;
        overflow: hidden !important;
    }

    .modal-hero {
        max-height: 190px !important;
        width: 100% !important;
        object-fit: cover !important;
    }

    .modal-hero-container.no-image,
    .modal-hero-placeholder {
        display: none !important;
    }

    /* Hide interactive UI elements */
    .modal-image-overlay-actions,
    .close-btn,
    .modal-actions,
    .servings-btn,
    .servings-presets,
    .servings-mode-btn,
    .scale-adj-badge,
    .tap-hint,
    .edit-form-actions {
        display: none !important;
    }

    .modal-header-row {
        display: block !important;
        padding-right: 0 !important;
        margin-bottom: 0.5rem !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .modal-title {
        color: #000000 !important;
        font-size: 22pt !important;
        line-height: 1.2 !important;
        margin-bottom: 0.25rem !important;
        font-family: 'Playfair Display', serif !important;
        -webkit-text-fill-color: initial !important;
        break-inside: avoid;
    }

    .recipe-subtitle {
        color: #64748b !important;
        font-size: 10pt !important;
        margin-bottom: 0.75rem !important;
        font-style: italic !important;
    }

    .recipe-subtitle a {
        color: #64748b !important;
        text-decoration: none !important;
    }

    .recipe-quick-meta {
        display: flex !important;
        align-items: center !important;
        margin-bottom: 1rem !important;
        gap: 1rem !important;
        border-bottom: none !important;
        padding-bottom: 0 !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .servings-scaler {
        background: none !important;
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
        color: #334155 !important;
        font-size: 10.5pt !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.35rem !important;
    }

    .servings-scaler-label {
        font-weight: 600 !important;
        color: #1e293b !important;
    }

    .servings-controls {
        display: inline !important;
        border: none !important;
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .servings-count {
        display: inline !important;
        font-weight: 700 !important;
        color: #0f172a !important;
    }

    .recipe-quick-meta .meta-badge {
        background: none !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 6px !important;
        padding: 0.15rem 0.5rem !important;
        box-shadow: none !important;
        color: #475569 !important;
        font-size: 9.5pt !important;
    }

    .cookbook-callout {
        background: #fdfdfd !important;
        border: 1px solid #e2e8f0 !important;
        border-left: 3px solid #64748b !important;
        border-radius: 4px !important;
        padding: 0.6rem 0.8rem !important;
        margin-bottom: 1.25rem !important;
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .cookbook-callout-header {
        font-size: 9.5pt !important;
        font-weight: 600 !important;
        color: #334155 !important;
        margin-bottom: 0.25rem !important;
    }

    .cookbook-callout-text {
        font-size: 9.5pt !important;
        color: #475569 !important;
        line-height: 1.4 !important;
    }

    .section-title {
        color: #000000 !important;
        font-size: 13pt !important;
        border-bottom: 1.5px solid #cbd5e1 !important;
        padding-bottom: 0.25rem !important;
        margin-top: 0.75rem !important;
        margin-bottom: 0.6rem !important;
        break-after: avoid;
        page-break-after: avoid;
    }

    .recipe-details {
        display: grid !important;
        grid-template-columns: 2fr 3fr !important;
        gap: 2rem !important;
        align-items: start !important;
    }

    .ingredients-list li.checkable-ingredient {
        padding: 0.3rem 0 !important;
        border-bottom: 1px dotted #e2e8f0 !important;
        font-size: 10pt !important;
        line-height: 1.35 !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .ingredients-list li.checkable-ingredient::before {
        display: none !important;
    }

    .ingredients-list li.checked,
    .steps-list li.checked {
        text-decoration: none !important;
        opacity: 1 !important;
        color: inherit !important;
    }

    .list-header {
        font-weight: 700 !important;
        font-size: 10.5pt !important;
        margin-top: 0.6rem !important;
        margin-bottom: 0.2rem !important;
        color: #0f172a !important;
        break-after: avoid;
        page-break-after: avoid;
    }

    .steps-list li:not(.list-header) {
        margin-bottom: 0.7rem !important;
        font-size: 10pt !important;
        line-height: 1.4 !important;
        padding-left: 2rem !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .steps-list li:not(.list-header)::before {
        background: #f1f5f9 !important;
        color: #1e293b !important;
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        width: 20px !important;
        height: 20px !important;
        font-size: 8.5pt !important;
        font-weight: 600 !important;
    }
}

/* Hidden Utility */
.hidden {
    display: none !important;
}

/* Welcome Screen */
.welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.welcome-screen.fade-out {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
}

.welcome-content {
    text-align: center;
    padding: 4rem;
    max-width: 600px;
    width: 90%;
}

.welcome-title {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    margin-bottom: 1rem;
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

.welcome-menu {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.url-input-section h3, .pdf-input-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-heading);
}

.welcome-input, .welcome-file-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 1rem;
    border-radius: 8px;
    color: var(--input-text);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.welcome-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.welcome-file-input {
    padding: 0.8rem;
}

.progress-text {
    margin-top: -1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    font-family: 'Inter', sans-serif;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Custom File Upload */
.custom-file-upload-wrapper {
    margin-bottom: 2rem;
    width: 100%;
}

.custom-file-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--surface-subtle);
    border: 2px dashed var(--input-border);
    padding: 1.5rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-file-upload:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
}

.custom-file-upload.has-file {
    border-style: solid;
    border-color: var(--secondary-accent);
    background: rgba(16, 185, 129, 0.08);
    color: var(--secondary-accent);
}

.hidden-file-input {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border: none !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    z-index: -1 !important;
}

.url-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--toast-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    color: var(--toast-text);
    padding: 0.85rem 1.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 2000;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.5);
}

.toast.success::before {
    content: '✓';
    color: #10b981;
    font-weight: bold;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.5);
}

.toast.error::before {
    content: '✕';
    color: #ef4444;
    font-weight: bold;
}

/* Header Controls & Filters (Tier 2) */
.header-controls {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    margin-bottom: 0;
}

.search-bar {
    flex: 1 1 260px;
    min-width: 220px;
}


/* ==========================================================================
   Edit Recipe Modal Layout & Aesthetics
   ========================================================================== */
.edit-recipe-layout {
    padding: 2.75rem 3rem 3rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    position: relative;
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.edit-recipe-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--panel-border);
    padding-right: 3.5rem; /* Space so it doesn't collide with the top-right close-btn */
}

.edit-recipe-title-group {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.edit-recipe-thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--panel-border);
    background: var(--surface-subtle);
}

.edit-recipe-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.edit-recipe-header .modal-title {
    margin-bottom: 0.3rem;
    font-size: clamp(1.8rem, 2.5vw, 2.4rem);
}

.edit-recipe-header .recipe-subtitle {
    margin-bottom: 0;
    color: var(--text-muted);
}

.edit-recipe-form {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    width: 100%;
}

.edit-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.edit-form-row {
    display: grid;
    grid-template-columns: 2fr 110px 1.2fr;
    gap: 1.25rem;
    align-items: start;
}

.edit-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-heading);
    letter-spacing: 0.01em;
}

.edit-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.edit-label-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
}

.edit-label-hint code {
    background: var(--surface-inset);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: var(--accent);
}

.edit-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--input-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.95rem;
    line-height: 1.45;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.edit-input:hover {
    border-color: #94a3b8;
}

.edit-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
    background: #ffffff;
}

.edit-textarea {
    resize: vertical;
    min-height: 85px;
    line-height: 1.5;
}

.edit-recipe-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.edit-recipe-columns textarea {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.92rem;
    line-height: 1.6;
    min-height: 280px;
    white-space: pre;
}

.edit-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 0.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--panel-border);
}

/* Header Top Row & Navigation (Tier 1) */
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-brand-nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.header-title {
    margin: 0;
    font-size: 2.15rem;
    line-height: 1.1;
}

.header-primary-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-recipes-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--mh-inset);
    border: 1px solid var(--mh-border);
    padding: 3px;
    border-radius: var(--mh-radius-group);
    height: var(--mh-control-h);
    box-sizing: border-box;
}

.nav-divider {
    width: 1px;
    height: 20px;
    background: var(--mh-border);
    margin: 0 0.2rem;
    flex-shrink: 0;
}

.header-nav-actions {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-label {
    font-size: 0.88rem;
    font-weight: 600;
}

.staged-badge {
    background: rgba(234, 88, 12, 0.12);
    color: #c2410c;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    margin-left: 2px;
    display: inline-block;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.active-tab .staged-badge {
    background: rgba(234, 88, 12, 0.16);
    color: #9a3412;
}

/* User Profile Dropdown */
.user-profile-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.user-profile-btn {
    gap: 0.35rem;
    padding: 0 0.55rem 0 0.3rem;
    border-radius: 999px;
    background: var(--mh-hover);
}

.user-profile-btn:hover {
    background: var(--mh-inset);
}

.custom-select:focus-visible {
    outline: var(--mh-focus);
    outline-offset: 2px;
}

.user-avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--mh-surface);
    border: 1px solid var(--mh-border);
    color: var(--mh-ink);
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-avatar-chevron {
    color: var(--mh-muted);
    transition: transform 120ms ease;
    flex-shrink: 0;
}

.user-profile-btn[aria-expanded="true"] .user-avatar-chevron {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--mh-surface);
    border: 1px solid var(--mh-border);
    border-radius: var(--mh-radius-group);
    padding: 0.4rem;
    box-shadow: 0 8px 24px rgba(31, 41, 55, 0.12);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-dropdown-header {
    padding: 0.5rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-dropdown-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mh-muted);
}

.user-dropdown-email {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--mh-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--mh-border);
    margin: 0.25rem 0.2rem;
}

.user-dropdown-item {
    justify-content: flex-start;
    padding: 0 0.7rem;
    font-weight: 500;
    text-align: left;
}

/* Header Search & View Controls */
.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-input-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--mh-muted);
    pointer-events: none;
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    width: 26px;
    height: 26px;
}

.view-sort-controls {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.sort-wrapper {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.control-label {
    font-size: 0.84rem;
    color: var(--mh-muted);
    font-weight: 600;
    white-space: nowrap;
}

.custom-select {
    background-color: var(--mh-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6560' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 14px 14px;
    border: 1px solid var(--mh-border);
    color: var(--mh-ink);
    height: var(--mh-control-h);
    padding: 0 2rem 0 0.85rem;
    border-radius: var(--mh-radius-control);
    font-family: 'Inter', sans-serif;
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    box-shadow: 0 1px 2px rgba(120, 80, 40, 0.04);
}

.custom-select:focus {
    border-color: var(--mh-accent);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.14);
}

.custom-select option {
    background: var(--mh-surface);
    color: var(--mh-ink);
}

/* Grid Columns Slider Control */
.grid-columns-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--mh-hover);
    border: 1px solid var(--mh-border);
    border-radius: var(--mh-radius-control);
    height: var(--mh-control-h);
    padding: 0 0.85rem;
    user-select: none;
    transition: opacity 120ms ease, visibility 120ms ease;
}

.grid-columns-wrapper.hidden {
    display: none !important;
}

.grid-columns-label {
    font-size: 0.84rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

#gridColumnsVal {
    color: var(--accent);
    font-weight: 700;
}

#gridColumnsSlider {
    -webkit-appearance: none;
    appearance: none;
    width: 75px;
    height: 6px;
    background: var(--input-border);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    vertical-align: middle;
}

#gridColumnsSlider:hover {
    background: var(--text-muted);
}

#gridColumnsSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #ffffff;
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-subtle);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

#gridColumnsSlider::-webkit-slider-thumb:hover,
#gridColumnsSlider::-webkit-slider-thumb:active {
    transform: scale(1.2);
    background: var(--accent-hover);
}

#gridColumnsSlider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #ffffff;
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-subtle);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

#gridColumnsSlider::-moz-range-thumb:hover,
#gridColumnsSlider::-moz-range-thumb:active {
    transform: scale(1.2);
    background: var(--accent-hover);
}

.view-toggle-wrapper {
    display: inline-flex;
    align-items: center;
    background: var(--mh-inset);
    border: 1px solid var(--mh-border);
    border-radius: var(--mh-radius-group);
    height: var(--mh-control-h);
    padding: 3px;
    gap: 2px;
    box-sizing: border-box;
}

/* List View Style */
.recipe-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 100% !important;
    margin: 0 !important;
}

.recipe-grid.list-view .recipe-card {
    aspect-ratio: auto;
    height: 110px;
    background: var(--surface-card);
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
}

.recipe-grid.list-view .recipe-image,
.recipe-grid.list-view .recipe-placeholder {
    position: relative;
    inset: auto;
    width: 110px;
    height: 110px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--glass-border);
    font-size: 1.5rem;
}

.recipe-grid.list-view .recipe-card:hover .recipe-image {
    transform: none;
}

.recipe-grid.list-view .recipe-content {
    position: static;
    inset: auto;
    background: none;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    pointer-events: auto;
    flex-grow: 1;
}

.recipe-grid.list-view .recipe-title {
    color: var(--text-heading);
    font-size: 1.25rem;
    margin-bottom: 0.35rem;
    text-shadow: none;
    -webkit-line-clamp: 1;
}

.recipe-grid.list-view .recipe-meta {
    margin-bottom: 0.35rem;
}

.recipe-grid.list-view .meta-pill {
    background: var(--surface-subtle);
    border-color: var(--glass-border);
    color: var(--accent);
    padding: 0.15rem 0.5rem;
    font-size: 0.72rem;
    text-shadow: none;
}

.recipe-grid.list-view .recipe-desc {
    color: var(--text-muted);
    max-height: none;
    opacity: 0.8;
    margin-top: 0;
    text-shadow: none;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Select Mode Checkboxes & Selection Glow */
.recipe-card.select-mode {
    position: relative;
}

.select-checkbox {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 0.2s ease;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.recipe-card.selected {
    border-color: var(--accent) !important;
    box-shadow: 0 0 20px var(--accent-subtle) !important;
    background: var(--accent-subtle) !important;
}

.recipe-card.selected .select-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}

.recipe-card.selected .select-checkbox::after {
    content: '✓';
    color: #ffffff;
}

/* Floating Bulk Toolbar */
.bulk-toolbar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    width: 90%;
    max-width: 800px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

.bulk-toolbar.hidden {
    transform: translateX(-50%) translateY(120px);
    opacity: 0;
    pointer-events: none;
}

.bulk-toolbar-content {
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-border);
    padding: 1rem 1.8rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15), 0 0 25px var(--accent-subtle);
    flex-wrap: wrap;
    gap: 1rem;
}

.selected-count-badge {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--accent);
}

.bulk-toolbar-buttons {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

/* Import Modal Tabs */
.import-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
}

.import-tab-btn {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: var(--mh-btn-radius-md) var(--mh-btn-radius-md) 0 0;
    color: var(--mh-muted);
}

.import-tab-btn.is-active,
.import-tab-btn.active {
    color: var(--mh-accent);
    border-bottom-color: var(--mh-accent);
}

.import-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Feature Banner inside Modal */
.import-feature-banner {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.import-feature-banner .feature-icon {
    font-size: 1.25rem;
    line-height: 1.2;
}

.import-feature-banner .feature-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.import-feature-banner .feature-text strong {
    color: #059669;
    font-weight: 600;
}

/* Selected Files List in Modal */
.selected-files-list {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 140px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.selected-file-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-subtle);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    color: var(--text-main);
}

.selected-file-chip .file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 75%;
}

.selected-file-chip .file-size {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Floating Background Job Widget */
.bg-job-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 420px;
    max-width: calc(100vw - 3rem);
    z-index: 99999;
    background: var(--panel-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 35px var(--accent-subtle);
    padding: 0;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-main);
}

.bg-job-widget.minimized {
    width: auto;
    max-width: 320px;
    border-radius: 8px;
}

.bg-job-widget.minimized .bg-job-accent-line,
.bg-job-widget.minimized .bg-job-body {
    display: none;
}

.bg-job-widget.minimized .bg-job-header {
    padding: 0.6rem 1.1rem;
}

.bg-job-accent-line {
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, #10b981, #ea580c, #e0533c);
}

.bg-job-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem 0.6rem;
    gap: 0.75rem;
}

.bg-job-title-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-heading);
}

.bg-job-pulse-dot {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: bgPulseDot 1.8s infinite ease-in-out;
    flex-shrink: 0;
}

@keyframes bgPulseDot {
    0%, 100% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 6px #10b981; }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 16px #34d399; }
}

.bg-job-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.bg-job-body {
    padding: 0.4rem 1.25rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bg-job-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.bg-job-filename {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.bg-job-filecount {
    background: var(--surface-subtle);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.bg-job-progress-container {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.bg-job-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--surface-subtle);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    overflow: hidden;
    padding: 1px;
}

.bg-job-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #10b981, #ea580c, #e0533c);
    border-radius: 4px;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bg-job-percent {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-heading);
    min-width: 35px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* PWA Offline Dot Indicator */
.offline-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d97706;
    flex-shrink: 0;
}

/* Mobile-only controls hidden on desktop/tablet >= 768px */
.search-filters-row {
    display: contents;
}

.mobile-menu-btn,
.mobile-filters-btn,
.mobile-nav-backdrop,
.mobile-nav-drawer {
    display: none;
}

.mobile-filters-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--mh-accent);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mobile-filters-badge.hidden {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .mh-btn,
    .mh-status-pill--live,
    .glass-header,
    .search-bar input,
    .user-profile-btn,
    .user-avatar-chevron,
    .custom-select,
    .grid-columns-wrapper,
    .modal-overlay,
    .confirm-dialog-overlay,
    .glass-panel {
        transition: none;
    }

    .mh-btn-spinner {
        animation: none;
    }
}

/* Tablet & Intermediate Desktop Wrapping */
@media (max-width: 1120px) {
    .glass-header {
        padding: 1.15rem 1.5rem;
    }

    .header-brand-nav {
        gap: 1.15rem;
    }

    .search-bar {
        flex: 1 1 100%;
    }

    .view-sort-controls {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Mobile & Android PWA Responsive Layout */
@media (max-width: 767.98px) {
    .app-container {
        padding: 0.75rem;
        padding-top: max(0.75rem, env(safe-area-inset-top));
        padding-bottom: max(4rem, env(safe-area-inset-bottom));
        overflow-x: clip;
    }

    .glass-header {
        padding: 0.85rem 0.9rem;
        border-radius: 12px;
        margin-bottom: 1.1rem;
        gap: 0;
    }

    .header-top-row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-brand-nav {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        width: auto;
        min-width: 0;
    }

    .header-title {
        font-size: 1.35rem;
        line-height: 1.15;
    }

    .nav-divider {
        display: none;
    }

    .header-nav-actions {
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
        gap: 0.45rem;
        flex-wrap: wrap;
        justify-content: flex-end;
        overflow: visible;
    }

    #userProfileDropdown {
        display: none;
    }

    .mobile-menu-btn {
        display: inline-flex;
        flex-shrink: 0;
    }

    .header-nav-actions .mh-btn,
    .header-nav-actions .mh-status-pill {
        flex-shrink: 0;
    }

    .header-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        margin-bottom: 0;
    }

    .search-filters-row {
        display: flex;
        align-items: flex-start;
        gap: 0.5rem;
        width: 100%;
        min-width: 0;
    }

    .search-bar {
        width: auto;
        flex: 1 1 0;
        min-width: 0;
    }

    .search-bar input {
        font-size: 0.88rem;
        padding: 0 2.15rem 0 2.25rem;
    }

    .mobile-filters-btn {
        display: inline-flex;
        flex-shrink: 0;
    }

    .mobile-filters-btn[aria-expanded="true"] {
        background: var(--mh-inset);
        border-color: var(--mh-ink);
        color: var(--mh-ink);
    }

    .view-sort-controls {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
        padding-top: 0.7rem;
        border-top: 1px solid var(--mh-border-subtle);
    }

    .header-controls.filters-open .view-sort-controls {
        display: flex;
    }

    .view-sort-controls .sort-wrapper {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.65rem;
        width: 100%;
    }

    .view-sort-controls .custom-select {
        flex: 1;
        min-width: 0;
        width: 100%;
    }

    .view-sort-controls .grid-columns-wrapper {
        display: flex;
        width: 100%;
        justify-content: space-between;
        box-sizing: border-box;
    }

    .view-sort-controls #gridColumnsSlider {
        flex: 1;
        max-width: 170px;
    }

    .view-sort-controls .view-toggle-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .view-sort-controls .view-toggle-btn {
        justify-content: center;
    }

    .view-sort-controls .toolbar-select-btn {
        width: 100%;
        justify-content: center;
    }

    /* Mobile Slide-Over Navigation Drawer */
    .mobile-nav-backdrop:not(.hidden) {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(28, 25, 23, 0.42);
        backdrop-filter: blur(2px);
        z-index: 1990;
    }

    .mobile-nav-drawer:not(.hidden) {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(320px, 86vw);
        max-width: 100vw;
        background: var(--mh-surface);
        border-left: 1px solid var(--mh-border);
        box-shadow: -12px 0 32px rgba(28, 25, 23, 0.16);
        z-index: 2000;
        padding: max(1rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom));
        box-sizing: border-box;
        overflow-y: auto;
    }

    .mobile-nav-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 0.85rem;
        border-bottom: 1px solid var(--mh-border-subtle);
        margin-bottom: 0.9rem;
    }

    .mobile-nav-drawer-title {
        font-family: 'Playfair Display', Georgia, serif;
        font-size: 1.2rem;
        font-weight: 700;
        color: var(--mh-ink);
    }

    .mobile-nav-close-btn {
        flex-shrink: 0;
    }

    .mobile-nav-drawer-body {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        flex: 1;
    }

    .mobile-nav-section {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .mobile-nav-section .header-primary-nav {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
        width: 100%;
    }

    .mobile-nav-section .nav-recipes-group {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        padding: 4px;
        width: 100%;
        height: auto;
        box-sizing: border-box;
    }

    .mobile-nav-section .header-primary-nav .nav-tab-btn.mh-btn {
        width: 100%;
        justify-content: flex-start;
        height: 42px;
        padding: 0 0.85rem;
        font-size: 0.9rem;
    }

    .mobile-nav-section .user-dropdown-menu {
        display: flex;
        flex-direction: column;
        position: static;
        width: 100%;
        min-width: 0;
        max-width: none;
        box-shadow: none;
        border: 1px solid var(--mh-border);
        border-radius: var(--mh-radius-group);
        padding: 0.35rem;
        background: var(--mh-inset);
        box-sizing: border-box;
    }

    .mobile-nav-section .user-dropdown-item {
        height: 42px;
        font-size: 0.9rem;
    }

    body.mobile-drawer-open {
        overflow: hidden;
    }


    .recipe-grid {
        gap: 0.85rem;
    }

    .recipe-card {
        border-radius: 8px;
    }

    .recipe-content {
        padding: 1.75rem 0.8rem 0.7rem;
    }

    .recipe-title {
        font-size: 1.05rem;
    }

    /* Full-screen Native-Style Recipe Sheet on Phones */
    .glass-panel.recipe-modal-panel {
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }

    .recipe-modal-body {
        margin-block: 0;
        margin-right: 0;
    }

    .recipe-modal-layout {
        padding: 1.35rem;
        padding-top: max(3.2rem, calc(env(safe-area-inset-top) + 2.5rem));
        padding-bottom: max(2.5rem, calc(env(safe-area-inset-bottom) + 1.5rem));
        gap: 1.25rem;
    }

    .edit-recipe-layout {
        padding: 1.35rem;
        padding-top: max(3.2rem, calc(env(safe-area-inset-top) + 2.5rem));
        padding-bottom: max(2.5rem, calc(env(safe-area-inset-bottom) + 1.5rem));
        gap: 1.25rem;
    }

    .edit-recipe-header {
        padding-right: 2.75rem;
    }

    .edit-recipe-thumb {
        width: 48px;
        height: 48px;
        border-radius: 6px;
    }

    .edit-recipe-columns {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .edit-recipe-columns textarea {
        min-height: 200px;
    }

    .edit-form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .edit-form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .edit-form-actions .mh-btn {
        width: 100%;
        height: var(--mh-btn-h-lg);
    }

    .recipe-modal-panel .close-btn {
        position: fixed;
        top: max(0.75rem, env(safe-area-inset-top));
        right: 0.85rem;
        background: var(--mh-surface);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .modal-header-row {
        padding-right: 0;
        gap: 0.85rem;
        margin-bottom: 1.25rem;
    }

    .modal-actions {
        gap: 0.45rem;
    }

    .recipe-quick-meta {
        gap: 0.5rem;
    }

    .modal-overlay,
    .confirm-dialog-overlay {
        padding: 0.65rem;
    }

    .glass-panel.modal-shell {
        max-height: 92dvh;
    }

    .modal-header {
        padding: 1rem 1.15rem 0.85rem;
    }

    .modal-body,
    .modal-tab-scroll {
        padding: 1rem 1.15rem;
    }

    .modal-body-tabbed .import-tabs {
        padding: 0 1.15rem;
    }

    .modal-footer {
        padding: 0.85rem 1.15rem 1rem;
    }

    .modal-invite-form {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-invite-btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .recipe-grid {
        gap: 0.75rem;
    }
}

/* Camera Snap Feature (Mobile) */
.camera-snap-btn {
    background: var(--btn-default-bg) !important;
    border-color: var(--accent-border) !important;
    color: var(--accent) !important;
}

.camera-snap-btn:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px var(--accent-subtle) !important;
}

.camera-snap-prompt-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2.25rem 1.25rem;
    background: rgba(0, 0, 0, 0.02);
    border: 2px dashed rgba(224, 83, 60, 0.35);
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
}

.camera-snap-icon {
    font-size: 3rem;
    line-height: 1;
}

.camera-snap-info {
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.camera-snap-info strong {
    font-size: 1.05rem;
    color: #1e293b;
}

.camera-snap-info span {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
}

.camera-snap-action-btn {
    width: auto !important;
    padding: 0.75rem 1.6rem !important;
    font-size: 1rem !important;
    display: inline-flex !important;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.camera-review-panel {
    will-change: transform, opacity;
}

.camera-preview-gallery {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.6rem;
    margin-bottom: 1rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    contain: layout paint;
}

.camera-preview-item {
    position: relative;
    flex: 0 0 120px;
    height: 155px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(224, 83, 60, 0.45);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    background: #0f172a;
    contain: strict;
}

.camera-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    content-visibility: auto;
}

.camera-preview-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.camera-preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.camera-review-controls {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.camera-sub-btn {
    flex: 1;
}

/* ==========================================================================
   Weekly Meal Planner Styles
   ========================================================================== */

.planner-view {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 3rem;
}

.planner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 1rem;
}

.planner-week-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.55rem;
    color: var(--text-heading);
    margin: 0;
}

.planner-nav-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.planner-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
    align-items: stretch;
}

@media (max-width: 1200px) {
    .planner-days-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

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

.planner-day-card {
    background: var(--surface-card);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 280px;
}

.planner-day-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.planner-day-card.is-today {
    border: 2px solid var(--accent);
    background: linear-gradient(180deg, #fffbf9 0%, #ffffff 100%);
    box-shadow: 0 8px 25px rgba(224, 83, 60, 0.12);
}

.planner-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.planner-day-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-heading);
}

.planner-day-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.planner-today-badge {
    background: var(--accent);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.planner-meal-slot {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.planner-empty-slot {
    flex: 1;
    border: 2px dashed var(--glass-border-strong);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    background: var(--surface-subtle);
    transition: all 0.2s ease;
    min-height: 180px;
}

.planner-empty-slot:hover {
    background: #fff;
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.02);
}

.planner-empty-slot-icon {
    font-size: 1.6rem;
    opacity: 0.85;
}

.planner-empty-slot-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.planner-filled-slot {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.planner-dish-clickable {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    cursor: pointer;
    text-decoration: none;
}

.planner-dish-clickable:hover .planner-dish-title {
    color: var(--accent);
}

.planner-dish-clickable:hover .planner-dish-img-wrap img {
    transform: scale(1.05);
}

.planner-dish-img-wrap {
    position: relative;
    width: 100%;
    height: 130px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #f1ede4;
}

.planner-dish-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.planner-dish-img-wrap:hover img {
    transform: scale(1.05);
}

.planner-dish-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-heading);
    line-height: 1.3;
    cursor: pointer;
    margin: 0;
    transition: color 0.15s ease;
}

.planner-dish-title:hover {
    color: var(--accent);
}

.planner-dish-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.planner-dish-notes {
    font-size: 0.78rem;
    color: #475569;
    background: var(--surface-subtle);
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    border-left: 3px solid var(--accent);
    margin: 0;
    font-style: italic;
}

.planner-slot-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.4rem;
}

.planner-slot-actions .cook-btn {
    flex: 1;
}

/* Plan Picker Item */
.plan-picker-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: var(--surface-card);
    cursor: pointer;
    transition: all 0.2s ease;
}

.plan-picker-item:hover {
    background: #fff8f6;
    border-color: var(--accent);
    transform: translateX(3px);
}

.plan-picker-thumb {
    width: 54px;
    height: 54px;
    border-radius: 5px;
    object-fit: cover;
    background: #f1ede4;
    flex-shrink: 0;
}

.plan-picker-info {
    flex: 1;
    min-width: 0;
}

.plan-picker-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 0.2rem 0;
}

.plan-picker-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

/* User Management & Access Styles */
.user-invite-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-radius: 6px;
    background: var(--surface-bg, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    gap: 0.75rem;
    transition: background 0.15s ease;
}

.user-invite-card:hover {
    background: var(--surface-hover, rgba(255, 255, 255, 0.07));
}

.user-invite-email {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-invite-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.user-status-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.user-status-badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.user-status-badge.invited {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   Recipe Sharing & In-App Notification Styling
   ========================================================================== */

/* Ensure secondary modals opened from inside the recipe modal stack cleanly on top */
#shareRecipeModal,
#planRecipeModal {
    z-index: 1500;
}

/* Notification Banner */
.shared-notification-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 10px;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
    transition: all 0.25s ease;
}

.shared-notification-banner.hidden {
    display: none !important;
}

.shared-notification-banner .banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.shared-notification-banner .banner-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.shared-notification-banner .banner-text strong {
    color: #14532d;
}

.shared-notification-banner .banner-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

/* Callout inside Recipe Modal for Shared Recipes */
.shared-recipe-callout {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    border-radius: 8px;
    padding: 0.85rem 1.15rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.shared-recipe-callout strong {
    color: #0c4a6e;
}

/* Pill badge on Recipe Cards */
.meta-pill.shared-pill {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    font-weight: 600;
}


