/* ============= Global Styles ============= */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --surface-bg: #ffffff;
    --surface-muted: #f8f9fa;
    --surface-border: #dee2e6;
    --page-bg: #f5f7fa;
    --text-body: #333;
    --text-strong: #212529;
    --text-muted: #6c757d;
    --selection-bg: #f0f6ff;
    --text-accent: #1565c0;
    --status-success-bg: #d4edda;
    --status-success-text: #155724;
    --status-warning-bg: #fff3cd;
    --status-warning-text: #664d03;
    --status-danger-text: #b71c1c;
    --status-neutral-bg: #cfd8dc;
    --status-neutral-text: #546e7a;
    --matrix-green-bg: #a3d9a5;
    --matrix-green-text: #0a3d0a;
    --matrix-yellow-bg: #ffe082;
    --matrix-yellow-text: #5d4200;
    --matrix-red-bg: #ef9a9a;
    --matrix-red-text: #5a0000;
    --panel-accent-bg: #f0f4ff;
}

body {
    background-color: var(--page-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-body);
    overflow-x: hidden;
}

/* ============= Main Layout ============= */

.main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
}

.main-content {
    flex: 1;
    padding: 2rem 0;
    overflow-x: hidden;
}

.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.brand-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

/* ============= Hero Section ============= */

.hero-section {
    text-align: center;
    padding: 2rem 0;
}

.hero-section h1 {
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-strong);
}

/* ============= Form Styles ============= */

.profile-form {
    background: var(--surface-bg);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.form-section {
    padding: 2rem;
    border-bottom: 1px solid var(--surface-border);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section-compact {
    padding: 1rem 1.25rem;
}

.form-section-compact .section-title {
    margin-bottom: 0.75rem;
}

.form-section-compact .form-group.mb-4 {
    margin-bottom: 0.85rem !important;
}

.form-section.bg-light {
    background-color: var(--surface-muted);
}

.section-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-strong);
}

.section-title .badge {
    font-weight: 400;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* ============= Form Inputs ============= */

.form-label {
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.form-control,
.form-control-lg,
.form-select {
    border: 1px solid var(--surface-border);
    border-radius: 0.5rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-control-lg:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-control-lg,
.form-control-lg:focus {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
}

.input-group-text {
    background-color: var(--surface-muted);
    border: 1px solid var(--surface-border);
}

/* ============= Sliders ============= */

.slider-container {
    margin: 1rem 0;
}

.form-range {
    height: 0.5rem;
    border-radius: 0.25rem;
}

.form-range::-webkit-slider-thumb {
    background-color: var(--primary-color);
    border: none;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.form-range::-moz-range-thumb {
    background-color: var(--primary-color);
    border: none;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3);
}

.slider-value {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-value .badge {
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

.investing-sliders {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.investing-sliders .form-group.mb-4 {
    margin-bottom: 0.9rem !important;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 0.75rem;
    row-gap: 0.25rem;
}

.investing-sliders .form-label {
    margin-bottom: 0;
    font-size: 0.95rem;
    grid-column: 1;
    grid-row: 1;
}

.investing-sliders .form-group.mb-4 > .form-text {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 0 0 0.15rem 0 !important;
    font-size: 0.82rem;
}

.investing-sliders .form-range {
    grid-column: 1 / -1;
    grid-row: 3;
    margin: 0.1rem 0 0;
}

.investing-sliders .slider-value {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    gap: 0.5rem;
    flex-wrap: wrap;
    white-space: normal;
    text-align: right;
}

.investing-sliders .slider-value .badge {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

.investing-sliders .slider-value small {
    line-height: 1.2;
    font-size: 0.8rem;
}

@media (max-width: 992px) {
    .investing-sliders .form-group.mb-4 {
        grid-template-columns: 1fr;
        row-gap: 0.35rem;
    }

    .investing-sliders .slider-value {
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
        text-align: left;
    }

    .investing-sliders .form-group.mb-4 > .form-text {
        grid-row: 3;
    }

    .investing-sliders .form-range {
        grid-row: 4;
    }
}

@media (max-width: 576px) {
    .investing-sliders .slider-value {
        gap: 0.35rem;
    }
}

/* ============= Radio Buttons & Checkboxes ============= */

.form-check {
    margin-bottom: 1rem;
}

.form-check-input {
    width: 1.25em;
    height: 1.25em;
    margin-top: 0.3em;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-label {
    cursor: pointer;
    margin-left: 0.5rem;
}

/* ============= Life Event Selection ============= */

.life-event-options {
    display: grid;
    gap: 1rem;
}

.life-event-options .form-check {
    margin-bottom: 0;
}

.life-event-options .form-check-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    border: 2px solid var(--surface-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.life-event-options .form-check-label:hover {
    border-color: var(--primary-color);
    background-color: var(--surface-muted);
}

.life-event-options .form-check-input:checked + .form-check-label {
    border-color: var(--primary-color);
    background-color: var(--selection-bg);
}

.life-event-options .emoji {
    font-size: 1.75rem;
}

.life-event-options .label {
    font-weight: 600;
    color: var(--text-strong);
    font-size: 1rem;
}

.life-event-options .description {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ============= Life Event Form ============= */

.life-event-form {
    padding: 1.5rem 0;
}

/* ============= Info Icons ============= */

.info-icon {
    display: inline-block;
    cursor: help;
    opacity: 0.6;
    margin-left: 0.5rem;
    transition: opacity 0.2s;
}

.info-icon:hover {
    opacity: 1;
}

/* ============= Alerts ============= */

.alert {
    border-radius: 0.5rem;
    border: none;
}

.alert-info {
    background-color: var(--bs-info-bg-subtle);
    color: var(--bs-info-text-emphasis);
}

.alert-warning {
    background-color: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
}

.alert-danger {
    background-color: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text-emphasis);
}

/* ============= Buttons ============= */

.btn {
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: #0b5ed7;
    border-color: #0b5ed7;
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ============= Loading Spinner ============= */

.loading-spinner {
    animation: rotate 2s linear infinite;
    width: 50px;
    height: 50px;
}

.loading-spinner .path {
    stroke: var(--primary-color);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

#app:empty,
#app .loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    flex-direction: column;
}

/* ============= Validation ============= */

.valid-feedback {
    display: block;
    color: var(--success-color);
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.invalid-feedback {
    display: block;
    color: var(--danger-color);
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.is-invalid {
    border-color: var(--danger-color);
}

.is-invalid:focus {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* ============= Badge Styles ============= */

.badge {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ============= Affordability Matrix ============= */

.affordability-matrix-wrapper {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-top: 2rem;
}

.affordability-matrix-wrapper.matrix-compact {
    padding: 0.9rem;
    margin-top: 0.25rem;
}

.affordability-matrix-wrapper.matrix-compact .matrix-title {
    font-size: 1rem;
    margin-bottom: 0.1rem;
}

.affordability-matrix-wrapper.matrix-compact .matrix-subtitle {
    margin-bottom: 0.5rem;
    font-size: 0.82rem;
}

.affordability-matrix-wrapper.matrix-compact .matrix-table {
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
}

.affordability-matrix-wrapper.matrix-compact .matrix-table-container {
    max-height: 360px;
}

.affordability-matrix-wrapper.matrix-compact .matrix-cell {
    padding: 0.45rem 0.35rem;
}

.affordability-matrix-wrapper.matrix-compact .cell-age {
    font-size: 0.92rem;
}

.affordability-matrix-wrapper.matrix-compact .cell-year,
.affordability-matrix-wrapper.matrix-compact .cell-dp,
.affordability-matrix-wrapper.matrix-compact .cell-dp-today,
.affordability-matrix-wrapper.matrix-compact .cell-monthly,
.affordability-matrix-wrapper.matrix-compact .cell-strategy,
.affordability-matrix-wrapper.matrix-compact .cell-shortfall {
    font-size: 0.66rem;
}

.affordability-matrix-wrapper.matrix-compact .matrix-legend {
    gap: 0.55rem;
    font-size: 0.72rem;
}

.matrix-title {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.matrix-subtitle {
    color: #6c757d;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.matrix-table-container {
    position: relative;
    overflow: auto;
    max-height: 440px;
}

.matrix-table {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.matrix-corner {
    background: var(--surface-muted);
}

.matrix-col-header {
    background: var(--surface-muted);
    min-width: 130px;
}

.matrix-col-header .dp-percent {
    font-weight: 700;
    font-size: 1rem;
}

.matrix-col-header .dp-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.matrix-row-header {
    background: var(--surface-muted);
    min-width: 120px;
    vertical-align: middle;
}

.matrix-row-header .price-amount {
    font-weight: 600;
    font-size: 0.95rem;
}

.matrix-row-header .price-offset {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.matrix-cell {
    vertical-align: middle;
    padding: 0.75rem 0.5rem;
    transition: background-color 0.3s ease;
    position: relative;
}

.matrix-cell {
    cursor: pointer;
}

.matrix-cell:hover {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.matrix-cell.matrix-cell-selected {
    outline: 3px solid var(--primary-color);
    outline-offset: -3px;
}

.cell-selected-badge {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    font-size: 0.62rem;
    line-height: 1;
    font-weight: 700;
    background: var(--primary-color);
    color: #fff;
    padding: 0.2rem 0.35rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.affordability-matrix-wrapper.matrix-compact .cell-selected-badge {
    top: 0.2rem;
    right: 0.2rem;
    font-size: 0.56rem;
    padding: 0.16rem 0.3rem;
}

td.matrix-cell-green {
    background-color: var(--matrix-green-bg) !important;
    color: var(--matrix-green-text);
}

td.matrix-cell-yellow {
    background-color: var(--matrix-yellow-bg) !important;
    color: var(--matrix-yellow-text);
}

td.matrix-cell-red {
    background-color: var(--matrix-red-bg) !important;
    color: var(--matrix-red-text);
}

td.matrix-cell-never {
    background-color: var(--status-neutral-bg) !important;
    color: var(--status-neutral-text);
}

.cell-age {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
}

.cell-year {
    font-size: 0.8rem;
}

.cell-dp {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 0.15rem;
}

.cell-dp-today {
    font-size: 0.65rem;
    opacity: 0.6;
    font-style: italic;
}

.strategy-today-note {
    font-size: 0.8rem;
    font-weight: normal;
    opacity: 0.7;
    margin-left: 0.25rem;
}

.cell-strategy {
    font-size: 0.65rem;
    margin-top: 0.25rem;
    opacity: 0.7;
    font-style: italic;
}

.cell-shortfall {
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

.matrix-strategy-detail {
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: var(--panel-accent-bg);
    border-radius: 0.5rem;
    border-left: 4px solid var(--primary-color);
}

.strategy-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--text-strong);
}

.strategy-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.strategy-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    padding: 0.4rem 0.6rem;
    background: var(--surface-bg);
    border-radius: 0.375rem;
}

.step-account {
    font-weight: 600;
    min-width: 180px;
}

.step-amount {
    font-weight: 500;
    min-width: 80px;
}

.step-tax {
    color: var(--status-danger-text);
    font-size: 0.8rem;
}

.step-tax-free {
    color: var(--success-color);
    font-size: 0.8rem;
    font-weight: 500;
}

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

/* Monthly payment in matrix cells */
.cell-monthly {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.2rem;
    color: var(--text-accent);
}

/* Monthly payment detail panel */
.matrix-payment-detail {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface-muted);
    border: 1px solid var(--surface-border);
    border-radius: 0.5rem;
}

.payment-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-strong);
    margin-bottom: 0.75rem;
}

.payment-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 0.2rem 0;
}

.payment-row.payment-total {
    border-top: 1px solid var(--surface-border);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    font-size: 0.95rem;
}

.payment-row.payment-pmi .payment-label {
    color: var(--status-warning-text);
}

.payment-note {
    font-size: 0.75rem;
    opacity: 0.7;
    font-style: italic;
}

.payment-assumptions {
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.matrix-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* ============= Dashboard ============= */

.dashboard-hero {
    border-radius: 0.75rem;
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
    color: white;
}

.dashboard-hero h2 {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.hero-detail {
    opacity: 0.9;
    margin-bottom: 0;
}

.hero-success {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
}

.hero-warning {
    background: linear-gradient(135deg, #cc8400 0%, #ffc107 100%);
    color: #212529;
}

.hero-warning .hero-detail {
    color: #3d2600;
}

.section-heading {
    font-weight: 600;
    font-size: 1.15rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #212529;
}

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

.account-card {
    background: var(--surface-bg);
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.account-card-total {
    background: var(--status-success-bg);
    border: 2px solid var(--success-color);
}

.account-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.account-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-strong);
    overflow-wrap: anywhere;
}

.account-card-total .account-value {
    color: var(--success-color);
}

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

.contrib-card {
    background: var(--surface-bg);
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

.contrib-account {
    font-weight: 600;
    font-size: 0.95rem;
}

.contrib-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
}

.contrib-maxed {
    background: var(--status-success-bg);
    color: var(--status-success-text);
}

.contrib-room {
    background: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.contrib-ineligible {
    background: var(--status-neutral-bg);
    color: var(--status-neutral-text);
}

.contrib-bar-track {
    height: 8px;
    background: var(--surface-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.contrib-bar-fill {
    height: 100%;
    background: #ffc107;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.contrib-bar-maxed {
    background: #198754;
}

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

.contrib-gap {
    color: #856404;
}

.contrib-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

.strategy-table-wrapper {
    background: var(--surface-bg);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    margin-bottom: 1rem;
}

.strategy-table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.strategy-table thead th {
    background: var(--surface-muted);
    border-bottom: 2px solid var(--surface-border);
    white-space: nowrap;
}

.strategy-table tfoot td {
    border-top: 2px solid var(--surface-border);
    background: var(--surface-muted);
}

.projection-table-wrapper {
    background: var(--surface-bg);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    margin-bottom: 2rem;
    max-height: 500px;
    overflow-y: auto;
}

.projection-table {
    margin-bottom: 0;
    font-size: 0.85rem;
}

.projection-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.projection-table thead th {
    background: var(--surface-muted);
    border-bottom: 2px solid var(--surface-border);
    white-space: nowrap;
}

.projection-target-row {
    background-color: var(--status-warning-bg) !important;
}

.projection-target-row td {
    font-weight: 600;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 1rem 0 2rem;
}

/* ============= Life Event Grid ============= */

.life-event-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.life-event-grid .btn {
    white-space: nowrap;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

/* ============= Responsive Design ============= */

@media (max-width: 768px) {
    .life-event-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .form-section {
        padding: 1.5rem 1rem;
    }

    .section-title {
        font-size: 1rem;
    }

    .hero-section {
        padding: 1.5rem 1rem;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .life-event-options .emoji {
        font-size: 1.5rem;
    }

    .form-control,
    .form-control-lg {
        font-size: 1rem;
    }

    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }

    .affordability-matrix-wrapper {
        padding: 0.75rem;
        margin-top: 1rem;
    }

    .matrix-table-container {
        max-height: 300px;
        -webkit-overflow-scrolling: touch;
    }

    .matrix-table {
        font-size: 0.75rem;
    }

    .cell-age {
        font-size: 0.85rem;
    }

    .matrix-col-header {
        min-width: 80px;
    }

    .matrix-row-header {
        min-width: 90px;
    }

    .matrix-cell {
        padding: 0.4rem 0.25rem;
    }

    .cell-dp,
    .cell-dp-today,
    .cell-monthly,
    .cell-shortfall {
        font-size: 0.6rem;
    }

    .matrix-legend {
        font-size: 0.75rem;
        gap: 0.5rem;
    }

    .dashboard-hero {
        padding: 1.5rem 1rem;
    }

    .dashboard-hero h2 {
        font-size: 1.2rem;
    }

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

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

    .dashboard-actions {
        flex-direction: column;
    }

    .dashboard-actions .btn {
        width: 100%;
    }
}

/* ============= Dark Mode (Optional) ============= */

@media (prefers-color-scheme: dark) {
    :root {
        --surface-bg: #2d2d2d;
        --surface-muted: #333;
        --surface-border: #444;
        --page-bg: #1a1a1a;
        --text-body: #e0e0e0;
        --text-strong: #e0e0e0;
        --text-muted: #aaa;
        --selection-bg: #25292d;
        --text-accent: #90caf9;
        --status-success-bg: #1b3a1b;
        --status-success-text: #66bb6a;
        --status-warning-bg: #3d3200;
        --status-warning-text: #ffe082;
        --status-danger-text: #ef9a9a;
        --status-neutral-bg: #455a64;
        --status-neutral-text: #b0bec5;
        --matrix-green-bg: #2e7d32;
        --matrix-green-text: #e8f5e9;
        --matrix-yellow-bg: #f9a825;
        --matrix-yellow-text: #fff8e1;
        --matrix-red-bg: #c62828;
        --matrix-red-text: #ffebee;
        --panel-accent-bg: #1e2a3a;
    }

    body {
        background-color: var(--page-bg);
        color: var(--text-body);
    }

    .form-control,
    .form-control-lg,
    .form-select {
        background-color: #2d2d2d;
        border-color: #444;
        color: #e0e0e0;
    }

    .form-control:focus,
    .form-control-lg:focus {
        background-color: #2d2d2d;
        border-color: var(--primary-color);
    }

    .profile-form {
        background-color: var(--surface-bg);
    }

    .form-section {
        border-bottom-color: var(--surface-border);
    }

    .form-section.bg-light {
        background-color: #25292d;
    }

    .section-title,
    .form-label,
    .life-event-options .label {
        color: #e0e0e0;
    }

    .life-event-options .description {
        color: #aaa;
    }

    .life-event-options .form-check-label {
        border-color: #444;
    }

    .life-event-options .form-check-label:hover {
        background-color: #333;
    }

    .input-group-text {
        background-color: var(--surface-muted);
        border-color: var(--surface-border);
        color: #e0e0e0;
    }

    .affordability-matrix-wrapper {
        background-color: var(--surface-bg);
    }

    .matrix-corner,
    .matrix-col-header,
    .matrix-row-header {
        background-color: #333;
        color: #e0e0e0;
    }

    .matrix-strategy-detail {
        background: var(--panel-accent-bg);
        border-left-color: #5c8dff;
    }

    .strategy-step {
        background: var(--surface-bg);
    }

    .matrix-recalculating-overlay {
        background: rgba(30, 30, 30, 0.7);
        color: #ccc;
    }

    .matrix-subtitle,
    .matrix-legend {
        color: #aaa;
    }

    .matrix-payment-detail {
        background: var(--surface-muted);
        border-color: var(--surface-border);
    }

    .payment-title {
        color: var(--text-strong);
    }

    .payment-row { color: #d4d4d4; }

    .payment-row.payment-total {
        border-top-color: var(--surface-border);
    }

    .payment-assumptions {
        color: var(--text-muted);
    }

    .section-heading {
        color: #e0e0e0;
    }

    .account-card {
        background: var(--surface-bg);
    }

    .account-card-total {
        background: var(--status-success-bg);
        border-color: var(--success-color);
    }

    .account-label {
        color: #aaa;
    }

    .account-value {
        color: #e0e0e0;
    }

    .account-card-total .account-value {
        color: var(--status-success-text);
    }

    .contrib-card {
        background: var(--surface-bg);
    }

    .contrib-account {
        color: #e0e0e0;
    }

    .contrib-bar-track {
        background: #444;
    }

    .contrib-detail {
        color: #bbb;
    }

    .contrib-note {
        color: #999;
    }

    .contrib-maxed {
        background: var(--status-success-bg);
        color: var(--status-success-text);
    }

    .contrib-room {
        background: var(--status-warning-bg);
        color: var(--status-warning-text);
    }

    .contrib-ineligible {
        background: var(--status-neutral-bg);
        color: var(--status-neutral-text);
    }

    .strategy-table-wrapper,
    .projection-table-wrapper {
        background: var(--surface-bg);
    }

    .strategy-table thead th,
    .strategy-table tfoot td,
    .projection-table thead th {
        background: var(--surface-muted);
        color: #e0e0e0;
    }

    .projection-target-row {
        background-color: var(--status-warning-bg) !important;
    }

    .hero-warning {
        color: #fff;
    }

    .hero-warning .hero-detail {
        color: #ffe082;
    }
}

/* ============= Print Styles ============= */

@media print {
    .navbar,
    footer,
    .btn {
        display: none;
    }
}
