        /* Enhanced color scheme and modern design */
        :root {
            --primary: #4f46e5; /* Keep primary, but might use less intensely */
            --primary-light: #a5b4fc; /* Lighter indigo */
            --primary-dark: #3730a3;
            --success: #10b981; /* Slightly brighter green */
            --warning: #f59e0b; /* Slightly brighter yellow */
            --danger: #ef4444; /* Slightly brighter red */
            --neutral-dark: #334155; /* Softer dark gray */
            --neutral: #64748b;
            --neutral-light: #e2e8f0; /* Lighter gray */
            --background: #f8fafc; /* Very light gray background */
            --card-background: #ffffff; /* White background for cards */
            --border-color: #e5e7eb; /* Subtle border color */
            --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06); /* Softer shadow */
            --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 15px rgba(0, 0, 0, 0.05); /* Softer large shadow */
            --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.05), 0 8px 10px rgba(0, 0, 0, 0.04); /* Softer XL shadow */
            --radius: 10px; /* Slightly adjusted radius */
            --radius-sm: 6px;
            --radius-lg: 12px;
            --transition: all 0.2s ease-in-out; /* Slightly faster transition */
            --ai-gradient: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%); /* Adjusted gradient */
        }

        /* Improved body styling */
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            line-height: 1.6;
            color: var(--neutral-dark);
            background-color: var(--background); /* Use new background */
            padding: 0;
            margin: 0;
            min-height: 100vh;
            position: relative;
            overflow-x: hidden;
            padding-top: 80px !important; /* Desktop: header is ~71px */
        }
        
        html {
            margin: 0;
            padding: 0;
            overflow-x: hidden;
        }

        /* Modern container styling */
        .container {
            max-width: 1100px; 
            margin: 30px auto; /* Add top/bottom margin */
            padding: 40px 50px; /* Increased padding */
            background: var(--card-background); /* Use card background */
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg); /* Use softer shadow */
            /* margin-top: 30px; */ /* Handled by margin: auto */
            /* margin-bottom: 10px; */ /* Handled by margin: auto */
            border: 1px solid var(--border-color); /* Add subtle border */
        }

        /* Enhanced tab styling - Not currently used, but kept for potential future use */
        .tabs {
            display: flex;
            background: var(--card-background);
            border-radius: var(--radius-lg);
            padding: 6px;
            margin-bottom: 30px;
            border: 1px solid var(--border-color);
            box-shadow: var(--shadow);
        }

        .tab {
            flex: 1;
            text-align: center;
            padding: 12px 18px;
            cursor: pointer;
            border-radius: var(--radius);
            font-weight: 600;
            transition: var(--transition);
            color: var(--neutral);
            border: 1px solid transparent;
        }

        .tab:hover {
            color: var(--primary);
            background: rgba(79, 70, 229, 0.03);
        }

        .tab.active {
            color: var(--primary);
            background: rgba(79, 70, 229, 0.1);
            box-shadow: var(--shadow);
            border-color: rgba(79, 70, 229, 0.2);
            font-weight: 700;
        }

        /* Enhanced input section */
        .input-section {
            max-width: 900px;
            margin: 0 auto;
        }

        .input-section h2 {
            font-size: 1.8rem;
            margin-bottom: 8px;
            color: var(--neutral-dark);
            font-weight: 700;
        }

        .input-section p {
            color: var(--neutral);
            margin-bottom: 30px;
            font-size: 1.05rem;
        }

        /* Improved input fields */
        input[type="text"],
        input[type="number"],
        select {
            width: 100%;
            padding: 14px;
            border: 1px solid var(--border-color); /* Use new border color */
            border-radius: var(--radius-sm);
            font-size: 1rem;
            transition: var(--transition);
            background-color: #fff; /* Ensure white background for inputs */
            /* box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); */ /* Remove default shadow */
            box-sizing: border-box; /* Add consistent box-sizing */
        }

        input[type="text"]:focus,
        input[type="number"]:focus,
        select:focus {
            border-color: var(--primary-light);
            box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); /* Softer focus ring */
            outline: none;
        }

        label {
            display: block;
            font-weight: 500;
            margin-bottom: 8px;
            color: var(--neutral-dark);
            font-size: 0.9rem; /* Slightly smaller label */
        }


        /* Enhanced buttons (general) - these styles were not present, adding them */
        button, .button {
            background-color: var(--primary);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: var(--radius);
            cursor: pointer;
            font-size: 1rem;
            font-weight: 600;
            transition: var(--transition);
            box-shadow: var(--shadow);
        }

        button:hover, .button:hover {
            background-color: var(--primary-dark);
            box-shadow: var(--shadow-lg);
            transform: translateY(-1px);
        }

        button:active, .button:active {
            transform: translateY(0px);
            box-shadow: var(--shadow);
        }

        /* Improved result cards */
        .result-card {
            background: var(--card-background);
            border-radius: var(--radius-lg);
            padding: 30px; /* Increased padding */
            margin-bottom: 25px; /* Increased margin */
            box-shadow: var(--shadow); /* Use softer shadow */
            transition: var(--transition);
            border: 1px solid var(--border-color);
        }

        .result-card:hover {
            /* box-shadow: var(--shadow-lg); */ /* Remove hover effect */
            /* transform: translateY(-2px); */ /* Remove hover effect */
            /* padding: 8px 20px; */ /* Remove hover effect */
            /* border: 2px solid white; */ /* Remove hover effect */
        }

        .primary-card {
            background: var(--ai-gradient);
            color: white;
            border: none;
        }

        /* Add results container styling to match container class */
        .results-container {
            max-width: 1100px;
            margin: 0 auto;
            padding: 30px 40px;
            background: white;
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            margin-top: 30px;
            margin-bottom: 10px;
        }

        .result-card h3 {
            font-size: 1.4rem;
            margin-top: 0;
            margin-bottom: 20px;
            font-weight: 700;
            display: flex;
            align-items: center;
            color: var(--neutral-dark); /* Ensure consistent heading color */
        }

        .chart-container {
            height: 300px;
            margin-top: 20px; /* Increased margin */
            position: relative;
        }

        /* Enhanced chart labels */
        .chart-label {
            font-size: 1.1rem;
            font-weight: 500;
            color: var(--neutral);
            margin-bottom: 10px;
        }

        /* Improved result highlight */
        .result-highlight {
            font-size: 3rem;
            font-weight: 800;
            text-align: center;
            margin: 10px 0;
            background: -webkit-linear-gradient(45deg, #fff, rgba(255,255,255,0.8));
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            transition: var(--transition);
        }

        /* Enhanced milestone styling */
        .milestones-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 16px;
            margin-top: 16px;
        }

        .milestone {
            background-color: white;
            border-radius: var(--radius-sm);
            padding: 16px;
            text-align: center;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
            border: 1px solid var(--neutral-light);
            transition: all 0.2s ease;
        }

        .milestone:hover {
            /* transform: translateY(-2px); */ /* Remove hover effect */
            /* padding: 8px 20px; */ /* Remove hover effect */
            /* border: 2px solid white; */ /* Remove hover effect */
            /* box-shadow: 0 4px 8px rgba(99, 102, 241, 0.15); */ /* Remove hover effect */
            /* border-color: rgba(99, 102, 241, 0.3); */ /* Remove hover effect */
        }

        .milestone-percent {
            font-weight: 700;
            font-size: 1.2rem;
            color: var(--primary);
            margin-bottom: 4px;
        }

        .milestone-amount {
            font-weight: 700;
            font-size: 1.5rem;
            color: var(--neutral-dark);
            margin-bottom: 8px;
        }

        .milestone-age {
            font-weight: 600;
            font-size: 1.2rem;
            color: var(--primary);
        }

        /* Improved summary grid */
        .summary-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 16px;
            margin-top: 16px;
        }

        .summary-card {
            background-color: white;
            border-radius: var(--radius-sm);
            padding: 18px;
            text-align: center;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
            border: 1px solid var(--neutral-light);
        }

        .summary-card h4 {
            color: var(--primary);
            font-size: 1rem;
            margin-top: 0;
            margin-bottom: 8px;
        }

        .summary-value {
            font-size: 2rem;
            font-weight: 700;
            color: var(--neutral-dark);
            margin: 8px 0;
        }

        .summary-caption {
            color: var(--neutral);
            font-size: 0.9rem;
        }

        /* Enhanced tooltip */
        .tooltip-container {
            position: relative;
            display: inline-block;
            margin-left: 8px;
        }

        .tooltip-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 18px;
            height: 18px;
            background-color: var(--neutral-light);
            color: var(--neutral);
            border-radius: 50%;
            font-size: 12px;
            cursor: help;
            transition: var(--transition);
        }

        .tooltip-container:hover .tooltip-icon {
            background-color: var(--neutral);
            color: white;
        }

        .tooltip-text {
            visibility: hidden;
            width: 250px;
            background-color: var(--neutral-dark);
            color: white;
            text-align: center;
            border-radius: var(--radius-sm);
            padding: 10px 15px;
            position: absolute;
            z-index: 100;
            bottom: 125%;
            left: 50%;
            transform: translateX(-50%);
            opacity: 0;
            transition: opacity 0.3s;
            font-weight: normal;
            font-size: 0.85rem;
            line-height: 1.4;
            box-shadow: var(--shadow-lg);
        }

        .tooltip-text::after {
            content: "";
            position: absolute;
            top: 100%;
            left: 50%;
            margin-left: -5px;
            border-width: 5px;
            border-style: solid;
            border-color: var(--neutral-dark) transparent transparent transparent;
        }

        .tooltip-container:hover .tooltip-text {
            visibility: visible;
            opacity: 1;
        }

        /* Improved table styling */
        .table-container {
            max-height: 400px;
            overflow-y: auto;
            margin-top: 1rem;
            border-radius: var(--radius);
            border: 1px solid var(--neutral-light);
            box-shadow: var(--shadow);
        }

        .simulations-table thead th {
            position: sticky;
            top: 0;
            background-color: var(--primary-dark);
            color: white;
            z-index: 10;
            font-weight: 600;
            padding: 15px;
        }

        .simulations-table, .detail-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.9rem;
        }

        .simulations-table th, .simulations-table td,
        .detail-table th, .detail-table td {
            padding: 12px 8px; /* Reduced horizontal padding */
            text-align: left;
            border-bottom: 1px solid var(--neutral-light);
        }

        /* Set specific widths for narrower columns in the retirement table */
        #retirement-results .simulations-table th:nth-child(1),
        #retirement-results .simulations-table td:nth-child(1) { /* Sim # */
            width: 10%;
            text-align: center;
        }

        #retirement-results .simulations-table th:nth-child(4),
        #retirement-results .simulations-table td:nth-child(4) { /* Status */
            width: 10%;
            text-align: center;
        }

        #retirement-results .simulations-table th:nth-child(5),
        #retirement-results .simulations-table td:nth-child(5) { /* Action */
            width: 15%;
            text-align: center;
        }

        .simulations-table tr:nth-child(even) {
            background-color: rgba(241, 245, 249, 0.5);
        }

        .simulations-table tr:hover {
            background-color: rgba(79, 70, 229, 0.05);
        }

        /* Enhanced modal */
        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0,0,0,0.4);
            backdrop-filter: blur(3px);
        }

        .modal-content {
            background-color: white;
            margin: 5% auto;
            padding: 25px;
            border-radius: var(--radius);
            box-shadow: var(--shadow-xl);
            width: 80%;
            max-width: 900px;
            position: relative;
            animation: slideIn 0.3s;
            overflow-y: auto;
            max-height: 90vh;
        }

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

        .close-modal {
            color: var(--neutral);
            float: right;
            font-size: 28px;
            font-weight: bold;
            margin-top: -10px;
            position: sticky;
            top: 10px;
            right: 25px;
            z-index: 100;
            background-color: rgba(255, 255, 255, 0.9);
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }

        .close-modal:hover,
        .close-modal:focus {
            color: var(--primary-dark);
            text-decoration: none;
            cursor: pointer;
        }

        /* Enhanced filter buttons */
        .filter-container {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .filter-btn {
            padding: 10px 16px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--neutral-light);
            background-color: white;
            color: var(--neutral-dark);
            cursor: pointer;
            transition: all 0.2s;
            font-size: 0.9rem;
            font-weight: 500;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        }

        .filter-btn:hover {
            background-color: var(--neutral-light);
            transform: translateY(-1px);
        }

        .filter-btn.active {
            background-color: var(--primary-dark);
            color: white;
            border-color: var(--primary-dark);
            box-shadow: 0 2px 4px rgba(55, 48, 163, 0.3);
        }

        .filter-btn.success {
            border-color: var(--success);
            color: var(--neutral-dark);
        }

        .filter-btn.success.active {
            background-color: var(--success);
            color: white;
            border-color: var(--success);
            box-shadow: 0 2px 4px rgba(5, 150, 105, 0.3);
        }

        .filter-btn.failure {
            border-color: var(--danger);
            color: var(--neutral-dark);
        }

        .filter-btn.failure.active {
            background-color: var(--danger);
            color: white;
            border-color: var(--danger);
            box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
        }

        /* Enhanced range slider */
        input[type="range"] {
            -webkit-appearance: none;
            width: 100%;
            height: 6px;
            border-radius: 5px;
            background: var(--neutral-light);
            outline: none;
            transition: var(--transition);
        }

        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            background: var(--primary);
            cursor: pointer;
            box-shadow: 0 1px 3px rgba(0,0,0,0.2);
            transition: var(--transition);
        }

        input[type="range"]::-moz-range-thumb {
            width: 22px;
            height: 22px;
            border-radius: 50%;
            background: var(--primary);
            cursor: pointer;
            box-shadow: 0 1px 3px rgba(0,0,0,0.2);
            transition: var(--transition);
            border: none;
        }

        input[type="range"]::-webkit-slider-thumb:hover {
            background: var(--primary-dark);
            transform: scale(1.1);
            box-shadow: 0 2px 5px rgba(0,0,0,0.3);
        }

        input[type="range"]::-moz-range-thumb:hover {
            background: var(--primary-dark);
            transform: scale(1.1);
            box-shadow: 0 2px 5px rgba(0,0,0,0.3);
        }

        /* Status labels */
        .status-success {
            color: var(--success);
            font-weight: 600;
        }

        .status-failure {
            color: var(--danger);
            font-weight: 600;
        }

        /* Help button */
        .round-button {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: var(--ai-gradient);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            cursor: pointer;
            box-shadow: 0 3px 10px rgba(79, 70, 229, 0.4);
            z-index: 100;
            transition: all 0.2s;
        }

        .round-button:hover {
            transform: scale(1.1) rotate(10deg);
            box-shadow: 0 5px 15px rgba(79, 70, 229, 0.5);
        }

        /* Responsive layout adjustments */
        @media (max-width: 768px) {
            body {
                padding-top: 66px !important; /* Mobile: compact header is 56px + 10px breathing room */
            }
            .header-content {
                height: 56px !important;
                padding: 0 15px !important;
                flex-wrap: nowrap;
            }
            .logo svg {
                width: 24px !important;
                height: 24px !important;
            }
            .logo h1 {
                font-size: 1.2rem !important;
            }
            .logo {
                gap: 6px !important;
            }
            .tab {
                padding: 10px;
                font-size: 0.9rem;
            }
            
            .summary-grid,
            .milestones-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            
            .modal-content {
                width: 95%;
                padding: 20px;
            }
            
            .result-highlight {
                font-size: 2.5rem;
            }
            
            .filter-container {
                flex-direction: column;
                align-items: stretch;
            }
            
            .container {
                padding: 25px 25px;
            }
            
            .header-content {
                padding: 15px 25px;
            }
            
            /* Add styles for better form layout on small screens */
            .input-section > div {
                width: 100%;
            }
        }

        /* App Header Styling */
        .app-header {
            /* background: var(--ai-gradient); */ /* Remove gradient */
            background-color: var(--card-background); /* Use card background (white) */
            color: var(--primary); /* Change text color to primary */
            padding: 0;
            box-shadow: var(--shadow); /* Use softer shadow */
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            width: 100%;
            z-index: 1000;
            border-bottom: 1px solid var(--border-color); /* Add subtle border */
        }

        .header-content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 40px; /* Adjust padding */
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 70px; /* Adjust height — no !important, allow mobile media query override */
            /* min-height: 30px; */ /* Not needed with fixed height */
        }

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

        .logo svg {
            /* filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1)); */ /* Remove shadow */
            color: var(--primary);
        }

        .logo h1 {
            font-size: 1.8rem; /* Slightly larger */
            font-weight: 700;
            margin: 0;
            letter-spacing: -0.5px;
            /* text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */ /* Remove shadow */
            color: var(--neutral-dark); /* Use darker neutral for title */
        }

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

        .header-button {
            display: flex;
            align-items: center;
            gap: 6px;
            background-color: rgba(255, 255, 255, 0.15);
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: var(--radius);
            cursor: pointer;
            font-size: 0.9rem;
            font-weight: 500;
            transition: all 0.2s;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .header-button:hover {
            background-color: rgba(255, 255, 255, 0.25);
            transform: translateY(-1px);
        }

        .header-button svg {
            width: 18px;
            height: 18px;
        }

        /* Adjust container margin to work with header */
        .container {
            margin-top: 20px;
            /* Bottom margin is now set globally at 10px */
        }

        /* Make app responsive */
        @media (max-width: 600px) {
            .logo h1 {
                font-size: 1.3rem;
            }
            
            .header-button {
                padding: 6px 12px;
                font-size: 0.8rem;
            }
            
            .header-button svg {
                width: 16px;
                height: 16px;
            }
            
            /* Mobile navigation - show only icons */
            .header-nav-link {
                padding: 10px 12px;
                display: flex;
                align-items: center;
                justify-content: center;
            }
            
            .header-nav-link .nav-icon {
                margin-right: 0;
                font-size: 1.3em;
                opacity: 1;
            }
            
            .header-nav-link .nav-text {
                display: none;
            }
        }

        /* Improved button styling for simulation buttons */
        .button-container {
            display: flex;
            justify-content: center;
            padding: 40px 0;
            margin-top: 20px;
            width: 100%;
        }

        .button-container button {
            min-width: 250px;
            font-size: 1.1rem;
            padding: 18px 30px;
            transition: all 0.3s ease;
            border-radius: 30px;
            background-color: var(--primary);
            color: white;
            font-weight: 600;
            box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
            border: none;
        }

        .button-container button:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
            background-color: var(--primary-dark);
        }

        .button-container button:active {
            transform: translateY(1px);
            box-shadow: 0 2px 5px rgba(99, 102, 241, 0.4);
        }

        /* Make sure the input-section has proper layout for centering */
        .input-section {
            display: flex;
            flex-direction: column;
            align-items: stretch;
        }

        /* Enhance the mobile responsive styles */
        @media (max-width: 768px) {
            body {
                /* padding: 0 15px; */ /* Remove horizontal padding */
            }
            
            .container {
                padding: 25px 20px;
                /* margin-left: 10px; */ /* Remove explicit margins */
                /* margin-right: 10px; */ /* Remove explicit margins */
            }
            
            .header-content {
                padding: 15px 20px;
            }
            
            .app-header {
                /* margin-left: -15px; */ /* Remove negative margin */
                /* margin-right: -15px; */ /* Remove negative margin */
                border-radius: 0;
            }
            
            .input-section, 
            .result-card {
                padding: 20px;
            }
        }

        /* Add even more padding for very small devices */
        @media (max-width: 480px) {
            body {
                /* padding: 0 15px; */ /* Remove horizontal padding */
            }
            
            .container {
                padding: 20px 15px;
                border-radius: var(--radius);
            }
            
            input, select {
                max-width: 100%;
            }
        }

        /* Update navigation styles to create pill buttons */
        .nav-container {
            display: flex;
            justify-content: center;
            gap: 20px;
        }

        .nav-link {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 10px 20px;
            background-color: rgba(255, 255, 255, 0.8);
            color: var(--neutral);
            text-decoration: none;
            border-radius: 30px;
            font-weight: 600;
            transition: all 0.3s ease;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
            border: 1px solid rgba(99, 102, 241, 0.1);
            min-width: 130px;
        }

        .nav-link:hover {
            background-color: rgba(255, 255, 255, 1);
            transform: translateY(-2px);
            padding: 8px 20px;
            border: 2px solid white;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            color: var(--primary);
        }

        .nav-link.active {
            background-color: var(--primary);
            color: white;
            box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
            border-color: var(--primary);
        }

        .nav-link svg, .nav-link img {
            margin-right: 8px;
            width: 20px;
            height: 20px;
        }

        /* Update specifically for the app-nav container */
        .app-nav {
            background: transparent;
            box-shadow: none;
            border-bottom: none;
            margin: 15px 0 30px;
            position: relative;
            z-index: 10;
        }

        /* New Run Simulation button styling - IDENTICAL FOR BOTH PAGES */
        .simulation-button-wrapper {
            display: flex;
            justify-content: center;
            width: 100%;
            margin: 40px 0 20px; /* Adjust margin */
        }

        .simulation-button {
            background: var(--primary);
            color: white;
            font-size: 1.05rem; /* Slightly adjusted */
            font-weight: 600;
            padding: 14px 32px; /* Adjusted padding */
            border-radius: var(--radius); /* Consistent radius */
            border: none;
            cursor: pointer;
            box-shadow: var(--shadow); /* Softer shadow */
            transition: var(--transition);
            min-width: 220px; /* Adjusted min-width */
            text-align: center;
            letter-spacing: 0.3px;
            position: relative;
            overflow: hidden;
        }

        .simulation-button:hover {
            background: var(--primary-dark);
            /* transform: translateY(-2px); */ /* Remove vertical movement */
            /* padding: 8px 20px; */ /* Remove padding change - likely an error */
            /* box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35); */ /* Keep original or adjust slightly */
            box-shadow: var(--shadow-lg); /* Slightly larger shadow on hover */
        }

        .simulation-button:active {
            transform: translateY(1px);
            box-shadow: var(--shadow);
        }

        .simulation-button::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
            pointer-events: none;
        }

        /* Share button styling */
        .share-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            background-color: white;
            color: var(--primary);
            border: 1px solid var(--primary-light);
            padding: 10px 16px;
            font-size: 0.95rem;
            font-weight: 600;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.2s ease;
            margin: 20px 0;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        }

        .share-button:hover {
            background-color: var(--primary-light);
            color: white;
            transform: translateY(-2px);
            padding: 8px 20px;
            border: 2px solid white;
            box-shadow: 0 4px 8px rgba(99, 102, 241, 0.2);
        }

        .share-button svg {
            width: 18px;
            height: 18px;
        }

        .share-container {
            display: flex;
            justify-content: center;
            width: 100%;
            margin-top: 10px;
        }

        /* Toast notification styling */
        .toast {
            position: fixed;
            top: 70px; /* Position below the fixed header */
            left: 50%;
            transform: translateX(-50%);
            background-color: var(--neutral-dark);
            color: white;
            padding: 12px 24px;
            border-radius: 30px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            z-index: 1100; /* Above the header's z-index */
            font-size: 0.9rem;
            font-weight: 500;
            opacity: 0;
            transition: opacity 0.3s ease;
            pointer-events: none;
        }

        .toast.visible {
            opacity: 1;
        }

        /* Add this to your CSS */
        .result-description {
            text-align: center;
            margin-top: 5px;
        }

        /* Add these styles to make the Number of Simulations dropdown consistent with other inputs */
        select#numSimulations {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--neutral-light);
            border-radius: var(--radius-sm);
            background-color: white;
            font-size: 1rem;
            font-family: inherit;
            color: var(--neutral-dark);
            appearance: auto; /* Ensures dropdown arrow is visible */
            box-sizing: border-box;
        }

        /* Apply the same styling to all dropdowns for consistency */
        select {
            width: 100%;
            padding: 14px; /* Use consistent padding */
            border: 1px solid var(--neutral-light);
            border-radius: var(--radius-sm);
            background-color: white;
            font-size: 1rem;
            font-family: inherit;
            color: var(--neutral-dark);
            box-sizing: border-box;
            /* margin-bottom: 16px; */ /* Remove redundant margin */
        }

        /* Ensure input groups are consistent */
        .input-section > div {
            margin-bottom: 16px;
            width: 100%;
        }

        /* Updated styles for tables and card-based data displays */
        .result-card table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 12px;
            border-radius: var(--radius-sm);
            overflow: hidden;
        }

        .result-card table th,
        .result-card table td {
            padding: 12px 16px;
            text-align: left;
            border-bottom: 1px solid var(--neutral-light);
        }

        .result-card table th {
            background-color: rgba(99, 102, 241, 0.08);
            color: var(--primary-dark);
            font-weight: 600;
            font-size: 0.95rem;
        }

        .result-card table tr:last-child td {
            border-bottom: none;
        }

        .result-card table tr:nth-child(even) {
            background-color: rgba(99, 102, 241, 0.03);
        }

        /* Duplicate milestones-grid, milestone, summary-grid, summary-card CSS removed — defined earlier */

        /* Add these styles for the new table and modal */
        .simulation-table-container {
            overflow-x: auto;
            margin-top: 16px;
            max-height: 500px; /* Set a max height for vertical scrolling */
            overflow-y: auto; /* Enable vertical scrolling */
            border: 1px solid var(--neutral-light);
            border-radius: var(--radius-sm);
        }

        .simulation-table {
            width: 100%;
            border-collapse: collapse;
        }

        .simulation-table th,
        .simulation-table td {
            padding: 10px;
            text-align: left;
            border-bottom: 1px solid var(--neutral-light);
        }

        .simulation-table th {
            position: sticky;
            top: 0; /* Make headers stick to the top when scrolling */
            background-color: rgba(99, 102, 241, 0.08);
            color: var(--primary-dark);
            font-weight: 600;
            z-index: 10; /* Ensure headers appear above content when scrolling */
        }

        .simulation-table tr:hover {
            background-color: rgba(99, 102, 241, 0.05);
        }

        .view-details-btn {
            padding: 5px 10px;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: var(--radius-sm);
            cursor: pointer;
            font-size: 0.9rem;
        }

        .view-details-btn:hover {
            background-color: var(--primary-dark);
        }

        .table-pagination {
            display: flex;
            justify-content: center;
            align-items: center;
            margin-top: 16px;
            gap: 16px;
        }

        .table-pagination button {
            padding: 6px 12px;
            background-color: white;
            border: 1px solid var(--neutral-light);
            border-radius: var(--radius-sm);
            cursor: pointer;
        }

        .table-pagination button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .simulation-detail-content {
            max-width: 900px;
            width: 90%;
        }

        .sim-detail-summary {
            display: flex;
            justify-content: space-between;
            margin: 24px 0;
            flex-wrap: wrap;
            gap: 16px;
        }

        .sim-detail-metric {
            background-color: white;
            padding: 16px;
            border-radius: var(--radius-sm);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
            min-width: 150px;
            flex: 1;
            text-align: center;
        }

        .metric-label {
            font-size: 0.9rem;
            color: var(--neutral);
            margin-bottom: 8px;
        }

        .metric-value {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--primary-dark);
        }

        .yearly-data-container {
            max-height: 300px;
            overflow-y: auto;
            margin: 16px 0;
            border: 1px solid var(--neutral-light);
            border-radius: var(--radius-sm);
        }

        .yearly-data-table {
            width: 100%;
            border-collapse: collapse;
        }

        .yearly-data-table th,
        .yearly-data-table td {
            padding: 8px 12px;
            text-align: left;
            border-bottom: 1px solid var(--neutral-light);
        }

        .yearly-data-table th {
            position: sticky;
            top: 0;
            background-color: white;
            font-weight: 600;
        }

        .sim-detail-chart-container {
            height: 300px;
            margin-top: 24px;
            width: 100%;
        }

        .table-pagination {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            margin-top: 16px;
        }

        /* Add these styles for sortable columns */
        .simulation-table th {
            cursor: pointer;
            user-select: none;
            position: relative;
        }

        .simulation-table th:hover {
            background-color: rgba(99, 102, 241, 0.15);
        }

        .simulation-table th.sorted-asc,
        .simulation-table th.sorted-desc {
            background-color: rgba(99, 102, 241, 0.2);
        }

        .sort-indicator {
            display: inline-block;
            margin-left: 5px;
            font-weight: bold;
        }

        /* Optional: Animation for sort indicator */
        .sort-indicator {
            animation: fadeIn 0.3s;
        }

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

        /* Duplicate .modal, .modal-content, .close-modal, @keyframes CSS removed — defined earlier */
        
        /* Ensure no extra space at bottom of page */
        .tab-content:last-child,
        .input-section:last-child,
        .results-container:last-child {
            margin-bottom: 0;
            padding-bottom: 0;
        }
        
        /* Duplicate .toast CSS removed — defined earlier */

        /* Add a success message for high retirement success rate */
        .success-message {
            position: fixed;
            bottom: 90px; /* Move it above the help button */
            left: 50%;
            transform: translateX(-50%) translateY(100px);
            background: var(--ai-gradient);
            color: white;
            padding: 15px 30px;
            border-radius: 30px;
            box-shadow: 0 4px 20px rgba(79, 70, 229, 0.4);
            font-size: 1.2rem;
            font-weight: 600;
            text-align: center;
            z-index: 1001;
            opacity: 0;
            animation: slideInBottom 0.5s forwards;
            max-width: 90%;
            pointer-events: none; /* Allow clicks to pass through */
        }

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

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

        .success-message.hide {
            animation: slideOutBottom 0.5s forwards;
        }
        
        /* Styles for header navigation */
        .header-nav {
            display: flex;
            gap: 10px; /* Reduce gap slightly */
            align-items: center;
        }
        
        .header-nav-link {
            display: flex;
            align-items: center;
            justify-content: center; /* Better center alignment */
            padding: 10px 20px; /* Adjust padding */
            /* background-color: rgba(255, 255, 255, 0.15); */ /* Remove old background */
            background-color: transparent;
            color: var(--neutral); /* Use neutral color for inactive */
            text-decoration: none;
            border-radius: var(--radius);
            font-weight: 600;
            font-size: 1rem; /* Slightly larger font */
            transition: all 0.2s ease;
            position: relative;
            border: 1px solid rgba(79, 70, 229, 0.2); /* Add subtle border */
        }
        
        .header-nav-link:hover {
            /* background-color: rgba(255, 255, 255, 0.25); */ /* Remove old background */
            background-color: rgba(79, 70, 229, 0.05); /* Very light primary on hover */
            color: var(--primary);
            /* transform: translateY(-1px); */ /* Remove transform */
            border-color: rgba(79, 70, 229, 0.3); /* Enhance border on hover */
        }
        
        .header-nav-link .nav-icon {
            margin-right: 8px;
            opacity: 1; /* Full opacity for better visibility */
            font-size: 1.1em;
            display: flex; /* Improve emoji alignment */
            align-items: center;
            justify-content: center;
        }

        /* Remove indicator for active link */
        /* .header-nav-link.active::after { ... } */ /* Remove underline */
        
        /* Enhanced active state with animation */
        .header-nav-link.active {
            /* background-color: rgba(255, 255, 255, 0.5); */ /* Remove old background */
            background-color: rgba(79, 70, 229, 0.1); /* Light primary background */
            /* box-shadow: 0 0 15px rgba(255, 255, 255, 0.5); */ /* Remove pulse shadow */
            /* transform: translateY(-2px); */ 
            /* padding: 8px 20px; */ 
            /* border: 2px solid white; */ 
            border-color: var(--primary); /* Primary color border for active state */
            /* animation: subtle-pulse 2s infinite; */ /* Remove animation */
            font-weight: 700;
            color: var(--primary); /* Use primary color for active text */
        }
        
        /* Animation for subtle pulsing effect */
        /* @keyframes subtle-pulse { ... } */ /* Remove animation */
        
        /* Make inactive links more subdued for contrast */
        .header-nav-link:not(.active) {
            /* opacity: 0.85; */ /* Remove opacity setting */
        }

        /* Improve form layout for both calculators on small screens */
        @media (max-width: 768px) {
            /* Ensure both calculator forms behave the same */
            #accumulation-tab .input-section,
            #retirement-tab .input-section {
                padding: 15px;
            }
            
            /* Give more breathing room to form elements */
            .input-section h2 {
                margin-top: 30px;
                font-size: 1.6rem;
            }
            
            /* First h2 shouldn't have top margin */
            .input-section h2:first-child {
                margin-top: 10px;
            }
            
            /* Make inputs more touch-friendly on mobile */
            input[type="text"],
            input[type="number"],
            select {
                font-size: 16px; /* Prevents iOS zoom on focus */
                padding: 12px;   /* Slightly smaller padding on mobile */
            }
            
            /* Ensure range sliders are easy to use */
            input[type="range"] {
                height: 10px; /* Slightly larger for touch */
            }
            
            /* Make labels more visible on small screens */
            label {
                font-size: 1rem;
                margin-bottom: 6px;
            }
            
            /* Make checkboxes more touch-friendly */
            input[type="checkbox"] {
                width: 20px;
                height: 20px;
                margin-right: 10px;
            }
            
            /* Fix the checkbox label layout */
            label[for="withdrawalAdjustment"] {
                display: flex;
                align-items: center;
                margin-top: 10px;
            }
            
            #withdrawalAdjustment {
                margin-top: 5px;
                margin-left: 0;
            }
            
            /* Fix tooltip positioning on narrow screens */
            .tooltip-container .tooltip-text {
                width: 200px;
                left: auto;
                right: 0;
                transform: none;
            }
            
            .tooltip-container .tooltip-text::after {
                left: auto;
                right: 10px;
            }
        }

        /* Updated result cards styling */
        
        /* Calculator intro styles */
        .calculator-title {
            font-size: 2rem;
            color: var(--primary);
            margin-bottom: 0.5rem;
            text-align: center;
        }
        
        .calculator-intro {
            font-size: 1.1rem;
            line-height: 1.6;
            color: var(--neutral);
            margin-bottom: 2rem;
            text-align: center;
            max-width: 900px;
            margin-left: auto;
            margin-right: auto;
        }
        
/* AI Analysis Feature */
        /* AI Analysis Button */
        .ai-analysis-container {
            display: flex;
            justify-content: center;
            margin: 20px 0;
        }
        
        .ai-analysis-button {
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 30px;
            font-size: 1.05rem;
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
            transition: all 0.3s ease;
        }
        
        .ai-analysis-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
        }
        
        /* AI Options Container */
        .ai-options-container {
            display: flex;
            gap: 20px;
            margin: 30px 0;
            flex-wrap: wrap;
        }
        
        .ai-option {
            flex: 1;
            min-width: 240px;
            padding: 25px;
            border-radius: var(--radius);
            border: 1px solid var(--neutral-light);
            background-color: white;
            box-shadow: var(--shadow);
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }
        
        .ai-option:hover {
            transform: translateY(-5px);
            box-shadow: var(--shadow-lg);
            border-color: var(--primary-light);
        }
        
        .ai-option-icon {
            color: var(--primary);
            margin-bottom: 15px;
        }
        
        .ai-option h3 {
            margin: 0 0 10px 0;
            color: var(--neutral-dark);
        }
        
        .ai-option p {
            margin: 0;
            color: var(--neutral);
            font-size: 0.9rem;
        }
        
        /* API Key Input Section */
        .api-key-input-container {
            display: flex;
            margin: 20px 0;
            width: 100%;
        }
        
        .api-key-input {
            flex: 1;
            padding: 12px;
            border: 1px solid var(--neutral-light);
            border-radius: var(--radius-sm) 0 0 var(--radius-sm);
            font-size: 1rem;
            font-family: monospace;
        }
        
        .api-key-submit {
            padding: 12px 24px;
            background-color: var(--primary);
            color: white;
            border: none;
            border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
            font-weight: 600;
            cursor: pointer;
        }
        
        .api-key-help {
            font-size: 0.9rem;
            color: var(--neutral);
            text-align: center;
        }
        
        .api-key-help a {
            color: var(--primary);
            text-decoration: none;
        }
        
        /* AI Analysis Results */
        .ai-analysis-content {
            background-color: #f8fafc;
            border-radius: var(--radius);
            padding: 20px;
            margin-top: 20px;
            border: 1px solid var(--neutral-light);
            max-height: 400px;
            overflow-y: auto;
        }
        
        .ai-loading {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 40px 0;
        }
        
        .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid rgba(79, 70, 229, 0.2);
            border-radius: 50%;
            border-top-color: var(--primary);
            animation: spin 1s linear infinite;
            margin-bottom: 20px;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        /* Additional styles for AI response content */
        .ai-response {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            line-height: 1.7;
        }
        
        .ai-response h1, 
        .ai-response h2, 
        .ai-response h3, 
        .ai-response h4 {
            color: var(--primary-dark);
            margin-top: 1.5em;
            margin-bottom: 0.75em;
        }
        
        .ai-response h1 {
            font-size: 1.5rem;
            border-bottom: 1px solid var(--neutral-light);
            padding-bottom: 0.5em;
        }
        
        .ai-response h2 {
            font-size: 1.3rem;
        }
        
        .ai-response h3 {
            font-size: 1.1rem;
        }
        
        .ai-response p {
            margin-bottom: 1em;
        }
        
        .ai-response ul, 
        .ai-response ol {
            margin-left: 1.5em;
            margin-bottom: 1em;
        }
        
        .ai-response li {
            margin-bottom: 0.5em;
        }
        
        .ai-response code {
            background-color: rgba(79, 70, 229, 0.1);
            padding: 0.2em 0.4em;
            border-radius: 3px;
            font-family: monospace;
            font-size: 0.9em;
        }
        
        .ai-response blockquote {
            border-left: 4px solid var(--primary-light);
            padding-left: 1em;
            margin-left: 0;
            color: var(--neutral);
            font-style: italic;
        }
        
        .ai-response table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 1em;
        }
        
        .ai-response th,
        .ai-response td {
            border: 1px solid var(--neutral-light);
            padding: 8px 12px;
            text-align: left;
        }
        
        .ai-response th {
            background-color: rgba(79, 70, 229, 0.05);
            font-weight: 600;
        }
        
        .ai-error {
            color: var(--danger);
            padding: 20px;
            text-align: center;
            background-color: rgba(239, 68, 68, 0.05);
            border-radius: var(--radius-sm);
            border: 1px solid rgba(239, 68, 68, 0.2);
        }

        /* =============================================
           UX IMPROVEMENTS — Feb 2026
           ============================================= */

        /* Skip to content link (accessibility) */
        .skip-to-content {
            position: absolute;
            top: -100px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--primary);
            color: white;
            padding: 12px 24px;
            border-radius: 0 0 var(--radius) var(--radius);
            z-index: 10000;
            font-weight: 600;
            text-decoration: none;
            transition: top 0.2s ease;
        }
        .skip-to-content:focus {
            top: 0;
        }

        /* Focus-visible for keyboard users */
        *:focus-visible {
            outline: 3px solid var(--primary-light);
            outline-offset: 2px;
        }
        /* Remove outline for mouse users */
        *:focus:not(:focus-visible) {
            outline: none;
        }

        /* Tab content transitions */
        .tab-content {
            animation: fadeInTab 0.25s ease-in-out;
        }
        @keyframes fadeInTab {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* Input error state */
        input.input-error,
        input.input-error:focus {
            border-color: var(--danger) !important;
            box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
        }
        .input-error-text {
            color: var(--danger);
            font-size: 0.8rem;
            margin-top: 4px;
            font-weight: 500;
        }

        /* Simulation button loading state */
        .simulation-button.loading {
            pointer-events: none;
            opacity: 0.85;
            position: relative;
        }
        .simulation-button.loading::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
            animation: shimmer 1.5s infinite;
        }
        @keyframes shimmer {
            to { left: 100%; }
        }

        /* Chart container responsive fix */
        .chart-container canvas {
            max-width: 100%;
            height: auto !important;
        }

        /* Very small screens (< 375px) */
        @media (max-width: 374px) {
            .milestones-grid {
                grid-template-columns: 1fr !important;
            }
            .summary-grid {
                grid-template-columns: 1fr !important;
            }
            .result-highlight {
                font-size: 2rem;
            }
            .calculator-title {
                font-size: 1.5rem;
            }
            .calculator-intro {
                font-size: 0.95rem;
            }
            .header-content {
                padding: 0 12px !important;
            }
            .results-container {
                padding: 15px 10px;
            }
            .result-card {
                padding: 15px;
            }
        }

        /* Small screens (375-480px) */
        @media (max-width: 480px) {
            .milestones-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            .sim-detail-summary {
                flex-direction: column;
            }
            .ai-options-container {
                flex-direction: column;
            }
            .filter-container {
                gap: 6px;
            }
            .filter-btn {
                padding: 8px 12px;
                font-size: 0.8rem;
            }
        }

        /* Override inline grid styles on mobile */
        @media (max-width: 640px) {
            .input-grid[style] {
                grid-template-columns: 1fr !important;
            }
        }

        /* Modal scroll fix for mobile */
        .modal-content {
            max-height: 85vh;
            max-height: 85dvh;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            margin: 5vh auto;
        }
        @media (max-width: 480px) {
            .modal-content {
                width: 96% !important;
                padding: 16px;
                margin: 2vh auto;
                max-height: 92vh;
                max-height: 92dvh;
            }
        }

        /* Retirement summary cards — fix dark-bg text contrast */
        .summary-item {
            background-color: var(--card-background) !important;
        }
        .summary-label {
            color: var(--neutral);
            font-size: 0.85rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.03em;
        }
        .summary-description {
            color: var(--neutral) !important;
        }

        /* Ensure tables scroll horizontally on small screens */
        .simulation-table-container,
        .table-container,
        .yearly-data-container {
            -webkit-overflow-scrolling: touch;
        }

        /* Simulation details table: collapsible on mobile */
        @media (max-width: 768px) {
            .simulation-table-container {
                max-height: 300px;
            }
        }

        /* Help modal sections: improve readability */
        .help-section {
            margin-bottom: 2rem;
        }
        .help-section h3 {
            color: var(--primary);
            font-size: 1.3rem;
            margin-bottom: 0.75rem;
            border-bottom: 2px solid var(--primary-light);
            padding-bottom: 0.5rem;
        }
        .help-section h4 {
            color: var(--neutral-dark);
            margin-top: 1.2rem;
            margin-bottom: 0.5rem;
        }
        .help-section ul, .help-section ol {
            padding-left: 1.5rem;
            margin-bottom: 1rem;
        }
        .help-section li {
            margin-bottom: 0.4rem;
            line-height: 1.6;
        }

        /* =============================================
           INCOME SOURCES — Collapsible Section
           ============================================= */
        .collapsible-section {
            margin: 24px 0;
            border: 1px solid var(--border-color);
            border-radius: var(--radius);
            overflow: hidden;
        }
        .collapsible-toggle {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            padding: 14px 18px;
            background: var(--background);
            border: none;
            cursor: pointer;
            font-size: 1rem;
            font-weight: 600;
            color: var(--neutral-dark);
            text-align: left;
            transition: background 0.2s;
        }
        .collapsible-toggle:hover {
            background: var(--neutral-light);
        }
        .collapsible-chevron {
            display: inline-block;
            transition: transform 0.2s;
            font-size: 0.75rem;
        }
        .collapsible-toggle[aria-expanded="true"] .collapsible-chevron {
            transform: rotate(90deg);
        }
        .collapsible-content {
            padding: 16px 18px 20px;
            border-top: 1px solid var(--border-color);
        }
        .income-group {
            margin-bottom: 20px;
            padding-bottom: 16px;
            border-bottom: 1px solid var(--neutral-light);
        }
        .income-group:last-child {
            margin-bottom: 0;
            padding-bottom: 0;
            border-bottom: none;
        }
        .checkbox-label {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 600;
            font-size: 0.95rem;
            color: var(--neutral-dark);
            cursor: pointer;
            margin-bottom: 12px;
        }
        .checkbox-label input[type="checkbox"] {
            width: 18px;
            height: 18px;
            margin: 0;
        }
        .income-subfields {
            margin-left: 26px;
        }

        /* =============================================
           TAX STRATEGY SECTION
           ============================================= */
        .tax-strategy-section {
            margin-top: 24px;
            margin-bottom: 16px;
            border: 1px solid var(--border-color);
            border-radius: var(--radius);
            padding: 16px 20px;
            background: var(--card-background);
        }
        .tax-strategy-header {
            cursor: pointer;
            user-select: none;
        }
        .tax-strategy-header h2 {
            font-size: 1.3rem !important;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        #taxStrategyToggle {
            font-size: 0.8rem;
            color: var(--neutral);
            transition: transform 0.2s;
        }
        .tax-mode-selector {
            display: flex;
            gap: 16px;
            margin-bottom: 12px;
        }
        .tax-mode-option {
            display: flex;
            align-items: center;
            gap: 6px;
            cursor: pointer;
            font-weight: 500;
            padding: 8px 16px;
            border: 1px solid var(--border-color);
            border-radius: var(--radius-sm);
            transition: var(--transition);
        }
        .tax-mode-option:has(input:checked) {
            border-color: var(--primary);
            background: rgba(79, 70, 229, 0.05);
        }
        .tax-mode-option input[type="radio"] {
            accent-color: var(--primary);
        }
        .tax-mode-label {
            font-size: 0.95rem;
        }

        /* Account mix bar */
        .account-mix-bar {
            display: flex;
            height: 12px;
            border-radius: 6px;
            overflow: hidden;
            background: var(--neutral-light);
            margin-top: 8px;
        }
        .mix-pretax {
            background: var(--primary);
            transition: width 0.3s;
        }
        .mix-roth {
            background: var(--success);
            transition: width 0.3s;
        }
        .mix-taxable {
            background: var(--warning);
            transition: width 0.3s;
        }
        .account-mix-legend {
            display: flex;
            gap: 16px;
            margin-top: 6px;
            font-size: 0.82rem;
            color: var(--neutral);
        }
        .mix-legend-item {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        .mix-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            display: inline-block;
        }
        .mix-dot-pretax { background: var(--primary); }
        .mix-dot-roth { background: var(--success); }
        .mix-dot-taxable { background: var(--warning); }
        .tax-mix-warning {
            color: var(--danger);
            font-size: 0.85rem;
            font-weight: 500;
            margin-top: 6px;
        }

        @media (max-width: 480px) {
            .tax-mode-selector {
                flex-direction: column;
                gap: 8px;
            }
        }

        /* Thumb-friendly touch targets */
        @media (max-width: 768px) {
            .header-nav-link {
                min-height: 44px;
                min-width: 44px;
            }
            .filter-btn {
                min-height: 44px;
            }
            .view-details-btn {
                min-height: 44px;
                padding: 8px 16px;
            }
            .round-button {
                width: 56px;
                height: 56px;
                bottom: 16px;
                right: 16px;
            }
        }
