:root {
    /* Brand colors (kept from before) */
    --bs-primary: #2F4F6F;
    --bs-primary-rgb: 47, 79, 111;
    --bs-secondary: #5F8F7B;
    --bs-secondary-rgb: 95, 143, 123;
    --bs-link-color: #2F4F6F;
    --bs-link-hover-color: #243F5B;

    /* Design tokens (Mercury/Asset-Map inspired) */
    --csf-bg: #E8F0F2;           /* brand light neutral page background */
    --csf-surface: #FFFFFF;      /* card background */
    --csf-surface-alt: #DDE8EC;  /* subtle highlight bg */
    --csf-border: #C8D5D9;       /* subtle cool border */
    --csf-border-strong: #A8B5BB;
    --csf-text: #1A1A1A;         /* primary text, not pure black */
    --csf-text-muted: #6B6B6B;   /* secondary text */
    --csf-text-subtle: #9B9B9B;  /* tertiary text */

    /* Shadows: very subtle, neutral grey */
    --csf-shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.04), 0 1px 3px rgba(26, 26, 26, 0.03);
    --csf-shadow-md: 0 2px 8px rgba(26, 26, 26, 0.05), 0 1px 3px rgba(26, 26, 26, 0.04);
    --csf-shadow-lg: 0 8px 24px rgba(26, 26, 26, 0.08), 0 2px 8px rgba(26, 26, 26, 0.04);

    /* Radii */
    --csf-radius-sm: 6px;
    --csf-radius: 10px;
    --csf-radius-lg: 14px;

    /* Spacing scale */
    --csf-space-1: 0.25rem;
    --csf-space-2: 0.5rem;
    --csf-space-3: 0.75rem;
    --csf-space-4: 1rem;
    --csf-space-5: 1.5rem;
    --csf-space-6: 2rem;
    --csf-space-7: 3rem;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--csf-text);
    background-color: var(--csf-bg);
}

body {
    font-size: 15px;
    line-height: 1.55;
}

/* Tighter, more modern headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--csf-text);
}

.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    font-weight: 700;
    letter-spacing: -0.025em;
}

/* Tabular numbers for consistent alignment */
td, .tabular-nums, .fw-semibold, .fw-bold {
    font-variant-numeric: tabular-nums;
}

/* Softer, cool-toned card aesthetic */
.card {
    border: 1px solid var(--csf-border);
    border-radius: var(--csf-radius);
    background-color: var(--csf-surface);
    overflow: hidden; /* clip shadows/children to rounded corners */
}

.card.shadow-sm {
    box-shadow: var(--csf-shadow-sm) !important;
    border-color: var(--csf-border);
}

.card-header {
    background-color: var(--csf-surface) !important;
    border-bottom: 1px solid var(--csf-border);
    padding: 1rem 1.25rem;
}

.card-header.bg-light {
    background-color: var(--csf-surface-alt) !important;
}

.card-body {
    padding: 1.25rem;
}

/* Ensure table-responsive doesn't create gaps at card edges */
.card-body.p-0 > .table-responsive {
    border-radius: 0;
}

/* Softer table styling */
.table {
    --bs-table-bg: transparent;
}

.table-light,
.table > thead {
    --bs-table-bg: var(--csf-surface-alt);
    background-color: var(--csf-surface-alt);
}

.table > :not(caption) > * > * {
    border-color: var(--csf-border);
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--csf-surface-alt);
}

/* Cleaner form controls */
.form-control, .form-select {
    border-color: var(--csf-border-strong);
    border-radius: var(--csf-radius-sm);
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(47, 79, 111, 0.12);
}

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

/* Cleaner buttons */
.btn {
    border-radius: var(--csf-radius-sm);
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: all 0.15s ease;
}

.btn-sm {
    border-radius: var(--csf-radius-sm);
    font-size: 13px;
}

/* Softer text muted */
.text-muted {
    color: var(--csf-text-muted) !important;
}

/* Badges with softer feel */
.badge {
    font-weight: 500;
    letter-spacing: 0.01em;
    border-radius: 6px;
}

/* ── Design System Utilities ──────────────────────────────────────── */

/* Eyebrow label above section titles */
.section-eyebrow,
.eyebrow {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #5F8F7B;
    margin-bottom: 0.25rem;
}

.eyebrow-muted {
    color: #9B9B9B;
}

/* Page title */
.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #2F4F6F;
    margin-bottom: 0;
}

/* Section title (inside pages) */
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: #1A1A1A;
    margin-bottom: 0.5rem;
}

/* Stat card: big number display for calculator results */
.stat-card {
    background: #FFFFFF;
    border: 1px solid #C8D5D9;
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    border-color: #A8B5BB;
    box-shadow: 0 4px 16px rgba(47, 79, 111, 0.05);
}

.stat-card.stat-primary {
    border-left: 3px solid #2F4F6F;
}

.stat-card.stat-success {
    border-left: 3px solid #5F8F7B;
}

.stat-card.stat-danger {
    border-left: 3px solid #C0392B;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6B6B6B;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #1A1A1A;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.375rem;
}

.stat-value-sm {
    font-size: 1.5rem;
}

.stat-value-lg {
    font-size: 2.5rem;
}

.stat-sub {
    font-size: 0.8125rem;
    color: #6B6B6B;
    line-height: 1.4;
}

.stat-trend-up {
    color: #5F8F7B;
    font-size: 0.8125rem;
    font-weight: 600;
}

.stat-trend-down {
    color: #C0392B;
    font-size: 0.8125rem;
    font-weight: 600;
}

/* App footer: generous padding, links that wrap to two rows on narrow screens */
.app-footer {
    padding: 1.75rem 1rem 2rem 1rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.25rem;
}

.footer-links a {
    white-space: nowrap;
}

/* Mobile: more breathing room so the footer clears the bottom nav and
   gives thumbs some padding below the last tap target. */
@media (max-width: 575.98px) {
    .app-footer {
        padding: 2rem 1rem 2.5rem 1rem;
    }
    .footer-links {
        gap: 0.625rem 1rem;
    }
}

/* Announcement modal (site updates shown as a popup, not an inline alert) */
.announcement-modal {
    background: rgba(26, 26, 26, 0.3);
}

.announcement-modal .modal-header {
    background: var(--csf-bg);
    border-bottom: 1px solid var(--csf-border);
}

.announcement-modal .modal-title {
    color: #2F4F6F;
    font-weight: 600;
}

.announcement-body {
    line-height: 1.55;
    color: var(--csf-text);
}

.announcement-body h1,
.announcement-body h2,
.announcement-body h3 {
    color: #2F4F6F;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.announcement-body h1:first-child,
.announcement-body h2:first-child,
.announcement-body h3:first-child {
    margin-top: 0;
}

.announcement-body h2 { font-size: 1.25rem; }
.announcement-body h3 { font-size: 1.0625rem; }

.announcement-body p { margin-bottom: 0.75rem; }
.announcement-body ul,
.announcement-body ol { padding-left: 1.25rem; margin-bottom: 0.75rem; }
.announcement-body li { margin-bottom: 0.25rem; }

/* Admin shell: tab nav shared across /admin pages */
.admin-page-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #2F4F6F;
}

.admin-tabs {
    border-bottom: 1px solid var(--csf-border);
    padding-bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    flex-wrap: nowrap;
}

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

.admin-tabs .nav-link {
    color: #6B6B6B;
    font-weight: 500;
    border-radius: 8px 8px 0 0;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}

.admin-tabs .nav-link:hover {
    color: #2F4F6F;
    background: transparent;
}

.admin-tabs .nav-link.active {
    color: #2F4F6F;
    background: transparent;
    border-bottom-color: #2F4F6F;
    font-weight: 600;
}

/* Admin tables: stronger headers and breathing room in cells */
.admin-shell .card .table {
    margin-bottom: 0;
}

/* The `d-none d-md-table-header-group` pattern Bootstrap-style doesn't
   actually work — Bootstrap 5 ships no display utility for
   table-header-group, so `d-none` hid the thead unconditionally.
   Handle the responsive show/hide ourselves instead. */
.admin-shell .card .table thead.admin-table-head {
    display: table-header-group;
}

@media (max-width: 767.98px) {
    .admin-shell .card .table thead.admin-table-head {
        display: none;
    }
}

.admin-shell .card .table thead th {
    background: var(--csf-bg);
    color: #2F4F6F;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-top: 1px solid var(--csf-border);
    border-bottom: 2px solid var(--csf-border-strong);
    padding: 0.75rem 1rem;
    white-space: nowrap;
    vertical-align: middle;
}

.admin-shell .card .table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-top: 1px solid var(--csf-border);
    border-bottom: none;
}

.admin-shell .card .table tbody tr:first-child td {
    border-top: none;
}

.admin-shell .card .table-hover tbody tr:hover td {
    background: var(--csf-bg);
}

/* Sensible widths so the user list doesn't squish actions into the edge */
.admin-shell .card .table .col-actions { width: 1%; white-space: nowrap; }

/* Cap the Name and Email columns so a very long username/email
   (some users have email-as-username) truncates with an ellipsis
   instead of stretching the table and forcing horizontal scroll. */
.admin-shell .card .table .user-name-cell {
    max-width: 220px;
}

.admin-shell .card .table .user-name-cell .text-truncate {
    max-width: 100%;
    display: block;
}

.admin-shell .card .table .user-email-cell {
    max-width: 260px;
}

.admin-shell .card .table .user-email-cell .text-truncate {
    max-width: 100%;
}

/* Per-account drawdown visualization (401k simulator) */
.sim-acct-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex: 0 0 auto;
}

.sim-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
}

.sim-legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: #2F4F6F;
    background: #E8F0F2;
    border: 1px solid #C8D5D9;
    border-radius: 999px;
    padding: 0.25rem 0.625rem;
    line-height: 1;
}

.sim-legend-label {
    font-weight: 500;
}

.sim-stack {
    display: flex;
    height: 4px;
    margin-top: 4px;
    border-radius: 2px;
    overflow: hidden;
    background: #DCE6EA;
}

.sim-stack-seg {
    height: 100%;
    min-width: 1px;
}

.sim-drawdown-table td {
    vertical-align: middle;
}

/* Data row (for compact list items in cards) */
.data-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px solid #DDE8EC;
}

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

.data-row .data-label {
    font-size: 0.875rem;
    color: #6B6B6B;
}

.data-row .data-value {
    font-weight: 600;
    color: #1A1A1A;
    font-variant-numeric: tabular-nums;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #9B9B9B;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #A8B5BB;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: #6B6B6B;
    margin-bottom: 0.25rem;
}

.empty-state-text {
    font-size: 0.875rem;
    color: #9B9B9B;
    max-width: 400px;
    margin: 0 auto;
}

/* Chart color palette: retirement/401k = red, IUL = green, refined shades */
:root {
    --chart-401k: #B94A45;         /* refined muted red for retirement/401k (best case) */
    --chart-401k-light: #E8A5A2;   /* lighter red for historical/secondary */
    --chart-iul: #5F8F7B;           /* brand teal-green for IUL */
    --chart-iul-light: #A8C5B8;    /* lighter IUL green */
    --chart-annuity: #2F4F6F;      /* brand blue for annuity */
    --chart-muted: #9B9B9B;        /* neutral */
    --chart-warning: #B8860B;      /* amber for warnings */
    --chart-grid: #DDE8EC;         /* subtle grid lines */
    --chart-axis: #A8B5BB;         /* axis lines */
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #2F4F6F;
}

/* Button Overrides */
.btn-primary {
    /* Set base colors */
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: #243F5B; /* Darker primary */
    --bs-btn-hover-border-color: #243F5B;
    
    /* SWAP ACTIVE STATE TO SECONDARY COLOR */
    --bs-btn-active-bg: var(--bs-secondary);
    --bs-btn-active-border-color: var(--bs-secondary);
    
    color: #fff;
    background-color: var(--bs-btn-bg);
    border-color: var(--bs-btn-border-color);
}

.btn-outline-primary {
    --bs-btn-color: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bs-primary);
    --bs-btn-hover-border-color: var(--bs-primary);
    /* SWAP ACTIVE STATE TO SECONDARY COLOR */
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--bs-secondary);
    --bs-btn-active-border-color: var(--bs-secondary);
}

.btn-secondary {
    /* Set base colors */
    --bs-btn-bg: var(--bs-secondary);
    --bs-btn-border-color: var(--bs-secondary);
    --bs-btn-hover-bg: #4D7566; /* Darker secondary */
    --bs-btn-hover-border-color: #4D7566;

    /* SWAP ACTIVE STATE TO PRIMARY COLOR */
    --bs-btn-active-bg: var(--bs-primary);
    --bs-btn-active-border-color: var(--bs-primary);
    
    color: #fff;
    background-color: var(--bs-btn-bg);
    border-color: var(--bs-btn-border-color);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(47, 79, 111, 0.5);
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #2F4F6F;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ═══════════════════════════════════════════════════
   PRINT STYLESHEET — Professional Financial Report
   ═══════════════════════════════════════════════════ */

@page {
    size: letter;
    margin: 0.6in 0.75in 0.7in 0.75in;
}

@media print {

    /* Force backgrounds to print */
    *,
    *::before,
    *::after {
        print-color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }

    /* Hide non-print chrome */
    .navbar-wrapper,
    .sidebar,
    .top-row.auth,
    footer,
    .no-print,
    .bottom-nav,
    #blazor-error-ui,
    .pwa-install-banner {
        display: none !important;
    }

    /* Reset layout to full-width flow */
    html, body {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    body {
        font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
        font-size: 10pt;
        line-height: 1.5;
        color: #1a1a1a;
        padding: 0;
        margin: 0;
    }

    .page {
        display: block !important;
        width: 100% !important;
        min-height: auto !important;
    }

    main {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    article.content,
    .content {
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Typography for print */
    h4 { font-size: 14pt; margin-bottom: 6pt; }
    h5 { font-size: 12pt; margin-bottom: 4pt; }
    h6 { font-size: 10pt; font-weight: 700; letter-spacing: 0.2pt; }
    p, span, td, th, li { font-size: 10pt; }
    .small, small { font-size: 8.5pt; }

    a {
        color: #2F4F6F !important;
        text-decoration: underline !important;
    }

    /* Links in headers/footers should not be styled */
    .card-header a,
    .print-page-footer a {
        color: inherit !important;
        text-decoration: none !important;
    }

    /* Logo header -- rendered as normal flow element on page 1.
       Chrome print does not reliably support fixed repeating headers. */
    .print-page-header {
        display: block !important;
        border-bottom: 2pt solid #2F4F6F;
        padding-bottom: 6pt;
        margin-bottom: 12pt;
    }

    .print-page-header img {
        height: 0.4in;
        max-width: 220px;
    }

    .print-report-title {
        font-size: 11pt;
        font-weight: 700;
        color: #2F4F6F;
        letter-spacing: 0.3pt;
    }

    /* Print report header (first page -- client name row below the logo) */
    .print-report-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1pt solid #ccc !important;
        padding-bottom: 6pt;
        margin-bottom: 10pt;
        margin-top: 0;
    }

    .print-report-header h4 {
        font-size: 16pt;
        font-weight: 700;
        color: #2F4F6F !important;
        margin: 0;
    }

    .print-report-header .text-muted {
        color: #555 !important;
    }

    /* Page footer -- flow element at end of content (not fixed, avoids overlap) */
    .print-page-footer {
        display: block !important;
        text-align: center;
        font-size: 7pt;
        color: #999;
        border-top: 0.5pt solid #ddd;
        padding-top: 3pt;
        margin-top: 20pt;
    }

    /* ── Card styling ── */
    .card {
        box-shadow: none !important;
        border: 0.5pt solid #e0e0e0 !important;
        border-radius: 0 !important;
        margin-bottom: 10pt !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Preserve colored borders on accent cards */
    .card[style*="border-left"],
    .card[style*="border-top"],
    .card[style*="border-color"] {
        border: 0.5pt solid #e0e0e0 !important;
    }

    .card[style*="border-left: 4px"] {
        border-left: 4px solid !important;
    }

    .card[style*="border-top: 3px"],
    .card[style*="border-top:3px"] {
        border-top: 3px solid !important;
    }

    .card-header {
        break-after: avoid;
        page-break-after: avoid;
        border-radius: 0 !important;
        padding: 5pt 10pt !important;
    }

    .card-header h6 {
        margin: 0;
        font-size: 10pt;
        font-weight: 700;
        letter-spacing: 0.3pt;
        text-transform: uppercase;
    }

    .card-header[style*="background:#2F4F6F"],
    .card-header[style*="background:var(--bs-secondary)"] {
        background: #2F4F6F !important;
        color: #fff !important;
        border-bottom: none !important;
    }

    .card-header[style*="background:#5F8F7B"] {
        background: #5F8F7B !important;
        color: #fff !important;
        border-bottom: none !important;
    }

    .card-header.bg-light {
        background: #f0f4f7 !important;
        border-bottom: 0.5pt solid #d0d0d0 !important;
    }

    .card-header.bg-white {
        background: #fff !important;
        border-bottom: 0.5pt solid #e0e0e0 !important;
    }

    .card-body {
        padding: 8pt 10pt !important;
    }

    .card-body.p-0,
    .card-body.py-2,
    .card-body.py-1 {
        padding: 6pt 10pt !important;
    }

    /* ── Table styling ── */
    .table {
        border-collapse: collapse;
        width: 100%;
        font-size: 9pt;
    }

    .table th,
    .table td {
        padding: 4pt 8pt !important;
        border: 0.5pt solid #d0d0d0 !important;
        vertical-align: top;
    }

    .table thead {
        display: table-header-group;
    }

    .table thead th {
        background: #2F4F6F !important;
        color: #fff !important;
        font-weight: 600;
        font-size: 8.5pt;
        text-transform: uppercase;
        letter-spacing: 0.3pt;
    }

    .table tbody tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .table tbody tr:nth-child(even) td {
        background: #f8fafb !important;
    }

    .table-success td,
    tr.table-success td {
        background: #d4edda !important;
    }

    .table-danger td,
    tr.table-danger td {
        background: #f8d7da !important;
    }

    thead.table-light th {
        background: #f0f4f7 !important;
        color: #333 !important;
        font-weight: 600;
        border-bottom: 1pt solid #2F4F6F !important;
    }

    .table-light td {
        background: #f0f4f7 !important;
    }

    /* ── Badge styling ── */
    .badge {
        border: none;
        padding: 2pt 8pt;
        font-size: 8pt;
        font-weight: 600;
        border-radius: 2pt;
    }

    .badge[style*="background:#2F4F6F"] {
        background: #2F4F6F !important;
        color: #fff !important;
    }

    .badge.bg-secondary {
        background: #6c757d !important;
        color: #fff !important;
    }

    .badge.bg-success {
        background: #198754 !important;
        color: #fff !important;
    }

    .badge.bg-warning {
        background: #ffc107 !important;
        color: #212529 !important;
    }

    /* ── Text color overrides ── */
    .text-muted {
        color: #666 !important;
    }

    .text-success {
        color: #0a6630 !important;
    }

    .text-danger {
        color: #b02a37 !important;
    }

    .fw-semibold {
        font-weight: 600;
    }

    .fw-bold {
        font-weight: 700;
    }

    /* ── Page break utilities ── */
    .print-break-before {
        break-before: page;
        page-break-before: always;
    }

    .print-break-after {
        break-after: page;
        page-break-after: always;
    }

    .print-break-avoid {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .print-section-gap {
        margin-top: 16pt !important;
    }

    /* Export sections: page break between visible sections only.
       Adjacent export-section siblings get a page break before.
       This prevents blank pages when sections are hidden. */
    .export-section + .export-section {
        break-before: page;
        page-break-before: always;
    }

    /* Keep export sections from splitting internally */
    .export-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* ── Row layout tuning ── */
    .row {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .col-3, .col-md-3, .col-lg-3 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }

    .col-4, .col-md-4, .col-lg-4 {
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }

    .col-6, .col-md-6, .col-lg-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .col-md-12, .col-lg-12, .col-12 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Auto-width columns for card grids */
    .col {
        flex: 1 0 0% !important;
    }

    /* Prevent multi-column card rows from breaking across pages */
    .row.g-2,
    .row.g-3 {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* ── Inline styles that need print enforcement ── */
    [style*="color:#c0392b"] { color: #c0392b !important; }
    [style*="color:#5F8F7B"] { color: #5F8F7B !important; }
    [style*="color:#2F4F6F"] { color: #2F4F6F !important; }
    [style*="color:#0d6efd"] { color: #0d6efd !important; }
    [style*="color:#FF0000"] { color: #FF0000 !important; }

    /* ── Font size refinements for dense export layouts ── */
    .fs-5 { font-size: 13pt !important; }
    .fs-6 { font-size: 11pt !important; }

    /* ── HR separators in print ── */
    hr {
        border: none !important;
        border-top: 0.5pt solid #ddd !important;
        margin: 6pt 0 !important;
    }

    /* ── Definition lists (dl.row) ── */
    dl.row {
        font-size: 8pt;
    }

    dl.row dt {
        font-weight: 600;
    }

    /* ── Disclaimer footer ── */
    .print-disclaimer {
        margin-top: 14pt;
        padding-top: 8pt;
        border-top: 0.5pt solid #ccc;
        font-size: 7.5pt;
        color: #888;
        text-align: center;
        font-style: italic;
    }

    /* Illustrations print: hide upload/list panel, full-width analysis */
    .illustrations-upload-panel {
        display: none !important;
    }

    .illustrations-analysis-panel {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Remove scroll constraints so the full table prints */
    .year-table-scroll {
        max-height: none !important;
        overflow: visible !important;
    }

    /* Always show the year-by-year table in print */
    .year-table-print-always {
        display: block !important;
    }

    /* ── Summary cards (Net Worth, etc.) ── */
    .card-body .row .col-md-4 .card,
    .card-body .row .col-md-3 .card {
        border: 0.5pt solid #e0e0e0 !important;
    }

    /* QR code sizing for print */
    .qr-print {
        overflow: visible !important;
        flex-shrink: 0 !important;
        min-width: 110px !important;
        width: 110px !important;
    }

    .qr-print svg {
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        min-height: 100px !important;
        display: block !important;
        margin: 0 auto;
    }

    /* Show print-only elements */
    .d-print-block {
        display: block !important;
    }

}

/* QR code sizing (screen + print) */
.qr-print {
    overflow: visible;
    flex-shrink: 0;
    min-width: 110px;
    width: 110px;
}

.qr-print svg {
    width: 100px !important;
    height: 100px !important;
    min-width: 100px !important;
    min-height: 100px !important;
    display: block;
    margin: 0 auto;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1030;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.bottom-nav .nav-item {
    text-align: center;
    flex: 1;
}

.bottom-nav .nav-link {
    color: #6c757d;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.75rem;
    text-decoration: none;
}

.bottom-nav .nav-link i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.bottom-nav .nav-link.active {
    color: var(--bs-primary);
}

/* Ensure footer content isn't hidden behind fixed bottom nav on mobile */
@media (max-width: 767.98px) {
    footer {
        padding-bottom: 4.5rem !important;
    }
}

/* Mobile Table handled via Bootstrap D-MD-NONE utilities in Razor files */

.navbar-logo {
    height: 2.5rem;
    max-height: 2.5rem;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

/* Full-width logo in the sidebar on desktop (overrides the mobile rule above) */
@media (min-width: 768px) {
    .sidebar .navbar-logo {
        height: auto;
        max-height: none;
        width: 100%;
        max-width: 100%;
    }
}

.export-logo {
    height: 3.5rem;
    width: auto;
    max-width: 300px;
    object-fit: contain;
}

/* ── PWA Install Banner ─────────────────────────────────── */
.pwa-install-banner {
    position: fixed;
    bottom: 68px; /* sits above the bottom-nav */
    left: 0;
    right: 0;
    z-index: 1040;
    padding: 0 0.75rem;
    pointer-events: none;
}

.pwa-install-content {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.10);
    padding: 0.625rem 0.75rem;
    max-width: 480px;
    margin: 0 auto;
    animation: pwa-slide-up 0.3s ease-out;
}

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

.pwa-install-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.pwa-install-text strong {
    font-size: 0.875rem;
    color: #212529;
}

.pwa-install-text span {
    font-size: 0.75rem;
    color: #6c757d;
}

.pwa-install-btn {
    flex-shrink: 0;
    border: none;
    background: var(--bs-primary);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.375rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.15s;
}

.pwa-install-btn:hover {
    background: #243F5B;
}

.pwa-install-close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    line-height: 1;
    color: #6c757d;
    padding: 0.25rem;
    cursor: pointer;
    transition: color 0.15s;
}

.pwa-install-close:hover {
    color: #212529;
}

/* Hide on desktop — only mobile/tablet via media query */
@media (min-width: 768px) {
    .pwa-install-banner {
        display: none !important;
    }
}

/* Dollar currency inputs - $ prefix via background image */
input[data-currency] {
    padding-left: 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='20'%3E%3Ctext x='0' y='15' font-family='system-ui,sans-serif' font-size='14' font-weight='500' fill='%236c757d'%3E%24%3C/text%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 8px center;
}

/* ── Floating Advisor Notepad ── */
.advisor-notepad {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    width: 320px;
    min-width: 250px;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    overflow: auto;
    resize: both;
    direction: rtl; /* makes the resize grip appear bottom-left so it doesn't hide behind viewport edge */
    background: #fff;
}
.advisor-notepad > * {
    direction: ltr;
}
.advisor-notepad.collapsed {
    width: auto;
    min-width: 0;
    max-width: none;
    resize: none;
    border-radius: 50px;
    overflow: hidden;
}
.advisor-notepad .drag-handle {
    background: var(--bs-gray-400, #ced4da);
    height: 10px;
    cursor: grab;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.advisor-notepad .drag-handle::after {
    content: '';
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--bs-gray-600, #6c757d);
}
.advisor-notepad .drag-handle:active {
    cursor: grabbing;
}
.advisor-notepad.collapsed .drag-handle {
    display: none;
}
.advisor-notepad .notepad-header {
    background: var(--bs-primary);
    color: #fff;
    padding: 10px 16px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}
.advisor-notepad.collapsed .notepad-header {
    padding: 10px 18px;
    border-radius: 50px;
}
.advisor-notepad .notepad-body {
    width: 100%;
    height: 200px;
    border: none;
    padding: 12px;
    font-size: .85rem;
    resize: vertical;
    outline: none;
    background: #fff;
    font-family: inherit;
}
@media (max-width: 576px) {
    .advisor-notepad { width: calc(100% - 40px); right: 20px; }
}

/* ── Client Table Sortable Headers ── */
.client-table th.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: relative;
    padding-right: 1.2em;
}
.client-table th.sortable-th:hover {
    background: rgba(0,144,177,.08);
}
.client-table th.sortable-th::after {
    content: "\F282"; /* bi-chevron-expand */
    font-family: "bootstrap-icons";
    font-size: .65em;
    margin-left: .35em;
    opacity: .35;
    position: absolute;
    right: .4em;
    top: 50%;
    transform: translateY(-50%);
}
.client-table th.sort-asc::after {
    content: "\F286"; /* bi-chevron-up */
    opacity: .85;
    color: var(--bs-primary);
}
.client-table th.sort-desc::after {
    content: "\F282"; /* bi-chevron-down */
    opacity: .85;
    color: var(--bs-primary);
}
/* keep the icons from shifting text in narrow columns */
.client-table th.sort-desc::after { content: "\F283"; }

/* ── Sticky Debt Save Bar ── */
.debt-save-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: var(--bs-primary);
    padding: 10px 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,.15);
}
.debt-save-bar .btn-light {
    color: var(--bs-primary);
    font-weight: 600;
}
.debt-save-bar textarea {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
}
.debt-save-bar textarea::placeholder { color: rgba(255,255,255,.6); }
.debt-save-bar textarea:focus { background: rgba(255,255,255,.2); color: #fff; box-shadow: none; border-color: rgba(255,255,255,.5); }

/* ── Toast Notifications ── */
#toast-container .toast {
    margin-bottom: 0.5rem;
    animation: slideInRight 0.3s ease;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Auto-save indicator fade ── */
.autosave-indicator {
    transition: opacity 0.5s ease;
}
.autosave-indicator.fade-out {
    opacity: 0;
}

/* ── Recently Viewed Cards ── */
.recently-viewed-card {
    min-width: 140px;
    max-width: 180px;
    transition: box-shadow 0.15s ease;
}
.recently-viewed-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ── Display-5 responsive sizing ── */
@media (max-width: 575.98px) {
    .display-5 {
        font-size: 1.75rem !important;
    }
}

/* ===================== Consumer site nav (mycsfanalytics.com) =====================
   Kept in the global stylesheet (not scoped to ConsumerNav) so it ships reliably. */
.cnav {
    background: #fff;
    border-bottom: 1px solid #E3EAED;
    position: sticky;
    top: 0;
    z-index: 1030;
    width: 100%;
}

.cnav-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding: 0.6rem 1.25rem;
    flex-wrap: wrap;
}

.cnav-brand {
    display: inline-flex;
    align-items: center;
}

.cnav-brand img {
    height: 2.4rem;
    width: auto;
    max-width: 220px;
}

.cnav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.cnav-link {
    color: #2F4F6F;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.98rem;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    transition: background .15s ease, color .15s ease;
}

.cnav-link:hover {
    background: #E8F0F2;
}

.cnav-link.active {
    background: #2F4F6F;
    color: #fff;
}

/* Consumer site: full-width stacked layout (top nav over content), no sidebar.
   !important overrides MainLayout's scoped ".page { flex-direction: row }" rule, which
   has equal specificity (scoped attribute) and loads after this global sheet. */
@media (min-width: 768px) {
    .page.consumer-site {
        flex-direction: column !important;
    }
}
