        :root {
            /* Mapped from main.css */
            --main-color: #1A48EE;
            --secondary-color: #008AFF;
            --tertiary-color: #2c20E6;
            --secondary-background: #f9f9f9;
            --main-background: #e5f3ff;
            --color-white: #ffffff;
            --color-error-dark: #c53030;
            --color-green: #16a34a;
            --color-gray: #4a5568;
            --border-color: #e2e8f0;
            
            /* Alias for existing logic */
            --primary: var(--main-color);
            --primary-dark: var(--tertiary-color);
            --text-main: #1a202c;
            --text-muted: #4a5568; /* Hardcoded darkened gray for better contrast (approx 7.6:1 on white) */
            --border: var(--border-color);
            --success: #15803d; /* Darkened from #16a34a (green-700) for better text contrast if used */
            --warning: #b45309; /* Darkened from #d97706 for WCAG AA compliance (4.5:1+) */
            --danger: var(--color-error-dark);
            --indigo: var(--secondary-color);
            --bg-card: var(--color-white);
        }

        /* Calculator Scoped Styles */
        /* Note: 'body' styles removed to let global css handle page background */
        
        .grid-container { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
        @media (min-width: 992px) { .grid-container { grid-template-columns: 1fr 1fr; gap: 2.5rem; } }

        /* Results Styling */
        #results-container {
            margin-top: 1.5rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--border-color);
        }

        .results-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 1.5rem;
            text-align: center;
        }

        @media (min-width: 576px) {
            .results-grid { grid-template-columns: repeat(3, 1fr); }
        }
        
        .amount-primary {
            font-size: 2.5rem;
            font-weight: 800;
            color: var(--main-color);
            display: block;
            line-height: 1.1;
            letter-spacing: -0.02em;
        }
        @media (max-width: 576px) {
            .amount-primary { font-size: 2rem; }
        }

        .amount-secondary {
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--text-main);
            display: block;
            margin-top: 0.25rem;
        }

        /* Table Styling */
        .amortization-table-container {
            max-height: 400px;
            overflow-y: auto;
            border: 1px solid var(--border-color);
            border-radius: 0.5rem;
            margin-top: 1rem;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
            -webkit-overflow-scrolling: touch;
        }

        .amortization-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; white-space: nowrap; }
        .amortization-table th, .amortization-table td { padding: 1rem; border-bottom: 1px solid var(--border-color); text-align: left; }
        .amortization-table th { background-color: var(--secondary-background); font-weight: 600; position: sticky; top: 0; z-index: 10; color: #334155; /* Darker than muted for table headers (Slate-700) */ }
        .amortization-table tr:hover { background-color: #f8fafc; }

        /* General Utilities */
        .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }
        :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

        /* Page Title */
        .page-title { 
            font-size: 2.25rem; 
            font-weight: 800; 
            color: var(--text-main); 
            text-align: center;
            margin: 0 0 2rem 0;
            line-height: 1.2;
            padding-top: 1rem;
        }

        /* Sticky Sidebar for Results */
        @media (min-width: 992px) {
            .output-col { position: sticky; top: 100px; height: fit-content; }
        }

        /* Cards */
        .card { 
            background: var(--bg-card); 
            border: 1px solid var(--border-color); 
            border-radius: 0.75rem; 
            padding: 1.5rem; 
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04); 
            margin-bottom: 1.5rem; 
            transition: transform 0.2s, box-shadow 0.2s;
        }
        @media (min-width: 768px) { .card { padding: 2rem; } }
        
        .section-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.5rem; display: flex; align-items: center; color: var(--text-main); }
        .section-title i { color: var(--primary); margin-right: 0.75rem; background: var(--main-background); padding: 8px; border-radius: 6px; font-size: 1rem; }
        
        .subsection-title { 
            font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: #64748b; /* Slate-500, Contrast ~4.6:1 on white */ margin-bottom: 0.75rem; display: block;
        }

        /* Form Controls */
        .form-group { margin-bottom: 1.5rem; }
        .form-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
        @media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }
        
        label { display: block; font-size: 0.95rem; font-weight: 600; color: var(--text-main); margin-bottom: 0.5rem; }
        .helper-text { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; line-height: 1.4; }

        .input-group { display: flex; box-shadow: 0 1px 2px rgba(0,0,0,0.05); border-radius: 0.5rem; }
        .input-group select { width: auto; border-radius: 0.5rem 0 0 0.5rem; border-right: 0; background-color: var(--secondary-background); border-color: var(--border); padding-right: 2rem; }
        .input-group input { border-radius: 0 0.5rem 0.5rem 0; flex: 1; border-color: var(--border); }

        input[type="text"], input[type="number"], select {
            width: 100%; padding: 0.85rem 1rem; 
            border: 1px solid var(--border-color); 
            border-radius: 0.5rem;
            font-family: inherit; font-size: 1rem; 
            transition: all 0.2s ease; 
            background-color: #fff;
            color: var(--text-main);
            min-height: 48px;
        }
        
        input:focus, select:focus { 
            outline: none; border-color: var(--primary); 
            box-shadow: 0 0 0 3px rgba(26, 72, 238, 0.15); transform: translateY(-1px);
        }
        
        .divider { height: 1px; background-color: var(--border); margin: 2rem 0; border: none; opacity: 0.6; }

        /* Mode Switcher */
        .mode-selector-wrapper {
            margin-bottom: 2rem;
            border-bottom: 1px solid var(--border);
            padding-bottom: 1.5rem;
        }
        .mode-selector { 
            display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; 
        }
        .mode-label { font-weight: 700; font-size: 1rem; display: flex; align-items: center; color: var(--text-main); margin-bottom: 0.5rem; }
        
        .switch-container { 
            display: flex; background: var(--secondary-background); padding: 0.35rem; 
            border-radius: 0.75rem; width: 100%; max-width: 350px; border: 1px solid var(--border);
            box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
        }
        @media (max-width: 640px) {
            .mode-selector { flex-direction: column; align-items: flex-start; }
            .switch-container { max-width: 100%; }
        }

        .switch-btn { 
            flex: 1; text-align: center; padding: 0.6rem; font-size: 0.9rem; 
            border-radius: 0.5rem; cursor: pointer; font-weight: 600; color: #64748b; /* Darker than original muted */
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
        }
        .switch-btn:hover {
            color: var(--primary);
        }
        .switch-btn.active { 
            background: white; color: var(--primary); 
            box-shadow: 0 2px 4px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04); 
            transform: scale(1.02);
        }

        .hidden { display: none; }

        /* Buttons */
        .btn { 
            display: inline-flex; align-items: center; justify-content: center; 
            padding: 0.85rem 1.5rem; border-radius: 0.5rem; font-weight: 600; 
            font-size: 1rem; cursor: pointer; transition: all 0.2s; 
            border: none; font-family: inherit; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); 
            min-height: 48px;
        }
        .btn:active { transform: translateY(1px); box-shadow: none; }
        .btn-primary { background-color: var(--primary); color: white; }
        .btn-primary:hover { background-color: var(--primary-dark); box-shadow: 0 6px 10px -2px rgba(26, 72, 238, 0.3); }
        .btn-outline { background-color: white; border: 1px solid var(--border); color: var(--text-main); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
        .btn-outline:hover { background-color: var(--secondary-background); border-color: var(--text-muted); color: var(--primary); }
        
        .action-bar { display: flex; gap: 1rem; margin-top: 2rem; justify-content: center; flex-wrap: wrap; }
        @media (max-width: 576px) {
            .action-bar { flex-direction: column; }
            .btn { width: 100%; }
        }

        /* Chart & Legend */
        .chart-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: center; }
        @media (min-width: 768px) { .chart-layout { grid-template-columns: 180px 1fr; } }
        
        .chart-container { width: 180px; height: 180px; position: relative; margin: 0 auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05)); }
        .donut-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
        .donut-val { font-size: 1.4rem; font-weight: 700; color: var(--text-main); }
        .donut-sub { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
        .donut-segment { transition: stroke-dasharray 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
        
        .legend-list { list-style: none; padding: 0; }
        .legend-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; border-radius: 0.5rem; margin-bottom: 0.25rem; transition: background 0.2s; }
        .legend-item:hover { background-color: var(--secondary-background); }
        .legend-info { display: flex; align-items: center; }
        .dot { width: 0.75rem; height: 0.75rem; border-radius: 2px; margin-right: 0.75rem; flex-shrink: 0; }
        .legend-label { font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }
        .legend-val { font-size: 0.9rem; font-weight: 700; color: var(--text-main); }

        /* Comparison Table Actions */
        .delete-btn { color: #64748b; /* Darkened from original text-muted */ cursor: pointer; background: transparent; border: 1px solid transparent; padding: 0.4rem; font-size: 0.9rem; border-radius: 0.375rem; transition: all 0.2s; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
        .delete-btn:hover { color: var(--danger); background-color: #fee2e2; border-color: #fca5a5; }

        /* Modal */
        .modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(2px); z-index: 200; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; padding: 1rem; }
        .modal-overlay.open { display: flex; opacity: 1; }
        .modal { background: white; width: 100%; max-width: 800px; max-height: 90vh; border-radius: 1rem; display: flex; flex-direction: column; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
        .modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--secondary-background); border-radius: 1rem 1rem 0 0; }
        .modal-title { font-size: 1.25rem; font-weight: 700; margin: 0; color: var(--text-main); }
        .modal-close { cursor: pointer; font-size: 1.5rem; color: #64748b; /* Slate-500 */ background: white; border: 1px solid var(--border); width: 2.5rem; height: 2.5rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all 0.2s; }
        .modal-close:hover { background-color: var(--primary); color: white; border-color: var(--primary); }
        .modal-body { padding: 1.5rem; overflow-y: auto; }

        /* Expert Analysis Box */
        .analysis-box {
            margin-top: 1.5rem; 
            background: #fffbe6; /* Matches disclaimer in main.css */
            border: 1px solid #ffe58f; 
            padding: 1.5rem; 
            border-radius: 0.75rem;
            position: relative;
        }
        .analysis-box::before {
            content: '\f0eb'; font-family: "Font Awesome 6 Free"; font-weight: 900;
            position: absolute; top: 1.5rem; right: 1.5rem;
            font-size: 1.5rem; color: var(--warning); opacity: 0.4; /* Increased opacity from 0.2 to 0.4 for better visibility */
        }

        /* Educational Footer */
        .edu-section { margin-top: 3rem; background: #fff; padding: 1.5rem; border-radius: 0.75rem; border: 1px solid var(--border); }
        @media (min-width: 768px) { .edu-section { padding: 2.5rem; } }
        .edu-term { margin-bottom: 1.5rem; }
        .edu-term dt { font-weight: 700; color: var(--primary); margin-bottom: 0.35rem; font-size: 0.95rem; }
        .edu-term dd { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

        /* Calc Footer */
        .calc-footer {border-top: 1px dotted var(--border); color: var(--text-muted); font-size: 0.8rem; text-align: center; }
        .privacy-note strong { color: var(--primary); display: inline; font-size: 0.9rem; } /* Changed display to inline */