        :root {
            /* Dark Theme (Default) */
            --bg-primary: #0a1612;
            --bg-secondary: #0f1f1b;
            --bg-tertiary: #1a3630;
            --bg-card: #27534c;
            --bg-card-hover: #3a6a5f;
            --text-primary: #ffffff;
            --text-secondary: rgba(255, 255, 255, 0.7);
            --text-tertiary: rgba(255, 255, 255, 0.6);
            --border-color: #27534c;
            --accent-color: #75b3ac;
            --accent-hover: #5a867e;
            --danger-color: #ff6b6b;
            --danger-hover: #b71c1c;
            --shadow-color: rgba(0, 0, 0, 0.5);
            --btn-primary-bg: #1a3630;
            --btn-primary-hover: #27534c;
            --btn-primary-text: #ffffff;
            --btn-secondary-bg: #27534c;
            --btn-secondary-hover: #3a6a5f;
            --btn-secondary-text: #ffffff;
            --btn-secondary-border: #3a6a5f;
            --btn-danger-border: #ff8a8a;
            --btn-focus-ring: rgba(117, 179, 172, 0.45);
            --hover-bg: #2f5f56;
            --hover-overlay: rgba(255, 255, 255, 0.05);
            --tab-hover-text: rgba(255, 255, 255, 0.8);
            --theme-highlight-bg: #2d5a3f;
            --theme-highlight-text: #ffffff;
            --theme-accent-line: #75b3ac;
            --theme-bloom-start: #5a9e8f;
            --theme-bloom-end: #3d7a6e;
            --theme-beneficial-bg: rgba(76, 175, 80, 0.1);
            --theme-beneficial-text: #4caf50;
            --theme-codex-active-tab: #2d5a3f;
            --theme-codex-active-subtab: var(--theme-accent-line);
            --theme-codex-badge: #2d5a3f;
            --bloom-month-width: 60px;
            --bloom-timeline-min-width: 940px;
        }

        body.light-mode {
            /* Light Theme */
            --bg-primary: #f0f4f3;
            --bg-secondary: #ffffff;
            --bg-tertiary: #e1ede9;
            --bg-card: #ffffff;
            --bg-card-hover: #f5f9f8;
            --text-primary: #1a2e28;
            --text-secondary: rgba(26, 46, 40, 0.7);
            --text-tertiary: rgba(26, 46, 40, 0.5);
            --border-color: #c8d9d3;
            --accent-color: #2d7a6e;
            --accent-hover: #236055;
            --danger-color: #d32f2f;
            --danger-hover: #b71c1c;
            --shadow-color: rgba(0, 0, 0, 0.08);
            --btn-primary-bg: #2d7a6e;
            --btn-primary-hover: #236055;
            --btn-primary-text: #ffffff;
            --btn-secondary-bg: #e1ede9;
            --btn-secondary-hover: #c8d9d3;
            --btn-secondary-text: #1a2e28;
            --btn-secondary-border: #97b7ae;
            --btn-danger-border: #d32f2f;
            --btn-focus-ring: rgba(45, 122, 110, 0.25);
            --hover-bg: #e8f2ee;
            --hover-overlay: rgba(0, 0, 0, 0.03);
            --tab-hover-text: rgba(26, 46, 40, 0.9);
            --theme-highlight-bg: #2d7a6e;
            --theme-highlight-text: #ffffff;
            --theme-accent-line: #2d7a6e;
            --theme-bloom-start: #2d7a6e;
            --theme-bloom-end: #1d6058;
            --theme-beneficial-bg: rgba(46, 125, 50, 0.08);
            --theme-beneficial-text: #2e7d32;
            --theme-codex-active-tab: #2d7a6e;
            --theme-codex-active-subtab: #2d5a3f;
            --theme-codex-badge: #2d7a6e;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            overflow: hidden;
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        /* App Container - Fixed Sandwich */
        .app-container {
            max-width: 480px;
            margin: 0 auto;
            background: var(--bg-secondary);
            height: 100vh;
            height: 100svh;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            position: relative;
            box-shadow: 0 0 50px var(--shadow-color);
        }

        /* Header - stays at top */
        .header {
            flex-shrink: 0;
            background: var(--bg-card);
            padding: 10px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 1000;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
            border-bottom: 1px solid rgba(0, 0, 0, 0.15);
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 15px;
            flex: 1;
        }

        .bloomlab-logo {
            font-size: 24px;
            font-weight: bold;
            color: var(--accent-color);
            font-family: 'Georgia', serif;
            letter-spacing: 1px;
        }

        .header-title-section {
            display: flex;
            flex-direction: column;
        }

        .header-title {
            font-size: 16px;
            font-weight: 600;
        }

        .header-subtitle {
            font-size: 11px;
            opacity: 0.8;
        }

        .menu-btn {
            background: transparent;
            border: 1px solid transparent;
            color: var(--text-primary);
            cursor: pointer;
            padding: 8px;
            font-size: 32px;
            line-height: 1;
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            transition: background 0.2s;
            flex-shrink: 0;
        }

        .menu-btn:hover {
            background: var(--hover-overlay);
            border-color: var(--border-color);
        }

        /* Category Dock */
        /* Filter Buttons - Replace category dock */
        .filter-buttons {
            flex-shrink: 0;
            background: var(--bg-tertiary);
            padding: 10px 15px;
            display: flex;
            gap: 10px;
            z-index: 99;
        }

        .filter-btn {
            flex: 1;
            padding: 15px 20px;
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            color: var(--text-primary);
            cursor: pointer;
            font-size: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: background 0.2s;
            font-weight: 600;
            min-height: 50px;
            -webkit-tap-highlight-color: rgba(117, 179, 172, 0.3);
            touch-action: manipulation;
            user-select: none;
            -webkit-user-select: none;
        }

        .filter-btn:active {
            background: var(--bg-card-hover);
            transform: scale(0.98);
        }

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

        .filter-btn.active {
            background: var(--accent-color);
            border-color: var(--accent-color);
        }

        .filter-icon {
            font-size: 20px;
        }

        /* Old category dock styles (kept for backwards compatibility if needed) */
        .category-dock {
            flex-shrink: 0;
            background: var(--bg-tertiary);
            padding: 10px 15px;
            display: flex;
            justify-content: space-between;
            gap: 6px;
            z-index: 99;
        }

        .cat-btn {
            padding: 8px 4px;
            background: var(--bg-card);
            flex: 1;
            min-width: 60px;
            flex-shrink: 0;
            border: none;
            border-radius: 12px;
            color: var(--text-primary);
            cursor: pointer;
            font-size: 10px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 3px;
            transition: background 0.2s;
            white-space: nowrap;
        }

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

        .cat-btn.active {
            background: var(--accent-color);
        }

        .cat-icon {
            font-size: 18px;
        }

        .category-dock::-webkit-scrollbar {
            height: 6px;
        }

        .category-dock::-webkit-scrollbar-track {
            background: var(--bg-tertiary);
        }

        .category-dock::-webkit-scrollbar-thumb {
            background: var(--accent-hover);
            border-radius: 3px;
        }

        /* Type List - This is the scrollable area */
        .type-list {
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding-bottom: 100px;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            flex-grow: 1;
            height: 0;
        }

        .type-card {
            background: var(--bg-card);
            border-radius: 15px;
            padding: 20px;
            cursor: pointer;
            transition: all 0.3s;
            position: relative;
            overflow: visible;
            min-height: 100px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            border-left: 6px solid;
        }

        .type-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
        }

        .type-card.pinned::before,
        .varietal-card.pinned::before {
            content: '📌';
            position: absolute;
            top: 4px;
            right: 4px;
            left: auto;
            font-size: 14px;
            z-index: 5;
        }

        .varietal-card.pinned .varietal-badges {
            right: 28px;
        }

        .card-settings-btn {
            position: absolute;
            bottom: 10px;
            right: 10px;
            left: auto;
            background: transparent;
            border: none;
            color: var(--text-primary);
            width: 30px;
            height: 30px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s;
            z-index: 10;
        }

        .card-settings-btn:hover {
            background: rgba(0, 0, 0, 0.3);
        }

        .card-menu {
            position: absolute;
            bottom: 45px;
            right: 10px;
            left: auto;
            background: var(--bg-tertiary);
            border-radius: 6px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
            z-index: 20;
            display: none;
            font-size: 13px;
        }

        .card-menu.active {
            display: flex;
            flex-direction: row;
            align-items: center;
            white-space: nowrap;
        }

        .card-menu-item {
            padding: 8px 12px;
            cursor: pointer;
            transition: background 0.2s;
            border-right: 1px solid var(--border-color);
            flex-shrink: 0;
        }

        .card-menu-item:last-child {
            border-right: none;
            border-bottom: none;
        }

        .card-menu-item:first-child {
            border-radius: 6px 0 0 6px;
        }

        .card-menu-item:last-child {
            border-radius: 0 6px 6px 0;
        }

        .card-menu-item:hover {
            background: var(--bg-card);
        }

        .card-menu-item.danger {
            color: var(--danger-color);
        }

        .type-name {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 8px;
            padding-right: 40px;
        }

        .type-category {
            font-size: 14px;
            opacity: 0.7; color: var(--text-secondary);
            margin-bottom: 8px;
        }

        .type-stats {
            font-size: 13px;
            opacity: 0.6;
        }

        /* Bottom Navigation Bar - Persistent Add Buttons */
        .bottom-nav {
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: 480px;
            display: none;
            z-index: 200;
            box-sizing: border-box;
        }

        .bottom-nav.active {
            display: block;
        }

        .bottom-nav-content {
            background: var(--bg-tertiary);
            padding: 15px 20px;
            padding-bottom: max(15px, env(safe-area-inset-bottom));
            border-top: 1px solid var(--border-color);
        }

        .bottom-nav-btn {
            width: 100%;
            background: var(--accent-color);
            color: var(--text-primary);
            border: none;
            padding: 14px 32px;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            cursor: pointer;
            transition: all 0.2s;
            box-sizing: border-box;
        }

        .bottom-nav-btn:hover {
            background: var(--accent-hover);
            transform: translateY(-2px);
        }

        .bottom-nav-btn:active {
            transform: translateY(0);
        }

        .bottom-nav-icon {
            font-size: 20px;
            font-weight: bold;
        }

        /* Responsive: On very small screens, use full width */
        @media (max-width: 768px) {
            /* Critical mobile scrolling fixes - extra padding for bottom nav */
            .type-list {
                padding-bottom: 140px !important;
            }
            
            .varietals-list {
                padding-bottom: 140px !important;
            }
            
            .event-list {
                padding-bottom: 140px !important;
            }
            
            .info-container {
                padding-bottom: 140px !important;
            }
            
            .stats-container {
                padding-bottom: 140px !important;
            }
        }
        
        @media (max-width: 480px) {
            .bottom-nav {
                left: 0;
                right: 0;
                transform: none;
                max-width: 100%;
            }
            
            .filter-buttons {
                padding: 12px 15px;
            }
            
            .filter-btn {
                font-size: 15px;
                padding: 16px 12px;
                min-height: 54px;
            }
            
            .filter-icon {
                font-size: 22px;
            }
        }

        /* Breadcrumb */
        .breadcrumb {
            background: var(--bg-primary);
            padding: 12px 20px;
            font-size: 14px;
            font-weight: 600;
            letter-spacing: 0.2px;
            color: var(--text-primary);
            flex-shrink: 0;
            border-bottom: 1px solid var(--border-color);
        }

        /* Event Type Tabs (Action/Observation/Harvest) */
        .event-type-tabs {
            display: flex;
            gap: 0;
            padding: 0 20px;
            background: var(--bg-secondary);
            flex-shrink: 0;
            border-bottom: 2px solid var(--border-color);
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
        }

        .event-type-tab {
            flex: 1;
            padding: 12px 20px;
            background: transparent;
            border: none;
            border-radius: 0;
            color: var(--text-tertiary);
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            border-bottom: 3px solid transparent;
        }

        .event-type-tab:hover {
            color: var(--tab-hover-text);
            background: transparent;
        }

        .event-type-tab.active {
            color: var(--accent-color);
            border-bottom-color: var(--accent-color);
            background: transparent;
            box-shadow: none;
        }

        /* Profile Tabs (Events/Info/Stats) */
        .profile-tabs {
            display: flex;
            background: var(--bg-tertiary);
            position: sticky;
            top: 118px;
            z-index: 98;
            border-bottom: 2px solid var(--border-color);
        }

        .profile-tab {
            flex: 1;
            padding: 15px;
            background: transparent;
            border: none;
            color: var(--text-primary);
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            border-bottom: 3px solid transparent;
        }

        .profile-tab:hover {
            background: var(--hover-overlay);
        }

        .profile-tab.active {
            background: var(--bg-card);
            border-bottom-color: var(--accent-color);
        }

        /* Profile Tab Content */
        .profile-tab-content {
            display: none;
        }

        .profile-tab-content.active {
            display: block;
        }

        /* Info Container */
        .info-container {
            padding: 20px;
            padding-bottom: 100px;
        }

        .info-section {
            background: var(--bg-card);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 15px;
        }

        .info-row {
            display: flex;
            justify-content: space-between;
            padding: 12px 0;
            border-bottom: 1px solid var(--border-color);
        }

        .info-row:last-child {
            border-bottom: none;
        }

        .info-label {
            font-weight: 600;
            opacity: 0.8;
        }

        .info-value {
            text-align: right;
        }

        /* Stats Container */
        .stats-container {
            padding: 20px;
            padding-bottom: 100px;
        }

        .stats-section {
            margin-bottom: 20px;
        }

        .stats-section-header {
            background: var(--bg-card);
            padding: 12px 20px;
            font-size: 16px;
            font-weight: bold;
            border-radius: 8px 8px 0 0;
        }

        .stats-section-content {
            background: var(--bg-tertiary);
            border-radius: 0 0 8px 8px;
        }

        .stats-row {
            display: flex;
            justify-content: space-between;
            padding: 12px 20px;
            border-bottom: 1px solid var(--border-color);
        }

        .stats-row:last-child {
            border-bottom: none;
        }

        /* Section Headers */
        .section-header {
            margin: 30px 0 15px 0;
            padding: 12px 0;
            border-bottom: 2px solid var(--border-color);
            font-size: 18px;
            opacity: 0.9;
        }

        /* Breadcrumb */
        .breadcrumb {
            background: var(--bg-primary);
            padding: 12px 20px;
            font-size: 14px;
            font-weight: 600;
            letter-spacing: 0.2px;
            color: var(--text-primary);
            flex-shrink: 0;
            border-bottom: 1px solid var(--border-color);
        }

        /* Modal/Screen Overlay */
        /* Screen - Scrollable content area */
        .screen {
            flex-grow: 1;
            display: none;
            flex-direction: column;
            overflow: hidden;
        }

        .screen.active {
            display: flex;
        }

        /* Varietal Profile Header - Make it smaller */
        /* Varietal Profile Header and Varietals Header - Make them same size */
        #varProfileHeader,
        #varietalsHeader {
            font-size: 16px;
            font-weight: 600;
            opacity: 0.9;
        }

        /* Varietals Screen */
        .varietals-list {
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding-bottom: 100px; /* Extra space for bottom nav */
            overflow-y: auto; /* Enable scrolling */
            -webkit-overflow-scrolling: touch;
            flex-grow: 1; /* Take remaining space */
        }

        .varietal-card {
            background: var(--bg-card);
            border-radius: 12px;
            padding: 18px;
            cursor: pointer;
            transition: all 0.3s;
            position: relative;
            border-left: 6px solid var(--border-color);
        }

        .varietal-card:hover {
            transform: translateX(5px);
        }

        .varietal-name {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 8px;
            padding-right: 80px;
        }

        .varietal-info {
            font-size: 13px;
            opacity: 0.7; color: var(--text-secondary);
            display: flex;
            justify-content: space-between;
            margin-top: 10px;
        }

        .varietal-badges {
            display: flex;
            gap: 8px;
            align-items: center;
            position: absolute;
            top: 10px;
            right: 10px;
        }

        .event-card {
            background: var(--bg-card);
            border-radius: 0 10px 10px 0;
            border-left: 6px solid var(--border-color);
            padding: 15px;
            cursor: pointer;
            display: flex;
            gap: 15px;
            align-items: flex-start;
            transition: all 0.2s;
            position: relative;
        }

        .event-card:hover {
            background: var(--hover-bg);
        }

        .event-date {
            min-width: 60px;
            text-align: center;
        }

        .event-date-day {
            font-size: 24px;
            font-weight: bold;
        }

        .event-date-month {
            font-size: 12px;
            opacity: 0.7; color: var(--text-secondary);
        }

        .event-info {
            flex: 1;
            padding-right: 40px;
        }

        .event-type {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 5px;
        }

        .event-details {
            font-size: 13px;
            opacity: 0.7; color: var(--text-secondary);
        }

        .event-quantity {
            font-size: 13px;
            color: var(--text-secondary);
            margin-top: 5px;
            font-weight: 500;
        }

        /* Forms */
        .form-container {
            padding: 20px;
            padding-bottom: 100px;
            overflow-y: auto;
            flex-grow: 1;
        }

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

        .form-label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            opacity: 0.8;
        }

        .form-input,
        .form-select,
        .form-textarea {
            width: 100%;
            padding: 12px;
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 8px;
            color: var(--text-primary);
            font-size: 16px;
        }

        .form-input:focus,
        .form-select:focus,
        .form-textarea:focus {
            outline: none;
            border-color: var(--accent-color);
        }

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

        .color-picker-grid {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 10px;
        }

        .color-option {
            width: 100%;
            aspect-ratio: 1;
            border-radius: 8px;
            border: 3px solid transparent;
            cursor: pointer;
            transition: all 0.2s;
        }

        .color-option:hover {
            transform: scale(1.1);
        }

        .color-option.selected {
            border-color: var(--text-primary);
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
        }
        
        /* Compact Color Picker for Garden Modal */
        #gardenCellColorPicker {
            display: grid;
            grid-template-columns: repeat(8, 1fr);
            gap: 8px;
            max-width: 100%;
        }
        
        #gardenCellColorPicker .color-option {
            width: 32px;
            height: 32px;
            border-radius: 6px;
            border: 2px solid transparent;
        }
        
        #gardenCellColorPicker .color-option.selected {
            border-color: var(--text-primary);
            box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
        }
        
        #gardenCellColorPicker .color-option:hover {
            transform: scale(1.15);
        }
        
        /* Event Color Customization Modals */
        .event-type-button {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 15px;
            margin-bottom: 10px;
            border-radius: 0 8px 8px 0;
            cursor: pointer;
            transition: all 0.2s;
            border: none;
            border-left: 6px solid transparent;
            width: 100%;
            text-align: center;
            font-size: 16px;
            font-weight: 600;
            color: var(--text-primary);
            background: var(--bg-card);
        }
        
        .event-type-button:hover {
            background: var(--bg-card-hover);
            transform: translateX(3px);
        }
        
        .color-picker-grid {
            display: grid;
            grid-template-columns: repeat(6, 40px);
            gap: 8px;
            padding: 10px 0;
        }
        
        .color-picker-grid .color-option {
            width: 40px;
            height: 40px;
            border-radius: 7px;
            border: 3px solid transparent;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .color-picker-grid .color-option:hover {
            transform: scale(1.1);
        }
        
        .color-picker-grid .color-option.selected {
            border-color: var(--text-primary);
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
        }

        /* Buttons */
        .btn {
            padding: 12px 24px;
            border: 2px solid transparent;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
            width: 100%;
        }

        .btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        }

        .btn:active {
            transform: translateY(0);
            box-shadow: none;
        }

        .btn-primary {
            background: var(--btn-primary-bg);
            color: var(--btn-primary-text);
            border-color: var(--accent-color);
        }

        .btn-primary:hover {
            background: var(--btn-primary-hover);
            border-color: var(--accent-hover);
        }

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

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

        .btn-danger {
            background: var(--danger-color);
            color: #ffffff;
            border-color: var(--btn-danger-border);
        }

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

        .btn:focus-visible,
        .menu-btn:focus-visible,
        .filter-btn:focus-visible,
        .event-type-tab:focus-visible,
        .bottom-nav-btn:focus-visible {
            outline: 3px solid var(--btn-focus-ring);
            outline-offset: 2px;
        }

        .btn-group {
            display: flex;
            gap: 10px;
            margin-top: 20px;
        }

        /* Profile View Tabs (Events/Stats) */
        .profile-view-tabs {
            display: flex;
            gap: 0;
            padding: 0 20px;
            background: var(--bg-secondary);
            border-bottom: 2px solid var(--border-color);
        }

        .profile-view-tab {
            flex: 1;
            padding: 12px 20px;
            background: transparent;
            border: none;
            color: var(--text-tertiary);
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            transition: all 0.2s;
            border-bottom: 3px solid transparent;
        }

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

        .profile-view-tab.active {
            color: var(--accent-color);
            border-bottom-color: var(--accent-color);
        }

        .profile-view-content {
            flex-grow: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            display: flex;
            flex-direction: column;
        }

        /* Info View */
        .info-container {
            padding: 20px;
            padding-bottom: 100px;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .info-section {
            background: var(--bg-tertiary);
            border-radius: 12px;
            padding: 15px;
        }

        .info-section-title {
            font-size: 18px;
            font-weight: 600;
            color: var(--accent-color);
            margin-bottom: 12px;
            padding-bottom: 8px;
            border-bottom: 2px solid var(--border-color);
        }

        .info-row {
            display: flex;
            justify-content: space-between;
            padding: 10px 0;
            border-bottom: 1px solid var(--border-color);
            gap: 15px;
        }

        .info-row:last-child {
            border-bottom: none;
        }

        .info-label {
            color: var(--text-secondary);
            font-size: 14px;
            min-width: 120px;
        }

        .info-value {
            font-weight: 500;
            font-size: 15px;
            color: var(--text-primary);
            text-align: right;
            flex: 1;
        }

        .info-value.empty {
            color: var(--text-tertiary);
            font-style: italic;
        }

        .info-checkbox {
            width: 20px;
            height: 20px;
            border-radius: 4px;
            background: var(--bg-card);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .info-checkbox.checked {
            background: var(--accent-color);
        }

        /* Stats View */
        .stats-season-selector {
            padding: 15px 20px;
            background: var(--bg-tertiary);
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .stats-season-selector label {
            font-weight: 600;
            min-width: 60px;
        }

        .stats-season-selector select {
            flex: 1;
        }

        .stats-container {
            padding: 20px;
            padding-bottom: 100px;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .stats-section {
            background: var(--bg-tertiary);
            border-radius: 12px;
            padding: 15px;
        }

        .stats-section-title {
            font-size: 18px;
            font-weight: 600;
            color: var(--accent-color);
            margin-bottom: 12px;
            padding-bottom: 8px;
            border-bottom: 2px solid var(--border-color);
        }

        .stats-row {
            display: flex;
            justify-content: space-between;
            padding: 10px 0;
            border-bottom: 1px solid var(--border-color);
        }

        .stats-row:last-child {
            border-bottom: none;
        }

        .stats-label {
            color: var(--text-secondary);
            font-size: 14px;
        }

        .stats-value {
            font-weight: 600;
            font-size: 16px;
            color: var(--text-primary);
        }

        /* Season Tabs */
        .season-tabs {
            display: flex;
            gap: 10px;
            padding: 15px;
            overflow-x: auto;
            background: var(--bg-tertiary);
            scrollbar-width: none;
            flex-shrink: 0;
        }

        .season-tabs::-webkit-scrollbar {
            display: none;
        }

        .season-tab {
            min-width: 120px;
            padding: 15px 20px;
            background: var(--bg-card);
            border: none;
            border-radius: 12px;
            color: var(--text-primary);
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.2s;
            text-align: center;
            flex-shrink: 0;
        }

        .season-tab:hover {
            background: var(--bg-card-hover);
        }

        .season-tab.active {
            background: var(--accent-color);
            border: 3px solid var(--accent-hover);
        }

        /* Event List - Make it scrollable within eventsView */
        .event-list {
            padding: 15px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            padding-bottom: 100px;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            flex-grow: 1;
        }

        /* Notification */
        .notification {
            position: fixed;
            top: 80px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(45, 122, 110, 0.5);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            color: #ffffff;
            padding: 10px 20px;
            border-radius: 8px;
            border: 1px solid rgba(117, 179, 172, 0.4);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            z-index: 300;
            display: none;
            animation: slideDown 0.3s ease-out;
            width: calc(min(90vw, 432px));
            max-width: 432px;
            font-size: 13px;
            font-weight: 500;
        }

        .notification.show {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }

        .notification.error {
            background: rgba(180, 40, 40, 0.6);
            border: 1px solid rgba(220, 80, 80, 0.5);
        }

        body.light-mode .notification.error {
            background: rgba(220, 60, 60, 0.15);
            border: 1px solid rgba(200, 50, 50, 0.5);
            color: #991b1b;
        }

        .notif-msg {
            flex: 1;
            text-align: center;
        }

        .notif-copy-btn {
            background: rgba(255,255,255,0.2);
            border: 1px solid rgba(255,255,255,0.3);
            color: inherit;
            padding: 3px 8px;
            border-radius: 4px;
            font-size: 11px;
            cursor: pointer;
            white-space: nowrap;
        }

        body.light-mode .notif-copy-btn {
            background: rgba(0,0,0,0.08);
            border: 1px solid rgba(0,0,0,0.15);
        }

        body.light-mode .notification {
            background: rgba(255, 255, 255, 0.6);
            border: 1px solid rgba(45, 122, 110, 0.5);
            color: var(--text-primary);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        /* Info tooltip (tap to show) */
        .info-tooltip {
            position: relative;
            cursor: pointer;
            font-size: 14px;
            color: var(--text-tertiary);
        }

        .info-tooltip-text {
            display: none;
            position: absolute;
            bottom: 130%;
            left: 50%;
            transform: translateX(-50%);
            background: #101a18;
            color: #f5f9f7;
            padding: 14px 18px;
            border-radius: 10px;
            font-size: 15px;
            width: 270px;
            box-shadow: 0 6px 24px rgba(0,0,0,0.35);
            border: 1px solid var(--border-color);
            z-index: 100;
            line-height: 1.6;
        }

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

        @keyframes slideDown {
            from {
                transform: translateX(-50%) translateY(-100%);
                opacity: 0;
            }
            to {
                transform: translateX(-50%) translateY(0);
                opacity: 1;
            }
        }

        /* Empty State */
        .empty-state {
            text-align: center;
            padding: 60px 20px;
            opacity: 0.7; color: var(--text-secondary);
        }

        .empty-state-icon {
            font-size: 64px;
            margin-bottom: 20px;
        }

        .empty-state-text {
            font-size: 18px;
            margin-bottom: 10px;
        }

        .empty-state-subtext {
            font-size: 14px;
            opacity: 0.7; color: var(--text-secondary);
        }

        /* First Time Panel */
        .first-time-panel {
            position: fixed;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            max-width: 480px;
            width: 100%;
            height: 100vh;
            height: 100svh;
            background: rgba(0, 0, 0, 0.95);
            z-index: 500;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .first-time-panel.active {
            display: flex;
        }

        .first-time-close {
            position: absolute;
            top: max(20px, env(safe-area-inset-top));
            right: 20px;
            background: none;
            border: none;
            color: #ef4444;
            font-size: 32px;
            font-weight: 700;
            cursor: pointer;
            line-height: 1;
            padding: 8px;
            z-index: 501;
        }

        .first-time-content {
            background: var(--bg-tertiary);
            border-radius: 20px;
            padding: 40px;
            text-align: center;
            max-width: 400px;
        }

        .first-time-title {
            font-size: 28px;
            font-weight: bold;
            margin-bottom: 20px;
            color: var(--accent-color);
        }

        .first-time-text {
            font-size: 16px;
            margin-bottom: 30px;
            line-height: 1.6;
        }

        /* Highlight Panel */
        .highlight-panel {
            position: fixed;
            bottom: 90px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--accent-color);
            color: var(--text-primary);
            padding: 15px 25px;
            border-radius: 12px;
            box-shadow: 0 4px 15px rgba(117, 179, 172, 0.5);
            text-align: center;
            font-size: 14px;
            max-width: 90%;
            z-index: 50;
        }

        .highlight-arrow {
            position: absolute;
            bottom: -10px;
            left: 50%;
            transform: translateX(-50%);
            width: 0;
            height: 0;
            border-left: 10px solid transparent;
            border-right: 10px solid transparent;
            border-top: 10px solid var(--theme-accent-line);
        }

        /* Event View Screen */
        .event-view-container {
            padding: 20px;
            padding-bottom: 100px;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            flex-grow: 1;
        }

        .event-view-header {
            background: var(--bg-card);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 20px;
        }

        .event-view-type {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 10px;
        }

        .event-view-date {
            font-size: 16px;
            opacity: 0.8;
        }

        .event-view-section {
            background: var(--bg-card);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 15px;
        }

        .event-view-section-title {
            font-size: 14px;
            opacity: 0.7; color: var(--text-secondary);
            margin-bottom: 8px;
        }

        .event-view-section-content {
            font-size: 16px;
        }

        /* To-Do Status Badge */
        .todo-status-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .todo-status-label {
            font-size: 14px;
            color: var(--text-secondary);
        }

        .todo-status-badge {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 18px;
            border-radius: 24px;
            font-size: 14px;
            font-weight: 600;
            border: none;
            cursor: pointer;
            transition: all 0.2s;
        }

        .todo-status-badge:active {
            transform: scale(0.95);
        }

        .todo-status-badge.is-todo {
            background: rgba(234, 179, 8, 0.2);
            color: #eab308;
        }

        .todo-status-badge.is-done {
            background: rgba(34, 197, 94, 0.2);
            color: #22c55e;
        }

        body.light-mode .todo-status-badge.is-todo {
            background: rgba(180, 140, 0, 0.12);
            color: #a16207;
        }

        body.light-mode .todo-status-badge.is-done {
            background: rgba(22, 163, 74, 0.12);
            color: #15803d;
        }

        /* Settings Toggle */
        .settings-toggle {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px;
            background: var(--bg-card);
            border-radius: 10px;
            margin-bottom: 10px;
        }

        .toggle-switch {
            position: relative;
            width: 50px;
            height: 28px;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: var(--border-color);
            transition: .4s;
            border-radius: 28px;
        }

        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 20px;
            width: 20px;
            left: 4px;
            bottom: 4px;
            background-color: var(--text-primary);
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .toggle-slider {
            background-color: var(--accent-color);
        }

        input:checked + .toggle-slider:before {
            transform: translateX(22px);
        }

        .theme-selector {
            display: flex;
            gap: 0;
            border: 1px solid var(--border-color);
            border-radius: 10px;
            overflow: hidden;
        }
        .theme-option {
            flex: 1;
            padding: 8px 6px;
            border: none;
            background: var(--bg-tertiary);
            color: var(--text-secondary);
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.2s, color 0.2s;
        }
        .theme-option + .theme-option {
            border-left: 1px solid var(--border-color);
        }
        .theme-option.active {
            background: var(--accent-color);
            color: #fff;
        }
        .theme-option:not(.active):hover {
            background: #101a18;
            color: #f5f9f7;
        }

        input:disabled + .toggle-slider {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* Garden Dimension Controls */
        .garden-dimension-controls {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            margin-bottom: 18px;
        }
        .garden-dims-row {
            display: flex;
            gap: 16px;
            justify-content: center;
            align-items: flex-end;
        }
        .garden-dim-group {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .garden-stepper {
            display: flex;
            align-items: center;
            gap: 0;
            border: 1px solid var(--border-color);
            border-radius: 10px;
            overflow: hidden;
        }
        .stepper-btn {
            width: 38px;
            height: 38px;
            border: none;
            background: var(--bg-tertiary);
            color: var(--text-primary);
            font-size: 18px;
            font-weight: bold;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.15s;
        }
        .stepper-btn:hover {
            background: var(--accent-color);
            color: #fff;
        }
        .stepper-btn:active {
            opacity: 0.8;
        }
        .stepper-input {
            width: 42px;
            height: 38px;
            border: none;
            border-left: 1px solid var(--border-color);
            border-right: 1px solid var(--border-color);
            background: #101a18;
            color: #f5f9f7;
            font-size: 16px;
            font-weight: 600;
            text-align: center;
            -moz-appearance: textfield;
        }
        .stepper-input::-webkit-inner-spin-button,
        .stepper-input::-webkit-outer-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
        .garden-set-btn {
            padding: 8px 18px !important;
            font-size: 14px !important;
            font-weight: 600;
            border-radius: 10px !important;
            height: 38px;
            white-space: nowrap;
        }

        /* Garden Grid */
        .garden-grid {
            display: grid;
            gap: 5px;
            padding: 20px;
            overflow: auto;
            max-height: 600px;
            width: fit-content;
            margin: 0 auto;
        }

        .garden-cell {
            width: 60px;
            height: 60px;
            background: var(--bg-card);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 11px;
            text-align: center;
            padding: 5px;
            transition: all 0.2s;
            word-wrap: break-word;
            overflow: hidden;
        }

        .garden-cell:hover {
            background: var(--bg-card-hover);
        }

        .recent-entry-chip {
            background: var(--bg-card);
            border: 2px solid var(--theme-accent-line);
            border-radius: 20px;
            padding: 8px 16px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .recent-entry-chip:hover {
            background: var(--bg-card-hover);
            transform: scale(1.05);
        }

        .recent-entry-color {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            border: 2px solid var(--border-color);
        }

        /* Bloom Tracker Styles */

        .bloom-tracker-title {
            margin: 0;
            font-size: 20px;
            font-weight: 700;
            color: var(--accent-color);
        }

        .bloom-range-toggle {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            color: var(--text-secondary);
            cursor: pointer;
            margin-top: 8px;
        }
        .bloom-range-toggle input {
            accent-color: var(--accent-color);
        }

        .bloom-info-button {
            width: auto;
            min-width: 110px;
            padding: 8px 14px;
            font-size: 14px;
        }

        .event-photo-preview {
            width: 100%;
            max-height: 240px;
            object-fit: cover;
            border-radius: 10px;
            border: 1px solid var(--border-color);
            background: var(--bg-card);
        }

        .bloom-timeline-container {
            flex-grow: 1;
            overflow: auto;
            background: var(--bg-secondary);
        }

        .bloom-timeline {
            min-width: var(--bloom-timeline-min-width);
            padding: 20px;
        }

        .bloom-legend {
            display: flex;
            background: var(--bg-tertiary);
            border-radius: 8px;
            margin-bottom: 5px;
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .bloom-varietal-column {
            width: 120px;
            flex-shrink: 0;
            padding: 12px 8px;
            font-weight: 600;
            font-size: 13px;
        }

        .bloom-months-row {
            flex-grow: 1;
            display: flex;
        }

        .bloom-month-header {
            width: var(--bloom-month-width);
            flex-shrink: 0;
            text-align: center;
            padding: 12px 0;
            font-weight: 600;
            font-size: 12px;
            border-left: 1px solid rgba(117, 179, 172, 0.2);
        }

        .bloom-month-header:first-child {
            border-left: none;
        }

        .bloom-row {
            display: flex;
            margin-bottom: 4px;
            background: var(--bg-tertiary);
            border-radius: 8px;
            position: relative;
            min-height: 50px;
        }

        .bloom-row:nth-child(even) {
            background: var(--bg-card, var(--bg-tertiary));
            opacity: 0.85;
        }

        .bloom-row:nth-child(odd) {
            background: var(--bg-tertiary);
        }

        .bloom-varietal-label {
            width: 120px;
            max-width: 120px;
            flex-shrink: 0;
            padding: 12px 8px;
            font-size: 13px;
            display: flex;
            align-items: center;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .bloom-timeline-area {
            flex-grow: 1;
            position: relative;
            display: flex;
        }

        .bloom-month-column {
            width: var(--bloom-month-width);
            flex-shrink: 0;
            border-left: 1px solid rgba(117, 179, 172, 0.1);
            position: relative;
        }

        .bloom-month-column:first-child {
            border-left: none;
        }

        .bloom-bar {
            position: absolute;
            height: 35px;
            top: 50%;
            transform: translateY(-50%);
            background: linear-gradient(135deg, var(--theme-bloom-start), var(--theme-bloom-end));
            border-radius: 4px;
            cursor: pointer;
            transition: opacity 0.2s;
        }

        .bloom-bar:hover {
            opacity: 0.8;
        }

        .bloom-bar-gradient {
            background: linear-gradient(to right, var(--theme-bloom-start), color-mix(in srgb, var(--theme-bloom-start) 8%, transparent));
        }

        body.light-mode .bloom-bar {
            background: linear-gradient(135deg, var(--theme-bloom-start), var(--theme-bloom-end));
        }

        body.light-mode .bloom-bar-gradient {
            background: linear-gradient(to right, var(--theme-bloom-start), color-mix(in srgb, var(--theme-bloom-start) 8%, transparent));
        }

        .bloom-bar-arrow {
            position: absolute;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            font-size: 20px;
            color: var(--text-primary);
        }

        .bloom-harvest-icon {
            position: absolute;
            top: 8px;
            font-size: 20px;
            pointer-events: none;
        }

        .bloom-tooltip {
            position: fixed;
            background: var(--bg-tertiary);
            border: 2px solid var(--theme-accent-line);
            border-radius: 8px;
            padding: 12px;
            z-index: 10000;
            white-space: nowrap;
            font-size: 13px;
            line-height: 1.6;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
            pointer-events: none;
        }

        /* Modal Overlay */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.8);
            z-index: 1100;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal-content {
            background: var(--bg-tertiary);
            border-radius: 15px;
            padding: 30px;
            max-width: 400px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
        }
        
        /* Auth Modal Specific Styling */
        .auth-modal-content {
            max-width: 420px;
        }
        
        .auth-modal .form-group {
            margin-bottom: 20px;
        }

        .modal-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 20px;
        }

        .season-list {
            max-height: 300px;
            overflow-y: auto;
            margin-bottom: 20px;
        }

        .season-list-item {
            padding: 12px;
            background: var(--bg-card);
            border-radius: 8px;
            margin-bottom: 8px;
            cursor: pointer;
            transition: background 0.2s;
        }

        .season-list-item:hover {
            background: var(--bg-card-hover);
        }

        .season-list-item.selected {
            background: var(--accent-color);
        }

        /* Filter Modal Styles */
        .filter-option {
            padding: 8px 10px;
            background: var(--bg-card);
            border-radius: 6px;
            margin-bottom: 0;
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            transition: background 0.2s;
            min-height: 38px;
            -webkit-tap-highlight-color: rgba(117, 179, 172, 0.3);
            touch-action: manipulation;
            user-select: none;
            -webkit-user-select: none;
        }

        .filter-option:active {
            background: var(--bg-card-hover);
        }

        .filter-option:hover {
            background: var(--bg-card-hover);
        }

        .filter-option input[type="checkbox"] {
            width: 18px;
            height: 18px;
            cursor: pointer;
            flex-shrink: 0;
        }

        .filter-option-label {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            cursor: pointer;
            color: #ffffff;
        }

        .filter-option-icon {
            font-size: 16px;
            flex-shrink: 0;
        }

        #categoryFilterOptions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 6px;
        }

        /* Light Mode Specific Overrides */
        body.light-mode .type-card,
        body.light-mode .varietal-card {
            border: 1px solid var(--border-color);
            box-shadow: 0 1px 3px var(--shadow-color);
        }

        body.light-mode .event-card {
            box-shadow: 0 1px 3px var(--shadow-color);
        }

        body.light-mode .type-card {
            border-left-width: 6px;
        }

        body.light-mode .type-card:hover {
            box-shadow: 0 4px 12px var(--shadow-color);
        }

        body.light-mode .bottom-nav-content {
            background: var(--bg-secondary);
            padding-bottom: max(15px, env(safe-area-inset-bottom));
            border-top: 1px solid var(--border-color);
        }

        body.light-mode .bottom-nav-btn {
            background: transparent;
            color: var(--accent-color);
            border: 2px solid var(--accent-color);
        }

        body.light-mode .bottom-nav-btn:hover {
            background: var(--accent-color);
            color: #ffffff;
        }

        body.light-mode .garden-cell {
            border: 1px solid var(--border-color);
        }

        body.light-mode .breadcrumb {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        body.light-mode .season-tab {
            background: var(--bg-tertiary);
            color: var(--text-primary);
            border: 2px solid var(--border-color);
        }

        body.light-mode .season-tab.active {
            background: var(--accent-color);
            color: #ffffff;
            border-color: var(--accent-hover);
        }

        body.light-mode .season-tab:hover {
            background: var(--border-color);
            border-color: var(--accent-color);
            color: var(--accent-color);
        }

        body.light-mode .info-row,
        body.light-mode .stats-row {
            color: var(--text-primary);
        }

        body.light-mode .info-label,
        body.light-mode .stats-label {
            color: var(--text-secondary);
        }

        body.light-mode .info-value,
        body.light-mode .stats-value {
            color: var(--text-primary);
        }

        body.light-mode .filter-buttons {
            background: var(--bg-secondary);
        }

        body.light-mode .filter-btn {
            background: transparent;
            color: var(--accent-color);
            border: 2px solid var(--accent-color);
        }

        body.light-mode .filter-btn:hover {
            background: var(--accent-color);
            color: #ffffff;
            border-color: var(--accent-color);
        }

        body.light-mode .filter-btn.active {
            background: var(--accent-color);
            color: #ffffff;
        }

        body.light-mode .filter-option-label {
            color: var(--text-primary);
        }

        body.light-mode .modal-content {
            background: var(--bg-secondary);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
        }

        body.light-mode .modal-title {
            color: var(--text-primary);
        }

        body.light-mode .btn-primary {
            background: var(--btn-primary-bg);
            color: var(--btn-primary-text);
        }

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

        body.light-mode .faq-category-header {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        body.light-mode .faq-question {
            background: var(--accent-color);
            color: #ffffff;
        }

        body.light-mode .faq-question:hover {
            background: var(--accent-hover);
        }

        body.light-mode .faq-answer {
            background: #f5f9f8;
            color: var(--text-primary);
            border: 1px solid var(--border-color);
        }

        /* Light mode: fix white glow on color swatches */
        body.light-mode .color-option.selected {
            box-shadow: 0 0 0 3px var(--accent-color), 0 0 10px rgba(0,0,0,0.15);
        }

        body.light-mode .event-type-button {
            border: 1px solid var(--border-color);
            border-left: 6px solid transparent;
        }

        body.light-mode #gardenCellColorPicker .color-option.selected {
            box-shadow: 0 0 0 2px var(--accent-color), 0 0 6px rgba(0,0,0,0.15);
        }

        body.light-mode .color-picker-grid .color-option.selected {
            box-shadow: 0 0 0 3px var(--accent-color), 0 0 10px rgba(0,0,0,0.15);
        }

        /* Light mode: form fields get proper border color */
        body.light-mode .form-input,
        body.light-mode .form-select,
        body.light-mode .form-textarea {
            border-color: var(--border-color);
            background: var(--bg-secondary);
        }

        body.light-mode .form-input:focus,
        body.light-mode .form-select:focus,
        body.light-mode .form-textarea:focus {
            border-color: var(--accent-color);
            box-shadow: 0 0 0 3px rgba(45, 122, 110, 0.15);
        }

        /* Light mode: event type tabs */
        body.light-mode .event-type-tab {
            background: transparent;
            color: var(--text-tertiary);
        }

        body.light-mode .event-type-tab:hover {
            color: var(--tab-hover-text);
        }

        body.light-mode .event-type-tab.active {
            color: var(--accent-color);
            border-bottom-color: var(--accent-color);
            background: transparent;
        }


        body.compact-cards .type-category,
        body.compact-cards .type-stats,
        body.compact-cards .event-details,
        body.compact-cards .varietal-badges {
            display: none;
        }

        body.compact-cards .type-card,
        body.compact-cards .varietal-card,
        body.compact-cards .event-card {
            padding-top: 10px;
            padding-bottom: 10px;
        }


        body.compact-cards .type-list {
            gap: 8px;
        }

        body.compact-cards .type-card {
            min-height: 72px;
            padding: 12px 14px;
        }

        body.compact-cards .type-name {
            font-size: 17px;
            margin-bottom: 0;
            line-height: 1.25;
        }

        body.compact-cards .card-settings-btn {
            bottom: 6px;
            right: 6px;
            width: 26px;
            height: 26px;
            font-size: 14px;
        }

        /* Wide color stripes */
        body.wide-color-stripes .type-card {
            border-left-width: 48px;
        }

        body.wide-color-stripes .varietal-card {
            border-left-width: 48px;
        }

        body.wide-color-stripes .event-card {
            border-left-width: 48px;
        }

        body.wide-color-stripes.light-mode .type-card {
            border-left-width: 48px;
        }

        /* Light mode: header shadow softer */
        body.light-mode .header {
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
            border-bottom: 1px solid var(--border-color);
        }

        /* Scrollbar */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        ::-webkit-scrollbar-track {
            background: var(--bg-tertiary);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--bg-card-hover);
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--accent-hover);
        }


        .photo-manager-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 10px;
        }

        .photo-manager-item {
            background: var(--bg-card);
            border: 1px solid var(--border-color);
            border-radius: 10px;
            padding: 8px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .photo-manager-image {
            width: 100%;
            height: 120px;
            object-fit: cover;
            border-radius: 8px;
            border: 1px solid var(--border-color);
        }

        .photo-manager-meta {
            font-size: 12px;
            opacity: 0.85;
            line-height: 1.35;
        }

        /* FAQ Styles */
        .faq-category {
            margin-bottom: 30px;
        }

        .faq-category-header {
            background: var(--bg-card);
            padding: 15px 20px;
            border-radius: 8px;
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 15px;
        }

        .faq-question-container {
            margin-bottom: 10px;
        }

        .faq-question {
            background: var(--accent-color);
            padding: 15px 20px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s;
            font-weight: 600;
            border: none;
            width: 100%;
            text-align: left;
            color: var(--text-primary);
            font-size: 16px;
        }

        .faq-question:hover {
            background: var(--accent-hover);
        }

        .faq-answer {
            background: rgba(117, 179, 172, 0.1);
            padding: 15px 20px;
            margin-top: 5px;
            margin-left: 15px;
            border-radius: 8px;
            line-height: 1.6;
            display: none;
            color: var(--text-primary);
            white-space: pre-line;
        }

        .faq-answer.visible {
            display: block;
        }
/* BloomGarden mini-game */
.bloom-garden-tabs-inline {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.bloom-garden-container {
    position: relative;
}

.bloom-garden-coins {
    font-size: 18px;
    font-weight: 700;
    color: #86efac;
    margin-bottom: 6px;
}

.bloom-garden-status {
    opacity: 0.85;
    font-size: 13px;
    margin-bottom: 16px;
}

.bloom-garden-section {
    margin-bottom: 22px;
}

.bloom-garden-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 10px;
}

.bloom-plot {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    min-height: 110px;
    font-size: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
}

.bloom-plot.empty { border-color: #334155; }
.bloom-plot.seedling { border-color: #fbbf24; }
.bloom-plot.growing { border-color: #60a5fa; }
.bloom-plot.ready { border-color: #4ade80; box-shadow: 0 0 0 1px #14532d inset; }

.bloom-plot button {
    margin-top: auto;
    padding-top: 8px;
    width: 100%;
    font-size: 11px;
    padding: 6px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bloom-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bloom-list-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
}

.bloom-list-item .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.bloom-float {
    position: absolute;
    right: 8px;
    top: 6px;
    color: #86efac;
    font-weight: 700;
    animation: bloomFloat 1000ms ease-out forwards;
    pointer-events: none;
}

@keyframes bloomFloat {
    0% { opacity: 1; transform: translateY(0px); }
    100% { opacity: 0; transform: translateY(-20px); }
}

.bloom-mini-btn {
    font-size: 12px;
    padding: 6px 12px;
    width: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.note-viewer-varietal {
    border-left: 4px solid var(--accent-color);
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.note-viewer-event {
    margin-top: 8px;
    padding: 8px;
    border-radius: 6px;
    background: rgba(117,179,172,0.08);
}

.note-viewer-summary {
    cursor: pointer;
    font-weight: 600;
}

.feature-locked {
    opacity: 0.5;
    filter: grayscale(0.2);
    pointer-events: none;
}

.lock-badge {
    cursor: pointer;
    pointer-events: auto;
    font-size: 14px;
    opacity: 0.8;
}

body.light-mode .info-tooltip-text {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}

/* Recommendation Lookup Modal */
.recommendation-modal-content {
    max-height: 85vh;
    overflow-y: auto;
}

@media (max-width: 600px) {
    .recommendation-modal-content {
        max-height: 75vh;
        padding: 20px 16px;
    }
}

.rec-match-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.rec-category-badge {
    background: var(--accent-color);
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.rec-match-score {
    font-size: 12px;
    opacity: 0.6;
}

.rec-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.rec-item {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 10px 12px;
}

.rec-item.full-width {
    grid-column: 1 / -1;
}

.rec-label {
    font-size: 11px;
    opacity: 0.6;
    margin-bottom: 4px;
}

.rec-value {
    font-size: 13px;
    line-height: 1.4;
}

.rec-tag {
    display: inline-block;
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin: 2px;
}

.rec-bug-tag,
.rec-beneficial-tag,
.rec-companion-tag {
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}
.rec-bug-tag:hover,
.rec-beneficial-tag:hover,
.rec-companion-tag:hover {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
}
.rec-bug-tag {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
}
.rec-beneficial-tag {
    background: rgba(76, 175, 80, 0.15);
    color: var(--theme-beneficial-text);
}
body.light-mode .rec-bug-tag {
    background: rgba(211, 47, 47, 0.12);
    color: #c62828;
}
body.light-mode .rec-beneficial-tag {
    background: rgba(46, 125, 50, 0.12);
    color: var(--theme-beneficial-text);
}

.pest-danger-badge {
    color: #fff;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.rec-incorrect-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
}

.rec-search-box {
    margin-bottom: 12px;
}

.rec-search-list {
    margin-top: 12px;
}

.rec-search-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
}

.rec-search-result:active {
    opacity: 0.7;
}

.rec-search-result-name {
    font-size: 14px;
}

/* Season Manager */
.season-manager-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.season-manager-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.season-manager-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.season-manager-name {
    font-size: 14px;
    font-weight: 500;
}

.season-manager-count {
    font-size: 11px;
    opacity: 0.5;
}

.season-manager-archive-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    opacity: 0.7;
    cursor: pointer;
}

/* Garden Clear Button */
.garden-clear-btn {
    background: var(--danger-color) !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 600;
    padding: 8px 20px !important;
    border-radius: 10px !important;
    margin-top: 16px;
    display: block;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}
.garden-clear-confirm {
    background: #d32f2f !important;
    animation: pulse-danger 0.6s infinite alternate;
}
@keyframes pulse-danger {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

/* Garden Empty Quick-Select Chip */
.recent-entry-empty {
    border-color: var(--border-color) !important;
    opacity: 0.7;
    font-size: 13px;
}
.recent-entry-empty:hover {
    opacity: 1;
}

/* ==================== BLOOMLAB CODEX ==================== */
.codex-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 16px 16px;
}

.codex-search-wrap {
    padding: 12px 0;
    flex-shrink: 0;
}

.codex-search {
    border-radius: 12px !important;
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color) !important;
}

.codex-suggest-card {
    border: 2px dashed var(--border-color) !important;
    background: transparent !important;
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.15s;
}
.codex-suggest-card:hover {
    opacity: 1;
}

/* Codex Tabs */
.codex-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.codex-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.6;
}

.codex-tab.active {
    background: var(--theme-codex-active-tab);
    color: #fff;
    opacity: 1;
}

body.light-mode .codex-tab.active {
    background: var(--theme-codex-active-tab);
    color: #fff;
}

/* Sub-tabs for plant categories */
.codex-subtabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.codex-subtab {
    padding: 6px 12px;
    border: none;
    border-radius: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.5;
    white-space: nowrap;
    flex-shrink: 0;
}

.codex-subtab.active {
    background: var(--theme-accent-line);
    color: #fff;
    opacity: 1;
}

body.light-mode .codex-subtab.active {
    background: var(--theme-codex-active-tab);
    color: #fff;
}

/* Codex Count */
.codex-count {
    font-size: 12px;
    opacity: 0.5;
    margin-bottom: 8px;
    padding-left: 4px;
}

/* Codex Card Grid */
.codex-grid {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.codex-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.codex-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--theme-accent-line);
}

.codex-card-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.codex-card-body {
    flex: 1;
    min-width: 0;
}

.codex-card-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.codex-card-cat {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--theme-codex-active-tab) 24%, transparent);
    color: var(--theme-accent-line);
    display: inline-block;
    margin-bottom: 6px;
}

body.light-mode .codex-card-cat {
    background: color-mix(in srgb, var(--theme-codex-active-tab) 12%, transparent);
    color: var(--text-primary);
}

.codex-card-danger {
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 6px;
}

.codex-card-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(76, 175, 80, 0.2);
    color: var(--theme-beneficial-text);
    display: inline-block;
    margin-bottom: 6px;
}

body.light-mode .codex-card-role {
    background: rgba(46, 125, 50, 0.1);
    color: var(--theme-beneficial-text);
}

.codex-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.codex-card-tag {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    opacity: 0.7;
}

.codex-tag-pest {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.codex-tag-beneficial {
    background: var(--theme-beneficial-bg);
    color: var(--theme-beneficial-text);
}

body.light-mode .codex-tag-pest {
    background: rgba(211, 47, 47, 0.08);
    color: #c62828;
}

body.light-mode .codex-tag-beneficial {
    background: var(--theme-beneficial-bg);
    color: var(--theme-beneficial-text);
}

/* Codex Detail View */
.codex-detail {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.codex-back-btn {
    background: none;
    border: none;
    color: var(--theme-accent-line);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 8px;
    display: inline-block;
}

body.light-mode .codex-back-btn {
    color: var(--text-primary);
}

.codex-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.codex-detail-name {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.codex-detail-badge {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 10px;
    background: var(--theme-codex-active-tab);
    color: #fff;
    font-weight: 500;
}

body.light-mode .codex-detail-badge {
    background: var(--theme-codex-active-tab);
}

.codex-add-garden-btn {
    margin-top: 20px;
    width: 100%;
    background: #2d5a3f !important;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
}

.codex-add-garden-btn:hover {
    background: var(--accent-hover) !important;
}

body.light-mode .codex-add-garden-btn {
    background: var(--btn-primary-bg) !important;
}

body.light-mode .codex-add-garden-btn:hover {
    background: var(--btn-primary-hover) !important;
}

/* Mobile adjustments for Codex */
@media (max-width: 600px) {
    .codex-container {
        padding: 0 10px 10px;
    }
    .codex-card {
        padding: 12px;
    }
    .codex-detail-name {
        font-size: 19px;
    }
}

/* Codex light mode: card outlines */
body.light-mode .codex-card {
    border: 1px solid var(--border-color);
}
body.light-mode .codex-card:hover {
    border-color: #2d7a6e;
}

/* Garden planner: white text in cells for light mode */
body.light-mode .garden-cell {
    color: #ffffff;
}

/* Light mode highlight panel / tooltip fixes */
body.light-mode .highlight-panel {
    background: var(--theme-codex-active-tab);
    color: #ffffff;
    z-index: 1050;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
body.light-mode .highlight-arrow {
    border-top-color: var(--text-primary);
}
.highlight-panel {
    z-index: 1050;
}

/* SortableJS drag-and-drop reordering */
.sortable-ghost {
    opacity: 0.3;
    border: 2px dashed var(--theme-accent-line) !important;
    background: var(--bg-tertiary) !important;
}
.sortable-chosen {
    cursor: grabbing;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transform: scale(1.02);
    z-index: 10;
}
.sortable-drag {
    opacity: 0.9;
}
body.light-mode .sortable-ghost {
    border-color: #2d7a6e !important;
    background: var(--bg-tertiary) !important;
}
body.light-mode .sortable-chosen {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}


/* Shared garden view-only mode */
body.shared-view-only .bottom-nav-btn,
body.shared-view-only .card-settings-btn,
body.shared-view-only #editInfoBtn,
body.shared-view-only #editEventBtn,
body.shared-view-only #eventEditButtons .btn,
body.shared-view-only #typeInfoScreen .btn-primary,
body.shared-view-only #varietalInfoScreen .btn-primary,
body.shared-view-only #addTypeScreen .btn-primary,
body.shared-view-only #addVarietalScreen .btn-primary,
body.shared-view-only #addEventScreen .btn-primary {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.25);
}


/* Coastal theme foundation (sampled from provided tile photo; blue base + pink accent) */
body.coastal-theme {
    --bg-primary: #cfe9f6;
    --bg-secondary: #b8ddee;
    --bg-tertiary: #d7ecf8;
    --bg-card: #e2f3fb;
    --bg-card-hover: #d3e9f7;
    --text-primary: #17355b;
    --text-secondary: #3c5f86;
    --text-tertiary: #587aa0;
    --accent-color: #c9879f;
    --accent-hover: #d89eb3;
    --border-color: #355f91;
    --success-color: #7fb7d4;
    --btn-primary-bg: #c9879f;
    --btn-primary-hover: #d89eb3;
    --btn-primary-text: #102e54;
    --btn-secondary-bg: #d7ecf8;
    --btn-secondary-hover: #c5e3f4;
    --btn-secondary-text: #17355b;
    --btn-secondary-border: #355f91;
    --theme-highlight-bg: #c9879f;
    --theme-highlight-text: #102e54;
    --theme-accent-line: #355f91;
    --theme-bloom-start: #5f98c2;
    --theme-bloom-end: #355f91;
    --theme-beneficial-bg: #d7ecf8;
    --theme-beneficial-text: #17355b;
    --theme-codex-active-tab: #5f98c2;
    --theme-codex-active-subtab: #355f91;
    --theme-codex-badge: #355f91;
}

body.shared-view-only .highlight-panel { display: none !important; }


/* Coastal theme detailed component coverage */
body.coastal-theme .header,
body.coastal-theme .bottom-nav-content,
body.coastal-theme .filter-buttons {
    background: #b8ddee;
    border-color: #355f91;
}

body.coastal-theme .type-card,
body.coastal-theme .varietal-card,
body.coastal-theme .event-card,
body.coastal-theme .modal-content,
body.coastal-theme .form-container,
body.coastal-theme .stats-section,
body.coastal-theme .profile-view {
    background: #e2f3fb;
    color: #17355b;
    border-color: #355f91;
}

body.coastal-theme .card-menu,
body.coastal-theme .card-menu-item,
body.coastal-theme .season-tab,
body.coastal-theme .profile-view-tab,
body.coastal-theme .btn-secondary,
body.coastal-theme .btn-primary,
body.coastal-theme .bottom-nav-btn,
body.coastal-theme .form-input,
body.coastal-theme .form-select,
body.coastal-theme .form-textarea {
    border-color: #355f91;
}

body.coastal-theme .card-menu,
body.coastal-theme .season-tab,
body.coastal-theme .profile-view-tab,
body.coastal-theme .btn-secondary,
body.coastal-theme .bottom-nav-btn,
body.coastal-theme .form-input,
body.coastal-theme .form-select,
body.coastal-theme .form-textarea {
    background: #d7ecf8;
    color: #17355b;
}

body.coastal-theme .btn-primary,
body.coastal-theme .profile-view-tab.active,
body.coastal-theme .season-tab.active,
body.coastal-theme .filter-btn.active {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}

body.coastal-theme .card-menu-item:hover,
body.coastal-theme .btn-secondary:hover,
body.coastal-theme .season-tab:hover,
body.coastal-theme .profile-view-tab:hover,
body.coastal-theme .filter-btn:hover {
    background: #c5e3f4;
}

body.coastal-theme ::-webkit-scrollbar-thumb {
    background: #355f91;
}
body.coastal-theme ::-webkit-scrollbar-track {
    background: #b8ddee;
}

body.coastal-theme .faq-answer,
body.coastal-theme .faq-question,
body.coastal-theme .season-manager-row,
body.coastal-theme .season-manager-list,
body.coastal-theme .account-item,
body.coastal-theme .highlight-panel,
body.coastal-theme .highlight-arrow,
body.coastal-theme #infoContainer,
body.coastal-theme #statsContainer,
body.coastal-theme #varietalStatsContainer,
body.coastal-theme #gardenPlannerScreen .form-container {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}
body.coastal-theme .highlight-panel { background: var(--theme-highlight-bg); color: var(--theme-highlight-text); }
body.coastal-theme .highlight-arrow { border-top-color: var(--theme-highlight-bg); }
body.coastal-theme .garden-cell { color: #ffffff; background: #355f91; }
body.coastal-theme .garden-cell:hover { background: #5f98c2; }
body.coastal-theme .stepper-btn { background: var(--btn-secondary-bg); color: var(--text-primary); }
body.coastal-theme .stepper-btn:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
body.coastal-theme .filter-option:hover,
body.coastal-theme .filter-option label:hover { background: var(--btn-secondary-hover); color: var(--text-primary); }
body.coastal-theme .bloom-tooltip { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-color); }
body.coastal-theme .codex-tag-beneficial,
body.coastal-theme .codex-card-role { background: #d7ecf8; color: #17355b; }

/* Coastal theme additional component coverage */
body.coastal-theme .app-container,
body.coastal-theme .screen,
body.coastal-theme .modal {
    background: var(--bg-secondary);
}

body.coastal-theme .empty-state,
body.coastal-theme .empty-state-icon,
body.coastal-theme .subtitle,
body.coastal-theme .card-subtitle,
body.coastal-theme .meta-row,
body.coastal-theme .type-description,
body.coastal-theme .event-date,
body.coastal-theme .stat-label {
    color: var(--text-secondary);
}

body.coastal-theme .toggle-slider {
    background: #9ebbd8;
}

body.coastal-theme input:checked + .toggle-slider {
    background: #5f98c2;
}

/* Forage theme foundation (earthy greens + bark accents) */
body.forage-theme {
    --bg-primary: #162217;
    --bg-secondary: #1f2f20;
    --bg-tertiary: #2d422c;
    --bg-card: #354f34;
    --bg-card-hover: #426342;
    --text-primary: #f2f7ec;
    --text-secondary: #ccdbc2;
    --text-tertiary: #a8b8a0;
    --accent-color: #c2a76d;
    --accent-hover: #d5bc85;
    --border-color: #6d875d;
    --btn-primary-bg: #c2a76d;
    --btn-primary-hover: #d5bc85;
    --btn-primary-text: #243120;
    --btn-secondary-bg: #2d422c;
    --btn-secondary-hover: #426342;
    --btn-secondary-text: #f2f7ec;
    --btn-secondary-border: #6d875d;
    --theme-highlight-bg: #6d875d;
    --theme-highlight-text: #f2f7ec;
    --theme-accent-line: #c2a76d;
    --theme-bloom-start: #93b07b;
    --theme-bloom-end: #6d875d;
    --theme-beneficial-bg: rgba(147, 176, 123, 0.18);
    --theme-beneficial-text: #d6e6c7;
    --theme-codex-active-tab: #6d875d;
    --theme-codex-active-subtab: #c2a76d;
    --theme-codex-badge: #6d875d;
}

body.forage-theme .header,
body.forage-theme .bottom-nav-content,
body.forage-theme .filter-buttons,
body.forage-theme .type-card,
body.forage-theme .varietal-card,
body.forage-theme .event-card,
body.forage-theme .modal-content,
body.forage-theme .form-container,
body.forage-theme .stats-section,
body.forage-theme .profile-view,
body.forage-theme .faq-question,
body.forage-theme .faq-answer,
body.forage-theme .account-item,
body.forage-theme #infoContainer,
body.forage-theme #statsContainer,
body.forage-theme #varietalStatsContainer {
    border-color: var(--border-color);
}

body.forage-theme .garden-cell { background: #6d875d; color: #f2f7ec; }
body.forage-theme .garden-cell:hover { background: #93b07b; }
body.forage-theme .codex-tag-beneficial,
body.forage-theme .codex-card-role { background: rgba(147, 176, 123, 0.22); color: #f2f7ec; }
body.forage-theme ::-webkit-scrollbar-thumb { background: #6d875d; }
body.forage-theme ::-webkit-scrollbar-track { background: #1f2f20; }

/* Coastal Dark variant */
body.coastal-theme.coastal-dark {
    --bg-primary: #101d2d;
    --bg-secondary: #17283c;
    --bg-tertiary: #213754;
    --bg-card: #274465;
    --bg-card-hover: #31547d;
    --text-primary: #eaf3ff;
    --text-secondary: #b8cee6;
    --text-tertiary: #90aeca;
    --accent-color: #efb2c8;
    --accent-hover: #f6c4d7;
    --border-color: #6f92bd;
    --btn-primary-bg: #efb2c8;
    --btn-primary-hover: #f6c4d7;
    --btn-primary-text: #1d3450;
    --btn-secondary-bg: #274465;
    --btn-secondary-hover: #31547d;
    --btn-secondary-text: #eaf3ff;
    --btn-secondary-border: #6f92bd;
    --theme-highlight-bg: #efb2c8;
    --theme-highlight-text: #1d3450;
    --theme-accent-line: #9cc2ea;
    --theme-bloom-start: #8fb8df;
    --theme-bloom-end: #5f86b3;
    --theme-beneficial-bg: rgba(159, 203, 241, 0.18);
    --theme-beneficial-text: #d8ecff;
    --theme-codex-active-tab: #5f86b3;
    --theme-codex-active-subtab: #9cc2ea;
    --theme-codex-badge: #5f86b3;
}

body.coastal-theme.coastal-dark .header,
body.coastal-theme.coastal-dark .bottom-nav-content,
body.coastal-theme.coastal-dark .filter-buttons {
    background: var(--bg-secondary);
}

body.coastal-theme.coastal-dark .card-menu,
body.coastal-theme.coastal-dark .season-tab,
body.coastal-theme.coastal-dark .profile-view-tab,
body.coastal-theme.coastal-dark .btn-secondary,
body.coastal-theme.coastal-dark .bottom-nav-btn,
body.coastal-theme.coastal-dark .form-input,
body.coastal-theme.coastal-dark .form-select,
body.coastal-theme.coastal-dark .form-textarea {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Forage Light variant */
body.forage-theme.forage-light {
    --bg-primary: #eef3e8;
    --bg-secondary: #f7faf3;
    --bg-tertiary: #e3ebdb;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f6eb;
    --text-primary: #263225;
    --text-secondary: #4f5f4d;
    --text-tertiary: #6e7d6b;
    --accent-color: #8b7345;
    --accent-hover: #a28654;
    --border-color: #9aad90;
    --btn-primary-bg: #8b7345;
    --btn-primary-hover: #a28654;
    --btn-primary-text: #ffffff;
    --btn-secondary-bg: #e3ebdb;
    --btn-secondary-hover: #d3dfc8;
    --btn-secondary-text: #263225;
    --btn-secondary-border: #9aad90;
    --theme-highlight-bg: #8b7345;
    --theme-highlight-text: #ffffff;
    --theme-accent-line: #6d875d;
    --theme-bloom-start: #8fa879;
    --theme-bloom-end: #6d875d;
    --theme-beneficial-bg: rgba(109, 135, 93, 0.12);
    --theme-beneficial-text: #2f4a29;
    --theme-codex-active-tab: #8fa879;
    --theme-codex-active-subtab: #6d875d;
    --theme-codex-badge: #6d875d;
}

body.forage-theme.forage-light .header,
body.forage-theme.forage-light .bottom-nav-content,
body.forage-theme.forage-light .filter-buttons {
    background: var(--bg-tertiary);
}

body.forage-theme.forage-light .codex-tag-beneficial,
body.forage-theme.forage-light .codex-card-role {
    background: rgba(109, 135, 93, 0.16);
    color: #2f4a29;
}

/* Theme picker modal */
.theme-modal-content {
    max-width: 460px;
}

.theme-modal-subtitle {
    color: var(--text-secondary);
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.4;
}

.theme-family-grid {
    display: grid;
    gap: 12px;
}

.theme-family-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
}

.theme-family-title {
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.theme-mode-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.theme-choice-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.theme-choice-btn:hover {
    transform: translateY(-1px);
    background: var(--bg-card-hover);
}

.theme-choice-btn.active {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 26%, transparent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 28%, transparent);
}

/* Batch event varietal picker */
.batch-varietal-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    margin-bottom: 8px;
    cursor: pointer;
}

.batch-varietal-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Coastal dark: emphasize light accents against dark base */
body.coastal-theme.coastal-dark {
    --accent-color: #c7e6ff;
    --accent-hover: #e2f2ff;
    --border-color: #9fc6ec;
    --theme-accent-line: #c7e6ff;
    --theme-codex-active-subtab: #c7e6ff;
}

body.coastal-theme.coastal-dark .btn-primary,
body.coastal-theme.coastal-dark .filter-btn.active,
body.coastal-theme.coastal-dark .season-tab.active,
body.coastal-theme.coastal-dark .profile-view-tab.active {
    background: #c7e6ff;
    color: #1d3450;
}

.batch-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.batch-selected-chip {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.batch-selected-chip.is-primary {
    background: color-mix(in srgb, var(--accent-color) 24%, transparent);
    border-color: var(--accent-color);
    font-weight: 600;
}

/* Coastal dark final polish: dark surfaces, light primary accent, pink secondary accent */
body.coastal-theme.coastal-dark {
    --accent-color: #b8daf7;
    --accent-hover: #d5ebff;
    --border-color: #9fc6ec;
    --btn-primary-bg: #efb2c8;
    --btn-primary-hover: #f6c4d7;
    --btn-primary-text: #1d3450;
    --btn-secondary-bg: #223b58;
    --btn-secondary-hover: #2e4d72;
    --btn-secondary-border: #9fc6ec;
    --theme-highlight-bg: #efb2c8;
    --theme-highlight-text: #1d3450;
    --theme-codex-active-subtab: #efb2c8;
}

body.coastal-theme.coastal-dark .menu-btn,
body.coastal-theme.coastal-dark .card-settings-btn,
body.coastal-theme.coastal-dark .account-item,
body.coastal-theme.coastal-dark .btn-secondary,
body.coastal-theme.coastal-dark .bottom-nav-btn,
body.coastal-theme.coastal-dark .card-menu,
body.coastal-theme.coastal-dark .card-menu-item,
body.coastal-theme.coastal-dark .season-tab,
body.coastal-theme.coastal-dark .profile-view-tab,
body.coastal-theme.coastal-dark .form-input,
body.coastal-theme.coastal-dark .form-select,
body.coastal-theme.coastal-dark .form-textarea {
    background: var(--btn-secondary-bg);
    color: var(--text-primary);
    border-color: var(--btn-secondary-border);
}

body.coastal-theme.coastal-dark .season-tab {
    border: 1px solid var(--btn-secondary-border);
    box-shadow: inset 0 0 0 1px rgba(239, 178, 200, 0.25);
}

body.coastal-theme.coastal-dark .stats-season-selector,
body.coastal-theme.coastal-dark #statsContainer,
body.coastal-theme.coastal-dark #varietalStatsContainer,
body.coastal-theme.coastal-dark .stats-section,
body.coastal-theme.coastal-dark .stats-row,
body.coastal-theme.coastal-dark .info-row {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

body.coastal-theme.coastal-dark .stats-label,
body.coastal-theme.coastal-dark .info-label {
    color: var(--text-secondary);
}

/* Coastal dark contrast and accent corrections */
body.coastal-theme.coastal-dark {
    --bg-primary: #0f1f31;
    --bg-secondary: #14263a;
    --bg-tertiary: #1a2f47;
    --bg-card: #203955;
    --bg-card-hover: #284766;
    --text-primary: #eef6ff;
    --text-secondary: #c7d9ec;
    --text-tertiary: #9eb8d3;
    --accent-color: #bcdfff;      /* light blue primary accent */
    --accent-hover: #d7ecff;
    --btn-primary-bg: #e8a6bf;    /* pink secondary accent */
    --btn-primary-hover: #f2bdd0;
    --btn-primary-text: #1f3752;
    --btn-secondary-bg: #223b58;
    --btn-secondary-hover: #2b4a6d;
    --btn-secondary-text: #eef6ff;
    --btn-secondary-border: #95bce3;
    --theme-highlight-bg: #e8a6bf;
    --theme-highlight-text: #1f3752;
    --theme-codex-active-subtab: #e8a6bf;
}

/* Force dark surfaces where light coastal defaults were still bleeding through */
body.coastal-theme.coastal-dark .screen,
body.coastal-theme.coastal-dark .form-container,
body.coastal-theme.coastal-dark .profile-view,
body.coastal-theme.coastal-dark .stats-container,
body.coastal-theme.coastal-dark .stats-section,
body.coastal-theme.coastal-dark .stats-season-selector,
body.coastal-theme.coastal-dark #statsContainer,
body.coastal-theme.coastal-dark #varietalStatsContainer,
body.coastal-theme.coastal-dark .account-item,
body.coastal-theme.coastal-dark .modal-content,
body.coastal-theme.coastal-dark .type-card,
body.coastal-theme.coastal-dark .varietal-card,
body.coastal-theme.coastal-dark .event-card {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

body.coastal-theme.coastal-dark .header,
body.coastal-theme.coastal-dark .filter-buttons,
body.coastal-theme.coastal-dark .bottom-nav-content,
body.coastal-theme.coastal-dark .breadcrumb {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Event card typography contrast */
body.coastal-theme.coastal-dark .event-type,
body.coastal-theme.coastal-dark .event-date-day,
body.coastal-theme.coastal-dark .event-quantity,
body.coastal-theme.coastal-dark .info-value,
body.coastal-theme.coastal-dark .stats-value {
    color: var(--text-primary);
}

body.coastal-theme.coastal-dark .event-date-month,
body.coastal-theme.coastal-dark .event-details,
body.coastal-theme.coastal-dark .info-label,
body.coastal-theme.coastal-dark .stats-label,
body.coastal-theme.coastal-dark .form-label {
    color: var(--text-secondary);
}

/* Remove dark blue circle around card settings icons */
body.coastal-theme.coastal-dark .card-settings-btn {
    background: transparent;
    box-shadow: none;
    border: none;
    color: #f6c4d7;
}

body.coastal-theme.coastal-dark .card-settings-btn:hover {
    background: rgba(232, 166, 191, 0.18);
}

/* Ensure season tab outlines are visible on varietal page */
body.coastal-theme.coastal-dark .season-tab {
    border: 1px solid #95bce3;
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(232, 166, 191, 0.35);
}

body.coastal-theme.coastal-dark .season-tab.active {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: #f2bdd0;
}

/* Add pink accent touches to major CTA surfaces */
body.coastal-theme.coastal-dark .btn-primary,
body.coastal-theme.coastal-dark .bottom-nav-btn,
body.coastal-theme.coastal-dark .profile-view-tab.active,
body.coastal-theme.coastal-dark .filter-btn.active {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}

/* Coastal Dark final pass: stronger outlines + distinct action colors */
body.coastal-theme.coastal-dark .type-card,
body.coastal-theme.coastal-dark .varietal-card,
body.coastal-theme.coastal-dark .event-card,
body.coastal-theme.coastal-dark .form-container,
body.coastal-theme.coastal-dark .stats-container,
body.coastal-theme.coastal-dark .stats-section,
body.coastal-theme.coastal-dark .info-section,
body.coastal-theme.coastal-dark .account-item,
body.coastal-theme.coastal-dark .settings-toggle,
body.coastal-theme.coastal-dark .card-menu,
body.coastal-theme.coastal-dark .modal-content {
    border: 1px solid #95bce3 !important;
    box-shadow: 0 0 0 1px rgba(188, 223, 255, 0.15) inset;
}

body.coastal-theme.coastal-dark .form-input,
body.coastal-theme.coastal-dark .form-select,
body.coastal-theme.coastal-dark .form-textarea,
body.coastal-theme.coastal-dark .season-tab,
body.coastal-theme.coastal-dark .profile-view-tab,
body.coastal-theme.coastal-dark .event-type-tab,
body.coastal-theme.coastal-dark .filter-btn,
body.coastal-theme.coastal-dark .menu-btn,
body.coastal-theme.coastal-dark .btn-secondary {
    background: #2f5f91 !important;   /* light blue button surface */
    color: #eef6ff !important;
    border: 1px solid #95bce3 !important;
}

body.coastal-theme.coastal-dark .btn-secondary:hover,
body.coastal-theme.coastal-dark .menu-btn:hover,
body.coastal-theme.coastal-dark .filter-btn:hover,
body.coastal-theme.coastal-dark .event-type-tab:hover,
body.coastal-theme.coastal-dark .profile-view-tab:hover,
body.coastal-theme.coastal-dark .season-tab:hover {
    background: #3d73a9 !important;
}

body.coastal-theme.coastal-dark .btn-primary,
body.coastal-theme.coastal-dark .bottom-nav-btn,
body.coastal-theme.coastal-dark .event-type-tab.active,
body.coastal-theme.coastal-dark .profile-view-tab.active,
body.coastal-theme.coastal-dark .season-tab.active,
body.coastal-theme.coastal-dark .filter-btn.active {
    background: #e8a6bf !important;   /* pink accent */
    color: #1f3752 !important;
    border: 1px solid #f2bdd0 !important;
}

/* Ensure event cards always have readable text */
body.coastal-theme.coastal-dark .event-card * {
    color: inherit;
}
body.coastal-theme.coastal-dark .event-card .event-type,
body.coastal-theme.coastal-dark .event-card .event-date-day,
body.coastal-theme.coastal-dark .event-card .event-quantity {
    color: #eef6ff !important;
}
body.coastal-theme.coastal-dark .event-card .event-date-month,
body.coastal-theme.coastal-dark .event-card .event-details {
    color: #c7d9ec !important;
}

/* Menu sync status indicator */
.menu-sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 5px 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}
.menu-sync-indicator.is-cloud { border-color: #7fd1be; color: #7fd1be; }
.menu-sync-indicator.is-local { border-color: #95bce3; color: #c7d9ec; }
.menu-sync-indicator.is-offline { border-color: #f2bdd0; color: #f2bdd0; }
.menu-sync-indicator.is-error { border-color: #ff8a8a; color: #ff8a8a; }
.menu-sync-indicator.is-pending { border-color: var(--accent-color); color: var(--accent-color); }

/* Coastal Dark bugfixes */
body.coastal-theme.coastal-dark #menuScreen .form-container {
    border: none !important; /* remove full-page border effect */
    box-shadow: none !important;
}

/* Preserve varietal/type/event left-edge card colours while keeping clear outlines */
body.coastal-theme.coastal-dark .type-card,
body.coastal-theme.coastal-dark .varietal-card,
body.coastal-theme.coastal-dark .event-card {
    border-top: 1px solid #95bce3 !important;
    border-right: 1px solid #95bce3 !important;
    border-bottom: 1px solid #95bce3 !important;
    border-left-width: 6px !important;
    border-left-style: solid !important;
    box-shadow: 0 0 0 1px rgba(188, 223, 255, 0.12) inset;
}

/* Theme-aware notification surfaces */
.notification {
    background: color-mix(in srgb, var(--bg-card) 86%, transparent);
    color: var(--text-primary);
    border: 1px solid color-mix(in srgb, var(--accent-color) 40%, var(--border-color));
}
.notification.error {
    background: color-mix(in srgb, #b42424 28%, var(--bg-card));
    color: var(--text-primary);
    border: 1px solid color-mix(in srgb, #ff8a8a 55%, var(--border-color));
}

/* FAQ readability across themes */
.faq-category-header {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.faq-question {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.faq-question:hover {
    background: var(--bg-card-hover);
}
.faq-answer {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* Codex cards: always outlined */
.codex-card {
    border-color: var(--border-color);
}

/* Remove odd full-page border artifacts on these screens in Coastal Dark */
body.coastal-theme.coastal-dark #gardenPlannerScreen .form-container,
body.coastal-theme.coastal-dark #settingsScreen .form-container,
body.coastal-theme.coastal-dark #faqScreen .form-container,
body.coastal-theme.coastal-dark #perennialScreen .form-container {
    border: none !important;
    box-shadow: none !important;
}

/* Keep card left-edge user colors visible while still showing outlines */
body.coastal-theme.coastal-dark .type-card,
body.coastal-theme.coastal-dark .varietal-card,
body.coastal-theme.coastal-dark .event-card {
    border-left-width: 6px !important;
    border-left-style: solid !important;
    border-top: 1px solid #95bce3 !important;
    border-right: 1px solid #95bce3 !important;
    border-bottom: 1px solid #95bce3 !important;
}

/* Varietal profile tabs should look like tabs (not buttons) in all themes */
#varProfileScreen .profile-view-tabs {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

#varProfileScreen .profile-view-tab {
    background: transparent !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0 !important;
    color: var(--text-secondary) !important;
    box-shadow: none !important;
}

#varProfileScreen .profile-view-tab:hover {
    background: color-mix(in srgb, var(--bg-card) 30%, transparent) !important;
    color: var(--text-primary) !important;
}

#varProfileScreen .profile-view-tab.active {
    background: transparent !important;
    color: var(--accent-color) !important;
    border-bottom-color: var(--accent-color) !important;
}

/* FAQ tier differentiation */
.faq-category-header {
    border-left: 4px solid var(--accent-color);
    font-size: 18px;
    letter-spacing: 0.2px;
}

.faq-question {
    border-left: 3px solid color-mix(in srgb, var(--accent-color) 75%, var(--border-color));
    font-size: 15px;
}

/* Coastal dark FAQ polish */
body.coastal-theme.coastal-dark .faq-category-header {
    background: #1f3752;
    color: #eef6ff;
    border-color: #95bce3;
    border-left-color: #e8a6bf;
}

body.coastal-theme.coastal-dark .faq-question {
    background: #223b58;
    color: #eef6ff;
    border-color: #95bce3;
    border-left-color: #bcdfff;
}

body.coastal-theme.coastal-dark .faq-answer {
    background: #1c334c;
    color: #cfe2f5;
    border-color: #95bce3;
}


/* Prevent flash: app hidden until initialization completes */
.app-loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    transition: opacity 220ms ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 1000;
}
.app-loading-screen.hidden { opacity: 0; pointer-events: none; }

body.app-booting #appContainer { visibility: hidden; }
body:not(.app-booting) #appContainer.ready { visibility: visible; }


.app-icon-spinner {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--accent-color) 20%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-color) 60%, transparent);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-color) 14%, transparent);
    animation: iconBloomPulse 1.4s ease-in-out infinite;
}

.app-icon-spinner-img {
    width: 34px;
    height: 34px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.28));
    animation: iconRotateWiggle 2.2s ease-in-out infinite;
}

@keyframes iconBloomPulse {
    0%, 100% { transform: scale(0.94); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-color) 20%, transparent); }
    50% { transform: scale(1.07); box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent-color) 10%, transparent); }
}

@keyframes iconRotateWiggle {
    0%, 100% { transform: rotate(-7deg) translateY(0); }
    50% { transform: rotate(7deg) translateY(-2px); }
}

.app-loading-label { color: var(--text-secondary); font-size: 14px; letter-spacing: 0.2px; }
/* Filter modal text contrast on light backgrounds */
body.light-mode .filter-option-label,
body.coastal-theme .filter-option-label,
body.forage-theme.forage-light .filter-option-label {
    color: var(--text-primary);
}

/* Invite Inbox */
.invite-inbox-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.invite-filter-chip {
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
}

.invite-filter-chip.active {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(34,197,94,0.08);
}

.invite-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--card-bg);
}

.invite-card-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.invite-card-meta {
    font-size: 12px;
    opacity: 0.75;
    margin-bottom: 8px;
}

.invite-card-status {
    display: inline-block;
    font-size: 11px;
    border-radius: 999px;
    padding: 4px 8px;
    margin-bottom: 8px;
    text-transform: capitalize;
    background: rgba(148,163,184,0.18);
}

.invite-card-status.pending {
    background: rgba(245, 158, 11, 0.2);
}

.invite-card-status.accepted {
    background: rgba(34,197,94,0.22);
}

.invite-card-status.declined {
    background: rgba(239,68,68,0.2);
}

.theme-launch-btn {
    justify-content: flex-start;
    text-align: left;
}

.shared-garden-hub {
    display: grid;
    gap: 12px;
}

.shared-hub-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    background: var(--bg-card);
}

.shared-hub-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.shared-hub-sub {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 10px;
}

.shared-hub-list {
    display: grid;
    gap: 8px;
}

.shared-hub-row {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: color-mix(in srgb, var(--bg-card) 90%, var(--bg-primary));
}

.shared-hub-row.pending {
    opacity: 0.85;
}

.shared-hub-row.active-view {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--accent-color) 12%, var(--bg-card));
}

.shared-hub-row-meta {
    font-size: 11px;
    opacity: 0.7;
}

.shared-hub-link-btn {
    border: none;
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 12px;
}

.shared-hub-actions {
    display: flex;
    gap: 8px;
}

.shared-hub-actions .btn {
    flex: 1;
}


body.light-mode .info-tooltip-text,
body.coastal-theme .info-tooltip-text,
body.forage-theme.forage-light .info-tooltip-text {
    background: #0f172a;
    color: #f8fafc;
    border-color: rgba(148,163,184,0.45);
}

body.coastal-theme.coastal-dark .info-tooltip-text,
body.forage-theme:not(.forage-light) .info-tooltip-text {
    background: #dbe7f5;
    color: #0f2744;
    border-color: #8fb3d8;
}


.shared-hub-list-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.68;
    margin: 2px 0 6px;
}

.selected-garden-row {
    margin-bottom: 10px;
}

.shared-hub-selected-pill {
    font-size: 11px;
    border-radius: 999px;
    padding: 3px 8px;
    color: #fff;
    background: var(--accent-color);
}

.shared-hub-row.selectable {
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.shared-hub-row.selectable:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--accent-color) 65%, var(--border-color));
}

.shared-hub-actions.owner-actions {
    margin-top: 12px;
}

.shared-hub-refresh-btn {
    transition: transform 0.2s ease, color 0.2s ease;
}

.shared-hub-refresh-btn.spinning {
    animation: hubSpin 0.7s linear infinite;
}

.shared-hub-refresh-btn.pulse {
    animation: hubPulse 0.8s ease;
}

@keyframes hubSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes hubPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); color: var(--accent-color); }
}

/* Onboarding Tutorial */
body.onboarding-open {
    overflow: hidden;
}

.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--bg-primary) 84%, #000 16%);
    backdrop-filter: blur(6px);
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.onboarding-overlay.active {
    display: flex;
}

.onboarding-shell {
    width: min(560px, 100%);
    min-height: min(86vh, 720px);
    background: linear-gradient(160deg, var(--bg-secondary), var(--bg-card));
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 25px 60px var(--shadow-color);
    position: relative;
    overflow: hidden;
}

.onboarding-skip {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    background: var(--btn-secondary-bg);
    border: 1px solid var(--btn-secondary-border);
    color: var(--btn-secondary-text);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
}

.onboarding-swiper,
.onboarding-slide {
    height: 100%;
}

.onboarding-slide {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    padding: 52px 24px 24px;
}

.onboarding-illustration {
    width: 92px;
    height: 92px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    font-size: 48px;
    background: linear-gradient(135deg, #2d5a3f, #75b3ac);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}

.onboarding-title {
    font-size: 30px;
    line-height: 1.1;
    color: var(--text-primary);
}

.onboarding-subtitle {
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-color);
}

.onboarding-description {
    color: var(--text-secondary);
    max-width: 420px;
    font-size: 16px;
    line-height: 1.5;
}

.onboarding-footer {
    margin-top: 16px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.onboarding-next-btn {
    min-width: 150px;
}


.onboarding-pagination-global {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    text-align: center;
}

.onboarding-pagination-global .swiper-pagination-bullet {
    width: 9px;
    height: 9px;
    background: var(--text-tertiary);
    opacity: 1;
}

.onboarding-pagination-global .swiper-pagination-bullet-active {
    background: var(--accent-color);
}

/* Page-level secondary titles under consistent BloomLab header */
.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Tooltip consistency + viewport-safe appearance */
.info-tooltip-text {
    opacity: 1 !important;
    max-width: min(270px, calc(100vw - 16px));
}

body.light-mode .info-tooltip-text,
body.coastal-theme .info-tooltip-text,
body.forage-theme .info-tooltip-text {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    opacity: 1 !important;
}

/* Theme-specific scrollbar tuning */
body.coastal-theme.coastal-light ::-webkit-scrollbar-thumb { background: #5f86b3; }
body.coastal-theme.coastal-light ::-webkit-scrollbar-track { background: #d7ecf8; }
body.forage-theme.forage-light ::-webkit-scrollbar-thumb { background: #8b7345; }
body.forage-theme.forage-light ::-webkit-scrollbar-track { background: #dce6d3; }

/* Forage light: ensure dark-brown primary action surfaces use white text */
body.forage-theme.forage-light .btn-primary,
body.forage-theme.forage-light .bottom-nav-btn,
body.forage-theme.forage-light .event-type-tab.active,
body.forage-theme.forage-light .profile-view-tab.active,
body.forage-theme.forage-light .season-tab.active,
body.forage-theme.forage-light .filter-btn.active,
body.forage-theme.forage-light #addTypeScreen .btn,
body.forage-theme.forage-light #addVarietalScreen .btn,
body.forage-theme.forage-light #addEventScreen .btn {
    color: #ffffff !important;
}

/* Garden planner stepper input should follow theme colors */
.stepper-input {
    background: var(--bg-card);
    color: var(--text-primary);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

/* Tutorial layout updates: top icon + bottom controls */
.onboarding-slide {
    justify-content: flex-start;
    padding-top: 34px;
    padding-bottom: 64px;
}

.onboarding-illustration {
    margin-top: 4px;
}

.onboarding-footer {
    margin-top: auto;
    padding-bottom: 8px;
}

.onboarding-pagination-global {
    bottom: 12px;
}

/* Tutorial: lock controls to very bottom */
.onboarding-shell {
    min-height: 100svh;
    border-radius: 0;
}

.onboarding-swiper {
    height: 100%;
}

.onboarding-slide {
    position: relative;
    min-height: 100%;
    padding-bottom: 120px;
}

.onboarding-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 42px;
    margin-top: 0;
    padding-bottom: 0;
}

.onboarding-pagination-global {
    bottom: 8px;
}


/* Onboarding final alignment fix (mobile safe-area aware) */
.onboarding-overlay {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
}

.onboarding-shell {
    width: min(560px, 100vw) !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 auto;
    border-radius: 0 !important;
}

.onboarding-swiper {
    height: 100% !important;
}

.onboarding-slide {
    height: 100% !important;
    min-height: 100% !important;
    padding-bottom: calc(env(safe-area-inset-bottom) + 116px) !important;
}

.onboarding-footer {
    position: absolute !important;
    left: 0;
    right: 0;
    bottom: calc(env(safe-area-inset-bottom) + 44px) !important;
    margin-top: 0 !important;
}

.onboarding-pagination-global {
    position: absolute !important;
    left: 0;
    right: 0;
    bottom: calc(env(safe-area-inset-bottom) + 12px) !important;
}

/* Header layout helpers */
.header-btn-spacer {
    visibility: hidden;
    pointer-events: none;
}

.garden-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.garden-name-row .form-input {
    flex: 1;
}

.garden-name-save-btn {
    width: auto;
    margin: 0;
    padding: 10px 12px;
    white-space: nowrap;
}

/* Coastal dark icon cleanup in headers */
body.coastal-theme.coastal-dark .header .menu-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

body.coastal-theme.coastal-dark .header .menu-btn:hover {
    background: rgba(255,255,255,0.08) !important;
    border-color: transparent !important;
}

/* Coastal dark: preserve prominent stripe width */
body.coastal-theme.coastal-dark.wide-color-stripes .type-card,
body.coastal-theme.coastal-dark.wide-color-stripes .varietal-card,
body.coastal-theme.coastal-dark.wide-color-stripes .event-card {
    border-left-width: 48px !important;
}

/* Coastal dark: remove odd account page full-outline effect */
body.coastal-theme.coastal-dark #accountScreen .form-container {
    border: none !important;
    box-shadow: none !important;
}
