            /* Primary Colors - Refined palette */
            --primary: #1a3a52;
            --primary-light: #2d5573;
            --primary-dark: #0f2430;
            --accent: #d4a574;
            --accent-light: #e8c794;
            --accent-dark: #b8895f;
            
            /* Backgrounds - More depth */
            --bg-primary: #fafafa;
            --bg-secondary: #f5f5f5;
            --bg-tertiary: #ffffff;
            --bg-hover: #f8f8f8;
            
            /* Text - Better hierarchy */
            --text-primary: #1a1a1a;
            --text-secondary: #666666;
            --text-muted: #999999;
            --text-disabled: #cccccc;
            
            /* Borders - Subtle */
            --border-light: #f0f0f0;
            --border: #e0e0e0;
            --border-dark: #d0d0d0;
            
            /* Shadows - Layered depth */
            --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
            --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
            --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
            --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
            
            /* Semantic colors */
            --color-success: #10b981;
            --color-success-bg: #d1fae5;
            --color-danger: #ef4444;
            --color-danger-bg: #fee2e2;
            --color-warning: #f59e0b;
            --color-warning-bg: #fef3c7;
            --color-info: #3b82f6;
            --color-info-bg: #dbeafe;
            
            /* Spacing system */
            --space-xs: 0.25rem;
            --space-sm: 0.5rem;
            --space-md: 1rem;
            --space-lg: 1.5rem;
            --space-xl: 2rem;
            --space-2xl: 3rem;
            
            /* Border radius */
            --radius-sm: 6px;
            --radius-md: 10px;
            --radius-lg: 16px;
            --radius-xl: 24px;
            --radius-full: 9999px;
            
            /* Transitions */
            --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
            --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
            --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
        }

        /* Dark Mode - Enhanced */
        [data-theme="dark"] {
            --primary: #60a5fa;
            --primary-light: #93c5fd;
            --primary-dark: #3b82f6;
            --accent: #fbbf24;
            --accent-light: #fcd34d;
            --accent-dark: #f59e0b;
            
            --bg-primary: #0a0a0a;
            --bg-secondary: #141414;
            --bg-tertiary: #1a1a1a;
            --bg-hover: #202020;
            
            --text-primary: #f5f5f5;
            --text-secondary: #a3a3a3;
            --text-muted: #737373;
            --text-disabled: #525252;
            
            --border-light: #262626;
            --border: #333333;
            --border-dark: #404040;
            
            --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
            --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
            --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
            --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
            
            --color-success: #34d399;
            --color-success-bg: #064e3b;
            --color-danger: #f87171;
            --color-danger-bg: #7f1d1d;
            --color-warning: #fbbf24;
            --color-warning-bg: #78350f;
            --color-info: #60a5fa;
            --color-info-bg: #1e3a8a;
        }


        [data-theme="dark"] body {
            background: var(--bg-primary);
            color: var(--text-primary);
        }

        [data-theme="dark"] .container {
            background: var(--bg-primary);
        }

        [data-theme="dark"] input,
        [data-theme="dark"] select,
        [data-theme="dark"] textarea {
            background: var(--bg-secondary);
            color: var(--text-primary);
            border-color: var(--border);
        }

        [data-theme="dark"] .section {
            background: var(--bg-secondary);
        }

        [data-theme="dark"] .dashboard-card,
        [data-theme="dark"] .chart-card,
        [data-theme="dark"] .correlation-card,
        [data-theme="dark"] .search-filter-container,
        [data-theme="dark"] .progress-container {
            background: var(--bg-secondary);
            border-color: var(--border);
        }

        /* Theme Toggle Button */
        .theme-toggle {
            background: var(--bg-secondary);
            border: 2px solid var(--border);
            padding: 0.5rem 1rem;
            border-radius: 20px;
            cursor: pointer;
            font-size: 1.2rem;
            transition: all 0.3s ease;
            margin-left: 1rem;
        }

        .theme-toggle:hover {
            background: var(--accent);
            transform: scale(1.1);
        }

        /* Smooth scroll */
        html {
            scroll-behavior: smooth;
        }

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

        body {
            font-family: 'Work Sans', sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            line-height: 1.6;
            min-height: 100vh;
            padding: 0;
            margin: 0;
            overflow-x: hidden;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        /* Selection styling */
        ::selection {
            background: var(--accent);
            color: white;
        }

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

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

        ::-webkit-scrollbar-thumb {
            background: var(--border-dark);
            border-radius: var(--radius-full);
        }

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

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: var(--space-xl) var(--space-md);
            animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
        }

        @keyframes fadeInUp {
            from { 
                opacity: 0; 
                transform: translateY(30px);
            }
            to { 
                opacity: 1; 
                transform: translateY(0);
            }
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

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

        header {
            text-align: center;
            margin-bottom: var(--space-2xl);
            padding: var(--space-2xl) var(--space-xl);
            background: var(--bg-tertiary);
            border-radius: var(--radius-xl);
            box-shadow: var(--shadow-sm);
            position: relative;
            overflow: hidden;
        }

        header::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
        }

        h1 {
            font-family: 'Playfair Display', serif;
            font-size: clamp(2rem, 5vw, 3rem);
            font-weight: 700;
            color: var(--primary);
            margin-bottom: var(--space-sm);
            letter-spacing: -1px;
            line-height: 1.2;
        }

        .subtitle {
            font-size: 1.1rem;
            color: var(--text-secondary);
            font-weight: 400;
            letter-spacing: 0.3px;
        }

        .date-selector {
            display: flex;
            gap: var(--space-md);
            align-items: center;
            justify-content: center;
            margin: var(--space-xl) 0;
            padding: var(--space-lg);
            background: var(--bg-tertiary);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-sm);
            transition: box-shadow var(--transition-base);
        }

        .date-selector:hover {
            box-shadow: var(--shadow-md);
        }

        .date-selector label {
            font-weight: 600;
            color: var(--text-primary);
            font-size: 0.95rem;
        }

        .date-selector input {
            padding: var(--space-sm) var(--space-md);
            border: 2px solid var(--border);
            border-radius: var(--radius-sm);
            font-family: 'Work Sans', sans-serif;
            font-size: 0.95rem;
            transition: all var(--transition-base);
            background: var(--bg-primary);
        }

        .date-selector input:hover {
            border-color: var(--border-dark);
        }

        .date-selector input:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px var(--accent-light);
            background: var(--bg-tertiary);
        }

        /* Enhanced Tabs */
        .tabs {
            display: flex;
            gap: var(--space-xs);
            margin-bottom: var(--space-xl);
            background: var(--bg-secondary);
            padding: var(--space-xs);
            border-radius: var(--radius-lg);
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

        .tab {
            padding: var(--space-md) var(--space-lg);
            background: transparent;
            border: none;
            font-family: 'Work Sans', sans-serif;
            font-size: 1rem;
            font-weight: 500;
            color: var(--text-muted);
            cursor: pointer;
            transition: all 0.3s ease;
            border-bottom: 3px solid transparent;
            position: relative;
        }

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

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

        .tab-content {
            display: none;
            animation: slideIn 0.4s ease-out;
        }

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

        @keyframes slideIn {
            from { opacity: 0; transform: translateX(-10px); }
            to { opacity: 1; transform: translateX(0); }
        }

        .section {
            background: white;
            border-radius: 16px;
            padding: 2rem;
            margin-bottom: 2rem;
            box-shadow: 0 4px 20px var(--shadow);
            border: 1px solid var(--border);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .section:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 30px var(--shadow);
        }

        .section-header {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 1.5rem;
            padding-bottom: 1rem;
            border-bottom: 2px solid var(--bg-secondary);
        }

        .section-number {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
            color: white;
            border-radius: 10px;
            font-weight: 600;
            font-size: 1.1rem;
        }

        .section-title {
            font-family: 'Playfair Display', serif;
            font-size: 1.5rem;
            font-weight: 600;
            color: var(--primary);
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 1.5rem;
            margin-bottom: 1.5rem;
        }

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

        .form-group label {
            font-weight: 500;
            color: var(--text-secondary);
            font-size: 0.9rem;
        }

        .form-group input,
        .form-group select,
        .form-group textarea {
            padding: 0.75rem;
            border: 2px solid var(--border);
            border-radius: 8px;
            font-family: 'Work Sans', sans-serif;
            font-size: 0.95rem;
            transition: all 0.3s ease;
            background: var(--bg-primary);
        }

        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
            background: white;
        }

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

        .form-group.full-width {
            grid-column: 1 / -1;
        }

        .checkbox-group {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.75rem;
            background: var(--bg-secondary);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .checkbox-group:hover {
            background: var(--accent);
            color: white;
        }

        .checkbox-group input[type="checkbox"] {
            width: 20px;
            height: 20px;
            cursor: pointer;
            accent-color: var(--primary);
        }

        .subsection-title {
            font-weight: 600;
            color: var(--primary);
            margin: 1.5rem 0 1rem;
            font-size: 1.1rem;
            padding-left: 0.5rem;
            border-left: 4px solid var(--accent);
        }

        .scale-input {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .scale-input input[type="number"] {
            flex: 0 0 80px;
        }

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

        .save-button {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 1rem 2.5rem;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
            color: white;
            border: none;
            border-radius: 12px;
            font-family: 'Work Sans', sans-serif;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(26, 58, 82, 0.3);
            margin-top: 1rem;
        }

        .save-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(26, 58, 82, 0.4);
        }

        .save-button:active {
            transform: translateY(0);
        }

        .button-group {
            display: flex;
            gap: 1rem;
            margin-top: 2rem;
            justify-content: center;
        }

        .export-button {
            padding: 0.75rem 1.5rem;
            background: white;
            color: var(--primary);
            border: 2px solid var(--primary);
            border-radius: 10px;
            font-family: 'Work Sans', sans-serif;
            font-size: 0.95rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .export-button:hover {
            background: var(--primary);
            color: white;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 1rem;
            margin: 2rem 0;
        }

        .stat-card {
            background: linear-gradient(135deg, var(--bg-secondary) 0%, white 100%);
            padding: 1.5rem;
            border-radius: 12px;
            border: 2px solid var(--border);
            text-align: center;
            transition: all 0.3s ease;
        }

        .stat-card:hover {
            border-color: var(--accent);
            transform: scale(1.02);
        }

        .stat-value {
            font-size: 2rem;
            font-weight: 700;
            color: var(--primary);
            font-family: 'Playfair Display', serif;
        }

        .stat-label {
            font-size: 0.9rem;
            color: var(--text-secondary);
            margin-top: 0.5rem;
        }

        .correlation-card {
            background: white;
            padding: 2rem;
            border-radius: 16px;
            border: 2px solid var(--border);
            box-shadow: 0 4px 12px var(--shadow);
            transition: all 0.3s ease;
        }

        .correlation-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 24px var(--shadow);
        }

        /* Dashboard Styles */
        .dashboard-container {
            margin: 2rem 0;
            animation: fadeIn 0.6s ease;
        }

        /* Smart Insights Banner */
        .insights-banner {
            background: linear-gradient(135deg, #fff3cd 0%, #fff8e1 100%);
            border-left: 4px solid var(--color-warning);
            padding: 1rem 1.5rem;
            border-radius: 8px;
            margin-bottom: 1.5rem;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            animation: slideDown 0.4s ease;
        }

        .insights-banner.warning {
            background: linear-gradient(135deg, #ffe5e5 0%, #fff0f0 100%);
            border-left-color: var(--color-danger);
        }

        .insights-banner.success {
            background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
            border-left-color: var(--color-success);
        }

        [data-theme="dark"] .insights-banner {
            background: linear-gradient(135deg, rgba(255, 167, 38, 0.15) 0%, rgba(255, 167, 38, 0.08) 100%);
        }

        [data-theme="dark"] .insights-banner.warning {
            background: linear-gradient(135deg, rgba(255, 107, 107, 0.15) 0%, rgba(255, 107, 107, 0.08) 100%);
        }

        [data-theme="dark"] .insights-banner.success {
            background: linear-gradient(135deg, rgba(94, 204, 127, 0.15) 0%, rgba(94, 204, 127, 0.08) 100%);
        }

        .insights-banner.hidden {
            display: none;
        }

        .insight-item {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 0.75rem 0;
            border-bottom: 1px solid rgba(0,0,0,0.05);
        }

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

        .insight-icon {
            font-size: 1.5rem;
            flex-shrink: 0;
        }

        .insight-text {
            flex: 1;
            font-size: 0.95rem;
            color: var(--text);
        }

        /* Progress Bar */
        .progress-container {
            background: white;
            padding: 1.5rem;
            border-radius: 12px;
            border: 2px solid var(--border);
            margin-bottom: 1.5rem;
            box-shadow: 0 2px 8px var(--shadow);
        }

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

        .progress-label {
            font-size: 1rem;
        }

        .streak-display {
            font-size: 1.2rem;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .progress-bar-track {
            width: 100%;
            height: 24px;
            background: #e9ecef;
            border-radius: 12px;
            overflow: hidden;
            position: relative;
        }

        .progress-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, #2d5573 0%, #5a8b6f 50%, #d4a574 100%);
            border-radius: 12px;
            transition: width 1s ease;
            position: relative;
            box-shadow: inset 0 2px 4px rgba(255,255,255,0.3);
        }

        .milestones-container {
            display: flex;
            gap: 0.5rem;
            margin-top: 1rem;
            flex-wrap: wrap;
        }

        .milestone-badge {
            background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
            padding: 0.5rem 1rem;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 600;
            border: 2px solid #ff9800;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            animation: popIn 0.3s ease;
        }

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

        @keyframes popIn {
            from {
                opacity: 0;
                transform: scale(0.8);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        /* Input Validation */
        .invalid-input {
            border-color: var(--color-danger) !important;
            background-color: rgba(255, 107, 107, 0.1) !important;
            animation: shake 0.4s ease;
        }

        .validation-error {
            color: var(--color-danger);
            font-size: 0.85rem;
            margin-top: 0.25rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-10px); }
            75% { transform: translateX(10px); }
        }

        .dashboard-container {
            margin: 2rem 0;
            animation: fadeIn 0.6s ease;
        }

        .dashboard-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 1rem;
        }

        .dashboard-card {
            background: linear-gradient(135deg, white 0%, #f8f9fa 100%);
            padding: 1.5rem;
            border-radius: 12px;
            border: 2px solid var(--border);
            display: flex;
            align-items: center;
            gap: 1rem;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .dashboard-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 20px var(--shadow);
            border-color: var(--accent);
        }

        .dashboard-card.recovery-card {
            background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
        }

        .dashboard-card.strain-card {
            background: linear-gradient(135deg, #fff3e0 0%, #fef9f3 100%);
        }

        .dashboard-card.compliance-card {
            background: linear-gradient(135deg, #e3f2fd 0%, #f0f7fc 100%);
        }

        .dashboard-icon {
            font-size: 2.5rem;
            flex-shrink: 0;
        }

        .dashboard-content {
            flex: 1;
        }

        .dashboard-label {
            font-size: 0.75rem;
            text-transform: uppercase;
            color: var(--text-secondary);
            font-weight: 600;
            letter-spacing: 0.5px;
            margin-bottom: 0.25rem;
        }

        .dashboard-value {
            font-size: 1.75rem;
            font-weight: 700;
            color: var(--primary);
            font-family: 'Playfair Display', serif;
            line-height: 1.2;
        }

        .dashboard-sublabel {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-top: 0.25rem;
        }

        /* Mini Charts */
        .charts-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 1.5rem;
            margin-top: 2rem;
        }

        .chart-card {
            background: white;
            padding: 1.5rem;
            border-radius: 12px;
            border: 2px solid var(--border);
            box-shadow: 0 2px 8px var(--shadow);
        }

        .chart-card canvas {
            height: 200px !important;
        }

        .chart-title {
            font-size: 1rem;
            font-weight: 600;
            color: var(--primary);
            margin-bottom: 1rem;
        }

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

        /* Navigation Buttons */
        .nav-button {
            background: var(--primary);
            color: white;
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 6px;
            cursor: pointer;
            font-size: 1rem;
            margin-left: 0.5rem;
            transition: all 0.3s ease;
        }

        .nav-button:hover {
            background: var(--accent);
            transform: scale(1.05);
        }

        /* Search and Filter */
        .search-filter-container {
            background: white;
            padding: 1.5rem;
            border-radius: 12px;
            border: 2px solid var(--border);
            margin: 1.5rem 0;
            box-shadow: 0 2px 8px var(--shadow);
        }

        .search-box {
            display: flex;
            gap: 1rem;
            margin-bottom: 1rem;
        }

        #searchInput {
            flex: 1;
            padding: 0.75rem 1rem;
            border: 2px solid var(--border);
            border-radius: 8px;
            font-size: 1rem;
            transition: all 0.3s ease;
        }

        #searchInput:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
        }

        .search-button {
            background: var(--primary);
            color: white;
            border: none;
            padding: 0.75rem 2rem;
            border-radius: 8px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .search-button:hover {
            background: var(--accent);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px var(--shadow);
        }

        .quick-filters {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
        }

        .filter-btn {
            background: var(--bg-secondary);
            border: 2px solid var(--border);
            padding: 0.5rem 1rem;
            border-radius: 20px;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .filter-btn:hover {
            background: var(--accent);
            color: white;
            border-color: var(--accent);
            transform: translateY(-2px);
        }

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

        /* Search Results */
        .search-results {
            background: white;
            padding: 1.5rem;
            border-radius: 12px;
            border: 2px solid var(--accent);
            margin-bottom: 1.5rem;
            box-shadow: 0 4px 12px var(--shadow);
            max-height: 400px;
            overflow-y: auto;
        }

        .search-results.hidden {
            display: none;
        }

        .search-result-item {
            padding: 1rem;
            border-bottom: 1px solid var(--border);
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .search-result-item:hover {
            background: var(--bg-secondary);
            transform: translateX(5px);
        }

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

        .search-result-date {
            font-weight: 600;
            color: var(--primary);
            font-size: 1.1rem;
        }

        .search-result-details {
            font-size: 0.9rem;
            color: var(--text-secondary);
            margin-top: 0.25rem;
        }

        .search-result-badge {
            background: var(--accent);
            color: white;
            padding: 0.25rem 0.75rem;
            border-radius: 12px;
            font-size: 0.85rem;
            font-weight: 600;
        }

        /* Mobile Optimizations */
        @media (max-width: 768px) {
            .container {
                padding: 1rem;
            }

            header h1 {
                font-size: 2rem;
            }

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

            .tabs {
                overflow-x: auto;
                white-space: nowrap;
                -webkit-overflow-scrolling: touch;
            }

            .tab {
                font-size: 0.9rem;
                padding: 0.75rem 1.5rem;
            }

            .form-grid {
                grid-template-columns: 1fr;
            }

            .search-box {
                flex-direction: column;
            }

            .search-button {
                width: 100%;
            }

            .quick-filters {
                flex-direction: column;
            }

            .filter-btn {
                width: 100%;
                text-align: left;
            }

            .nav-button {
                padding: 0.5rem;
                font-size: 1.2rem;
            }

            .stats-grid {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 480px) {
            .dashboard-grid {
                grid-template-columns: 1fr;
            }

            .progress-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 0.5rem;
            }
        }

        /* Touch-friendly improvements */
        @media (hover: none) and (pointer: coarse) {
            .tab {
                min-height: 48px;
            }

            button, .save-button, .export-button {
                min-height: 44px;
                font-size: 1rem;
            }

            input, select, textarea {
                min-height: 44px;
                font-size: 16px; /* Prevents iOS zoom */
            }

            .checkbox-group {
                min-height: 44px;
            }
        }

        /* Comparison Tables */
        .comparison-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
            gap: 2rem;
            margin-top: 1.5rem;
        }

        .comparison-table {
            background: white;
            border: 2px solid var(--border);
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 2px 8px var(--shadow);
        }

        [data-theme="dark"] .comparison-table {
            background: var(--bg-secondary);
        }

        .comparison-header {
            background: var(--primary);
            color: white;
            padding: 1rem 1.5rem;
            font-weight: 600;
            font-size: 1.1rem;
        }

        .comparison-row {
            display: flex;
            justify-content: space-between;
            padding: 1rem 1.5rem;
            border-bottom: 1px solid var(--border);
        }

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

        .comparison-row:nth-child(even) {
            background: var(--bg-secondary);
        }

        .comparison-label {
            font-weight: 500;
            color: var(--text-secondary);
        }

        .comparison-value {
            font-weight: 700;
            color: var(--primary);
            font-size: 1.1rem;
        }

        .comparison-value.positive {
            color: var(--color-success);
        }

        .comparison-value.negative {
            color: var(--color-danger);
        }

        .comparison-value.neutral {
            color: var(--color-warning);
        }

        /* Backup Info */
        .backup-info {
            background: var(--bg-secondary);
            padding: 1.5rem;
            border-radius: 8px;
            border-left: 4px solid var(--accent);
        }

        .backup-info p {
            margin: 0.5rem 0;
            font-size: 1rem;
        }

        /* Multi-Session Training */
        .subsection-header-with-add {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }

        .add-session-btn {
            background: var(--accent);
            color: white;
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .add-session-btn:hover {
            background: var(--accent-dark);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px var(--shadow);
        }

        .training-session {
            background: white;
            border: 2px solid var(--border);
            border-radius: 12px;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            transition: all 0.3s ease;
        }

        [data-theme="dark"] .training-session {
            background: var(--bg-secondary);
        }

        .training-session:hover {
            border-color: var(--accent);
            box-shadow: 0 4px 12px var(--shadow);
        }

        .session-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            padding-bottom: 0.75rem;
            border-bottom: 2px solid var(--border);
        }

        .session-label {
            font-weight: 600;
            font-size: 1.1rem;
            color: var(--primary);
        }

        .remove-session-btn {
            background: var(--color-danger);
            color: white;
            border: none;
            padding: 0.4rem 0.8rem;
            border-radius: 6px;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .remove-session-btn:hover {
            background: #c0392b;
            transform: scale(1.1);
        }

        /* Conditional field visibility */
        .session-details {
            max-height: 1000px;
            overflow: hidden;
            transition: max-height 0.3s ease, opacity 0.3s ease;
            opacity: 1;
        }

        .session-details.hidden-until-completed {
            max-height: 0;
            opacity: 0;
            pointer-events: none;
        }

        /* Collapsible sections */
        .section.collapsible .section-header {
            cursor: pointer;
            user-select: none;
        }

        .section.collapsible .section-header::after {
            content: '▼';
            margin-left: 0.5rem;
            font-size: 0.8rem;
            transition: transform 0.3s ease;
        }

        .section.collapsible.collapsed .section-header::after {
            transform: rotate(-90deg);
        }

        .section.collapsible.collapsed > *:not(.section-header) {
            display: none;
        }

        /* Quick entry mode */
        .quick-entry-toggle {
            position: fixed;
            bottom: 2rem;
            left: 2rem;
            background: var(--accent);
            color: white;
            border: none;
            padding: 0.8rem 1.2rem;
            border-radius: 50px;
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            z-index: 1000;
            transition: all 0.3s ease;
        }

        .quick-entry-toggle:hover {
            transform: scale(1.05);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
        }

        /* Floating buttons container for better organization */
        #aiBtn {
            position: fixed;
            bottom: 30px;
            right: 30px;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: linear-gradient(135deg, #1a3a52, #2c5f88);
            color: #fff;
            border: none;
            font-size: 28px;
            cursor: pointer;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
            z-index: 9999;
            transition: all 0.3s ease;
        }

        #aiBtn:hover {
            transform: scale(1.1);
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
        }

        body.quick-entry-mode .form-group.non-essential {
            display: none;
        }

        body.quick-entry-mode .section.collapsible.collapsed {
            display: none;
        }

        /* Mobile improvements */
        @media (max-width: 768px) {
            input[type="checkbox"] {
                width: 24px;
                height: 24px;
            }

            input[type="number"] {
                font-size: 16px; /* Prevents zoom on iOS */
            }

            .number-stepper {
                display: flex;
                align-items: center;
                gap: 0.5rem;
            }

            .number-stepper button {
                width: 40px;
                height: 40px;
                font-size: 1.2rem;
                border: 2px solid var(--border);
                background: white;
                border-radius: 8px;
                cursor: pointer;
                transition: all 0.2s ease;
            }

            .number-stepper button:active {
                background: var(--bg-secondary);
                transform: scale(0.95);
            }

            .number-stepper input {
                flex: 1;
                text-align: center;
            }
        }

        /* Validation warnings */
        .validation-warning {
            background: #fff3cd;
            border-left: 4px solid #ffc107;
            padding: 0.75rem 1rem;
            margin: 1rem 0;
            border-radius: 6px;
            font-size: 0.9rem;
            color: #856404;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            animation: slideIn 0.3s ease;
        }

        .validation-warning.danger {
            background: #f8d7da;
            border-left-color: #dc3545;
            color: #721c24;
        }

        .validation-warning .icon {
            font-size: 1.2rem;
        }

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

        /* Session template button */
        .template-btn {
            background: var(--bg-secondary);
            border: 2px dashed var(--border);
            color: var(--text-primary);
            padding: 0.5rem 1rem;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.9rem;
            margin-left: 0.5rem;
            transition: all 0.2s ease;
        }

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

        .reflection-section {
            background: linear-gradient(135deg, #f8f6f0 0%, #fafaf8 100%);
            border-left: 4px solid var(--accent);
            padding: 2rem;
            border-radius: 12px;
            margin-top: 2rem;
        }

        .notification {
            position: fixed;
            top: 2rem;
            right: 2rem;
            padding: 1rem 1.5rem;
            background: var(--color-success);
            color: white;
            border-radius: 10px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
            opacity: 0;
            transform: translateX(400px);
            transition: all 0.4s ease;
            z-index: 10001;
            font-weight: 500;
            font-size: 0.95rem;
        }

        .notification.show {
            opacity: 1;
            transform: translateX(0);
        }

        .notification.error {
            background: var(--color-danger);
        }

        .notification.warning {
            background: var(--color-warning);
        }

        .notification.info {
            background: var(--color-info);
        }

        @media (max-width: 768px) {
            h1 {
                font-size: 2rem;
            }

            .form-grid {
                grid-template-columns: 1fr;
            }

            .tabs {
                overflow-x: auto;
            }

            .section {
                padding: 1.5rem;
            }

            .button-group {
                flex-direction: column;
            }
        }

        .info-text {
            background: var(--bg-secondary);
            padding: 1rem;
            border-radius: 8px;
            font-size: 0.9rem;
            color: var(--text-secondary);
            margin-bottom: 1.5rem;
            border-left: 3px solid var(--accent);
        }

        /* Login Screen Styles */
        .login-container {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            padding: 2rem;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
            z-index: 9999;
        }

        .login-box {
            background: white;
            padding: 3rem;
            border-radius: 20px;
            box-shadow: 0 10px 40px var(--shadow);
            max-width: 450px;
            width: 100%;
            animation: fadeIn 0.6s ease-out;
        }

        .login-box h1 {
            font-family: 'Playfair Display', serif;
            font-size: 2rem;
            color: var(--primary);
            margin-bottom: 0.5rem;
            text-align: center;
        }

        .login-box .subtitle {
            text-align: center;
            color: var(--text-secondary);
            font-size: 0.9rem;
            margin-bottom: 2rem;
            font-style: italic;
        }

        .login-form {
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }

        .login-form input {
            padding: 1rem;
            border: 2px solid var(--border);
            border-radius: 10px;
            font-family: 'Work Sans', sans-serif;
            font-size: 1rem;
            transition: all 0.3s ease;
        }

        .login-form input:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
        }

        .login-button {
            padding: 1rem;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
            color: white;
            border: none;
            border-radius: 12px;
            font-family: 'Work Sans', sans-serif;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(26, 58, 82, 0.3);
        }

        .login-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(26, 58, 82, 0.4);
        }

        .login-button:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .toggle-auth {
            text-align: center;
            margin-top: 1rem;
            color: var(--text-secondary);
            font-size: 0.9rem;
        }

        .toggle-auth a {
            color: var(--primary);
            text-decoration: none;
            font-weight: 600;
            cursor: pointer;
        }

        .toggle-auth a:hover {
            color: var(--accent);
        }

        .error-message {
            background: #fee;
            color: #c33;
            padding: 0.75rem;
            border-radius: 8px;
            font-size: 0.9rem;
            border-left: 3px solid #c33;
        }

        .hidden {
            display: none !important;
        }

        .user-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
            padding: 1rem 1.5rem;
            background: white;
            border-radius: 12px;
            box-shadow: 0 2px 8px var(--shadow);
        }

        .user-email {
            color: var(--text-secondary);
            font-size: 0.9rem;
        }

        .logout-button {
            padding: 0.5rem 1.5rem;
            background: white;
            color: var(--primary);
            border: 2px solid var(--primary);
            border-radius: 8px;
            font-family: 'Work Sans', sans-serif;
            font-size: 0.9rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .logout-button:hover {
            background: var(--primary);
            color: white;
        }

        .loading-spinner {
            display: inline-block;
            width: 16px;
            height: 16px;
            border: 2px solid rgba(255,255,255,.3);
            border-radius: 50%;
            border-top-color: white;
            animation: spin 1s ease-in-out infinite;
        }

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

        #mainApp {
            animation: fadeIn 0.6s ease-out;
        }

        /* ========================================
           ENHANCED MOBILE OPTIMIZATIONS
           ======================================== */

        /* Improved Quick Entry for Mobile */
        @media (max-width: 768px) {
            .quick-entry-toggle {
                width: 56px;
                height: 56px;
                font-size: 1.5rem;
                bottom: 1rem;
                left: 1rem;
                box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            }

            #aiBtn {
                width: 56px;
                height: 56px;
                font-size: 1.5rem;
                bottom: 20px;
                right: 20px;
                box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            }

            /* Make date selector stack on mobile */
            .date-selector {
                flex-wrap: wrap;
                gap: 0.5rem;
            }

            .date-selector input[type="date"] {
                flex: 1 1 100%;
                min-width: 100%;
            }

            /* Better dashboard cards on mobile */
            .dashboard-card {
                padding: 1rem;
            }

            .dashboard-value {
                font-size: 1.8rem;
            }

            /* Improved charts on mobile */
            .chart-card {
                padding: 1rem;
            }

            .chart-title {
                font-size: 0.95rem;
            }

            /* Stack sections better */
            .section {
                padding: 1rem;
            }

            .section-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 0.5rem;
            }

            /* Better form inputs on mobile */
            .form-group label {
                font-size: 0.9rem;
            }

            /* Scrollable tables on mobile */
            .comparison-table {
                overflow-x: auto;
            }
        }

        /* Enhanced touch targets for mobile */
        @media (max-width: 480px) {
            .save-button, .export-button {
                width: 100%;
                padding: 1rem;
                font-size: 1.1rem;
            }

            .tabs {
                padding: 0.5rem;
                gap: 0.25rem;
            }

            .tab {
                padding: 0.75rem 1rem;
                font-size: 0.85rem;
            }
        }

        /* Progress Bar Visualization */
        .project-progress {
            background: var(--bg-tertiary);
            border-radius: var(--radius-lg);
            padding: 1.5rem;
            margin: 1rem 0;
            box-shadow: var(--shadow-sm);
        }

        .project-progress h3 {
            margin-bottom: 1rem;
            color: var(--text-primary);
            font-size: 1.1rem;
        }

        .progress-bar-container {
            position: relative;
            width: 100%;
            height: 40px;
            background: var(--bg-secondary);
            border-radius: var(--radius-full);
            overflow: hidden;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
        }

        .progress-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
            border-radius: var(--radius-full);
            transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            align-items: center;
            justify-content: flex-end;
            padding-right: 1rem;
            color: white;
            font-weight: 600;
            font-size: 0.9rem;
        }

        .progress-details {
            display: flex;
            justify-content: space-between;
            margin-top: 0.75rem;
            font-size: 0.9rem;
            color: var(--text-secondary);
        }

        /* Streak Visualization */
        .streak-container {
            background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
            border-radius: var(--radius-lg);
            padding: 1.5rem;
            margin: 1rem 0;
            box-shadow: var(--shadow-md);
            text-align: center;
        }

        [data-theme="dark"] .streak-container {
            background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
        }

        .streak-number {
            font-size: 3rem;
            font-weight: 700;
            color: var(--accent-dark);
            line-height: 1;
            margin: 0.5rem 0;
        }

        [data-theme="dark"] .streak-number {
            color: var(--accent-light);
        }

        .streak-label {
            font-size: 1rem;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 600;
        }

        .streak-message {
            margin-top: 0.5rem;
            font-size: 0.9rem;
            color: var(--text-secondary);
        }

        /* Data Export Section */
        .export-section {
            background: var(--bg-tertiary);
            border-radius: var(--radius-lg);
            padding: 1.5rem;
            margin: 1rem 0;
            box-shadow: var(--shadow-sm);
        }

        .export-buttons {
            display: flex;
            gap: 1rem;
            flex-wrap: wrap;
            margin-top: 1rem;
        }

        .export-button {
            background: var(--primary);
            color: white;
            border: none;
            padding: 0.75rem 1.5rem;
            border-radius: var(--radius-md);
            font-weight: 600;
            cursor: pointer;
            transition: all var(--transition-base);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .export-button:hover {
            background: var(--primary-dark);
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
        }

        .export-button:active {
            transform: translateY(0);
        }

        /* Insights Section */
        .insights-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 1rem;
            margin-top: 1rem;
        }

        .insight-card {
            background: var(--bg-tertiary);
            border-left: 4px solid var(--accent);
            border-radius: var(--radius-md);
            padding: 1.5rem;
            box-shadow: var(--shadow-sm);
            transition: all var(--transition-base);
        }

        .insight-card:hover {
            box-shadow: var(--shadow-md);
            transform: translateY(-2px);
        }

        .insight-card.positive {
            border-left-color: var(--color-success);
        }

        .insight-card.negative {
            border-left-color: var(--color-danger);
        }

        .insight-card.neutral {
            border-left-color: var(--color-info);
        }

        .insight-title {
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 0.5rem;
        }

        .insight-value {
            font-size: 2rem;
            font-weight: 700;
            color: var(--primary);
            margin: 0.5rem 0;
        }

        .insight-description {
            font-size: 0.9rem;
            color: var(--text-secondary);
            line-height: 1.5;
        }

        /* Validation Messages */
        .validation-message {
            background: var(--color-danger-bg);
            color: var(--color-danger);
            padding: 0.75rem 1rem;
            border-radius: var(--radius-md);
            margin-top: 0.5rem;
            font-size: 0.9rem;
            display: none;
            border-left: 4px solid var(--color-danger);
        }

        .validation-message.show {
            display: block;
            animation: slideDown 0.3s ease-out;
        }

        .validation-message.success {
            background: var(--color-success-bg);
            color: var(--color-success);
            border-left-color: var(--color-success);
        }

        .validation-message.warning {
            background: var(--color-warning-bg);
            color: var(--color-warning);
            border-left-color: var(--color-warning);
        }

        /* Loading states */
        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            opacity: 0;
            pointer-events: none;
            transition: opacity var(--transition-base);
        }

        .loading-overlay.show {
            opacity: 1;
            pointer-events: all;
        }

        .loading-content {
            background: var(--bg-tertiary);
            padding: 2rem;
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-xl);
            text-align: center;
        }

        .loading-spinner-large {
            width: 50px;
            height: 50px;
            border: 4px solid var(--border);
            border-top-color: var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 1rem;
