* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --green: #8FA57F;
    --green-dark: #6B8E5C;
    --green-light: #E8F5E3;
    --off-white: #F8F7F5;
    --white: #FFFFFF;
    --cream: #FAF7F2; 
    --off-white: #f8f9fa;
    --text-dark: #2C2C2C;
    --text-medium: #4A4A4A;
    --text-light: #6A6A6A;
    --border: #E5E5E5;
    --shadow: rgba(0,0,0,0.08);
    --danger: #E89B9B;
    --grey-dark: #5A5A5A;
    --charcoal: #333333;
    --gold: #FFD700;
    --gold-dark: #D4A017;
}

@media (prefers-color-scheme: dark) {
    :root {
        --green: #A5C398;  
        --green-dark: #8FA57F;
        --green-light: rgba(165, 195, 152, 0.15);  
        --off-white: #0A0A0A;  
        --white: #1A1A1A; 
        --cream: #1F1F1F; 
        --text-dark: #FFFFFF;  
        --text-medium: #C0C0C0;  
        --text-light: #999999;  
        --border: #333333;  
        --shadow: rgba(0,0,0,0.6);
        --danger: #FF9999;  
        --grey-dark: #666666;
        --charcoal: #E0E0E0;  
        --gold: #FFD700;  
    }
    
    /* Specific adjustments for dark mode */
    input, select, textarea {
        background: #252525;
        color: #E0E0E0;
    }
    
    .modal-content {
        background: #1E1E1E;
        box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    }
    
    .hero-section {
        background: linear-gradient(135deg, #1F2A1D 0%, #1E1E1E 100%);
    }
    
    .stock-btn, .type-btn, .category-pill {
        background: #252525;
    }
    
    .toast {
        background: #2A2A2A !important;
        border: 1px solid #444444 !important;
        color: #FFFFFF !important;
    }
    
    /* Fix duplicate management modal */
    .duplicate-alert {
        background: #2A2A2A !important;
        border: 1px solid #666666 !important;
    }
    
    .duplicate-item {
        background: #333333 !important;
        color: #E0E0E0 !important;
    }
    
    .duplicate-choice {
        background: #2A2A2A !important;
        border: 1px solid #444444 !important;
    }
    
    /* Fix merge/separate buttons */
    .merge-btn {
        background: #8FA57F !important;
        color: #000000 !important;
    }
    
    .separate-btn {
        background: #4A4A4A !important;
        color: #E0E0E0 !important;
        border: 1px solid #666666 !important;
    }
    
    /* Fix buttons in duplicate modal */
    .duplicate-choice-options button.secondary {
        background: #3A3A3A !important;
        color: #E0E0E0 !important;
        border: 1px solid #555555 !important;
    }
    
    .duplicate-choice-options button:not(.secondary) {
        background: #8FA57F !important;
        color: #000000 !important;
    }
    
    /* Fix household modal */
    .household-status {
        background: #2A2A2A !important;
        color: #E0E0E0 !important;
    }
    
    .household-member-item {
        background: #333333 !important;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 12px;
    }
    
    .member-name {
        color: #FFFFFF !important;
    }
    
    .member-role {
        color: #999999 !important;
    }
    
    .member-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
    }
    
    .remove-member-btn:hover {
        background: #c82333 !important;
    }
    
    .invite-section {
        background: #2A2A2A !important;
    }
    
    .invite-code input {
        background: #333333 !important;
        color: #E0E0E0 !important;
    }
    
/* Fix Add to Home Screen guide */
    .install-guide {
        background: #1E1E1E !important;
        color: #E0E0E0 !important;
        border: 1px solid #444444 !important;
    }
    
    .install-guide button {
        background: #8FA57F !important;
        color: #000000 !important;
        border: none !important;
    }
       
    header {
        background: #1A1A1A;
        border-bottom: 1px solid #333333;
    }
    
    header h1 {
        color: #FFFFFF !important;
    }
    
    /* Force Lazy Sous header text to white */
    header h1 {
        color: #FFFFFF !important;
    }
    
    .section-title {
        color: #FFFFFF;
    }
    
    .hero-title {
        color: #FFFFFF !important;
    }
    
    /* Force all primary text to white */
    .section-title-main span,
    .day-header,
    .meal-type-label,
    .spinner-note {
        color: #FFFFFF !important;
    }
    
    .hero-section {
        background: linear-gradient(135deg, rgba(165, 195, 152, 0.2) 0%, #1A1A1A 100%);
    }
    
    /* Improve button contrast */
    .spinner-button {
        background: #8FA57F;
        border-color: #FFD700;
        color: #FFFFFF;
        font-weight: 700;
    }
    
    .spinner-button:hover {
        background: #A5C398;
    }
    
    /* Tab visibility */
    .desktop-tabs {
        background: #1A1A1A;
        border-bottom: 1px solid #333333;
    }
    
    .desktop-tabs .tab {
        color: #C0C0C0;
        background: #242424;
        border: 1px solid #333333;
    }
    
    .desktop-tabs .tab.active {
        color: #A5C398;
        border: 2px solid #A5C398;
        background: rgba(165, 195, 152, 0.1);
    }
    
    /* Mobile nav visibility */
    .mobile-nav {
        background: #1A1A1A;
        border-top: 1px solid #333333;
    }
    
    .mobile-nav .nav-item {
        color: #C0C0C0;
    }
    
    .mobile-nav .nav-item.active {
        color: #A5C398;
    }
    
    /* Card contrast */
    .day-card {
        background: #242424;
        border: 1px solid #333333;
    }
    
    .day-card.today {
        border: 2px solid #FFD700;
        box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.2);
    }
    
    /* Category pills */
    .category-pill {
        background: #2A2A2A;
        color: #C0C0C0;
        border: 1px solid #333333;
    }
    
    .category-pill.active {
        background: #8FA57F !important;
        color: #000000 !important;  /* Pure black for better contrast */
        border-color: #8FA57F !important;
    }
    
    .category-pill.spinner-selected {
        background: #FFD700;
        color: #1A1A1A !important;  /* Dark text on gold */
        font-weight: 600;
    }
    
    /* Ensure gold spinner button has dark text */
    .spinner-button.spinning {
        color: #1A1A1A !important;
    }
    
    /* Fix all medium/light text to be white in dark mode */
    .spinner-note,
    .time-info,
    .dish-meta,
    .empty-state p,
    .help-text,
    .backup-info,
    .footer-copyright {
        color: #FFFFFF !important;
    }
    
    /* Ensure step numbers are visible */
    .step-number {
        color: #1A1A1A !important;  /* Dark text in circle */
    }
    
    /* Type buttons */
    .type-btn {
        background: #242424;
        color: #C0C0C0;
        border: 1px solid #333333;
    }
    
    .type-btn.active[data-type="cook"] {
        background: #8FA57F;
        color: #1A1A1A;  /* Black text on green */
    }
    
    .type-btn.active[data-type="off"] {
        background: #666666;
        color: #FFFFFF;
    }
    
    /* Dropdown readability */
    .custom-select select {
        background: #242424;
        color: #FFFFFF;
        border: 1px solid #444444;
    }
    
    /* Help text visibility */
    .help-text {
        background: rgba(165, 195, 152, 0.2);
        color: #FFFFFF;
        border: 1px solid rgba(165, 195, 152, 0.3);
    }
    
    /* Shopping list items */
    .aisle-title {
        color: #A5C398;
        border-bottom-color: #333333;
    }
    
    .item-line1 {
        color: #FFFFFF;
    }
    
    .item-needed {
        color: #C0C0C0;
    }
    
    .item-needed.need-buy {
        background: #DC3545 !important;
        color: #FFFFFF !important;  /* Force white text */
        padding: 3px 8px;
        border-radius: 12px;
        font-weight: 600;
        display: inline-block;
    }
    
    /* Make stock buttons more visible */
    .stock-btn {
        background: #2A2A2A;
        color: #FFFFFF;
        border: 1px solid #444444;
    }
    
    /* Shopper buttons */
    .shopper-btn {
        background: #2A2A2A !important;
        color: #C0C0C0 !important;
        border: 1px solid #444444 !important;
    }
    
    @media (hover: hover) {
    .shopper-btn:hover {
        background: #333333 !important;
        border-color: #A5C398 !important;
    }
}
    
    .shopper-btn.active {
        background: #8FA57F !important;
        color: #000000 !important;
        border-color: #8FA57F !important;
    }

    @media (hover: hover) {
    .stock-btn:not(.active-all):not(.active-some):hover {
        /* Hover effect removed to prevent misleading visual feedback */
    }
}
    
    button.stock-btn {
        background: #1A1A1A !important;  /* Black background */
        color: #B0B0B0 !important;  /* Gray text */
        border: 1px solid #606060 !important;  /* Gray border */
    }
    
    button.stock-btn.active-all {
        background: #8FA57F !important;
        color: #000000 !important;  /* Pure black text */
        border-color: #8FA57F !important;
        font-weight: 600;
    }
    
    button.stock-btn.active-some {
        background: #FFA726 !important;
        color: #000000 !important;  /* Pure black text */
        border-color: #FFA726 !important;
        font-weight: 600;
    }
    
    /* Buttons contrast */
    button {
        background: #8FA57F;
        color: #FFFFFF;
    }
    
    button:hover {
        background: #A5C398;
    }
    
    button.secondary {
        background: #4A4A4A;  /* Slightly lighter gray */
        color: #E0E0E0;  /* Light gray text for better contrast */
        border: 1px solid #606060;  /* Add border for definition */
    }
    
    button.danger {
        background: #CC5555;
        color: #FFFFFF;
    }
    
    /* Fix export buttons accessibility */
    .export-buttons button {
        background: #8FA57F !important;
        color: #1A1A1A !important;  /* Black text on green */
    }
    
    .reset-week-btn {
        background: #4A4A4A !important;
        color: #E0E0E0 !important;
        border: 1px solid #606060 !important;
    }
    
    /* Footer contrast */
    .footer-section {
        background: #0A0A0A;
        border-top: 1px solid #333333;
    }
    
    .footer-icon {
        color: #C0C0C0;
    }
    
    .footer-icon:hover {
        color: #A5C398;
    }
/* Modal improvements for dark mode - COMPREHENSIVE */
    .modal {
        background: rgba(0,0,0,0.8);
    }
    
    .modal-content {
        background: #1E1E1E !important;
        color: #E0E0E0 !important;
    }
    
    .modal-content h2,
    .modal-header h2,
    .modal-content h3,
    .modal-content h4 {
        color: #FFFFFF !important;
    }
    
    .modal-content p,
    .confirm-message,
    .form-group label,
    .modal-content label,
    .modal-body,
    .modal-content div {
        color: #E0E0E0 !important;
    }
    
    /* All inputs in modals */
    .modal-content input[type="text"],
    .modal-content input[type="url"],
    .modal-content input[type="number"],
    .modal-content input[type="email"],
    .modal-content textarea,
    .modal-content select,
    input[type="text"],
    input[type="url"],
    input[type="number"],
    input[type="email"],
    textarea,
    select {
        background: #2A2A2A !important;
        color: #E0E0E0 !important;
        border: 1px solid #444444 !important;
    }
    
    /* Placeholder text */
    .modal-content input::placeholder,
    .modal-content textarea::placeholder,
    input::placeholder,
    textarea::placeholder {
        color: #808080 !important;
    }
    
    /* Category selection in modals */
    .category-option {
        background: #2A2A2A !important;
        color: #E0E0E0 !important;
        border: 1px solid #444444 !important;
    }
    
    .category-option:hover {
        background: #333333 !important;
        border-color: var(--green) !important;
    }
    
    .category-option.selected {
        background: var(--green) !important;
        color: #000000 !important;
        border-color: var(--green) !important;
    }
    
    /* Modal close button */
    .modal-close {
        background: transparent;
        color: #E0E0E0 !important;
    }
    
    .modal-close:hover {
        background: #333333;
        color: #FFFFFF !important;
    }
    
    /* Welcome modal options */
    .welcome-option-btn {
        background: #2A2A2A !important;
        border: 2px solid #444444 !important;
        color: #E0E0E0 !important;
    }
    
    .welcome-option-btn:hover {
        background: #333333 !important;
        border-color: var(--green) !important;
    }
    
    .welcome-title {
        color: #FFFFFF !important;
    }
    
    .welcome-subtitle {
        color: #C0C0C0 !important;
    }
    
    /* Duplicate management modal */
    .duplicate-choice {
        background: #2A2A2A !important;
        border: 1px solid #444444 !important;
    }
    
    .duplicate-choice-header {
        color: #FFFFFF !important;
    }
    
    .duplicate-choice button {
        background: #333333 !important;
        color: #E0E0E0 !important;
        border: 1px solid #555555 !important;
    }
    
    .duplicate-choice button.selected {
        background: var(--green) !important;
        color: #000000 !important;
    }
    
    /* Contact form specific */
    #contact-form input,
    #contact-form textarea,
    #contact-form select {
        background: #2A2A2A !important;
        border: 1px solid #444444 !important;
        color: #E0E0E0 !important;
    }
    
    /* Help text in modals */
    .help-text {
        background: rgba(165, 195, 152, 0.2) !important;
        color: #FFFFFF !important;
        border: 1px solid rgba(165, 195, 152, 0.3) !important;
    }
    
    /* Error messages */
    #url-error,
    .error-message {
        color: #FF6B6B !important;
    }
    
    /* Loading screen */
    #loading-screen {
        background: #1A1A1A !important;
    }
    
    #loading-screen h1 {
        color: var(--green) !important;
    }
    
    /* Settings modal specific buttons - use standard green */
    #settings-modal .household-selector .household-btn.active,
    .modal-content .household-selector .household-btn.active {
        background: var(--green) !important;
        color: white !important;
        border-color: var(--green) !important;
    }
    
    #settings-modal .unit-option.active,
    .modal-content .unit-option.active,
    .unit-toggle .unit-option.active {
        background: #8FA57F !important;
        color: #000000 !important;  /* Black text on green */
        border-color: #8FA57F !important;
    }
    
    /* Category preference buttons in settings - these are critical */
    #category-preferences button.active,
    #category-preferences .pref-btn.active,
    .category-pref-grid button.active,
    .category-pref-grid .pref-btn.active {
        background: #8FA57F !important;
        color: #000000 !important;  /* Black text on green */
        border-color: #8FA57F !important;
    }
    
    #category-preferences button.inactive,
    #category-preferences .pref-btn.inactive,
    .category-pref-grid button.inactive,
    .category-pref-grid .pref-btn.inactive {
        background: #2A2A2A !important;
        color: #808080 !important;
        border: 1px solid #444444 !important;
    }
    
    /* Save Changes button */
    #settings-modal .save-settings-btn,
    .settings-actions .save-settings-btn,
    button.save-settings-btn {
        background: #8FA57F !important;
        color: #000000 !important;  /* Black text on green */
    }
    
    .unit-option.active {
        background: #8FA57F !important;
        color: #000000 !important;  /* Black text on green */
        border-color: #8FA57F !important;
    }
    
    /* Category preference buttons in settings */
    .pref-btn.active {
        background: #8FA57F !important;
        color: #000000 !important;  /* Black text on green */
        border-color: #8FA57F !important;
    }
    
    .pref-btn.inactive {
        background: #2A2A2A !important;
        color: #808080 !important;  /* Gray text for inactive */
        border: 1px solid #444444 !important;
    }
    
    /* Save Changes button */
    .save-settings-btn {
        background: #8FA57F !important;
        color: #000000 !important;  /* Black text on green */
    }
    
    .modal-content h2,
    .modal-header h2 {
        color: #FFFFFF !important;
    }
    
    .modal-content p,
    .confirm-message,
    .form-group label {
        color: #E0E0E0 !important;
    }
    
    .modal-close {
        background: transparent;
        color: #E0E0E0 !important;
    }
    
    .modal-close:hover {
        background: #333333;
        color: #FFFFFF !important;
    }
    
    .welcome-option-btn {
        background: #2A2A2A;
        border: 2px solid #444444;
    }
    
    .welcome-option-btn:hover {
        background: #333333;
        border-color: var(--green);
    }
    
    .welcome-title {
        color: #FFFFFF !important;
    }
    
    .welcome-subtitle {
        color: #C0C0C0 !important;
    }
    
    .duplicate-choice {
        background: #2A2A2A;
        border: 1px solid #444444;
    }
    
    .duplicate-choice-header {
        color: #FFFFFF !important;
    }
    
    #contact-form input,
    #contact-form textarea,
    #contact-form select {
        background: #2A2A2A;
        border: 1px solid #444444;
        color: #E0E0E0;
    }
    
    #loading-screen {
        background: #1A1A1A !important;
    }
    
    #loading-screen h1 {
        color: var(--green) !important;
    }
    
    /* Only green buttons get black text */
    .export-buttons button,
    button[onclick*="copyMealPlan"],
    button[onclick*="collapseAllCategories"],
    button[onclick*="expandAllCategories"],
    button[onclick*="backupRecipes"],
    button[onclick*="restoreRecipes"],
    pe-btn {
        background: #8FA57F !important;
        color: #000000 !important;  /* Black text on green */
    }
    
    /* Category pills in Plan tab - without emoji */
    .category-pill {
        background: #2A2A2A;
        color: #FFFFFF;  /* White text */
        border: 1px solid #444444;
    }
    
    .category-pill.active {
        background: #8FA57F !important;
        color: #000000 !important;  /* Black text when selected */
    }
    
    /* Web Import button */
    .add-url-btn {
        background: #1A1A1A !important;
        color: #A5C398 !important;  /* Green text */
        border: 2px solid #8FA57F !important;
    }
    
    /* Edit buttons */
    .edit-btn {
        background: #2A2A2A !important;
        color: #FFFFFF !important;  /* White text */
        border: 1px solid #606060 !important;
    }
    
    /* Footer labels */
    .footer-icon-label {
        color: #C0C0C0 !important;  /* Light gray */
    }
    
    /* Desktop tab buttons */
    .desktop-tabs .tab {
        color: #C0C0C0 !important;  /* Light gray */
        background: #242424 !important;
        border: 1px solid #333333 !important;
    }
    
    .desktop-tabs .tab.active {
        color: #A5C398 !important;  /* Green when active */
        border: 2px solid #A5C398 !important;
    }
    
    /* Cook button needs black text */
    .type-btn.active[data-type="cook"] {
        background: #8FA57F !important;
        color: #000000 !important;  /* Black text on green */
    }
    
    /* Dinner Spinner button needs black text */
    .spinner-button {
        color: #000000 !important;  /* Black text */
    }
    
    .spinner-button.spinning {
        background: linear-gradient(45deg, #FFD54F, #FFA726, #FFD54F) !important;
        background-size: 200% 200% !important;
        border-color: #FFA000 !important;
        color: #000000 !important;  /* Black text on gold */
    }
    
    /* Category pills when selected by spinner - gold */
    .category-pill.spinner-selected {
        background: #FFD700 !important;
        color: #000000 !important;  /* Black text on gold */
        border-color: #FFD700 !important;
    }
    
    /* Fix toast visibility in dark mode */
    .toast {
        background: #2A2A2A !important;
        border: 1px solid #444444 !important;
        color: #FFFFFF !important;
    }
    
    /* Fix category pill base state to allow animations */
    .category-pill:not(.active):not(.spinner-selected) {
        background: #2A2A2A;
        color: #FFFFFF;
        border: 1px solid #444444;
    }
}

/* Dark mode animations - OUTSIDE the media query */
@media (prefers-color-scheme: dark) {
    @keyframes waveLeft {
        0%, 100% { background: #2A2A2A; color: #FFFFFF; transform: scale(1); }
        50% { background: #FFD700; color: #000000; transform: scale(1.05); }
    }
    
    @keyframes waveRight {
        0%, 100% { background: #2A2A2A; color: #FFFFFF; transform: scale(1); }
        50% { background: #FFD700; color: #000000; transform: scale(1.05); }
    }
    
    @keyframes cascadeDown {
        0% { transform: translateY(-50px); opacity: 0; }
        50% { transform: translateY(0); opacity: 1; background: #FFD700; color: #000000; }
        100% { transform: translateY(0); opacity: 1; background: #2A2A2A; color: #FFFFFF; }
    }
    
    @keyframes spiralIn {
        0% { transform: rotate(-120deg) scale(0.3); opacity: 0; }
        50% { transform: rotate(0) scale(1.05); background: #FFD700; color: #000000; }
        100% { transform: rotate(0) scale(1); background: #2A2A2A; color: #FFFFFF; }
    }
    
    @keyframes zigzagPulse {
        0%, 100% { transform: translateX(0); background: #2A2A2A; }
        25% { transform: translateX(-10px); background: #FFD700; color: #000000; }
        75% { transform: translateX(10px); background: #FFA726; color: #000000; }
    }
    
    @keyframes rippleOut {
        0% { transform: scale(0.9); opacity: 0; }
        40% { transform: scale(1.06); background: #FFD700; color: #000000; box-shadow: 0 0 10px rgba(255, 213, 79, 0.4); }
        100% { transform: scale(1); opacity: 1; background: #2A2A2A; color: #FFFFFF; }
    }
    
    @keyframes diamondWipe {
        0% { transform: rotate(45deg) scale(0.5); opacity: 0; }
        50% { transform: rotate(0) scale(1.03); background: linear-gradient(45deg, #FFD700, #FFA726); color: #000000; }
        100% { transform: rotate(0) scale(1); background: #2A2A2A; color: #FFFFFF; }
    }
}
    
    /* Danger buttons (Remove All, etc) need better contrast */
    button.danger,
    .danger {
        background: #FF6B6B !important;
        color: #000000 !important;  /* Black text on pale red */
        border: 1px solid #CC5555 !important;
    }
    
    /* Web Import button specifically */
    .add-url-btn {
        background: transparent !important;
        color: #A5C398 !important;
        border: 2px solid #8FA57F !important;
    }
    
    .add-url-btn:hover {
        background: rgba(143, 165, 127, 0.1) !important;
    }
}

/* Tour Modal Styles */
.tour-modal {
    background: rgba(0, 0, 0, 0.95) !important;
    z-index: 1001;
}

.modal .tour-content {
    position: relative;
    overflow: visible;
}

.modal .tour-content {
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    max-width: 390px !important;
    width: 390px !important;
    max-height: 100vh !important;
    height: 100vh !important;
    overflow: visible !important;
    position: relative;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto !important;
}

.modal .tour-content .tour-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 22px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.modal .tour-content .tour-close-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.modal .tour-content .tour-image-container {
    position: relative;
    width: 390px;
    height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.modal .tour-content #tour-image {
    width: 100% !important;
    height: auto !important;
    max-height: 90vh !important;
    max-width: 100% !important;
    object-fit: contain !important;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal .tour-content .tour-nav-left,
.modal .tour-content .tour-nav-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 1001;
    cursor: pointer;
    background: transparent;
}

.modal .tour-content .tour-nav-left {
    left: 0;
}

.modal .tour-content .tour-nav-right {
    right: 0;
}

.modal .tour-content .tour-nav-left::after {
    content: '◀';
    font-size: 32px;
    color: white;
    opacity: 0.3;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.2s;
}

.modal .tour-content .tour-nav-right::after {
    content: '▶';
    font-size: 32px;
    color: white;
    opacity: 0.3;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.2s;
}

.modal .tour-content .tour-nav-left:hover::after,
.modal .tour-content .tour-nav-right:hover::after {
    opacity: 0.8;
}

.modal .tour-content .tour-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    font-weight: 500;
    z-index: 1002;
}

/* Dark mode compatibility */
@media (prefers-color-scheme: dark) {
    .modal .tour-content .tour-close-btn {
        background: rgba(30, 30, 30, 0.9);
        color: #E0E0E0;
    }
    
    .modal .tour-content .tour-close-btn:hover {
        background: rgba(30, 30, 30, 1);
    }
}

/* Dark mode logo adjustment */
        
    header h1 {
        color: #E8E8E8;
    }
    
    .section-title {
        color: #E8E8E8;
    }
    
    .hero-title {
        color: #E8E8E8;
    }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--off-white);
    color: var(--text-dark);
    min-height: 100vh;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--white);
    min-height: 100vh;
    box-shadow: 0 0 20px var(--shadow);
    position: relative;
    overflow: hidden;
}

header {
    background: var(--cream);
    padding: 20px 15px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-left: max(15px, env(safe-area-inset-left));
    padding-right: max(15px, env(safe-area-inset-right));
    text-align: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-logo-text {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    height: 46px;
    width: auto;
}

header h1 {
    margin: 0;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 46px;
    color: #000000;
    line-height: 1;
}

/* Disable hover effects on mobile devices - but preserve active states */
@media (hover: none) and (pointer: coarse) {
    /* Only disable problematic hover effects that cause sticky states on mobile */
    .stock-btn:hover,
    .category-pill:hover {
        /* Prevent sticky hover states after tap on mobile */
        background: initial;
        border-color: initial;
        transform: none;
    }
    
    /* Ensure active states work properly on mobile */
    button:active:not(:disabled),
    .category-pill:active:not(:disabled),
    .type-btn:active:not(:disabled),
    .stock-btn:active:not(:disabled) {
        /* Allow active states to work normally */
        transform: scale(0.95);
    }
}

/* Prevent mobile tap highlighting and focus artifacts */
.modal {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
    
    .modal-content {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Prevent focus outlines on mobile for modal content */
    .modal-content *:focus {
        outline: none !important;
    }
    
    /* Ensure modal background is properly clickable */
    .modal {
        cursor: pointer;
    }
    
    .modal-content {
        cursor: default;
        pointer-events: auto;
    }
}

/* Mobile-specific header sizing */
@media (max-width: 767px) {
    header {
        padding: 17px 13px;
    }
    
    .header-logo-text {
        gap: 10px;
    }
    
    .header-logo {
        height: 39px;
    }
    
    header h1 {
        font-size: 39px;
    }
    
    .header-controls.right {
        right: 10px;
        gap: 10px;
    }
    
    .auth-btn .auth-text {
        display: none;  /* Hide "Log In" text on mobile to save space */
    }
}

/* NEW label for auth button */
.auth-btn {
    position: relative;
}

.auth-new-label {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 6px;
    animation: gentleGlow 2s ease-in-out infinite;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1;
    white-space: nowrap;
}

@keyframes gentleGlow {
    0%, 100% {
        box-shadow: 0 0 4px rgba(255, 215, 0, 0.4),
                    0 1px 3px rgba(0,0,0,0.2);
    }
    50% {
        box-shadow: 0 0 8px rgba(255, 215, 0, 0.7),
                    0 0 12px rgba(255, 165, 0, 0.4),
                    0 1px 3px rgba(0,0,0,0.2);
    }
}
/* Hide NEW label when user is signed in */
.auth-btn.signed-in .auth-new-label {
    display: none;
}

/* Household button and member avatars */
.household-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--border);
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    opacity: 0.4;
}

.household-btn:hover {
    opacity: 0.6;
}

.household-btn.has-household {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    opacity: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.household-btn.has-household:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.3);
}

.household-icon {
    font-size: 20px;
    line-height: 1;
}

/* Match settings button size on mobile */
@media (max-width: 768px) {
    .household-btn {
        font-size: 18px;
        padding: 4px;
    }
    
    .household-icon {
        font-size: 16px;
    }
}

.household-members {
    display: flex;
    gap: 4px;
}

.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    border: 2px solid var(--white);
}

.avatar-color-0 { background: #FF6B6B; }
.avatar-color-1 { background: #4ECDC4; }
.avatar-color-2 { background: #45B7D1; }
.avatar-color-3 { background: #FFA07A; }
.avatar-color-4 { background: #98D8C8; }
.avatar-color-5 { background: #FFD93D; }

.household-modal-content {
    max-width: 500px;
    margin: 50px auto;
}

.household-members-list {
    margin: 20px 0;
}

.household-member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--cream);
    border-radius: 8px;
    margin-bottom: 8px;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 600;
    color: var(--text-dark);
}

.member-role {
    font-size: 12px;
    color: var(--text-light);
}

.invite-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.invite-section h4 {
    margin-bottom: 12px;
}

.invite-code {
    display: flex;
    gap: 8px;
}

.invite-code input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: monospace;
    letter-spacing: 2px;
    text-align: center;
    text-transform: uppercase;
}

.invite-code button {
    padding: 10px 20px;
}
}
/* Ultra-small screens - stack header elements */
@media (max-width: 380px) {
    header {
        padding: 12px 10px;
        min-height: 90px;
    }
    
    .header-logo-text {
        flex-direction: column;
        gap: 4px;
        margin-top: 5px;
    }
    
    .header-logo {
        height: 32px;
    }
    
    header h1 {
        font-size: 32px;
    }
    
    .header-controls {
        position: relative;
        top: auto;
        transform: none;
    }
    
    .header-controls.left {
        position: absolute;
        top: 10px;
        left: 10px;
    }
    
    .header-controls.right {
        position: absolute;
        top: 10px;
        right: 10px;
    }
}

/* For screens where title + buttons might overlap (320-380px range) */
@media (max-width: 380px) and (min-width: 320px) {
    .header-logo-text {
        max-width: 60%;
        margin: 0 auto;
    }
}

/* iPhone SE and other very narrow screens */
@media (max-width: 320px) {
    header {
        flex-direction: column;
        padding: 10px 8px;
        min-height: 100px;
    }
    
    .header-controls.right {
        bottom: 10px;
        top: auto;
        right: 10px;
    }
    
    .header-controls.left {
        bottom: 10px;
        top: auto;
        left: 10px;
    }
    
    .header-logo-text {
        margin-top: 0;
    }
    
    /* Adjust content for new header height */
    .desktop-tabs {
        top: 100px;
    }
    
    .content-wrapper {
        margin-top: 100px;
    }
}

.header-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-controls.left {
    left: 15px;
}

.header-controls.right {
    right: 15px;
}

.add-to-home-btn {
    background: transparent;
    border: none;
    color: var(--text-medium);
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-btn {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: none;
    color: #000;
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.auth-btn:hover {
    color: var(--text-dark);
    background: var(--off-white);
    border-radius: 8px;
}

.auth-icon {
    font-size: 18px;
    line-height: 1;
}

.auth-text {
    display: none;
}

.add-to-home-btn:hover {
    color: var(--text-dark);
    background: var(--off-white);
    border-radius: 8px;
}

/* Hide add to home button on desktop */
@media (min-width: 768px) {
    .add-to-home-btn {
        display: none !important;
    }
}

.settings-btn {
    background: transparent;
    border: none;
    color: var(--text-medium);
    cursor: pointer;
    font-size: 22px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 5px;
}

.settings-btn:hover { 
    transform: rotate(90deg);
    color: var(--text-dark);
    background: var(--off-white);
    border-radius: 8px;
}

.desktop-tabs {
    display: none;
    background: var(--white);
    padding: 10px;
    padding-bottom: 8px;
    position: fixed;
    top: 86px;
    left: 0;
    right: 0;
    z-index: 99;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

@media (min-width: 768px) {
    .desktop-tabs { display: flex; }
    .desktop-tabs .tab:nth-child(1)::before { content: '📅 '; }
    .desktop-tabs .tab:nth-child(2)::before { content: '🛒 '; }
    .desktop-tabs .tab:nth-child(3)::before { content: '👨‍🍳 '; }
    .desktop-tabs .tab:nth-child(4)::before { content: '📖 '; }
    body { padding-bottom: 0; }
}

.desktop-tabs .tab {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-medium);
    transition: all 0.2s;
}

.desktop-tabs .tab:hover {
    background: var(--off-white);
    box-shadow: 0 2px 6px var(--shadow);
}

.desktop-tabs .tab.active {
    color: var(--green-dark);
    border: 2px solid var(--green-dark);
}

.content-wrapper {
    position: relative;
    min-height: calc(100vh - 226px);
    overflow: hidden;
}

@media (min-width: 768px) {
    .content-wrapper {
        margin-top: 140px; /* Account for fixed header + fixed tabs */
    }
}

@media (max-width: 767px) {
    .content-wrapper {
        min-height: calc(100vh - 146px);
        margin-top: 73px;
    }
}

.tab-content {
    display: none;
    min-height: 100%;
    overflow-y: auto;
    padding: 15px;
    padding-bottom: 0;
    flex-direction: column;
}

.tab-content.active {
    display: flex;
}

/* Swipe animation classes */
.tab-content.slide-left {
    animation: slideLeft 0.3s ease-out;
}

.tab-content.slide-right {
    animation: slideRight 0.3s ease-out;
}

@keyframes slideLeft {
    from {
        transform: translateX(100%);
        opacity: 0.8;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideRight {
    from {
        transform: translateX(-100%);
        opacity: 0.8;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    box-shadow: 0 -2px 10px var(--shadow);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (min-width: 768px) {
    .mobile-nav { display: none; }
}

@media (max-width: 767px) {
    body { 
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0)); 
    }
}

/* PWA mode adjustments - enhanced for better iOS compatibility */
@media (display-mode: standalone) {
    .mobile-nav {
        padding-bottom: env(safe-area-inset-bottom, 25px);
    }
    
    body {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 25px));
    }
    
    .tab-content {
        padding-bottom: env(safe-area-inset-bottom, 25px);
    }
}

.mobile-nav .nav-item {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-medium);
    transition: all 0.2s;
    position: relative;
}

.mobile-nav .nav-item.active {
    color: var(--green-dark);
}

.mobile-nav .nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 35%;
    right: 35%;
    height: 3px;
    background: var(--green);
    border-radius: 2px;
}

.mobile-nav .nav-item .icon { font-size: 20px; }

.help-text {
    color: var(--text-medium);
    font-size: 13px;
    padding: 10px 12px;
    background: var(--green-light);
    border-radius: 8px;
    margin-bottom: 15px;
}

.section {
    background: var(--cream);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    flex: 1; /* This makes sections expand to fill available space */
}

.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--green);
    color: white;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 6px;
    transition: all 0.2s;
    text-transform: none;
}

.info-icon:hover {
    background: var(--green-dark);
    transform: scale(1.1);
}

.info-tooltip {
    display: none;
    position: absolute;
    top: 20px;
    left: -10px;
    background: var(--green-light);
    border: 2px solid var(--green-dark);
    border-radius: 8px;
    padding: 10px;
    width: 220px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 100;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-dark);
    text-transform: none;
}

.info-tooltip.show {
    display: block;
}

.info-tooltip p {
    margin: 0 0 8px 0;
}

.hero-section {
    text-align: center;
    padding: 25px 15px;
    background: var(--green-light);
    border-radius: 12px;
    margin-bottom: 15px;
    margin-top: -5px;
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(32px, 4.5vw, 46px);
    font-weight: 600;
    color: #000000;
    text-align: center;
    margin: 8px auto 4px;
    white-space: nowrap;
}

.spinner-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 8px auto 0;
    font-weight: 800;
    letter-spacing: .2px;
    padding: 14px 26px;
    border-radius: 28px;
    border: 3px solid var(--gold);
    color: #fff;
    background: #7d9879;
    box-shadow: 0 6px 18px rgba(55,89,52,.18), 0 0 12px rgba(255, 215, 0, 0.3);
    cursor: pointer;
}

.spinner-button:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px var(--shadow);
}

.spinner-button.spinning {
    background: linear-gradient(45deg, #FFD54F, #FFA726, #FFD54F);
    background-size: 200% 200%;
    animation: spinGradient 0.5s ease 4, pulse 0.25s ease 8;
    border-color: #FFA000;
    color: #1a1a1a;
    box-shadow: 0 0 20px rgba(255, 213, 79, 0.6);
    transform: scale(1.05);
}

@keyframes spinGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1.05); }
    50% { transform: scale(1.08); }
}

@keyframes waveLeft {
    0%, 100% { background: var(--off-white); color: var(--text-medium); transform: scale(1); }
    50% { background: var(--gold); color: var(--text-dark); transform: scale(1.05); }
}

@keyframes waveRight {
    0%, 100% { background: var(--off-white); color: var(--text-medium); transform: scale(1); }
    50% { background: var(--gold); color: var(--text-dark); transform: scale(1.05); }
}

@keyframes cascadeDown {
    0% { transform: translateY(-50px); opacity: 0; }
    50% { transform: translateY(0); opacity: 1; background: var(--gold); color: var(--text-dark); }
    100% { transform: translateY(0); opacity: 1; background: var(--off-white); color: var(--text-medium); }
}

@keyframes spiralIn {
    0% { transform: rotate(-120deg) scale(0.3); opacity: 0; }
    50% { transform: rotate(0) scale(1.05); background: var(--gold); color: var(--text-dark); }
    100% { transform: rotate(0) scale(1); background: var(--off-white); color: var(--text-medium); }
}

@keyframes zigzagPulse {
    0%, 100% { transform: translateX(0); background: var(--off-white); }
    25% { transform: translateX(-10px); background: var(--gold); color: var(--text-dark); }
    75% { transform: translateX(10px); background: #FFA726; color: var(--text-dark); }
}

@keyframes rippleOut {
    0% { transform: scale(0.9); opacity: 0; }
    40% { transform: scale(1.06); background: var(--gold); color: var(--text-dark); box-shadow: 0 0 10px rgba(255, 213, 79, 0.4); }
    100% { transform: scale(1); opacity: 1; background: var(--off-white); color: var(--text-medium); }
}

@keyframes diamondWipe {
    0% { transform: rotate(45deg) scale(0.5); opacity: 0; }
    50% { transform: rotate(0) scale(1.03); background: linear-gradient(45deg, var(--gold), #FFA726); color: var(--text-dark); }
    100% { transform: rotate(0) scale(1); background: var(--off-white); color: var(--text-medium); }
}

.spinner-note {
    display: block;
    margin: 8px auto 12px;
    text-align: center;
    font-style: normal;
    color: #56625c;
    font-weight: 500;
    font-size: clamp(14px, 1.6vw, 18px);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 980px;
}

.day-card {
    background: var(--white);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.day-card.today {
    border: 2px solid #FFA726;
    background: linear-gradient(135deg, var(--white) 0%, rgba(143, 165, 127, 0.05) 100%);
    box-shadow: 0 0 0 4px rgba(255, 213, 79, 0.3);
}

.day-header {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.today-badge {
    background: var(--green);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.meal-type-label {
    font-size: 10px;
    color: var(--text-medium);
    text-transform: uppercase;
    margin: 12px 0 6px;
    font-weight: 500;
}

.meal-type-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.type-btn {
    padding: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-medium);
    transition: all 0.2s;
    flex: 1;
    text-align: center;
}

.type-btn:hover {
    border-color: var(--green);
    background: var(--green-light);
}

.type-btn.active[data-type="cook"] {
    border-color: var(--green);
    background: var(--green);
    color: white;
}

.type-btn.active[data-type="off"] {
    border-color: var(--grey-dark);
    background: var(--grey-dark);
    color: white;
}

.type-btn:active {
    transform: scale(0.95);
}

.category-pills {
    display: grid;
    gap: 5px;
    margin-bottom: 10px;
}

.category-pills[data-count="1"],
.category-pills[data-count="2"],
.category-pills[data-count="3"],
.category-pills[data-count="4"] {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
}

.category-pills[data-count="5"] {
    grid-template-columns: repeat(3, 1fr);
}

.category-pills[data-count="5"] .category-pill:nth-child(4),
.category-pills[data-count="5"] .category-pill:nth-child(5) {
    grid-column: span 1;
}

.category-pills[data-count="5"] .category-pill:nth-child(4) {
    grid-column: 1 / span 1;
}

.category-pills[data-count="5"] .category-pill:nth-child(5) {
    grid-column: 2 / span 2;
}

.category-pills[data-count="6"] {
    grid-template-columns: repeat(3, 1fr);
}

.category-pills[data-count="7"] {
    grid-template-columns: repeat(3, 1fr);
}

.category-pills[data-count="7"] .category-pill:nth-child(7) {
    grid-column: span 3;
}

.category-pills[data-count="8"] {
    grid-template-columns: repeat(4, 1fr);
}

.category-pills[data-count="9"] {
    grid-template-columns: repeat(3, 1fr);
}

.category-pills[data-count="10"] {
    grid-template-columns: repeat(4, 1fr);
}

.category-pills[data-count="10"] .category-pill:nth-child(9),
.category-pills[data-count="10"] .category-pill:nth-child(10) {
    grid-column: span 2;
}

.category-pills[data-count="11"] {
    grid-template-columns: repeat(4, 1fr);
}

.category-pills[data-count="11"] .category-pill:nth-child(9),
.category-pills[data-count="11"] .category-pill:nth-child(10),
.category-pills[data-count="11"] .category-pill:nth-child(11) {
    grid-column: span 1;
}

.category-pills[data-count="12"] {
    grid-template-columns: repeat(4, 1fr);
}

.category-pill {
    padding: 8px 4px;
    background: var(--off-white);
    border: 1px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-medium);
    transition: all 0.2s;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-pill:hover {
    border-color: var(--green);
    background: var(--green-light);
}

.category-pill.active {
    background: var(--green);
    color: white;
    border-color: var(--green);
}

.category-pill:active {
    transform: scale(0.95);
}

.category-pill.spinner-selected {
    background: var(--gold);
    color: var(--text-dark);
    border-color: var(--gold);
}

.dish-select-wrapper {
    margin-top: 8px;
    padding: 8px;
    background: linear-gradient(135deg, var(--off-white) 0%, var(--white) 100%);
    border-radius: 10px;
    border: 2px solid var(--green-light);
}

.dish-select-wrapper.placeholder {
    opacity: 0.5;
}

.dish-select-wrapper.golden-pulse {
    background: linear-gradient(45deg, #FFD54F, #FFA726, #FFD54F);
    background-size: 200% 200%;
    animation: spinGradient 0.5s ease 4, pulse 0.25s ease 8;
    border-color: #FFA000;
    box-shadow: 0 0 20px rgba(255, 213, 79, 0.6);
    transform: scale(1.05);
}

.dish-select-wrapper.user-locked {
    background: linear-gradient(135deg, var(--green-light) 0%, #e8f5e3 100%);
    border-color: var(--green);
    box-shadow: 0 0 0 2px rgba(143, 165, 127, 0.2);
}

.dish-select-wrapper.user-locked .custom-select select {
    border-color: var(--green);
    background: rgba(255, 255, 255, 0.95);
    font-weight: 700;
}

.spinning-text {
    text-align: center;
    color: #1a1a1a;
    font-weight: 700;
    font-size: 14px;
    padding: 10px;
    animation: pulse 0.25s ease infinite;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select select {
    width: 100%;
    padding: 10px 30px 10px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    background: var(--white);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    min-height: 40px;
    color: var(--charcoal);
    font-weight: 700;
}

.dish-select-wrapper .custom-select select {
    border: 2px solid var(--green);
    font-weight: 700;
}

.custom-select::after {
    content: '▼';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: var(--text-medium);
    font-size: 12px;
    pointer-events: none;
}

.custom-select select:focus {
    outline: none;
    border-color: var(--green-dark);
    box-shadow: 0 0 0 3px rgba(143, 165, 127, 0.1);
}

/* Mobile adjustments for custom items */
@media (max-width: 480px) {
    .custom-add-item-container {
        flex-wrap: wrap;
    }
    
    .custom-item-name-input {
        flex: 1 1 100%;
        margin-bottom: 8px;
    }
    
    .custom-item-volume-input,
    .custom-item-units-select,
    .custom-item-add-btn,
    .custom-item-cancel-btn {
        flex: 0 0 auto;
    }
}

input[type="text"], input[type="url"], input[type="number"], textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    background: var(--white);
    min-height: 40px;
}

textarea#add-dish-steps,
textarea#edit-dish-steps {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-dark);
    min-height: 120px;
    resize: vertical;
}

input[type="number"].people-count-input {
    width: 50px;
    padding: 6px;
    min-height: 28px;
    font-size: 13px;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--green);
}

/* CRITICAL FIX: Remove focus outlines on touch devices */
@media (hover: none) and (pointer: coarse) {
    /* Remove ALL focus outlines for stock buttons on mobile */
    .stock-btn:focus,
    .stock-btn:focus-visible {
        outline: none !important;
        box-shadow: none !important;
    }
    
    /* Remove focus outlines for all interactive elements on touch */
    button:focus,
    button:focus-visible,
    .category-pill:focus,
    .category-pill:focus-visible,
    .type-btn:focus,
    .type-btn:focus-visible,
    select:focus,
    select:focus-visible,
    input:focus,
    input:focus-visible,
    textarea:focus,
    textarea:focus-visible,
    .household-btn:focus,
    .household-btn:focus-visible,
    .unit-option:focus,
    .unit-option:focus-visible,
    .modal-close:focus,
    .modal-close:focus-visible {
        outline: none !important;
        box-shadow: none !important;
    }
}

/* Ensure dissolving items don't leave focus artifacts */
.shopping-item.dissolving,
.shopping-item.dissolving * {
    pointer-events: none !important;
    outline: none !important;
}

/* Keep focus indicators ONLY for keyboard users */
@media (hover: hover) and (pointer: fine) {
    button:focus-visible,
    .category-pill:focus-visible,
    .type-btn:focus-visible,
    .stock-btn:focus-visible,
    select:focus-visible {
        outline: 3px solid var(--green);
        outline-offset: 2px;
    }
}

/* Ensure active states still work for touch feedback */
@media (hover: none) and (pointer: coarse) {
    .stock-btn:active:not(:disabled) {
        transform: scale(0.95);
        transition: transform 0.1s;
    }
}

.modal-close:focus-visible {
    outline: 3px solid var(--green);
    outline-offset: -3px;
}

button {
    background: var(--green);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

button:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

button:active {
    background: var(--green-dark);
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

button.secondary {
    background: var(--text-light);
}

button.secondary:hover {
    background: var(--text-medium);
}

button.secondary:active {
    background: var(--text-dark);
    transform: scale(0.98);
}

button.danger {
    background: var(--danger);
}

button.danger:active {
    background: #D78585;
    transform: scale(0.98);
}

button.danger:hover {
    background: #D78585;
}

.reset-week-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: var(--text-light);
    height: 32px;
    white-space: nowrap;
    flex-shrink: 0;
}

.lock-btn {
    padding: 6px 8px;
    font-size: 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lock-btn:hover {
    background: var(--off-white);
    border-color: var(--green);
}

.lock-btn.locked {
    background: var(--green-light);
    border-color: var(--green);
}
.aisle-group {
    background: var(--white);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.aisle-title {
    font-weight: 600;
    color: var(--green-dark);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.shopping-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--off-white);
    transition: all 0.3s ease;
}

.shopping-item.dissolving {
    animation: dissolveItem 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes dissolveItem {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    50% {
        opacity: 0;
        transform: translateY(-5px);
        max-height: 100px;
        padding: 10px 0;
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
        padding: 0;
        margin: 0;
        border-bottom-width: 0;
        border: none;
    }
}

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

.item-line1 {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 13px;
    margin-bottom: 6px;
}

.item-line2 {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    font-size: 11px;
}

@media (max-width: 480px) {
    .item-line2 {
        gap: 4px;
    }
}

.item-needed {
    color: var(--text-medium);
    font-size: 10px;
    flex-shrink: 0;
    min-width: 85px;
    display: inline-block;
}

.item-needed.need-buy {
    color: #C62828;
    font-weight: 500;
    white-space: nowrap;
}

.stock-btn {
    padding: 4px 6px;
    font-size: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-medium);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    touch-action: manipulation;
    min-height: 32px;
    min-width: 60px;
}

@media (hover: hover) {
    .stock-btn:not(.active-all):not(.active-some):hover {
        /* Hover effect removed to prevent misleading visual feedback */
    }
}
.stock-btn.active-all {
    background: var(--green);
    color: white;
    border-color: var(--green);
    cursor: pointer;
}

.stock-btn.active-some {
    background: #FFA726;
    color: white;
    border-color: #FFA726;
}

.stock-btn:active {
    transform: scale(0.95);
}

.some-input {
    width: calc(4ch + 24px);
    height: 40px;
    line-height: 40px;
    padding: 0 12px 0 8px;
    font-size: 14px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 10px;
}

@media (max-width: 480px) {
    .some-input {
        width: 70px;
        min-width: 40px;
        padding: 0 4px;
        font-size: 12px;
        height: 32px;
        line-height: 32px;
    }
}

.need-badge {
    background: #C62828;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    margin-left: auto;
    white-space: nowrap;
    min-width: 45px;
    text-align: center;
    display: inline-block;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .need-badge {
        min-width: 35px;
        padding: 2px 4px;
        font-size: 9px;
    }
}

.need-button {
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.need-button:hover {
    background: #A32222;
    transform: scale(1.05);
}

.need-button:active {
    transform: scale(0.95);
}

.have-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2e7d32;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    margin-left: auto;
    flex-shrink: 0;
}

.step-checkbox {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--white);
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.step-checkbox:hover {
    border-color: var(--green);
    transform: scale(1.1);
}

.step-checkbox.completed {
    background: var(--green);
    border-color: var(--green);
}

.step-checkbox.completed::after {
    content: '✓';
    color: white;
    font-size: 16px;
    font-weight: 700;
}

.step-number {
    font-size: 13px;
    color: var(--text-medium);
    font-weight: 600;
}

.step-content {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.step-text {
    flex: 1;
    font-size: 13px;
    transition: all 0.2s;
}

.step-text.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.export-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.export-buttons button { flex: 1; }

.cook-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}

.time-info {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    font-size: 12px;
    color: var(--text-medium);
    flex-wrap: nowrap;
    white-space: nowrap;
}

.time-info span {
    flex-shrink: 0;
}

.dish-card {
    background: var(--white);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: start;
}

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

.dish-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.3;
    word-wrap: break-word;
    margin-bottom: 4px;
}

.dish-meta {
    font-size: 11px;
    color: var(--text-light);
}

.dish-categories {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.dish-category-tag {
    font-size: 9px;
    padding: 2px 6px;
    background: var(--green-light);
    color: var(--green-dark);
    border-radius: 10px;
    text-transform: capitalize;
}

.dish-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 10px;
}

.edit-btn {
    padding: 6px 10px;
    font-size: 11px;
    background: var(--off-white);
    color: var(--text-medium);
    border: 1px solid var(--border);
}

.edit-btn:hover {
    background: var(--green-light);
    border-color: var(--green);
}

.recipe-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

pe-btn {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    color: white;
    padding: 14px 20px;
    border-radius: 10px;
    border: 2px solid var(--gold);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

pe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

@media (max-width: 480px) {
    .recipe-buttons {
        display: flex;
        gap: 10px;
        margin-bottom: 5px;
        flex-wrap: nowrap;
    }
    
    .add-recipe-btn,
    .add-url-btn {
        padding: 14px 8px;
        font-size: 14px;
        gap: 6px;
        flex: 1;
        min-width: 0;
    }
}

.add-url-btn {
    background: var(--white);
    color: #4A6D3C !important;
    padding: 14px 20px;
    border-radius: 10px;
    border: 2px solid var(--green);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.add-url-btn:hover {
    background: var(--green-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.collapsible {
    background: var(--off-white);
    padding: 14px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--text-medium);
    border: 1px solid var(--border);
    transition: all 0.2s;
    user-select: none;
}

.collapsible * {
    pointer-events: none;
}

.collapsible:hover {
    background: var(--green-light);
    border-color: var(--green);
}

.collapsible[data-collapsed="true"] {
    background: var(--off-white);
    border-color: var(--border);
    color: var(--text-medium);
}

.category-group { margin-bottom: 15px; }

.category-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.category-controls button {
    padding: 8px 12px;
    font-size: 12px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-medium);
}

.ingredient-row {
    display: grid;
    grid-template-columns: 1fr 90px 60px 30px;
    gap: 6px;
    margin-bottom: 6px;
    align-items: center;
}

.category-select {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.category-option {
    padding: 10px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-size: 12px;
}

.category-option:hover {
    border-color: var(--green);
    background: var(--green-light);
}

.category-option.selected {
    border-color: var(--green);
    background: #e6f4ea;
    color: var(--charcoal);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.modal.show { display: flex; }

.modal-content {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 90dvh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 1001;
}

/* Mobile optimizations for modals */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: none;
        padding: 15px;
        border-radius: 8px;
        max-height: 95vh;
    }
    
    .modal-content.long-modal {
        max-height: 95vh;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-left: -20px;
    margin-right: -20px;
    margin-top: -20px;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 20px;
}

.modal-header h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
font-size: 26px !important;
}

@media (prefers-color-scheme: dark) {
    .modal-header {
        background: #1E1E1E;
        border-bottom-color: #333333;
    }
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--charcoal);
    cursor: pointer;
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 40px;
    font-size: 26px;
    font-weight: 600;
    border-radius: 9999px;
    transition: background 0.15s ease, transform 0.05s ease;
}

.modal-close:hover { background: var(--off-white); }
.modal-close:active { transform: scale(0.96); }

.confirm-modal .modal-content {
    max-width: 400px;
    text-align: center;
}

.confirm-modal .chef-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.confirm-modal .confirm-message {
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 25px;
    line-height: 1.5;
}

.confirm-modal .confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-modal .confirm-buttons button {
    flex: 1;
}

.duplicate-alert {
    background: #FFF8E1;
    border: 1px solid #FFD54F;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    font-size: 12px;
}

.duplicate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.duplicate-alert-title {
    font-weight: 500;
    color: var(--text-dark);
}

.duplicate-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 10px;
    background: rgba(255,255,255,0.7);
    border-radius: 6px;
    margin: 6px 0;
    gap: 8px;
}

@media (max-width: 480px) {
    .duplicate-item {
        flex-direction: column;
        align-items: stretch;
    }
}

.dup-list {
    max-height: 260px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.merge-option-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.merge-option-btns button {
    padding: 3px 8px;
    font-size: 11px;
    flex: 1;
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
    min-height: 24px;
}

@media (max-width: 480px) {
    .merge-option-btns {
        flex-direction: row;
        gap: 6px;
    }
    
    .merge-option-btns button {
        flex: 1;
        min-width: unset;
    }
}

.household-selector {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
}

.unit-toggle {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    margin: 8px 0 10px;
    width: 100%;
}

.household-btn.has-household .household-icon {
    animation: gentleGlow 3s ease-in-out infinite;
}

.household-selector .household-btn {
    background: white;
    border: 2px solid var(--border);
    padding: 10px 15px;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    text-align: center;
    box-shadow: none;
    color: var(--text-dark);
    font-weight: 600;
    transition: all 0.2s;
    opacity: 1;
}

.unit-option {
    background: #F5F5F5;
    border: 1px solid var(--border);
    padding: 10px 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: none;
    color: var(--text-dark);
    font-weight: 600;
    transition: all 0.2s;
    font-size: 14px;
    line-height: 1.3;
    min-height: 48px;
    width: 100%;
}

.household-selector .household-btn.active,
.unit-option.active {
    background: var(--green);
    border-color: var(--green);
    color: white;
}

.household-selector .household-btn:hover:not(.active),
.unit-option:hover:not(.active) {
    background: var(--off-white);
    border-color: var(--green-light);
}

@media (max-width: 480px) {
    .settings-grid {
        gap: 8px;
    }
    
    .household-selector {
        gap: 6px;
    }
    
    .unit-toggle {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 6px;
    }
    
    .household-selector .household-btn {
        padding: 6px 3px;
        font-size: 13px;
        min-height: 36px;
        border-radius: 8px;
    }
    
    .unit-option {
        padding: 6px 3px;
        font-size: 11px;
        min-height: 44px;
        line-height: 1.2;
    }
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.3;
}

.welcome-option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(135deg, var(--white) 0%, var(--green-light) 100%);
    border: 2px solid var(--green-light);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.welcome-option-btn:hover {
    border-color: var(--green);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
}

.welcome-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.welcome-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 3px;
}

.welcome-subtitle {
    font-size: 12px;
    color: var(--text-medium);
}

.welcome-help-btn {
    background: transparent;
    border: 2px solid var(--green);
    color: var(--green-dark);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.welcome-help-btn:hover {
    background: var(--green);
    color: white;
}

.backup-section {
    background: var(--cream);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid var(--border);
}

.backup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.backup-info {
    font-size: 12px;
    color: var(--text-medium);
    margin-bottom: 15px;
    line-height: 1.4;
}

.backup-buttons {
    display: flex;
    gap: 10px;
}

.backup-buttons button {
    flex: 1;
}



.footer-icons {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 12px;
}

.footer-copyright {
    text-align: center;
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.4;
    padding: 10px 0 calc(20px + env(safe-area-inset-bottom, 0));
}

@media (max-width: 767px) {
    .footer-copyright {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
    }
}

@media (min-width: 768px) {
    .footer-copyright {
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
    }
}

.spinner-stats .gold-text {
    color: var(--gold-dark);
    font-weight: 700;
}

.footer-section {
    background: var(--off-white);
    padding: 20px;
    margin-top: auto;
    border-top: 1px solid var(--border);
}

.footer-icons {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 12px;
}

.footer-icon {
    color: var(--text-medium);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
}

.footer-icon:hover {
    color: var(--green);
    transform: translateY(-2px);
}

.footer-icon-label {
    font-size: 10px;
    font-weight: 500;
    color: inherit;
}

.footer-copyright {
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.4;
    padding: 10px 0;
    margin-top: 10px;
}

#contact-form .form-group {
    margin-bottom: 15px;
    text-align: left;
}

#contact-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-medium);
}

#contact-form input[type="text"],
#contact-form input[type="email"],
#contact-form textarea,
#contact-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--white);
}

#contact-form input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

#contact-form textarea {
    resize: vertical;
    min-height: 80px;
}

@media (max-width: 480px) {
    .footer-icons {
        gap: 12px;
    }
    .footer-copyright {
        font-size: 10px;
    }
}

.hidden { display: none !important; }

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-dark);
    color: white;
    padding: 12px 16px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 1100;
    animation: slideUpToast 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    max-width: 90%;
    text-align: center;
    line-height: 1.3;
}

@keyframes slideUpToast {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes slideUp {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.category-pref-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.category-pref-grid .pref-btn {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--off-white);
    font-size: 12px;
    text-align: center;
    cursor: pointer;
}

.category-pref-grid .pref-btn.active {
    border-color: var(--green);
    background: var(--green);
    color: #fff;
}

.category-pref-grid .pref-btn.inactive {
    background: var(--white);
    color: var(--text-dark);
}

/* Household removal warning - styled like inactive category buttons */
.household-removal-warning {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    background: var(--white);
    color: var(--text-dark);
    border: 1px solid var(--border);
}

/* Dark mode styling for household removal warning */
@media (prefers-color-scheme: dark) {
    .household-removal-warning {
        background: #2A2A2A;
        color: #808080;
        border: 1px solid #444444;
    }
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.settings-section label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0 16px;
}

.settings-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.settings-actions button {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 8px;
    font-weight: 500;
}

/* Responsive behavior for smaller screens */
@media (max-width: 580px) {
    .settings-actions {
        flex-direction: column;
    }
    
    .settings-actions button {
        width: 100%;
        flex: none;
    }
}

@media (max-width: 400px) {
    .settings-actions button {
        font-size: 13px;
        padding: 10px 12px;
    }
}

.save-settings-btn {
    background: var(--green);
    color: #fff;
}

.save-settings-btn:hover {
    background: var(--green-dark);
}

.seg-toggle {
    display: flex;
    gap: 6px;
    margin: 8px 0 10px;
}

.seg-toggle .seg {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 9999px;
    border: 1px solid var(--mid-grey, #c7c7c7);
    background: #f7f7f7;
    color: var(--text, #222);
    cursor: pointer;
}

.seg-toggle .seg.active {
    background: #e6f4ea;
    border-color: var(--green);
    color: var(--green-dark);
    box-shadow: inset 0 0 0 2px rgba(46,125,50,.12);
}

.fresh-plates-section {
    background: linear-gradient(135deg, var(--green-light) 0%, var(--cream) 100%);
    border: 2px solid var(--green);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    display: none;
}

.fresh-plates-section.has-items {
    display: block;
}

.fresh-plates-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    color: var(--green-dark);
}

.fresh-plates-header .subtitle {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-medium);
}

.fresh-plate-card {
    background: var(--white);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--green-light);
}

.fresh-plate-info {
    margin-bottom: 8px;
}

.fresh-plate-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.fresh-plate-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fresh-plate-actions button {
    padding: 6px 12px;
    font-size: 11px;
    flex: 1;
}

.view-recipe-modal {
    display: none;
}

.view-recipe-modal .modal-content {
    max-width: 600px;
}

#cook-day-select {
    font-weight: 700;
}

.duplicate-choice {
    padding: 12px;
    background: var(--off-white);
    border-radius: 8px;
    margin-bottom: 12px;
}

.duplicate-choice-header {
    font-weight: 600;
    margin-bottom: 8px;
}

.duplicate-choice-options {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.duplicate-choice-options button {
    flex: 1;
    padding: 8px;
    font-size: 12px;
}

.duplicate-choice-options button.selected,
.duplicate-choice-scope button.selected {
    background: var(--green);
    color: white;
    border-color: var(--green);
}

.duplicate-choice {
    background: var(--white);
}

.duplicate-choice-actions {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.duplicate-choice-actions button {
    flex: 1;
}

.duplicate-choice-scope button {
    flex: 1;
    padding: 6px;
    font-size: 11px;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.title-with-source {
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-badge {
    font-size: 11px;
    padding: 2px 6px;
    background: var(--off-white);
    color: var(--text-medium);
    border-radius: 4px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .settings-section {
        margin-bottom: 10px;
    }
    
    .settings-section label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .settings-actions {
        margin-top: 15px;
        gap: 8px;
    }
    
    .settings-actions button {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .household-selector .household-btn {
        padding: 8px 4px;
        font-size: 14px;
        min-height: 40px;
    }
    
    .unit-option {
        padding: 8px 4px;
        font-size: 12px;
        min-height: 50px;
    }
}

@media (max-width: 1024px) {
    .spinner-button {
        display: flex !important;
        width: 100% !important;
        max-width: none !important;
        justify-content: center;
        min-width: 300px;
    }
}

/* Desktop - make spinner button wider to match text above */
@media (min-width: 1025px) {
    .spinner-button {
        width: 100% !important;
        max-width: none !important;
        min-width: 400px;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding-top: 12px !important;
        padding-bottom: 16px !important;
    }
    .hero-title {
        margin-top: 6px !important;
        margin-bottom: 6px !important;
        font-size: clamp(28px, 7vw, 38px) !important;
    }
    .spinner-button {
        width: calc(100% - 48px) !important;
        max-width: 560px !important;
        margin: 8px auto 0 !important;
    }
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Custom Items Section Styles - SINGLE CLEAN VERSION */
#custom-items-section {
    background: white;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #E5E5E5;
}

#custom-items-section .aisle-title {
    font-weight: 600;
    color: #6B8E5C;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #E5E5E5;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logged-in-feature-btn {
    background: #FFD700;
    color: #000000;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    border: none;
}

/* Input container - Clean flex layout */
.custom-add-item-container {
    padding: 2px 12px;
    display: flex;
    gap: 6px;
    align-items: stretch; /* This ensures all items stretch to same height */
    flex-wrap: nowrap;
}

/* Labels - SMALL like shopping list */
.custom-label {
    font-weight: 500 !important;  /* Match Red Wine weight */
    color: #333333 !important;    /* Match Red Wine color (var(--text-dark)) */
    font-size: 13px !important;   /* Match Red Wine size */
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

/* Input fields - COMPACT */
.custom-item-name-input {
    flex: 1 1 100px;
    min-width: 60px;
    padding: 6px 8px;
    border: 1px solid #E5E5E5;
    border-radius: 6px;
    font-size: 12px;
    height: 32px;
    color: #000000;
}

.custom-item-name-input::placeholder {
    color: #999999;
    font-style: normal;
    font-size: 12px;
}

.custom-item-volume-input {
    width: 45px !important;
    flex-shrink: 0;
    padding: 6px 3px;
    border: 1px solid #E5E5E5;
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
    height: 32px;
    color: #000000;
}

.custom-item-volume-input::placeholder {
    font-size: 12px;
    color: #999999;
    font-style: normal;
}

.custom-item-units-select {
    width: 52px !important;
    flex-shrink: 0;
    padding: 7px 2px;
    border: 1px solid #E5E5E5;
    border-radius: 6px;
    font-size: 11px;
    background: white;
    color: #000000;
    height: 40px;
    line-height: 1;
}

.custom-item-add-btn,
.custom-item-cancel-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    flex-shrink: 0;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 !important;
    line-height: 1;
}

.custom-item-add-btn {
    background: #81b366;
    color: white;
    font-size: 16px;  /* Larger checkmark */
}

.custom-item-add-btn:hover:not(:disabled) {
    background: #6B8E5C;
    transform: scale(1.1);
}

.custom-item-add-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.custom-item-cancel-btn {
    background: #E89B9B;
    color: white;
    font-size: 18px;  /* Larger X */
}

.custom-item-cancel-btn:hover {
    background: #D57777;
    transform: scale(1.1);
}

/* List items */
.custom-items-list {
    padding: 8px 12px 4px;
}

.custom-item {
    background: #FAF7F2;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-item-name {
    font-size: 13px;
    color: #333333;
}

.custom-item-details {
    font-size: 11px;
    color: #999999;
    margin-top: 2px;
}

.custom-item-delete {
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    border-radius: 50%;
    background: #E89B9B;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0 !important;
    line-height: 1;
}
.custom-item:hover .custom-item-delete {
    opacity: 1;
}
/* Only wrap on VERY small screens */
@media (max-width: 380px) {
    .custom-add-item-container {
        flex-wrap: wrap !important;
    }
    
    .custom-label:first-child {
        flex: 0 0 100%;
        margin-bottom: 4px;
    }
    
    .custom-item-name-input {
        flex: 1 1 100%;
        margin-bottom: 6px;
    }
}
/* Dark mode */
@media (prefers-color-scheme: dark) {
    #custom-items-section {
        background: #1F1F1F;
    }
    
    #custom-items-section .aisle-title {
        color: #A5C398;
        border-bottom-color: #333333;
    }
    
    .custom-label {
        color: #FFFFFF !important;
    }
    
    .custom-item {
        background: #252525;
        border-color: #333333;
    }
    
    .custom-item-name {
        color: #E0E0E0;
    }
}

/* Custom item delete button - MUST be red */
.custom-item-remove-btn {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    border-radius: 50% !important;
    background: #DC3545 !important;
    color: white !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-size: 12px !important;
    font-weight: bold !important;
    margin-left: 4px !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: all 0.2s !important;
    vertical-align: middle !important;
    text-decoration: none !important;
    box-shadow: none !important;
}
.custom-item-remove-btn:hover {
    background: #C82333 !important;
    color: white !important;
    transform: scale(1.1) !important;
    text-decoration: none !important;
}
.custom-item-remove-btn:focus,
.custom-item-remove-btn:active {
    background: #DC3545 !important;
    color: white !important;
    outline: none !important;
    box-shadow: none !important;
}
/* Household button and avatars */
.household-btn {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border: none;
    padding: 6px 10px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: -8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}


/* Long modals - ensure content doesn't scroll behind header */
.modal-content.long-modal {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-content.long-modal .modal-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--off-white);
    z-index: 10;
}

/* Mobile: Make the entire modal content scroll as one unit */
@media (max-width: 768px) {
    .modal-content.long-modal {
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-content.long-modal .modal-header {
        position: static;
        background: transparent;
    }
    
    .modal-content.long-modal > div:not(.modal-header) {
        flex: none;
        overflow-y: visible;
        max-height: none;
    }
}

/* Desktop: Keep the original behavior for larger screens */
@media (min-width: 769px) {
    .modal-content.long-modal > div:not(.modal-header) {
        flex: 1;
        overflow-y: auto;
        max-height: calc(85vh - 80px);
    }
}

/* Removed household removal modal styles - no longer needed */

.household-members {
    display: flex;
    gap: -8px;
}

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
    border: 2px solid white;
    margin-left: -8px;
    position: relative;
    transition: all 0.2s;
}

.member-avatar:first-child {
    margin-left: 0;
}

.member-avatar:hover {
    transform: scale(1.1);
    z-index: 10;
}

/* Active member indicators in header */
.active-members {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-left: 8px;
}

.active-member-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 10px;
    border: 2px solid var(--green);
    position: relative;
    opacity: 0.8;
    transition: all 0.2s;
}

.active-member-avatar:hover {
    opacity: 1;
    transform: scale(1.1);
}

.active-member-avatar::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    border: 1px solid white;
    animation: pulse 2s infinite;
}

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

/* Avatar colors */
.avatar-color-0 { background: #81b366; }
.avatar-color-1 { background: #E57373; }
.avatar-color-2 { background: #64B5F6; }
.avatar-color-3 { background: #FFD54F; }
.avatar-color-4 { background: #BA68C8; }
.avatar-color-5 { background: #4DB6AC; }

/* Household modal */
.household-modal-content {
    max-width: 500px;
}

.household-status {
    background: #FAF7F2;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.household-members-list {
    margin: 15px 0;
}

.household-member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 600;
    color: #333;
}

.member-role {
    font-size: 12px;
    color: #666;
}

.invite-section {
    background: #F5F5F5;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

.invite-code {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.invite-code input {
    flex: 1;
    padding: 10px;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    font-family: monospace;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
}

.invite-code button {
    padding: 10px 20px;
    background: #81b366;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
@keyframes gentlePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}
