/* ============================================================
   SoftLOGiX — My Income Model
   Modernized stylesheet. Keeps the navy + gold brand identity;
   refreshes typography, spacing, elevation, controls and tables.
   All original class names are preserved so every page keeps
   working; only the presentation is updated.
   ============================================================ */

:root {
    /* Brand */
    --navy: #1f3864;
    --navy2: #2e4a7a;
    --navy-deep: #16294a;
    --gold: #d1a23c;
    --gold-soft: #e7c987;

    /* Interactive accent (slightly brighter than brand navy for links/focus) */
    --accent: #2f5aa8;
    --accent-soft: #eaf0fb;

    /* Neutrals */
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e6e9f0;
    --line-strong: #d5dae4;

    /* Surfaces */
    --bg: #eef1f6;
    --bg-2: #f6f8fb;
    --card: #ffffff;

    /* Status */
    --good: #1e7d32;
    --good-soft: #e8f4ea;
    --bad: #c0261f;
    --bad-soft: #fbeceb;
    --warn-bg: #fff8e6;
    --warn-line: #f0e0a8;
    --warn-ink: #6b5a12;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .06);
    --shadow-topbar: 0 2px 10px rgba(16, 24, 40, .12);

    /* Radii */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;

    /* Layout */
    --topbar-h: 60px;
    --sidenav-w: 220px;

    /* Added 2026 — heading text color (lets dark mode lighten headings
       independently of the navy fills) plus tokens for surfaces that were
       previously hard-coded. Light values equal the originals. */
    --heading: var(--navy);
    --ink-2: #374151;
    --total-bg: #eef2f8;
    --disabled-bg: #f1f3f7;
    --disabled-ink: #9aa1ac;
    --policy-1: #fbfcfe;
    --policy-2: #f5f8fc;
    --tooltip-bg: #1f2937;
    --amber-row: #fff4d6;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Helvetica, Arial, "Helvetica Neue", sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.page { display: flex; flex-direction: column; min-height: 100vh; }

/* ============================================================
   Top bar — stationary (sticky) title + menu icon panel
   ============================================================ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: var(--topbar-h);
    background: linear-gradient(180deg, var(--navy2) 0%, var(--navy) 62%, var(--navy-deep) 100%);
    color: #fff;
    padding: 8px 20px;
    box-shadow: var(--shadow-topbar);
}

/* Menu icon button that lives in the top bar. Hidden on desktop (the side
   menu is always visible); shown on small screens where it opens the drawer. */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--r-sm);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease;
}
.nav-toggle:hover { background: rgba(255, 255, 255, .20); }
.nav-toggle:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }

.brand { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; flex: 0 0 auto; }
.wordmark { font-size: 23px; font-weight: 800; font-style: italic; letter-spacing: .3px; }
.wm-soft { color: var(--gold); }
.wm-logix { color: #fff; }
.brand-name {
    color: #c3cde0; font-weight: 600; font-size: 11.5px;
    letter-spacing: .6px; text-transform: uppercase; margin-top: 4px;
}

/* Push the account block to the right edge. */
.who {
    margin-left: auto;
    display: flex; align-items: center; gap: 4px;
    font-size: 13px; color: #e7ecf5;
}
.who .email { margin-right: 8px; color: #eef2f8; }
.who .muted { color: #aab6cd; }

.muted { color: var(--muted); }

/* ============================================================
   Body: desktop = sticky side menu + content; mobile = stacked
   ============================================================ */
.body { display: flex; flex: 1; align-items: flex-start; }

.sidenav {
    width: var(--sidenav-w);
    flex: 0 0 var(--sidenav-w);
    background: var(--bg-2);
    border-right: 1px solid var(--line);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--topbar-h);
    align-self: stretch;
    min-height: calc(100vh - var(--topbar-h));
}

.navlinks { display: flex; flex-direction: column; gap: 2px; }

.navitem {
    display: flex; align-items: center;
    padding: 9px 14px;
    margin: 0;
    color: var(--heading);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--r-sm);
    transition: background .14s ease, color .14s ease;
}
.navitem:hover { background: var(--accent-soft); color: var(--navy-deep); }
.navitem.active {
    background: var(--navy);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.navitem.active:hover { background: var(--navy2); color: #fff; }

/* The in-topbar menu button (mobile) reuses .nav-toggle; the sidebar no longer
   carries its own toggle. Kept for backward compatibility if referenced. */
.navtoggle { display: none; }

.content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 26px 32px 40px;
    max-width: 1200px;
    width: 100%;
}

/* ============================================================
   Typography
   ============================================================ */
h1 {
    color: var(--heading);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.2px;
    margin: 0 0 16px;
}
h3 {
    color: var(--heading);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.1px;
    margin: 0 0 12px;
}

.lead { color: var(--ink-2); max-width: 860px; line-height: 1.65; margin: 0 0 12px; }
/* Home tagline: bigger and in heading colour so the top of the page lands harder.
   Scoped to .hero so every other .lead paragraph is unchanged. */
.lead.hero { font-size: 18px; line-height: 1.5; color: var(--heading); margin: 0 0 16px; }
.fineprint { color: var(--muted); font-size: 12.5px; line-height: 1.55; margin-top: 16px; }
.hint { color: var(--good); font-size: 13px; margin-left: 8px; }

/* ------------------------------------------------------------
   Home page — lead benefits as three numbered pillars.
   Replaces the plain bulleted list under the tagline. Every colour
   flows through an existing token (--card, --line, --gold, --heading,
   --ink-2), so dark mode needs NO new overrides: the ghost numeral is
   --gold at low alpha and brightens automatically when --gold flips.
   The container keeps the original .lead-points class and stays a <ul>
   (list semantics preserved; markers removed).
   ------------------------------------------------------------ */
.lead-points {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    max-width: 860px;          /* aligns with .lead above it */
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.lead-points .pillar {
    position: relative;
    overflow: hidden;          /* clips the oversized numeral */
    background: var(--card);
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);   /* echoes .card.section / metric tiles */
    border-radius: var(--r-md);
    padding: 20px 20px 18px;
    box-shadow: var(--shadow-sm);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.lead-points .pillar:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--gold-soft);
    border-top-color: var(--gold);       /* shorthand above would recolour the top rule */
}

/* Featured pillar (the AI optimizer). A warm gold wash mixed from the existing
   --gold token, so it re-mixes itself in dark mode with no override block.
   Browsers without color-mix() simply fall back to the plain --card background. */
.lead-points .pillar.featured {
    background: linear-gradient(180deg,
                color-mix(in srgb, var(--gold) 13%, var(--card)) 0%,
                var(--card) 62%);
    border-color: var(--gold-soft);
    border-top-color: var(--gold);
    box-shadow: var(--shadow-md);
}
.lead-points .pillar.featured .pillar-num { opacity: .2; }

/* Small uppercase pill beside the featured heading. Inline inside the <h3> so
   all three headings stay on the same baseline. */
.lead-points .pillar-badge {
    display: inline-block;
    vertical-align: 2px;
    margin: 0 0 0 8px;
    padding: 1px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--gold) 24%, var(--card));
    border: 1px solid var(--gold-soft);
    color: var(--heading);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    line-height: 1.7;
}

.lead-points .pillar-num {
    position: absolute;
    right: 8px;
    top: -10px;
    font-size: 66px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.04em;
    color: var(--gold);
    opacity: .14;
    pointer-events: none;
    user-select: none;
}

/* position:relative keeps the text painted above the ghost numeral. */
.lead-points .pillar h3 {
    position: relative;
    margin: 0 0 7px;
    font-size: 17.5px;
    font-weight: 800;
    letter-spacing: -.2px;
}

.lead-points .pillar p {
    position: relative;
    margin: 0;
    color: var(--ink-2);
    font-size: 14px;
    line-height: 1.55;
}

@media (prefers-reduced-motion: reduce) {
    .lead-points .pillar { transition: none; }
    .lead-points .pillar:hover { transform: none; }
}

@media (max-width: 820px) {
    .lead-points { grid-template-columns: 1fr; gap: 10px; }
    .lead-points .pillar-num { font-size: 54px; }
    .lead.hero { font-size: 16.5px; }
}


.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 20px 22px;
    margin: 16px 0;
    box-shadow: var(--shadow-sm);
}

.foot {
    padding: 18px 32px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.6;
    border-top: 1px solid var(--line);
    background: var(--card);
}
.foot a { color: var(--accent); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.footsep { color: var(--line-strong); }

/* ============================================================
   Forms
   ============================================================ */
.txt, .num, select.txt {
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: var(--card);
    transition: border-color .14s ease, box-shadow .14s ease;
}
.num { width: 140px; }
.txt { width: 260px; }
.txt:focus, .num:focus, select.txt:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(47, 90, 168, .16);
}
.num:disabled, select:disabled, .num.disabled, .txt:disabled {
    background: var(--disabled-bg); color: var(--disabled-ink); cursor: not-allowed;
}
.note-inline {
    grid-column: 1 / -1;
    background: var(--warn-bg); border: 1px solid var(--warn-line);
    color: var(--warn-ink); padding: 9px 12px; border-radius: var(--r-sm);
    font-size: 12.5px; margin-bottom: 6px;
}
.note-inline a { color: var(--heading); font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > label { font-size: 12px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.field > .num, .field > .txt { margin-top: auto; }
.form-grid > label { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 10px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.form-grid > label > .txt, .form-grid > label > .num { margin-top: auto; }
.field .check { flex-direction: row; align-items: center; gap: 6px; display: flex; }

.info {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; border-radius: 50%;
    background: var(--navy); color: #fff; font-size: 10px; font-style: italic;
    font-weight: 700; line-height: 1; cursor: pointer; user-select: none;
    font-family: Georgia, "Times New Roman", serif;
    /* Works as either a decorative <span> or an interactive <button> (InfoTip). */
    border: 0; padding: 0; margin: 0; appearance: none; -webkit-appearance: none;
    vertical-align: middle;
}
.info:hover, .info:focus { background: var(--navy2); outline: none; }
.info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================================
   Info tooltip (InfoTip.razor) — works with touch and mouse.
   Desktop: hover the ⓘ reveals the note. Touch/keyboard: tapping (or
   Enter/Space) toggles the `open` class; a transparent full-screen
   backdrop catches the outside tap to dismiss. No reliance on the
   native title attribute, which never shows on touch devices.
   ============================================================ */
.infotip { position: relative; display: inline-flex; vertical-align: middle; }

.infotip-bubble {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 60;
    display: none;
    width: max-content;
    max-width: min(280px, 86vw);
    padding: 9px 11px;
    background: var(--tooltip-bg);
    color: #fff;
    font: 400 12.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-style: normal;
    letter-spacing: normal;
    text-align: left;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .24);
    overflow-wrap: anywhere;
    white-space: normal;
    cursor: auto;
    user-select: text;
}
/* small caret pointing up at the marker */
.infotip-bubble::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 9px;
    border: 6px solid transparent;
    border-bottom-color: var(--tooltip-bg);
}

/* Tap/keyboard reveal (all devices). */
.infotip.open .infotip-bubble { display: block; }

/* Hover reveal only where a real pointer can hover (desktop), so a tap doesn't
   get "stuck" open via :hover on touch screens. */
@media (hover: hover) and (pointer: fine) {
    .infotip:hover .infotip-bubble { display: block; }
}

/* Dismiss catcher. It is rendered as a SIBLING of .infotip in InfoTip.razor —
   never a child. :hover matches every ancestor of the hovered element, so a
   full-screen backdrop nested inside .infotip would hold `.infotip:hover` true
   across the whole viewport and the hover rule above would pin the bubble open
   permanently. Keep it outside .infotip's ancestor chain. z-index 55 sits below
   the bubble (60) so the bubble stays readable and selectable above it. */
.infotip-backdrop { position: fixed; inset: 0; z-index: 55; background: transparent; }

/* On small screens the marker can sit anywhere on a line, so an anchored bubble
   would overflow the edge. Instead show the note as a full-width card pinned near
   the bottom of the viewport — it never overflows, and the dimmed backdrop makes
   the outside-tap-to-close target obvious. */
@media (max-width: 640px) {
    .infotip-bubble {
        position: fixed;
        left: 12px; right: 12px; bottom: 12px; top: auto;
        width: auto; max-width: none;
        font-size: 13.5px;
        padding: 12px 14px;
    }
    .infotip-bubble::before { display: none; }
    .infotip-backdrop { background: rgba(16, 24, 40, .28); }
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px 28px; }

/* Field banding (2026-09). A field's note must sit under ITS OWN input: written as a
   sibling of <Num> it became a separate grid cell and pushed the following fields out of
   place. Every direct child now occupies a three-row band — label / control / note — and
   .field maps its own rows onto those tracks with subgrid, so labels, inputs and notes each
   line up across a row however long a note is. Children that are not .field (a bare <label>
   wrapping a <select>, .derived, .strategy) simply span the band without subgridding.
   Browsers without subgrid fall back to a plain auto-row grid: the note stays inside its
   field (the point of the change); only the cross-field alignment is lost. */
.form-grid > * { grid-row: span 3; }
.form-grid > .field {
    display: grid;
    grid-template-rows: subgrid;
    row-gap: 4px;
    align-content: start;
}

/* Visible note under an input — for a statement a user should not have to hover to find.
   Quieter than .fineprint and scoped to the field. */
.field-note {
    margin: 1px 0 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--muted);
    font-weight: 400;
}
.section h3 { border-bottom: 1px solid var(--line); padding-bottom: 8px; }

.toolbar { display: flex; align-items: center; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.derived {
    grid-column: 1 / -1; color: var(--heading);
    background: var(--warn-bg); border: 1px solid var(--warn-line);
    padding: 9px 12px; border-radius: var(--r-sm); margin-top: 6px;
}

/* strategy selector block */
.strategy { display: flex; flex-direction: column; gap: 8px; max-width: 900px; }
.strategy .wide { width: 420px; max-width: 100%; }
.strategy-desc { margin: 0; color: var(--ink-2); line-height: 1.6; }

/* ============================================================
   Buttons & links
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    background: var(--card);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    color: var(--heading);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .04s ease;
}
.btn:hover { background: var(--accent-soft); border-color: #c4d1ea; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn.primary {
    background: var(--navy); color: #fff; border-color: var(--heading);
}
.btn.primary:hover { background: var(--navy2); border-color: var(--navy2); }

.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

.link {
    background: none; border: none; color: var(--accent); cursor: pointer;
    text-decoration: underline; text-underline-offset: 2px; padding: 0;
    font-size: inherit; font-family: inherit; font-weight: 600;
}
.link:hover { color: var(--navy-deep); }
.link.danger { color: var(--bad); }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.danger:hover { background: #9e1e18; border-color: #9e1e18; }

/* ============================================================
   Membership pages
   ============================================================ */
.navgap { height: 1px; border-top: 1px solid var(--line); margin: 12px 10px; }
.reg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 820px) { .reg-grid { grid-template-columns: 1fr; } }
ol.tiers { margin: 4px 0 0; padding-left: 18px; }
ol.tiers li { margin-bottom: 10px; }
.you { color: var(--good); font-weight: 700; }
.statusline {
    margin-top: 10px; padding: 8px 14px; border-radius: 999px;
    background: var(--accent-soft); color: var(--heading); font-weight: 600;
    display: inline-block;
}
.devcode {
    background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink);
    padding: 10px 12px; border-radius: var(--r-sm); margin: 8px 0; font-size: 13px;
}
.devcode .code {
    font-family: "Courier New", monospace; font-weight: 700; font-size: 15px;
    letter-spacing: 2px; color: var(--heading);
}
.tierline { margin: 2px 0 10px; color: var(--heading); font-size: 13px; }
.sub-notes { color: var(--ink-2); line-height: 1.6; margin: 8px 0 0 18px; }
.sub-notes li { margin: 4px 0; }
.paypal-wrap { margin-top: 10px; }
.disclaimer { color: var(--muted); font-size: 12.5px; }
.rowactions { display: flex; gap: 12px; justify-content: flex-end; }

.signin { max-width: 460px; display: flex; flex-direction: column; gap: 10px; }
.emaillist { list-style: none; padding: 0; margin: 0; }
.emaillist li { padding: 3px 0; }
.notes ul { line-height: 1.65; }

.remember { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.remember input { margin: 0; width: auto; }

.small { font-size: 12.5px; }

/* ============================================================
   Dashboard: sequencing-policy panel
   ============================================================ */
.policy {
    border-left: 4px solid var(--navy);
    background: linear-gradient(180deg, var(--policy-1) 0%, var(--policy-2) 100%);
}
.policy-summary { margin: 2px 0; }
.policy .small { font-size: 12.5px; }
ol.waterfall { margin: 8px 0 6px; padding-left: 22px; }
ol.waterfall li { margin-bottom: 6px; line-height: 1.55; }

/* ============================================================
   Dashboard metrics — elevated tiles with a gold accent rule
   ============================================================ */
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 16px 0; }
.metric {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 16px 18px 18px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow .16s ease, transform .16s ease;
}
.metric::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-soft) 100%);
}
.metric:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.metric-title { font-weight: 700; color: var(--heading); font-size: 14.5px; }
.metric-sub { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.metric .big { font-size: 26px; font-weight: 800; letter-spacing: -.4px; color: var(--ink); }
.metric .mid { font-size: 16px; font-weight: 700; color: var(--ink); }
.metric .good { color: var(--good); }
.metric .bad { color: var(--bad); }

/* ============================================================
   Tables
   ============================================================ */
.tablewrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    background: var(--card);
}
/* Every standalone data table scrolls horizontally when it is wider than its container
   (e.g. on a phone) instead of forcing the whole page wide. display:block turns the table
   itself into the scroll box; fit-content keeps narrow tables compact rather than stretched. */
table.grid {
    border-collapse: collapse;
    display: block;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 12.5px;
    background: var(--card);
}
table.grid.narrow { width: -webkit-fit-content; width: fit-content; }
/* Inside a .tablewrap the wrapper already handles scrolling, so keep the table a normal
   full-width table and let the wrapper scroll (Projection page). */
.tablewrap table.grid {
    display: table;
    width: 100%;
    max-width: none;
    overflow: visible;
}
table.grid th, table.grid td {
    border-bottom: 1px solid var(--line);
    padding: 8px 12px; text-align: right; white-space: nowrap;
}
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid thead th {
    background: var(--navy); color: #fff; font-weight: 600;
    position: relative; border-bottom: none;
    white-space: nowrap;
}
table.grid thead th:first-child { border-top-left-radius: var(--r-md); }
table.grid thead th:last-child { border-top-right-radius: var(--r-md); }
table.grid tbody tr { transition: background .1s ease; }
table.grid tbody tr:nth-child(even) { background: var(--bg-2); }
table.grid tbody tr:hover { background: var(--accent-soft); }
table.grid tfoot td { background: var(--total-bg); font-weight: 700; border-top: 2px solid var(--line-strong); }
td.bad, .bad { color: var(--bad); font-weight: 600; }
td.good, .good { color: var(--good); font-weight: 600; }

table.grid.compare tbody td:nth-child(2) { background: rgba(30, 125, 50, 0.10); }
table.grid.compare tbody tr:hover td:nth-child(2) { background: rgba(30, 125, 50, 0.16); }

/* ============================================================
   Chart
   ============================================================ */
.chart { width: 100%; height: 300px; background: var(--card); }
.chart .axis { stroke: #9aa1ac; stroke-width: 1; }
.chart .line { fill: none; stroke-width: 2.25; }
.chart .line.nominal { stroke: var(--navy); }
.chart .line.real { stroke: #c55a11; }
.chart .lbl { fill: var(--muted); font-size: 11px; }
.chart .lbl.end { text-anchor: end; }
.chart .gridline { stroke: #cfd5e0; stroke-width: 1; stroke-dasharray: 1 3; stroke-linecap: round; }
.chart .gridlbl { fill: #9aa1ac; font-size: 10px; }
.chart .gridlbl.end { text-anchor: end; }
.chart .gridlbl.mid { text-anchor: middle; }
.legend { margin-top: 8px; font-size: 12.5px; }
.legend .key { margin-right: 16px; }
.legend .key.nominal::before { content: "\2014 "; color: var(--heading); font-weight: 700; }
.legend .key.real::before { content: "\2014 "; color: #c55a11; font-weight: 700; }

/* ============================================================
   Responsive / mobile support
   ------------------------------------------------------------
   Desktop uses a sticky side menu. Below 820px the side menu
   collapses into a drawer that drops down from the sticky top
   bar; the menu icon in the top bar toggles it. Grids stack to
   a single column and fixed-width inputs shrink to fit. Wide
   data tables already scroll inside .tablewrap.
   ============================================================ */

@media (max-width: 820px) {
    .lead, .strategy-desc, .fineprint, .disclaimer, .sub-notes,
    .metric, .card, .foot { overflow-wrap: anywhere; }
}

@media (max-width: 820px) {
    /* Show the menu icon in the top bar. */
    .nav-toggle { display: inline-flex; }

    /* Keep the brand/title from being squeezed off the bar by a long account
       block (badge + email + plan name): the account block yields space and its
       email truncates with an ellipsis, so "My Income Model" always stays visible. */
    .who { min-width: 0; }
    .who .email { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Stack the drawer below the top bar. */
    .body { flex-direction: column; align-items: stretch; }

    .sidenav {
        width: 100%;
        flex: 0 0 auto;
        min-height: 0;
        position: sticky;
        top: var(--topbar-h);
        z-index: 40;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 10px 12px;
        box-shadow: var(--shadow-md);
        /* Collapsed by default; expands when .open is set from the top bar. */
        max-height: 0;
        overflow: hidden;
        padding-top: 0;
        padding-bottom: 0;
        border-bottom-width: 0;
        transition: max-height .22s ease, padding .22s ease, border-bottom-width .22s ease;
    }
    .sidenav.open {
        max-height: 80vh;
        overflow-y: auto;
        padding-top: 10px;
        padding-bottom: 12px;
        border-bottom-width: 1px;
    }
    .navlinks { gap: 3px; }
    .navitem { padding: 12px 14px; font-size: 15px; }

    .content { padding: 18px 16px 28px; max-width: 100%; }
    .foot { padding: 16px; }

    .form-grid { grid-template-columns: 1fr; }
    .metrics   { grid-template-columns: 1fr; }

    .txt, .num, select.txt { width: 100%; max-width: 100%; }
    .strategy .wide { width: 100%; }
    .signin { max-width: 100%; }

    h1 { font-size: 22px; }
}

/* Phones: tighten the top bar and let controls fill the width. */
@media (max-width: 560px) {
    /* Not enough width for the brand and the account details on one line, so let
       the top bar wrap: the menu icon + brand stay on line 1, and the account
       block (email / plan name + sign out) drops to a right-aligned second line. */
    .topbar { padding: 8px 14px; gap: 4px 10px; flex-wrap: wrap; }
    .who {
        flex-basis: 100%;
        width: 100%;
        margin-left: 0;
        flex-direction: column;   /* stack the account details on the second line */
        align-items: flex-end;    /* right-align the block */
        gap: 2px;
        font-size: 12px;
    }
    /* Full-width line so a long address / plan name wraps and stays right-aligned
       instead of overflowing off the right edge; "sign out" sits right-aligned below. */
    .who .email {
        width: 100%;
        margin-right: 0;
        overflow: visible;
        white-space: normal;
        overflow-wrap: anywhere;
        text-align: right;
    }

    .toolbar { gap: 8px; }
    .toolbar .btn { flex: 1 1 auto; text-align: center; }

    /* Frozen header + first column stay active in the bounded scroll box on phones. */
    .tablewrap { max-height: 72vh; }

    .rowactions { flex-wrap: wrap; justify-content: flex-start; }

    .wordmark { font-size: 20px; }
    .brand-name { font-size: 10.5px; }
    .content { padding: 16px 13px 22px; }
}


/* ============================================================
   REFRESH ADD-ONS (2026) — pills, tonal buttons, status chips,
   table polish, and dark theme. All additive; the rules above
   are unchanged and light mode renders identically.
   ============================================================ */

/* Row-action pills (Home saved-models list) -------------------- */
.rowactions { gap: 8px; }
.pill {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1px solid transparent; border-radius: 999px;
    padding: 5px 13px; font: inherit; font-size: 12.5px; font-weight: 600;
    line-height: 1; cursor: pointer; text-decoration: none;
    transition: background .14s ease, color .14s ease, border-color .14s ease;
}
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill.blue  { background: var(--accent-soft); color: var(--heading); }
.pill.blue:hover  { background: color-mix(in srgb, var(--accent) 20%, var(--accent-soft)); }
.pill.quiet { background: transparent; color: var(--muted); }
.pill.quiet:hover { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--ink); }
.pill.red   { background: var(--bad-soft); color: var(--bad); }
.pill.red:hover   { background: var(--bad); color: #fff; }

/* Tonal button tier -------------------------------------------- */
.btn.tonal {
    background: var(--accent-soft); color: var(--heading);
    border-color: transparent; box-shadow: none;
}
.btn.tonal:hover { background: color-mix(in srgb, var(--accent) 18%, var(--accent-soft)); border-color: transparent; }
.btn.gold { background: var(--gold); color: #3a2c08; border-color: var(--gold); }
.btn.gold:hover { filter: brightness(.96); background: var(--gold); border-color: var(--gold); }
.btn.ghost-danger {
    background: var(--bad-soft); color: var(--bad);
    border-color: transparent; box-shadow: none;
}
.btn.ghost-danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }

/* Status chips (driven off the existing status tokens) --------- */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    border-radius: 999px; padding: 4px 11px;
    font-size: 12px; font-weight: 650; white-space: nowrap;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad  { background: var(--bad-soft);  color: var(--bad); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }

/* Table polish ------------------------------------------------- */
table.grid { font-variant-numeric: tabular-nums; }
/* Long data tables scroll inside the wrapper with a sticky header. Tables
   shorter than the cap don't scroll, so short tables look unchanged. */
.tablewrap { max-height: 78vh; overflow: auto; }
.tablewrap table.grid thead th { position: sticky; top: 0; z-index: 3; }
.tablewrap table.grid tbody td:first-child { font-weight: 600; color: var(--heading); }

/* Top-bar theme toggle ----------------------------------------- */
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex: 0 0 auto; margin-left: auto;
    background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18);
    border-radius: var(--r-sm); color: #fff; cursor: pointer;
    font-size: 16px; line-height: 1; transition: background .15s ease;
}
.theme-toggle:hover { background: rgba(255,255,255,.20); }
.theme-toggle:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.theme-toggle .ico-sun, .theme-toggle .ico-moon { display: none; }
.theme-toggle .ico-moon { display: inline; }         /* light / OS-light: offer the moon */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .ico-moon { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .ico-sun  { display: inline; }
}
:root[data-theme="light"] .theme-toggle .ico-moon { display: inline; }
:root[data-theme="light"] .theme-toggle .ico-sun  { display: none; }
:root[data-theme="dark"]  .theme-toggle .ico-moon { display: none; }
:root[data-theme="dark"]  .theme-toggle .ico-sun  { display: inline; }

/* ============================================================
   Dark theme — token overrides only. Applies on the visitor's OS
   setting unless they've explicitly chosen light; an explicit
   dark choice (toggle) wins the other way.
   ============================================================ */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --navy: #2f4a7a; --navy2: #3a5892; --navy-deep: #223a63;
        --gold: #e3b968; --gold-soft: #f0d59a;
        --accent: #6f9bea; --accent-soft: #22304a;
        --ink: #e7ebf3; --muted: #94a1b6; --line: #2a3342; --line-strong: #3a4556;
        --bg: #0e131d; --bg-2: #151b27; --card: #1b2230;
        --good: #5fce87; --good-soft: #17321f; --bad: #f0837c; --bad-soft: #3a1f1e;
        --warn-bg: #3a3316; --warn-line: #5c4f1f; --warn-ink: #e7cf7a;
        --heading: #a9c2f0; --ink-2: #c2cad8; --total-bg: #223049;
        --disabled-bg: #10151f; --disabled-ink: #667082;
        --policy-1: #1a2233; --policy-2: #141b28; --tooltip-bg: #0b0f16; --amber-row: #3a2f10;
        --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
        --shadow-md: 0 4px 12px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.4);
        --shadow-topbar: 0 2px 10px rgba(0,0,0,.55);
    }
}
:root[data-theme="dark"] {
    --navy: #2f4a7a; --navy2: #3a5892; --navy-deep: #223a63;
    --gold: #e3b968; --gold-soft: #f0d59a;
    --accent: #6f9bea; --accent-soft: #22304a;
    --ink: #e7ebf3; --muted: #94a1b6; --line: #2a3342; --line-strong: #3a4556;
    --bg: #0e131d; --bg-2: #151b27; --card: #1b2230;
    --good: #5fce87; --good-soft: #17321f; --bad: #f0837c; --bad-soft: #3a1f1e;
    --warn-bg: #3a3316; --warn-line: #5c4f1f; --warn-ink: #e7cf7a;
    --heading: #a9c2f0; --ink-2: #c2cad8; --total-bg: #223049;
    --disabled-bg: #10151f; --disabled-ink: #667082;
    --policy-1: #1a2233; --policy-2: #141b28; --tooltip-bg: #0b0f16; --amber-row: #3a2f10;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.4);
    --shadow-topbar: 0 2px 10px rgba(0,0,0,.55);
}

/* Optimize A/B: the row matching the chosen objective (themed, legible in dark). */
table.grid tr.objrow > td { background: var(--amber-row); }

/* Inputs page: gold accent stripe on each section card, echoing the Dashboard
   metric tiles. Solid left border (not a ::before) so overflow stays visible and
   InfoTip popovers inside a section are never clipped. */
.card.section { border-left: 3px solid var(--gold); }

/* Projection: freeze the first column (Year) during horizontal scroll. Header +
   body only, so the footer's colspan layout is untouched (its one total-row label
   just scrolls with the row). Backgrounds stay opaque and keep the zebra/hover/
   header colors so the frozen column reads as part of the table. */
.tablewrap table.grid thead th:first-child,
.tablewrap table.grid tbody td:first-child {
    position: sticky;
    left: 0;
    /* box-shadow divider (not border-right): a collapsed-table border can drop out
       on a sticky cell in mobile Safari; a shadow travels with the cell reliably. */
    box-shadow: 1px 0 0 0 var(--line-strong), 4px 0 6px -4px rgba(16, 24, 40, .10);
}
.tablewrap table.grid tbody td:first-child { z-index: 2; background: var(--card); }
.tablewrap table.grid tbody tr:nth-child(even) td:first-child { background: var(--bg-2); }
.tablewrap table.grid tbody tr:hover td:first-child { background: var(--accent-soft); }
.tablewrap table.grid thead th:first-child { z-index: 5; }  /* corner: sticky top (already) + left */


