:root {
    --lf-primary: #0d6e4f;
    --lf-primary-dark: #094a35;
    --lf-accent: #f0b429;
    --lf-soft: color-mix(in srgb, var(--lf-primary) 10%, #ffffff);
    --lf-chart-soft: color-mix(in srgb, var(--lf-primary) 40%, #ffffff);
    --lf-sidebar-width: 240px;
}

body {
    background-color: #f4f6f8;
}

.app-topbar {
    background-color: var(--lf-primary-dark);
}

.app-shell {
    display: flex;
    min-height: calc(100vh - 56px);
}

.app-sidebar {
    width: var(--lf-sidebar-width);
    flex-shrink: 0;
    background-color: #ffffff;
    border-right: 1px solid #e3e6e8;
}

.app-sidebar .nav-link {
    color: #495057;
    border-radius: .375rem;
    padding: .55rem .75rem;
    margin-bottom: .15rem;
}

.app-sidebar .nav-link:hover {
    background-color: var(--lf-soft);
    color: var(--lf-primary);
}

.app-sidebar .nav-link.active {
    background-color: var(--lf-primary);
    color: #fff;
}

.app-content {
    flex-grow: 1;
    min-width: 0;
}

.auth-body {
    background: linear-gradient(135deg, var(--lf-primary-dark), var(--lf-primary));
    min-height: 100vh;
}

.auth-shell {
    min-height: 100vh;
    padding: 1.5rem;
}

.auth-card {
    max-width: 420px;
    width: 100%;
}

.stat-card {
    border: 1px solid #e3e6e8;
    border-radius: .5rem;
    background: #fff;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 600;
}

.text-gain {
    color: #157347;
}

.text-loss {
    color: #dc3545;
}

.scheme-card {
    border: 1px solid #e3e6e8;
    border-radius: .5rem;
    transition: box-shadow .15s ease-in-out;
}

.scheme-card:hover {
    box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .06);
}

.calc-table thead th {
    background-color: var(--lf-primary);
    color: #fff;
    border-color: var(--lf-primary-dark);
}

.calc-table tbody tr.calc-table-footer {
    background-color: var(--lf-soft) !important;
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    .calc-table tbody tr.calc-table-footer {
        background-color: #16352a !important;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        top: 56px;
        bottom: 0;
        left: -260px;
        z-index: 1030;
        transition: left .2s ease-in-out;
        overflow-y: auto;
    }

    .app-sidebar.show {
        left: 0;
    }
}

/* Bootstrap's "success" green is the brand color in this app, so the tenant palette
   (--lf-primary) recolors buttons and links in every template. */
.btn-success {
    --bs-btn-color: var(--lf-on-primary, #fff);
    --bs-btn-hover-color: var(--lf-on-primary-dark, #fff);
    --bs-btn-active-color: var(--lf-on-primary-dark, #fff);
    --bs-btn-disabled-color: var(--lf-on-primary, #fff);
    --bs-btn-bg: var(--lf-primary);
    --bs-btn-border-color: var(--lf-primary);
    --bs-btn-hover-bg: var(--lf-primary-dark);
    --bs-btn-hover-border-color: var(--lf-primary-dark);
    --bs-btn-active-bg: var(--lf-primary-dark);
    --bs-btn-active-border-color: var(--lf-primary-dark);
    --bs-btn-disabled-bg: var(--lf-primary);
    --bs-btn-disabled-border-color: var(--lf-primary);
}

.btn-outline-success {
    --bs-btn-hover-color: var(--lf-on-primary, #fff);
    --bs-btn-active-color: var(--lf-on-primary, #fff);
    --bs-btn-color: var(--lf-primary);
    --bs-btn-border-color: var(--lf-primary);
    --bs-btn-hover-bg: var(--lf-primary);
    --bs-btn-hover-border-color: var(--lf-primary);
    --bs-btn-active-bg: var(--lf-primary);
    --bs-btn-active-border-color: var(--lf-primary);
    --bs-btn-disabled-color: var(--lf-primary);
    --bs-btn-disabled-border-color: var(--lf-primary);
}

.text-success {
    color: var(--lf-primary) !important;
}

.app-footer {
    border-top: 1px solid #e3e6e8;
    margin-top: 2rem;
}

/* Page head: the themed band at the top of every page (the title row, or the _PageHead partial). Each template sets the --ph-*
   variables (and shape) in its own stylesheet; these defaults are the classic look — a brand gradient with light text. */
.page-head {
    --ph-bg: linear-gradient(135deg, var(--lf-primary-dark), var(--lf-primary));
    --ph-fg: #ffffff;
    --ph-muted: rgba(255, 255, 255, .78);
    --ph-btn-bg: #ffffff;
    --ph-btn-fg: var(--lf-primary-dark);
    --ph-outline: rgba(255, 255, 255, .65);
    --ph-outline-hover-bg: #ffffff;
    --ph-outline-hover-fg: var(--lf-primary-dark);
    background: var(--ph-bg);
    color: var(--ph-fg);
    border-radius: var(--ph-radius, .75rem);
    border: var(--ph-border, 0);
    border-bottom: var(--ph-border-bottom, var(--ph-border, 0));
    box-shadow: var(--ph-shadow, 0 6px 18px rgba(0, 0, 0, .08));
    padding: var(--ph-padding, 1.1rem 1.4rem);
    margin-bottom: 1.5rem !important;
}

.page-head h1, .page-head h2, .page-head h3, .page-head h4, .page-head h5, .page-head h6,
.page-head a:not(.btn) { color: var(--ph-fg); }
.page-head h4 { font-weight: var(--ph-title-weight, 600); font-size: var(--ph-title-size, 1.35rem); }
.page-head .text-muted { color: var(--ph-muted) !important; }
.page-head .text-decoration-none:hover { text-decoration: underline !important; }

.page-head .btn-success,
.page-head .btn-primary {
    --bs-btn-bg: var(--ph-btn-bg);
    --bs-btn-color: var(--ph-btn-fg);
    --bs-btn-border-color: var(--ph-btn-bg);
    --bs-btn-hover-bg: var(--ph-btn-bg);
    --bs-btn-hover-color: var(--ph-btn-fg);
    --bs-btn-hover-border-color: var(--ph-btn-bg);
    --bs-btn-active-bg: var(--ph-btn-bg);
    --bs-btn-active-color: var(--ph-btn-fg);
    --bs-btn-active-border-color: var(--ph-btn-bg);
    --bs-btn-disabled-bg: var(--ph-btn-bg);
    --bs-btn-disabled-color: var(--ph-btn-fg);
    --bs-btn-disabled-border-color: var(--ph-btn-bg);
}

.page-head .btn-outline-success,
.page-head .btn-outline-secondary,
.page-head .btn-outline-primary,
.page-head .btn-outline-dark {
    --bs-btn-color: var(--ph-fg);
    --bs-btn-border-color: var(--ph-outline);
    --bs-btn-hover-bg: var(--ph-outline-hover-bg);
    --bs-btn-hover-color: var(--ph-outline-hover-fg);
    --bs-btn-hover-border-color: var(--ph-outline-hover-bg);
    --bs-btn-active-bg: var(--ph-outline-hover-bg);
    --bs-btn-active-color: var(--ph-outline-hover-fg);
    --bs-btn-active-border-color: var(--ph-outline-hover-bg);
    --bs-btn-disabled-color: var(--ph-fg);
    --bs-btn-disabled-border-color: var(--ph-outline);
}

@media (max-width: 575.98px) {
    .page-head { padding: .9rem 1rem; }
    .page-head h4 { font-size: 1.15rem; }
}

/* Slider under a number input (see site.js) */
.lf-slider { margin-top: .4rem; }
.lf-slider .form-range { accent-color: var(--lf-primary); height: 1.25rem; }
.lf-slider .form-range::-webkit-slider-thumb { background-color: var(--lf-primary); }
.lf-slider .form-range::-moz-range-thumb { background-color: var(--lf-primary); }
.lf-slider-scale { display: flex; justify-content: space-between; font-size: .72rem; opacity: .65; margin-top: -.15rem; }

/* Step-by-step add pages (assets, liabilities, insurance): step pills, choice cards, chosen-type bar */
.asset-steps { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.asset-steps .step { padding: .3rem .8rem; border-radius: 999px; font-size: .82rem; background: rgba(127, 127, 127, .14); color: inherit; opacity: .7; }
.asset-steps .step.on { background: var(--lf-primary); color: var(--lf-on-primary, #fff); opacity: 1; font-weight: 600; }
.asset-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .75rem; }
.asset-choice { text-align: left; display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border: 1px solid rgba(127, 127, 127, .3); border-radius: .75rem; background: transparent; color: inherit; transition: border-color .15s, box-shadow .15s; }
.asset-choice:hover, .asset-choice:focus-visible { border-color: var(--lf-primary); box-shadow: 0 0 0 .15rem color-mix(in srgb, var(--lf-primary) 25%, transparent); outline: 0; }
.asset-choice .bi { font-size: 1.4rem; color: var(--lf-primary); }
.asset-choice .sub { display: block; font-size: .78rem; opacity: .7; margin-top: .1rem; }
.asset-picked { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .9rem; border-radius: .75rem; background: rgba(127, 127, 127, .12); margin-bottom: 1rem; }

/* Tabbed plan page (Financial Planner): scrolls sideways on narrow screens instead of wrapping */
.plan-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.plan-tabs .nav-link { white-space: nowrap; color: inherit; opacity: .75; }
.plan-tabs .nav-link:hover { opacity: 1; }
.plan-tabs .nav-link.active { opacity: 1; font-weight: 600; color: var(--lf-primary); border-bottom-color: var(--lf-primary); }

/* Sections of the active plan group: a second, smaller row under the group tabs that scrolls sideways if it must */
.plan-subtabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; gap: .25rem; padding-bottom: .15rem; }
.plan-subtabs .nav-link { white-space: nowrap; color: inherit; opacity: .75; padding: .35rem .8rem; border-radius: .5rem; }
.plan-subtabs .nav-link:hover { opacity: 1; background: rgba(127, 127, 127, .12); }
.plan-subtabs .nav-link.active { opacity: 1; font-weight: 600; color: var(--lf-primary); background: color-mix(in srgb, var(--lf-primary) 12%, transparent); }

/* Statement of net worth: Total assets − Total liabilities = Net worth as three boxes; stacked with the symbols between rows on narrow screens */
.nw-eq { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: .75rem; }
.nw-box { border-radius: .9rem; padding: 1rem 1.15rem; border: 1px solid var(--nw-line); background: var(--nw-bg); min-width: 0; }
.nw-label { display: flex; align-items: center; gap: .55rem; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }
.nw-ico { width: 2rem; height: 2rem; flex: none; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; background: var(--nw-ico-bg); color: var(--nw-ico); }
.nw-value { margin-top: .6rem; font-size: 1.6rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.nw-sub { margin-top: .3rem; font-size: .75rem; opacity: .7; }
.nw-assets { --nw-bg: rgba(16, 185, 129, .07); --nw-line: rgba(16, 185, 129, .35); --nw-ico-bg: rgba(16, 185, 129, .16); --nw-ico: #059669; }
.nw-liab { --nw-bg: rgba(239, 68, 68, .07); --nw-line: rgba(239, 68, 68, .35); --nw-ico-bg: rgba(239, 68, 68, .16); --nw-ico: #dc2626; }
.nw-net-pos { --nw-bg: rgba(16, 185, 129, .13); --nw-line: rgba(16, 185, 129, .6); --nw-ico-bg: rgba(16, 185, 129, .22); --nw-ico: #059669; box-shadow: 0 4px 14px rgba(16, 185, 129, .15); }
.nw-net-neg { --nw-bg: rgba(239, 68, 68, .13); --nw-line: rgba(239, 68, 68, .6); --nw-ico-bg: rgba(239, 68, 68, .22); --nw-ico: #dc2626; box-shadow: 0 4px 14px rgba(239, 68, 68, .15); }
.nw-op { align-self: center; justify-self: center; width: 2.4rem; height: 2.4rem; border-radius: 9999px; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; font-weight: 700; line-height: 1; background: rgba(127, 127, 127, .16); opacity: .8; }
@media (max-width: 767.98px) {
    .nw-eq { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
    .nw-value { font-size: 1.4rem; }
}
