/* =============================================================================
 * wf-ui.css — the WealthFlow app skin
 * -----------------------------------------------------------------------------
 * Loaded AFTER index.html's own stylesheet, so at equal specificity this file
 * wins. It does three jobs, in this order:
 *
 *   1. LEGACY BRIDGE. index.html (and ~40 modules) are written against the old
 *      variables — --bg, --card, --accent, --text3 … — hundreds of times, many
 *      inside inline styles. Re-pointing those names at the wf-tokens.css values
 *      re-colours every screen at once, including markup nobody has touched.
 *   2. COMPONENT SKIN. .btn .card .stat-card .tbl-wrap .md .fi … get one
 *      consistent shape, type scale, spacing and state treatment.
 *   3. SHELL. Sidebar, top bar, mobile tab bar, sheets, command palette,
 *      toasts, sign-in.
 *
 * It changes presentation only. No selector here depends on, or alters, what a
 * button does or what data a screen reads.
 *
 * TOUCH TARGETS: 44 px on touch devices (WCAG 2.2 AAA / Apple HIG), 36 px
 * elsewhere (AA minimum is 24 px).
 * ===========================================================================*/

/* ═════════════════ 1. LEGACY BRIDGE ═════════════════════════════════════════ */
:root {
    --bg: var(--wf-bg);
    --bg2: var(--wf-surface);
    --bg3: var(--wf-card);
    --card: var(--wf-card);
    --card2: var(--wf-card-2);
    --card3: var(--wf-card-3);
    --border: var(--wf-line);
    --border2: var(--wf-line-2);
    --accent: var(--wf-accent);
    --accent2: var(--wf-gold-500);
    --accent3: var(--wf-gold-300);
    --ag: var(--wf-accent-soft);
    --green: var(--wf-pos);
    --green2: var(--wf-pos);
    --gg: var(--wf-pos-soft);
    --red: var(--wf-neg);
    --red2: var(--wf-neg);
    --rg: var(--wf-neg-soft);
    --blue: var(--wf-info);
    --blue2: var(--wf-info);
    --purple: var(--wf-violet);
    --purple2: var(--wf-violet);
    --cyan: var(--wf-teal);
    --text: var(--wf-text);
    --text2: var(--wf-text-2);
    --text3: var(--wf-text-3);
    --font: var(--wf-font);
    /* Money was set in a monospace face. Banking interfaces use the UI face with
       tabular figures instead: columns still line up, and it stops reading like a terminal. */
    --mono: var(--wf-font);
    --r: var(--wf-r-md);
    --r2: var(--wf-r-sm);
    --r3: var(--wf-r-xl);
    --shadow: var(--wf-shadow-3);
    --sh2: var(--wf-shadow-1);
    --sw: 256px;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: auto;
}

body {
    font-family: var(--wf-font);
    font-size: var(--wf-fs-md);
    line-height: 1.5;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: 'tnum' 1, 'lnum' 1, 'cv11' 1;
    background: var(--wf-bg);
    color: var(--wf-text);
}

h1, h2, h3, h4 { text-wrap: balance; }
p, .card-sub, .stat-meta, .fhint, .empty-sub { text-wrap: pretty; }

/* A keyboard user must always see where they are. */
:focus-visible {
    outline: none;
    box-shadow: var(--wf-focus);
    border-radius: var(--wf-r-xs);
}
.btn:focus-visible, .nav-item:focus-visible, .wf-tab:focus-visible { border-radius: var(--wf-r-sm); }

::selection { background: var(--wf-accent-soft); color: var(--wf-text); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--wf-line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--wf-text-3); background-clip: padding-box; border: 2px solid transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--wf-line-2) transparent; }

/* Desktop fields are 14 px; the old rule forced 16 px everywhere (right for iOS zoom, too big with a mouse). */
@media (min-width: 901px) and (pointer: fine) {
    input, select, textarea { font-size: 14px !important; }
}

/* ═════════════════ 2. BRAND MARK ════════════════════════════════════════════ */
.wf-mark { display: block; width: 100%; height: 100%; }
.wf-tile {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: radial-gradient(120% 120% at 20% 10%, #1b2236 0%, #0c101b 70%);
    border: 1px solid rgba(228, 194, 107, .28);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 6px 18px rgba(0, 0, 0, .35);
}
.wf-tile .wf-mark { width: 74%; height: 74%; }
.wf-wordmark { font-weight: 650; letter-spacing: -.02em; color: var(--wf-text); line-height: 1.1; }

/* ═════════════════ 3. SPLASH ════════════════════════════════════════════════ */
/* The loading screen is the first frame of the sign-in screen: the same navy field, gold light and
   glass tile, pinned to that dark palette in every theme, so the hand-over to the login is one
   continuous scene. Markup and the script that drives #spFill / #spStatus are unchanged. */
#splash {
    color-scheme: dark; --wf-text: #e9edf6; --wf-text-3: #8e9bb4;
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(212, 175, 55, .14), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(23, 50, 99, .7), transparent 60%),
        linear-gradient(180deg, #071226, #050d1c);
    gap: 18px;
    transition: opacity .5s var(--wf-ease), transform .5s var(--wf-ease);
}
#splash.hide { transform: scale(1.02); }
.sp-logo {
    position: relative; overflow: visible; margin-bottom: 12px;
    width: 88px; height: 88px; border-radius: 26px; padding: 0;
    background: radial-gradient(120% 120% at 20% 10%, #12294f 0%, #07142b 72%);
    border: 1px solid rgba(228, 194, 107, .34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 6px rgba(228, 194, 107, .05), 0 28px 64px -18px rgba(0, 0, 0, .7);
    animation: wfBreathe 2.8s ease-in-out infinite;
}
.sp-logo .wf-mark { width: 72%; height: 72%; }
/* A thin gold arc circles the tile (a circle, so turning it never swings a corner) while the app loads: it says "working" without a spinner. */
.sp-logo::after {
    content: ''; position: absolute; inset: -16px; border-radius: 50%; pointer-events: none;
    background: conic-gradient(from 0deg, transparent 0 72%, rgba(228, 194, 107, .95) 92%, transparent 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    padding: 1.5px; animation: wfSplashOrbit 2.4s linear infinite;
}
@keyframes wfBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes wfSplashOrbit { to { transform: rotate(360deg); } }
.sp-title {
    font-size: 30px; font-weight: 650; letter-spacing: -.035em;
    background: none; -webkit-text-fill-color: currentColor; color: #fff; margin: 0;
}
.sp-sub { font-size: 11.5px; letter-spacing: .26em; color: #d4af37; font-weight: 600; opacity: .9; }
.sp-bar-wrap {
    width: 184px; height: 3px; border-radius: 3px; background: rgba(212, 175, 55, .16); box-shadow: none;
}
.sp-fill {
    background: linear-gradient(90deg, var(--wf-gold-500), var(--wf-gold-300)); box-shadow: none; border-radius: 3px;
    transition: width .35s var(--wf-ease); overflow: hidden;
}
.sp-fill::after {
    content: ''; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
}
.sp-status { font-family: var(--wf-font); font-size: 12.5px; color: #8e9bb4; letter-spacing: .01em; }

@media (prefers-reduced-motion: no-preference) {
    #splash::before {
        content: ''; position: fixed; inset: -12%; z-index: -1; pointer-events: none; will-change: transform;
        background:
            radial-gradient(42% 38% at 72% 18%, rgba(212, 175, 55, .1), transparent 70%),
            radial-gradient(46% 40% at 14% 80%, rgba(23, 50, 99, .6), transparent 72%);
        animation: wfAuthDrift 30s ease-in-out infinite alternate;
    }
    @keyframes wfSplashRise { from { opacity: 0; transform: translate3d(0, 14px, 0); } }
    #splash .sp-logo { animation: wfSplashRise .8s var(--wf-ease) backwards, wfBreathe 2.8s ease-in-out .8s infinite; }
    #splash .sp-title-wrap, #splash .sp-bar-wrap, #splash .sp-status { animation: wfSplashRise .8s var(--wf-ease) backwards; }
    #splash .sp-title-wrap { animation-delay: .12s; }
    #splash .sp-bar-wrap { animation-delay: .24s; }
    #splash .sp-status { animation-delay: .34s; }
    .sp-fill::after { animation: wfSplashSheen 1.6s ease-in-out 1s infinite; }
    @keyframes wfSplashSheen { to { transform: translateX(100%); } }
    /* If loading takes longer than usual, say so (the 8 s failsafe still ends it); no script involved. */
    #splash::after {
        content: 'Taking longer than usual. Check your connection; WealthFlow keeps trying.';
        position: absolute; left: 24px; right: 24px; bottom: max(40px, 8vh); text-align: center;
        font: 500 12.5px/1.5 var(--wf-font); color: #aab5cb; opacity: 0; pointer-events: none;
        animation: wfSplashHint .6s var(--wf-ease) 5s forwards;
    }
    @keyframes wfSplashHint { to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { .sp-logo, .sp-logo::after { animation: none; } }

/* ═════════════════ 4. SIGN-IN ═══════════════════════════════════════════════ */
/* The sign-in screen wears the public home page's look (landing.html): the same navy field,
   the same gold light, the same glass card. It is pinned to that dark palette in every
   theme, as the public page is, so the first thing a person sees after "Login / Register"
   is the page they just left. Only colour and motion live here; the markup is unchanged. */
#authScreen {
    color-scheme: dark; color: var(--wf-text);
    --wf-bg: #071226; --wf-surface: #0b1d3d; --wf-card: #0e2144; --wf-card-2: rgba(5, 13, 28, .55); --wf-card-3: rgba(212, 175, 55, .1);
    --wf-line: rgba(212, 175, 55, .22); --wf-line-2: rgba(255, 255, 255, .16); --wf-line-3: #7385ab;
    --wf-text: #e9edf6; --wf-text-2: #b4bfd4; --wf-text-3: #8e9bb4;
    --wf-field: rgba(5, 13, 28, .6); --wf-accent-soft: rgba(228, 194, 107, .13);
    --wf-accent: var(--wf-gold-400); --wf-accent-fill: var(--wf-gold-400); --wf-accent-ink: #17120a; --wf-accent-line: rgba(228, 194, 107, .34);
    --wf-focus: 0 0 0 3px rgba(228, 194, 107, .38); --wf-pos: #3dd28d; --wf-neg: #ff6b78; --accent: #e4c26b;
    --text: #e9edf6; --text2: #b4bfd4; --text3: #8e9bb4; --bg2: #0b1d3d; --card: #0e2144; --card2: rgba(5, 13, 28, .55);
    --border: rgba(212, 175, 55, .22); --border2: rgba(255, 255, 255, .16);
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(212, 175, 55, .14), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(23, 50, 99, .7), transparent 60%),
        linear-gradient(180deg, #071226, #050d1c);
}
.auth-box {
    position: relative;
    background: linear-gradient(160deg, rgba(23, 50, 99, .78), rgba(11, 29, 61, .88));
    border: 1px solid var(--wf-line); border-radius: 22px;
    padding: 36px 32px 32px; max-width: 408px; width: calc(100% - 32px); margin: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .07);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    animation: wfAuthIn .6s var(--wf-ease) both;
}
@keyframes wfAuthIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
/* The slide icons carry one colour, the brand gold (they were four, set inline). */
.auth-slide .as-ic { color: var(--wf-gold-400) !important; }
.auth-logo {
    width: 68px; height: 68px; border-radius: 20px; margin: 0 auto 18px; padding: 0; font-size: 26px;
    background: radial-gradient(120% 120% at 20% 10%, #12294f 0%, #07142b 70%);
    border: 1px solid rgba(228, 194, 107, .34); color: var(--wf-accent);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.auth-logo .wf-mark { width: 72%; height: 72%; }
.auth-logo svg:not(.wf-mark) { width: 26px; height: 26px; }
.auth-title { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-sub { font-size: 14px; color: var(--wf-text-2); margin-bottom: 24px; line-height: 1.5; }
.auth-slider { margin: 0 0 22px; }
.auth-slide {
    background: var(--wf-card-2); border: 1px solid rgba(255, 255, 255, .08); border-radius: 16px; padding: 18px 16px;
}
.auth-slide .as-h { font-size: 15px; font-weight: 600; color: var(--wf-text); }
.auth-slide .as-p { font-size: 13px; color: var(--wf-text-2); line-height: 1.55; }
.auth-dots .ad { background: var(--wf-line-2); }
.auth-dots .ad.on { background: var(--wf-accent); }
.pin-dots { gap: 14px; margin-bottom: 26px; }
.pin-dot { width: 13px; height: 13px; background: transparent; border: 1.5px solid var(--wf-line-2); transition: all .16s var(--wf-ease); }
.pin-dot.filled { background: var(--wf-accent); border-color: var(--wf-accent); box-shadow: none; transform: scale(1.12); }
.numpad { gap: 12px; max-width: 264px; }
.npb {
    width: 70px; height: 70px; border: none; background: var(--wf-card-2); color: var(--wf-text);
    font-size: 24px; font-weight: 500; transition: background var(--wf-dur-1), transform var(--wf-dur-1);
}
.npb:hover { background: var(--wf-card-3); color: var(--wf-text); border-color: transparent; transform: none; }
.npb:active { transform: scale(.94); background: var(--wf-accent-soft); }
.npb.del { background: transparent; color: var(--wf-text-2); font-size: 18px; }
.npb-sub { font-size: 9px; letter-spacing: .12em; color: var(--wf-text-3); }
.auth-link { font-size: 13px; color: var(--wf-text-2); }
.auth-link:hover { color: var(--wf-accent); }
.auth-err { font-size: 13px; }
.auth-form-label { font-size: 12.5px; font-weight: 500; color: var(--wf-text-2); }
.auth-input {
    background: var(--wf-field); border: 1px solid var(--wf-line-3); border-radius: var(--wf-r-sm);
    padding: 12px 14px; transition: border-color var(--wf-dur-1), box-shadow var(--wf-dur-1);
}
.auth-input:focus { border-color: var(--wf-accent); box-shadow: var(--wf-focus); }
.auth-btn {
    padding: 13px 16px; border-radius: var(--wf-r-sm); font-size: 15px; font-weight: 600;
    background: var(--wf-accent-fill); color: var(--wf-accent-ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
    transition: background var(--wf-dur-1), transform var(--wf-dur-1), box-shadow var(--wf-dur-1);
}
.auth-btn:hover { background: var(--wf-gold-300); transform: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45); }
.auth-btn:active { transform: scale(.985); }
.auth-btn.ghost { background: var(--wf-card-2); color: var(--wf-text); border: 1px solid var(--wf-line); box-shadow: none; }
/* "Continue with Google" is styled inline (Google's own white button); it only gains a lift and a press. */
#authGoogle .auth-btn { transition: transform .25s var(--wf-ease), box-shadow .25s var(--wf-ease) !important; }
#authGoogle .auth-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(0, 0, 0, .35) !important; }
#authGoogle .auth-btn:active { transform: scale(.985); }

/* Desktop: a brand panel beside the form, instead of a lone card on a flat field. */
.auth-brand { display: none; }
@media (min-width: 981px) {
    #authScreen.show { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); align-items: stretch; justify-items: center; overflow: hidden; }
    #authScreen .auth-box { grid-column: 2; grid-row: 1; align-self: center; margin: 24px; }
    .auth-brand {
        grid-column: 1; grid-row: 1; display: flex; flex-direction: column; justify-content: space-between;
        width: 100%; padding: 48px 56px; position: relative; color: #eef1f7;
        border-right: 1px solid rgba(212, 175, 55, .14);
        /* A shade deeper than the form side so the two halves read apart; same navy, so the aurora and the gold still show through. */
        background: linear-gradient(90deg, rgba(3, 8, 18, .6), rgba(4, 10, 22, .34));
        box-shadow: inset -28px 0 56px -28px rgba(0, 0, 0, .4);
    }
}
.ab-lockup { display: flex; align-items: center; gap: 12px; }
.ab-lockup .wf-tile { width: 44px; height: 44px; border-radius: 13px; }
.ab-lockup .wf-wordmark { font-size: 20px; color: #fff; }
.ab-head { max-width: 520px; }
.ab-head h2 { font-size: clamp(34px, 3.6vw, 52px); font-weight: 650; letter-spacing: -.035em; line-height: 1.05; color: #fff; margin: 0 0 18px; }
.ab-head h2 em { font-style: normal; background: linear-gradient(135deg, #f1d98d, #d4af37); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ab-head p { font-size: 16px; line-height: 1.6; color: #b4bfd4; max-width: 440px; margin: 0; }
.ab-points { display: grid; gap: 14px; margin: 34px 0 0; padding: 0; list-style: none; max-width: 460px; }
.ab-points li { display: flex; gap: 14px; align-items: flex-start; }
.ab-points .ab-ic { width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; background: rgba(212, 175, 55, .1); border: 1px solid rgba(212, 175, 55, .22); color: var(--wf-gold-400); }
.ab-points .ab-ic svg { width: 19px; height: 19px; }
.ab-points b { display: block; font-size: 14.5px; font-weight: 600; color: #fff; margin-bottom: 2px; }
.ab-points span { font-size: 13.5px; color: #aab5cb; line-height: 1.5; }
.ab-foot { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 12.5px; color: #8e9bb4; }
.ab-foot span { display: inline-flex; align-items: center; gap: 7px; }
.ab-foot svg { width: 14px; height: 14px; color: var(--wf-gold-400); }

/* Sign-in motion: the light of the field drifts slowly, the brand panel arrives in reading order.
   Transform and opacity only; nothing moves for people who ask for less motion. */
@media (prefers-reduced-motion: no-preference) {
    #authScreen.show::before {
        content: ''; position: fixed; inset: -12%; z-index: -1; pointer-events: none; will-change: transform;
        background:
            radial-gradient(42% 38% at 72% 18%, rgba(212, 175, 55, .1), transparent 70%),
            radial-gradient(46% 40% at 14% 80%, rgba(23, 50, 99, .6), transparent 72%);
        animation: wfAuthDrift 30s ease-in-out infinite alternate;
    }
    @keyframes wfAuthDrift { to { transform: translate3d(-2.5%, 2%, 0) scale(1.06); } }
    @keyframes wfAuthRise { from { opacity: 0; transform: translate3d(0, 16px, 0); } }
    .auth-brand .ab-lockup, .auth-brand .ab-head h2, .auth-brand .ab-head > p, .auth-brand .ab-points li, .auth-brand .ab-foot { animation: wfAuthRise .8s var(--wf-ease) backwards; }
    .auth-brand .ab-head h2 { animation-delay: .1s; }
    .auth-brand .ab-head > p { animation-delay: .18s; }
    .auth-brand .ab-points li:nth-child(1) { animation-delay: .26s; }
    .auth-brand .ab-points li:nth-child(2) { animation-delay: .34s; }
    .auth-brand .ab-points li:nth-child(3) { animation-delay: .42s; }
    .auth-brand .ab-foot { animation-delay: .5s; }
}
@media (prefers-reduced-motion: reduce) { .auth-box { animation: none; } }
@media (prefers-reduced-transparency: reduce) { .auth-box { -webkit-backdrop-filter: none; backdrop-filter: none; background: #0e2144; } }

/* ═════════════════ 5. SHELL: SIDEBAR ════════════════════════════════════════ */
.sidebar { background: var(--wf-surface); border-right: 1px solid var(--wf-line); width: var(--sw); }
.sb-logo { padding: 18px 16px 14px; border-bottom: none; }
.sb-logomark { gap: 12px; }
.sb-icon { width: 40px; height: 40px; border-radius: 12px; padding: 0; box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 6px 16px rgba(0, 0, 0, .28);
    background: radial-gradient(120% 120% at 20% 10%, #1b2236 0%, #0c101b 70%); border: 1px solid rgba(228, 194, 107, .26); }
.sb-icon .wf-mark { width: 80%; height: 80%; margin: auto; }
.sb-title { font-size: 18px; font-weight: 650; letter-spacing: -.025em; background: none; -webkit-text-fill-color: currentColor; color: var(--wf-text); line-height: 1.15; }
.sb-sub { font-size: 11.5px; letter-spacing: 0; text-transform: none; color: var(--wf-text-3); font-weight: 450; margin-top: 2px; }
.sb-nav { padding: 4px 10px 12px; }
.sb-group { font-size: 11px; font-weight: 600; letter-spacing: .09em; color: var(--wf-text-3); padding: 18px 10px 6px; text-transform: uppercase; }
.sb-group:first-child { padding-top: 6px; }
.nav-item {
    height: 38px; padding: 0 10px; gap: 11px; margin: 1px 0; border-radius: var(--wf-r-sm);
    font-size: 14px; font-weight: 500; color: var(--wf-text-2); border: 1px solid transparent;
    transition: background var(--wf-dur-1), color var(--wf-dur-1);
}
.nav-item:hover { background: var(--wf-hover); color: var(--wf-text); }
.nav-item:active { background: var(--wf-press); }
.nav-item.active, [data-theme="light"] .nav-item.active {
    background: var(--wf-accent-soft); color: var(--wf-text); border: 1px solid transparent; font-weight: 600;
}
.nav-item.active::before {
    content: ''; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--wf-accent);
}
.nav-item.active .nav-icon { color: var(--wf-accent); }
.nav-icon { width: 20px; height: 20px; font-size: 0; display: grid; place-items: center; color: var(--wf-text-3); transition: color var(--wf-dur-1); }
.nav-item:hover .nav-icon { color: var(--wf-text-2); }
.nav-icon svg, .nav-icon i { width: 18px; height: 18px; stroke-width: 1.75; }
.nb { background: var(--wf-neg); font-size: 10.5px; font-weight: 650; padding: 1px 6px; min-width: 18px; height: 18px; line-height: 16px; border-radius: 9px; animation: none; }
.sb-footer {
    padding: 12px; margin: 0 10px 12px; min-height: 0; border: 1px solid var(--wf-line); border-radius: var(--wf-r-md);
    background: var(--wf-card); padding-bottom: 12px;
}
.sb-user { font-size: 13.5px; font-weight: 600; gap: 10px; margin-bottom: 2px; }
.sb-user-photo, .sb-user-initial { width: 32px; height: 32px; }
.sb-user-photo { border: 1px solid var(--wf-line-2); }
.sb-user-initial { background: var(--wf-accent-soft); color: var(--wf-accent); font-size: 14px; font-weight: 650; border: 1px solid var(--wf-accent-line); }
.sb-date { font-family: var(--wf-font); font-size: 12px; color: var(--wf-text-3); letter-spacing: 0; padding-left: 42px; }
.sb-ver { font-size: 11px; color: var(--wf-text-3); padding-left: 42px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═════════════════ 6. SHELL: TOP BAR ════════════════════════════════════════ */
@media (min-width: 901px) { .main { margin-left: var(--sw); } }
.topbar {
    min-height: 64px; padding: 10px 28px; gap: 16px;
    background: color-mix(in srgb, var(--wf-bg) 84%, transparent);
    -webkit-backdrop-filter: saturate(150%) blur(14px); backdrop-filter: saturate(150%) blur(14px);
    border-bottom: 1px solid var(--wf-line);
}
html.wf-ios-stable .topbar { background: var(--wf-bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
.tb-left { gap: 12px; min-width: 0; }
.pg-title { font-size: 19px; font-weight: 650; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.pg-title svg { width: 20px; height: 20px; stroke-width: 1.75; color: var(--wf-accent); flex-shrink: 0; }
.pg-title span { color: var(--wf-text); }
.tb-right { gap: 4px; flex-wrap: nowrap; }
.network-wrap { margin-right: 6px; gap: 6px; }
.online-badge {
    padding: 5px 11px 5px 9px; gap: 7px; font-family: var(--wf-font); font-size: 12.5px; font-weight: 500; border-radius: var(--wf-r-pill);
}
.online-badge.on { background: var(--wf-pos-soft); color: var(--wf-pos); border: 1px solid transparent; }
.online-badge.off { background: var(--wf-neg-soft); color: var(--wf-neg); border: 1px solid transparent; }
.online-dot { width: 7px; height: 7px; box-shadow: none; animation: none; }
.online-badge.on .online-dot { animation: wfPulse 2.6s ease-in-out infinite; }
@keyframes wfPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.sync-indicator { font-family: var(--wf-font); font-size: 12px; color: var(--wf-info); letter-spacing: 0; }
.tb-action-icon { min-width: 40px; min-height: 40px; border-radius: var(--wf-r-sm); color: var(--wf-text-2); transition: background var(--wf-dur-1), color var(--wf-dur-1); }
.tb-action-icon:hover, .tb-action-icon:active { color: var(--wf-text); background: var(--wf-hover); }
.tb-action-icon svg { width: 20px; height: 20px; stroke-width: 1.75; }
.month-badge {
    font-family: var(--wf-font); font-size: 12.5px; font-weight: 500; padding: 7px 12px; margin-left: 6px;
    border-radius: var(--wf-r-pill); background: var(--wf-card); color: var(--wf-text-2); border: 1px solid var(--wf-line);
}
.wf-search {
    display: inline-flex; align-items: center; gap: 10px; height: 40px; min-width: 260px; padding: 0 8px 0 12px; margin-right: 8px;
    border-radius: var(--wf-r-sm); border: 1px solid var(--wf-line); background: var(--wf-card); color: var(--wf-text-3);
    font-family: var(--wf-font); font-size: 13.5px; cursor: pointer; transition: border-color var(--wf-dur-1), background var(--wf-dur-1);
}
.wf-search:hover { border-color: var(--wf-line-2); background: var(--wf-card-2); }
.wf-search svg { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; }
.wf-search span { flex: 1; text-align: left; }
.wf-kbd {
    font-family: var(--wf-font-mono); font-size: 11px; font-weight: 500; line-height: 1; color: var(--wf-text-3);
    padding: 4px 6px; border: 1px solid var(--wf-line-2); border-radius: 6px; background: var(--wf-surface);
}

/* ═════════════════ 7. CONTENT + PAGE HEADER ═════════════════════════════════ */
.content { padding: 28px 32px 112px; width: 100%; max-width: 1380px; margin: 0 auto; }
.page.active { animation: wfPageIn .32s var(--wf-ease) both; }
@keyframes wfPageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* The top bar already names the page; the second title under it said the same thing twice. */
.page > .sh > .sh-title { display: none; }
.sh { margin-bottom: 18px; justify-content: flex-end; gap: 12px; }
.page > .sh:has(> .sh-title:only-child) { display: none; }
.sh-actions { gap: 8px; }
.sh-title { font-size: 18px; font-weight: 650; letter-spacing: -.02em; }

/* ═════════════════ 8. BUTTONS ═══════════════════════════════════════════════ */
.btn {
    height: 38px; padding: 0 16px; border-radius: var(--wf-r-sm); font-size: 13.5px; font-weight: 600; gap: 7px;
    letter-spacing: -.005em; line-height: 1; border: 1px solid transparent;
    transition: background var(--wf-dur-1), border-color var(--wf-dur-1), color var(--wf-dur-1), box-shadow var(--wf-dur-1), transform var(--wf-dur-1);
}
.btn svg, .btn i { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary {
    background: var(--wf-accent-fill); color: var(--wf-accent-ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 1px 2px rgba(0, 0, 0, .22);
}
.btn-primary:hover:not(:disabled) { background: var(--wf-gold-300); transform: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 4px 14px var(--wf-accent-soft); }
.btn-secondary { background: var(--wf-card-2); color: var(--wf-text); border-color: var(--wf-line); }
.btn-secondary:hover:not(:disabled) { background: var(--wf-card-3); border-color: var(--wf-line-2); }
.btn-ghost { background: transparent; color: var(--wf-text-2); border-color: var(--wf-line); }
.btn-ghost:hover:not(:disabled) { background: var(--wf-hover); color: var(--wf-text); border-color: var(--wf-line-2); }
.btn-danger { background: var(--wf-neg-soft); color: var(--wf-neg); border-color: transparent; }
.btn-danger:hover:not(:disabled) { background: var(--wf-neg); color: #fff; }
.btn-success { background: var(--wf-pos-soft); color: var(--wf-pos); border-color: transparent; }
.btn-success:hover:not(:disabled) { background: var(--wf-pos); color: #04150c; }
.btn-warning { background: var(--wf-warn-soft); color: var(--wf-warn); border-color: transparent; }
.btn-warning:hover:not(:disabled) { background: var(--wf-warn); color: #1f1303; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .45; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
/* Same floor the app has always held (index.html): 44 px for a finger, on touch screens and at phone widths. */
@media (pointer: coarse), (max-width: 768px) { .btn, .btn-sm, .btn-xs { min-height: 44px; min-width: 44px; } }

/* ═════════════════ 9. CHIPS + SEGMENTED CONTROLS ════════════════════════════ */
.sort-bar, .exp-view-toggle, .month-tabs, .dash-view-switch { gap: 6px; align-items: center; }
.sb-btn, .exp-vbtn, .mtab, .dvs-btn, .liq-tab {
    height: 34px; min-width: 0; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font-family: var(--wf-font); font-size: 13px; font-weight: 550; line-height: 1; border-radius: var(--wf-r-sm);
    background: transparent; color: var(--wf-text-2); border: 1px solid var(--wf-line); box-shadow: none;
    transition: background var(--wf-dur-1), color var(--wf-dur-1), border-color var(--wf-dur-1);
}
.sb-btn:hover, .exp-vbtn:hover, .mtab:hover, .dvs-btn:hover, .liq-tab:hover { background: var(--wf-hover); color: var(--wf-text); border-color: var(--wf-line-2); }
.sb-btn.active, .exp-vbtn.active, .mtab.active, .dvs-btn[aria-pressed="true"], .liq-tab.active {
    background: var(--wf-accent-soft); color: var(--wf-accent); border-color: var(--wf-accent-line);
}
.sb-lbl { font-size: 12.5px; color: var(--wf-text-3); }
.exp-vbtn svg, .exp-vbtn i { width: 15px; height: 15px; }

/* ═════════════════ 10. CARDS ════════════════════════════════════════════════ */
.card, .loan-card, .inc-card, .chq-card, .tgt-card, .sub-card {
    background: var(--wf-card); border: 1px solid var(--wf-line); border-radius: var(--wf-r-lg);
    box-shadow: var(--wf-shadow-1); padding: 22px;
    transition: border-color var(--wf-dur-2) var(--wf-ease), box-shadow var(--wf-dur-2) var(--wf-ease);
}
.card:hover, .loan-card:hover, .inc-card:hover, .chq-card:hover, .tgt-card:hover, .sub-card:hover { border-color: var(--wf-line-2); box-shadow: var(--wf-shadow-2); }
.card-sm { padding: 16px; border-radius: var(--wf-r-md); }
.card-header { margin-bottom: 18px; }
.card-title { font-size: 15px; font-weight: 650; letter-spacing: -.012em; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 17px; height: 17px; stroke-width: 1.85; color: var(--wf-text-3); }
.card-sub { font-size: 12.5px; color: var(--wf-text-3); margin-top: 3px; }
.golden-frame {
    border: 1px solid var(--wf-accent-line); border-radius: var(--wf-r-lg); padding: 22px; box-shadow: none;
    background: linear-gradient(135deg, var(--wf-accent-soft), transparent 55%), var(--wf-card);
}
.gf-title { font-size: 16px; font-weight: 650; letter-spacing: -.012em; }
.gf-btn {
    background: var(--wf-accent-fill); color: var(--wf-accent-ink); border-radius: var(--wf-r-sm); padding: 0 16px; height: 36px;
    font-size: 13.5px; font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38);
}
.gf-btn:hover { transform: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 4px 14px var(--wf-accent-soft); background: var(--wf-gold-300); }

.stat-card {
    background: var(--wf-card); border: 1px solid var(--wf-line); border-radius: var(--wf-r-lg); box-shadow: var(--wf-shadow-1);
    padding: 16px 18px 15px; transition: border-color var(--wf-dur-2) var(--wf-ease);
}
.stat-card:hover { transform: none; box-shadow: var(--wf-shadow-1); border-color: var(--wf-line-2); }
.stat-card::after { display: none; }
.stat-label {
    font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--wf-text-2);
    display: flex; align-items: center; gap: 7px;
}
.stat-label::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--wf-text-3); flex-shrink: 0; }
.sc-gold .stat-label::before { background: var(--wf-accent); }
.sc-green .stat-label::before { background: var(--wf-pos); }
.sc-red .stat-label::before { background: var(--wf-neg); }
.sc-blue .stat-label::before { background: var(--wf-info); }
.sc-purple .stat-label::before { background: var(--wf-violet); }
.sc-cyan .stat-label::before { background: var(--wf-teal); }
.stat-val {
    font-family: var(--wf-font); font-weight: 650; letter-spacing: -.025em; line-height: 1.1; margin: 9px 0 5px;
    font-size: clamp(19px, 4.6vw, 26px); color: var(--wf-text);
}
.sc-gold .stat-val, .sc-blue .stat-val, .sc-purple .stat-val, .sc-cyan .stat-val { color: var(--wf-text); }
.sc-green .stat-val { color: var(--wf-pos); }
.sc-red .stat-val { color: var(--wf-neg); }
.stat-meta { font-size: 12.5px; color: var(--wf-text-3); }

.g2, .g3, .g4, .g5 { gap: 14px; }

/* ═════════════════ 11. TABLES ═══════════════════════════════════════════════ */
.tbl-wrap { border-radius: var(--wf-r-lg); border: 1px solid var(--wf-line); background: var(--wf-card); box-shadow: var(--wf-shadow-1); }
/* The first column stays in view while the rest slides under it, so it needs a solid background of its own
   (inheriting the row's transparent one let the scrolled columns show through it, text over text). */
.tbl-wrap table tbody td:first-child { background: var(--wf-card); }
.tbl-wrap table thead th:first-child { background: var(--wf-card-2); }
.tbl-wrap table tbody tr:hover > td:first-child { background: linear-gradient(var(--wf-hover), var(--wf-hover)), var(--wf-card); }
.tbl-wrap table :is(thead th, tbody td):first-child:not(:last-child) { box-shadow: 10px 0 10px -10px rgba(0, 0, 0, .4); }
[data-theme="light"] .tbl-wrap table :is(thead th, tbody td):first-child:not(:last-child) { box-shadow: 10px 0 10px -10px rgba(16, 24, 40, .16); }
table { font-size: 13.5px; }
thead th {
    background: var(--wf-card-2); color: var(--wf-text-3); font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
    padding: 11px 14px; border-bottom: 1px solid var(--wf-line);
}
tbody tr { border-top: 1px solid var(--wf-line); transition: background var(--wf-dur-1); }
tbody tr:first-child { border-top: none; }
tbody tr:hover, [data-theme="light"] tbody tr:hover { background: var(--wf-hover); }
tbody td { padding: 13px 14px; }
.td-mono, .td-g, .td-r, .td-a { font-family: var(--wf-font); font-size: 13.5px; font-weight: 550; }
.td-m { font-size: 13px; color: var(--wf-text-2); }
.td-date { white-space: nowrap; }   /* a date in a table never breaks at its hyphen (2026-10-\n11) */
.td-a { color: var(--wf-text); }
.done-row { opacity: .5; }

/* ═════════════════ 12. BADGES ═══════════════════════════════════════════════ */
.badge { padding: 3px 10px; border-radius: var(--wf-r-pill); font-size: 11.5px; font-weight: 600; letter-spacing: 0; gap: 4px; }
.bg-g { background: var(--wf-pos-soft); color: var(--wf-pos); }
.bg-r { background: var(--wf-neg-soft); color: var(--wf-neg); }
.bg-a { background: var(--wf-accent-soft); color: var(--wf-accent); }
.bg-b { background: var(--wf-info-soft); color: var(--wf-info); }
.bg-gr { background: var(--wf-hover); color: var(--wf-text-2); }
.bg-p { background: var(--wf-violet-soft); color: var(--wf-violet); }
.bg-c { background: var(--wf-teal-soft); color: var(--wf-teal); }

/* ═════════════════ 13. FORMS ════════════════════════════════════════════════ */
.fg { margin-bottom: 16px; }
.fl { font-size: 12.5px; font-weight: 550; color: var(--wf-text-2); letter-spacing: 0; margin-bottom: 6px; }
.fi, .fs, .fta {
    background: var(--wf-field); border: 1px solid var(--wf-line-3); border-radius: var(--wf-r-sm);
    padding: 10px 13px; min-height: 42px; color: var(--wf-text); font-family: var(--wf-font);
    transition: border-color var(--wf-dur-1), box-shadow var(--wf-dur-1), background var(--wf-dur-1);
}
.fi::placeholder, .fta::placeholder, .auth-input::placeholder { color: var(--wf-text-3); opacity: 1; }
.fi:hover, .fs:hover, .fta:hover { border-color: var(--wf-text-2); }
.fi:focus, .fs:focus, .fta:focus { border-color: var(--wf-accent); box-shadow: var(--wf-focus); outline: none; }
select.fi, select.fs {
    appearance: none; -webkit-appearance: none; padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238591a8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.fs option { background: var(--wf-card); color: var(--wf-text); }
.fta { min-height: 84px; }
.fhint { font-size: 12.5px; color: var(--wf-text-3); margin-top: 5px; }
.fcalc { font-family: var(--wf-font); font-size: 13px; color: var(--wf-accent); font-weight: 550; }
.fr { gap: 14px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--wf-accent-fill); }
input[type="date"], input[type="month"] { color-scheme: inherit; }

/* ═════════════════ 14. MODALS ═══════════════════════════════════════════════ */
.mo { background: var(--wf-overlay); padding: 20px; }
/* The top 100px of the screen belongs to toasts (§15; the tallest is three lines), so a dialog never opens underneath one. */
@media (min-width: 641px) {
    .mo.open { padding-top: 100px; }
    .mo.open .md { max-height: calc(100dvh - 120px); }
}
.mo.open { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
html.wf-ios-stable .mo.open { background: var(--wf-overlay); }
.md {
    background: var(--wf-card); border: 1px solid var(--wf-line); border-radius: 22px; padding: 26px; max-width: 580px;
    box-shadow: var(--wf-shadow-3);
    transform: none;
}
/* A dialog box is hidden only while the `.mo` around it is closed. It used to be hidden everywhere, so a `.md` placed in any other layer showed as nothing:
   the statement review list sat invisible under its dark layer and the whole screen went black after "Open reviews". */
.mo .md {
    transform: translateY(18px) scale(.985); opacity: 0;
    transition: transform .3s var(--wf-ease), opacity .2s var(--wf-ease);
}
.mo.open .md { transform: none; opacity: 1; }
.md-hdr { margin-bottom: 22px; }
.md-title { font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.md-x {
    width: 34px; height: 34px; border-radius: 10px; background: transparent; border: 1px solid transparent; color: var(--wf-text-3); font-size: 16px;
}
.md-x:hover { background: var(--wf-hover); color: var(--wf-text); border-color: transparent; }
.md-ftr { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--wf-line); gap: 10px; }
.conf-icon { font-size: 44px; }
.conf-msg { color: var(--wf-text-2); }

/* On a phone a dialog is a sheet that rises from the bottom edge, where the thumb is. */
@media (max-width: 640px) {
    .mo { padding: 0; align-items: flex-end; }
    .md, .mo > .md[style] {
        max-width: none !important; width: 100%; max-height: min(92dvh, calc(100dvh - 100px - env(safe-area-inset-top, 0px))) !important; border-radius: 22px 22px 0 0;
        border-left: none; border-right: none; border-bottom: none; padding: 22px 18px max(22px, env(safe-area-inset-bottom));
    }
    .mo .md, .mo > .md[style] { transform: translateY(40px); opacity: 0; }
    .mo.open .md { transform: none; opacity: 1; }
    .md::before {
        content: ''; display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--wf-line-2); margin: -8px auto 14px;
    }
    .md-ftr .btn { flex: 1 1 auto; justify-content: center; }
}

/* ═════════════════ 15. TOASTS ═══════════════════════════════════════════════ */
/* They stacked bottom-centre, which is exactly where a dialog keeps its Save button, so a message that
   arrived while a form was open hid the one control the person needed (and on a phone they sat over the
   sheet's title and its close button). They now drop in from the top edge, centred, where no action row
   lives. notify() shows three at a time (two on a phone, one while a dialog is open) and queues the rest,
   and §14 keeps the top of every dialog clear of them. Tap a toast to dismiss it. */
#notifs {
    top: 12px; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); max-width: none; width: min(420px, calc(100vw - 32px));
    flex-direction: column; gap: 8px; pointer-events: none; align-items: center;
}
.notif {
    pointer-events: auto; width: fit-content; max-width: 100%; cursor: pointer;
    background: var(--wf-card-2); border: 1px solid var(--wf-line-2); border-radius: var(--wf-r-md); box-shadow: var(--wf-shadow-2);
    padding: 12px 16px; font-size: 13.5px; font-weight: 500; gap: 11px; line-height: 1.45;
    transform: translateY(-10px) scale(.98); opacity: 0; transition: transform .28s var(--wf-ease), opacity .2s var(--wf-ease);
    border-left-width: 1px;
}
.notif.show { transform: none; opacity: 1; }
.notif.success { border-left: 1px solid var(--wf-line-2); } .notif.error { border-left: 1px solid var(--wf-line-2); }
.notif.info { border-left: 1px solid var(--wf-line-2); } .notif.warn { border-left: 1px solid var(--wf-line-2); }
.notif-ico {
    width: 24px; height: 24px; border-radius: 50%; justify-content: center; font-size: 0; flex-shrink: 0; color: var(--wf-info); background: var(--wf-info-soft);
}
.notif-ico svg { width: 14px; height: 14px; stroke-width: 2.2; }
/* Three lines at most, so the toast never grows taller than the lane a dialog leaves for it. */
.notif > span:last-child { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }
.notif.success .notif-ico { color: var(--wf-pos); background: var(--wf-pos-soft); }
.notif.error .notif-ico { color: var(--wf-neg); background: var(--wf-neg-soft); }
.notif.warn .notif-ico { color: var(--wf-warn); background: var(--wf-warn-soft); }
@media (max-width: 900px) {
    #notifs { left: 16px; right: 16px; width: auto; transform: none; top: calc(env(safe-area-inset-top, 0px) + 8px); align-items: stretch; }
    .notif { width: auto; }
}

/* ═════════════════ 16. PROGRESS, EMPTY STATES, ICON BUTTONS ═════════════════ */
.pb { height: 8px; background: var(--wf-card-3); border-radius: var(--wf-r-pill); }
.pf { border-radius: var(--wf-r-pill); }
.pf-a { background: var(--wf-accent-fill); }
.pf-g { background: var(--wf-pos); }
.pf-r { background: var(--wf-neg); }
.pf-b { background: var(--wf-info); }
.empty { padding: 56px 24px; }
.empty-icon {
    width: 56px; height: 56px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 18px; font-size: 0; opacity: 1;
    background: var(--wf-card-2); border: 1px solid var(--wf-line); color: var(--wf-text-3);
}
.empty-icon svg { width: 24px; height: 24px; stroke-width: 1.6; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--wf-text); }
.empty-sub { font-size: 13.5px; color: var(--wf-text-3); max-width: 340px; margin: 0 auto; }
.ib {
    width: 32px; height: 32px; border-radius: 9px; border: 1px solid transparent; color: var(--wf-text-3);
    transition: background var(--wf-dur-1), color var(--wf-dur-1);
}
.ib svg, .ib i { width: 16px; height: 16px; stroke-width: 1.85; }
.ib:hover { background: var(--wf-hover); color: var(--wf-text); }
.ib.e:hover { color: var(--wf-info); background: var(--wf-info-soft); border-color: transparent; }
.ib.d:hover { color: var(--wf-neg); background: var(--wf-neg-soft); border-color: transparent; }
.ib.c:hover { color: var(--wf-pos); background: var(--wf-pos-soft); border-color: transparent; }
@media (pointer: coarse) { .ib { width: 40px; height: 40px; } }

/* ═════════════════ 17. FLOATING AI ══════════════════════════════════════════ */
/* It sat on every screen as the loudest gold object in the interface, competing with the
   figures people came to read. It is now a quiet card-coloured disc with a gold ring: findable,
   not shouting. */
.fab-ai-btn {
    width: 48px; height: 48px; border-radius: 50%; color: var(--wf-accent); background: var(--wf-card-2);
    border: 1px solid var(--wf-accent-line); box-shadow: var(--wf-shadow-2);
}
/* It floated above a dialog's backdrop, crisp on top of the blur, and over a sheet's form on a phone. */
body:has(.mo.open) .fab-ai-btn { opacity: 0; pointer-events: none; }
.fab-ai-btn:hover { transform: translateY(-1px) scale(1.04); background: var(--wf-card-3); box-shadow: var(--wf-shadow-3); }
.fab-ai-btn svg { width: 22px; height: 22px; stroke-width: 1.8; }
.floating-ai-input { background: var(--wf-card); border-color: var(--wf-line-2); }
.floating-ai-send { background: var(--wf-accent-fill); color: var(--wf-accent-ink); }

/* ═════════════════ 18. SHELL: BRAND IN THE TOP BAR (phones) ═════════════════ */
.wf-topmark { display: none; }
.wf-search-btn { display: none; }

/* ═════════════════ 19. SHELL: TAB BAR, SHEETS, COMMAND PALETTE ══════════════ */
.wf-tabbar { display: none; }

.wf-ov {
    position: fixed; inset: 0; background: var(--wf-overlay); opacity: 0; visibility: hidden; pointer-events: none;
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    transition: opacity var(--wf-dur-2) var(--wf-ease), visibility 0s linear var(--wf-dur-2);
}
.wf-ov.open { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
html.wf-ios-stable .wf-ov { -webkit-backdrop-filter: none; backdrop-filter: none; }
#wfSheetOv { z-index: var(--wf-z-sheet); }
#wfPalOv { z-index: var(--wf-z-palette); }
html.wf-sheet-open .fab-ai-btn { opacity: 0; pointer-events: none; }
html.wf-sheet-open, html.wf-sheet-open body { overscroll-behavior: contain; }

/* The bottom sheet: the phone's equivalent of the sidebar. */
.wf-sheet {
    position: absolute; left: 0; right: 0; bottom: 0; max-height: min(88dvh, 720px); display: flex; flex-direction: column;
    background: var(--wf-card); border: 1px solid var(--wf-line); border-bottom: 0; border-radius: 26px 26px 0 0;
    box-shadow: var(--wf-shadow-3); transform: translateY(100%); transition: transform var(--wf-dur-3) var(--wf-ease);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.wf-ov.open .wf-sheet { transform: none; }
.wf-grab { flex: none; width: 40px; height: 4px; border-radius: 4px; background: var(--wf-line-2); margin: 10px auto 6px; }
.wf-sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 16px 20px; -webkit-overflow-scrolling: touch; }
.wf-me { display: flex; align-items: center; gap: 12px; padding: 10px 4px 14px; }
.wf-me-av {
    width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; overflow: hidden;
    background: var(--wf-accent-soft); color: var(--wf-accent); border: 1px solid var(--wf-accent-line); font-weight: 650; font-size: 18px;
}
.wf-me-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wf-me-name { font-size: 16px; font-weight: 650; letter-spacing: -.015em; color: var(--wf-text); line-height: 1.2; }
.wf-me-sub { font-size: 12.5px; color: var(--wf-text-3); margin-top: 2px; }
.wf-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.wf-quick button {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; min-height: 64px;
    border: 1px solid var(--wf-line); border-radius: var(--wf-r-md); background: var(--wf-card-2); color: var(--wf-text);
    font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer; transition: background var(--wf-dur-1), transform var(--wf-dur-1);
}
.wf-quick button:active { transform: scale(.97); background: var(--wf-card-3); }
.wf-quick svg { width: 20px; height: 20px; stroke-width: 1.8; color: var(--wf-accent); }
.wf-grp { margin: 18px 4px 8px; font-size: 11px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--wf-text-3); }
.wf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 4px; }
.wf-item {
    display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 10px 2px 8px; min-height: 78px; border: 0; background: none;
    border-radius: var(--wf-r-md); color: var(--wf-text-2); font: inherit; font-size: 11.5px; font-weight: 550; line-height: 1.25; text-align: center;
    cursor: pointer; position: relative; -webkit-tap-highlight-color: transparent; transition: background var(--wf-dur-1);
}
.wf-item:active { background: var(--wf-press); }
.wf-item .wf-ic {
    width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--wf-card-2); border: 1px solid var(--wf-line); color: var(--wf-text);
}
.wf-item .wf-ic svg { width: 21px; height: 21px; stroke-width: 1.7; }
.wf-item[aria-current="page"] { color: var(--wf-text); }
.wf-item[aria-current="page"] .wf-ic { background: var(--wf-accent-soft); border-color: var(--wf-accent-line); color: var(--wf-accent); }
.wf-item .wf-badge {
    position: absolute; top: 6px; right: calc(50% - 30px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--wf-neg); color: #fff;
    font-size: 10.5px; font-weight: 650; line-height: 17px; text-align: center;
}
.wf-signout {
    width: 100%; margin-top: 18px; min-height: 46px; border-radius: var(--wf-r-md); border: 1px solid var(--wf-line); background: transparent;
    color: var(--wf-neg); font: inherit; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
}
.wf-signout svg { width: 17px; height: 17px; }

/* Command palette: one box that goes anywhere (Ctrl or Cmd + K, or the search button). */
.wf-pal {
    position: absolute; left: 50%; top: 12vh; width: min(620px, calc(100vw - 24px)); max-height: min(72dvh, 560px); display: flex; flex-direction: column;
    transform: translate(-50%, -10px) scale(.985); opacity: 0; transition: transform var(--wf-dur-2) var(--wf-ease), opacity var(--wf-dur-2) var(--wf-ease);
    background: var(--wf-card); border: 1px solid var(--wf-line-2); border-radius: var(--wf-r-xl); box-shadow: var(--wf-shadow-3); overflow: hidden;
}
.wf-ov.open .wf-pal { transform: translate(-50%, 0); opacity: 1; }
.wf-pal-in { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--wf-line); }
.wf-pal-in svg { width: 19px; height: 19px; color: var(--wf-text-3); flex: none; }
.wf-pal-in input {
    flex: 1; min-width: 0; height: 58px; border: 0 !important; outline: 0; background: transparent !important; box-shadow: none !important;
    color: var(--wf-text); font: inherit; font-size: 16px !important; min-height: 0 !important; padding: 0 !important;
}
.wf-pal-in input::placeholder { color: var(--wf-text-3); }
.wf-pal-list { overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
.wf-pal-h { padding: 10px 12px 6px; font-size: 11px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--wf-text-3); }
.wf-pal-it {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 12px; min-height: 46px; border: 0; background: none; border-radius: var(--wf-r-sm);
    color: var(--wf-text); font: inherit; font-size: 14.5px; font-weight: 500; text-align: left; cursor: pointer;
}
.wf-pal-it svg { width: 18px; height: 18px; color: var(--wf-text-3); flex: none; stroke-width: 1.8; }
.wf-pal-it small { margin-left: auto; font-size: 12px; color: var(--wf-text-3); font-weight: 450; }
.wf-pal-it[aria-selected="true"] { background: var(--wf-accent-soft); }
.wf-pal-it[aria-selected="true"] svg { color: var(--wf-accent); }
.wf-pal-empty { padding: 36px 16px; text-align: center; color: var(--wf-text-3); font-size: 14px; }
.wf-pal-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--wf-line); background: var(--wf-surface); color: var(--wf-text-3); font-size: 12px; }
.wf-pal-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ═════════════════ 20. PHONES AND TABLETS (≤ 900 px) ════════════════════════ */
@media (max-width: 900px) {
    :root { --wf-tab-h: 62px; }

    /* Top bar: the app mark, where you are, and three quiet actions. */
    .topbar { min-height: 56px; padding: calc(env(safe-area-inset-top, 0px) + 8px) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left)); gap: 8px; }
    .mobile-btn { display: none !important; }
    .wf-topmark { display: inline-flex; width: 34px; height: 34px; border-radius: 10px; flex: none; }
    .tb-left { gap: 10px; flex: 1 1 auto; }
    .tb-left .pg-title { font-size: 17px; max-width: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .pg-title svg { width: 18px; height: 18px; }
    .tb-right { gap: 0; flex: none; }
    #topRefreshBtn, #themeBtn, .month-badge, .sync-indicator { display: none !important; }
    .network-wrap { margin: 0; }
    /* Online is the normal state, so it is a dot; only "Offline" earns words. */
    .online-badge.on { padding: 8px; background: transparent; }
    .online-badge.on #onlineText { display: none; }
    .online-badge.off { padding: 4px 10px 4px 8px; font-size: 12px; }
    .wf-search { display: none; }
    .wf-search-btn { display: inline-flex; }
    .tb-action-icon { min-width: 44px; min-height: 44px; }

    .content { padding: 16px max(16px, env(safe-area-inset-right)) calc(var(--wf-tab-h) + env(safe-area-inset-bottom, 0px) + 28px) max(16px, env(safe-area-inset-left)); }
    .card { padding: 18px; }
    .golden-frame { padding: 18px; }
    .sh { flex-wrap: wrap; justify-content: stretch; }
    .sh-actions { width: 100%; flex-wrap: wrap; }
    .stat-val { font-size: clamp(19px, 5.6vw, 24px); }

    /* Tab bar */
    .wf-tabbar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--wf-z-nav); display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
        padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left));
        background: color-mix(in srgb, var(--wf-surface) 88%, transparent); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
        border-top: 1px solid var(--wf-line); transition: transform var(--wf-dur-2) var(--wf-ease);
    }
    html.wf-ios-stable .wf-tabbar { background: var(--wf-surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
    body.wf-typing .wf-tabbar { transform: translateY(110%); }
    .wf-tab {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 50px; padding: 4px 2px 2px;
        border: 0; background: none; border-radius: 14px; color: var(--wf-text-3); font: inherit; font-size: 11px; font-weight: 550; letter-spacing: 0; cursor: pointer;
        -webkit-tap-highlight-color: transparent; transition: color var(--wf-dur-1);
    }
    .wf-tab svg { width: 23px; height: 23px; stroke-width: 1.7; transition: transform var(--wf-dur-2) var(--wf-ease-spring); }
    .wf-tab:active svg { transform: scale(.88); }
    .wf-tab[aria-current="page"] { color: var(--wf-accent); font-weight: 650; }
    .wf-tab[aria-current="page"] svg { stroke-width: 2; }
    .wf-tab[aria-current="page"]::before {
        content: ''; position: absolute; top: -7px; left: 50%; width: 24px; height: 3px; margin-left: -12px; border-radius: 0 0 3px 3px; background: var(--wf-accent);
    }
    .wf-tab .wf-dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--wf-neg); border: 2px solid var(--wf-surface); }

    /* The AI button rides above the tab bar. */
    .fab-ai-btn { bottom: calc(var(--wf-tab-h) + env(safe-area-inset-bottom, 0px) + 16px) !important; right: 16px !important; }
    .floating-ai-bar { bottom: calc(var(--wf-tab-h) + env(safe-area-inset-bottom, 0px) + 16px) !important; }

    /* Tables scroll sideways inside their card; the page itself must never. */
    .tbl-wrap { border-radius: var(--wf-r-md); }
    .g2, .g3, .g4, .g5 { gap: 12px; }
    .md-hdr { margin-bottom: 16px; }
}

@media (max-width: 540px) {
    .tb-left .pg-title { font-size: 16px; max-width: none; }
    .content { padding-top: 12px; }
    .sh-actions .btn, .sh-actions select, .sh-actions .fs, .sh-actions .fi { flex: 1 1 auto; }
}

@media (max-width: 380px) {
    .wf-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Large desktop: let the sidebar breathe and keep line lengths readable. */
@media (min-width: 1500px) {
    :root { --sw: 272px; }
    .content { padding-left: 40px; padding-right: 40px; }
}

/* ═════════════════ 22. DASHBOARD ════════════════════════════════════════════
   The dashboard is a stack of independent blocks that other code fills by id. Making
   the page a flex column lets `order` choose the reading order (money first, then what
   needs the owner, then charts, then housekeeping) without moving a single node. */
#page-dashboard.active { display: flex; flex-direction: column; gap: 16px; }
#page-dashboard > * { margin-bottom: 0 !important; }
#page-dashboard > #wfGreet { order: 0; }
#page-dashboard > #dashStats { order: 1; }
#page-dashboard > #wfRunway { order: 2; }
#page-dashboard > #wfBrief { order: 3; }
#page-dashboard > #wfVerifyQueue { order: 4; }
#page-dashboard > .dash-view-switch { order: 5; }
#page-dashboard > .dash-chart-row { order: 6; }
#page-dashboard > .g2 { order: 7; }
#page-dashboard > #wfMailSync { order: 8; }
#page-dashboard > .golden-frame { order: 9; }

.wf-greet { padding: 4px 2px 2px; }
.wf-greet-h { margin: 0; font-size: clamp(22px, 3.4vw, 28px); font-weight: 650; letter-spacing: -.028em; line-height: 1.15; color: var(--wf-text); }
.wf-greet-p { margin: 4px 0 0; font-size: 13.5px; color: var(--wf-text-3); }

/* The summary bar: five figures on one surface, divided by hairlines, not five boxes. */
#dashStats {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0;
    background: var(--wf-card); border: 1px solid var(--wf-line); border-radius: var(--wf-r-lg); box-shadow: var(--wf-shadow-1); overflow: hidden;
}
#dashStats .stat-card { position: relative; background: none; border: 0; border-radius: 0; box-shadow: none; padding: 20px 22px 18px; min-width: 0; }
#dashStats .stat-card + .stat-card::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 1px; background: var(--wf-line); }
#dashStats .stat-label { font-size: 12.5px; }
#dashStats .stat-label::before { display: none; }
#dashStats .stat-val { font-size: clamp(20px, 2.2vw, 28px); font-weight: 650; font-variant-numeric: tabular-nums; margin: 8px 0 4px; color: var(--wf-text); overflow-wrap: anywhere; }
#dashStats .sc-green .stat-val { color: var(--wf-pos); }
#dashStats .sc-red .stat-val, #dashStats .sc-blue .stat-val, #dashStats .sc-cyan .stat-val { color: var(--wf-text); }
#dashStats .stat-val.is-neg { color: var(--wf-neg); }
#dashStats .stat-val.is-pos { color: var(--wf-text); }
#dashStats .sc-gold .stat-val.is-pos { color: var(--wf-pos); }
#dashStats .stat-meta { font-size: 12px; line-height: 1.4; }
#dashStats > [style*="grid-column"] { margin: 12px; border-radius: var(--wf-r-md) !important; }

/* The attention feed and the confirmation queue sit on cards of their own. */
#wfBrief:empty, #wfBrief[style*="display: none"] { display: none; }
#wfVerifyQueue .wf-vq { padding: 18px 20px; }
#wfVerifyQueue .btn-primary { background: var(--wf-accent-soft); color: var(--wf-accent); border: 1px solid var(--wf-accent-line); box-shadow: none; }
#wfVerifyQueue .btn-primary:hover:not(:disabled) { background: var(--wf-accent-fill); color: var(--wf-accent-ink); }
#wfVerifyQueue .btn-secondary { background: transparent; border-color: var(--wf-line-2); color: var(--wf-text-2); }
#wfVerifyQueue .wf-vq-row { border-top-color: var(--wf-line) !important; }
.wf-vq:not(.is-open) .wf-vq-row[data-more] { display: none !important; } /* the rows carry an inline display:flex */
.wf-vq .wfx-toggle {
    border: 0; background: none; color: var(--wf-accent); font: inherit; font-size: 12.5px; font-weight: 600; padding: 8px 2px; min-height: 40px; cursor: pointer; border-radius: 8px;
}
.wf-vq .wfx-toggle:hover { text-decoration: underline; }

/* The runway keeps its colour cue (clear / tight / critical) as a quiet left edge. */
#wfRunway .wf-runway { border-left-width: 3px; }
#wfRunway .wf-runway-when { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
#wfRunway .wf-runway-fig { background: var(--wf-card-2); border-radius: var(--wf-r-sm); }

/* Statement sync and the AI card are housekeeping: quieter, and last. */
.golden-frame { background: var(--wf-card); border-color: var(--wf-line); }
.golden-frame .gf-btn { background: var(--wf-accent-soft); color: var(--wf-accent); border: 1px solid var(--wf-accent-line); box-shadow: none; }
.golden-frame .gf-btn:hover { background: var(--wf-accent-fill); color: var(--wf-accent-ink); }

.dash-view-switch { justify-content: flex-end; font-size: 12px; color: var(--wf-text-3); }

@media (max-width: 1100px) {
    #dashStats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    #dashStats .stat-card:nth-child(n+4)::before { display: block; }
    #dashStats .stat-card:nth-child(3n+1)::before { display: none; }
}
@media (max-width: 900px) {
    #page-dashboard.active { gap: 14px; }
    #dashStats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #dashStats .stat-card { padding: 16px 16px 14px; }
    #dashStats .stat-card::before { display: none !important; }
    #dashStats .stat-card:nth-child(2n) { border-left: 1px solid var(--wf-line); }
    #dashStats .stat-card:nth-child(n+3) { border-top: 1px solid var(--wf-line); }
    #dashStats .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
    #dashStats .stat-val { font-size: clamp(20px, 6vw, 26px); }
    #wfVerifyQueue .wf-vq { padding: 16px; }
}

/* ═════════════════ 23. FINANCE PAGES ════════════════════════════════════════
   Monthly Plan, Income, Investments, Bank Loans, CC Installments, CC One-Time, Cheques.
   Presentation only: the markup these pages draw is unchanged, so every figure, button
   and handler is where it was. */

/* A toolbar choice (sort by, table or schedule) is one segmented control, not a row of loose pills. */
.sort-bar, .exp-view-toggle { gap: 2px; padding: 3px; background: var(--wf-card-2); border: 1px solid var(--wf-line); border-radius: var(--wf-r-md); }
.sort-bar .sb-btn, .exp-view-toggle .exp-vbtn { height: 30px; padding: 0 12px; border: 0; border-radius: var(--wf-r-sm); }
.sort-bar .sb-btn:hover, .exp-view-toggle .exp-vbtn:hover { background: var(--wf-hover); }
.sort-bar .sb-btn.active, .exp-view-toggle .exp-vbtn.active { background: var(--wf-card); color: var(--wf-text); box-shadow: 0 0 0 1px var(--wf-line-2), var(--wf-shadow-1); }
.sort-bar .sb-lbl { padding: 0 4px 0 9px; }
.btn-warning, .loan-month-btn.lmb-partial, .sub-due-soon { color: var(--wf-warn); }

/* Monthly Plan */
.mhero { background: var(--wf-card); border: 1px solid var(--wf-line); border-radius: var(--wf-r-xl); box-shadow: var(--wf-shadow-1); padding: 24px 28px 18px; }
.mhero::before { background: radial-gradient(circle at 88% 0%, var(--wf-accent-soft), transparent 55%); pointer-events: none; }
.mhero > * { position: relative; }
.mh-lbl { font-size: 12px; font-weight: 650; letter-spacing: .08em; color: var(--wf-accent); margin-bottom: 8px; }
.mh-bal { font-family: var(--wf-font); font-size: clamp(30px, 6vw, 44px); font-weight: 650; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.mh-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 16px; margin-top: 20px; padding-top: 6px; border-top: 1px solid var(--wf-line); }
.mhi { min-width: 0; padding: 12px 0 6px; }
.mhi-lbl { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--wf-text-3); }
.mhi-val { margin-top: 3px; font-family: var(--wf-font); font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
#monthlyContent > .g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
#monthlyContent .card-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
#monthlyContent .card-sub { margin-top: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
#monthlyContent .td-r { flex: 0 0 auto; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
#monthlyContent .card div[style*="justify-content:space-between"] > span:first-child { min-width: 0; padding-right: 14px; }
#page-monthly .sh { margin-bottom: 10px; }
#page-monthly .month-tabs { margin-bottom: 16px; }

/* Bank Loans: the card is a statement, so the figure that matters is neutral ink and the one action is the one gold thing. */
.loan-card { padding: 22px 24px; }
.loan-top { gap: 16px; margin-bottom: 14px; }
.loan-name { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.loan-bank { margin-top: 4px; font-size: 12.5px; }
.loan-monthly { font-family: var(--wf-font); font-size: 20px; font-weight: 650; letter-spacing: -.02em; color: var(--wf-text); font-variant-numeric: tabular-nums; }
.loan-pay-cta {
    min-height: 52px; padding: 10px 16px; border-radius: var(--wf-r-md); background: var(--wf-accent-fill); color: var(--wf-accent-ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 1px 2px rgba(0, 0, 0, .14); animation: none;
}
.loan-pay-cta:hover { background: var(--wf-gold-300); transform: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 4px 14px var(--wf-accent-soft); }
.loan-card .ld { flex: 1 1 150px; margin: 0 0 12px; padding-right: 16px; min-width: 0; }
.ld-l { font-size: 11px; font-weight: 550; letter-spacing: .04em; }
.ld-v { margin-top: 3px; font-family: var(--wf-font); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.loan-projection { border-radius: var(--wf-r-md); }

/* Stat cards on a phone: one figure per line (name left, value right) instead of a tall card each,
   so the first screen shows the page and not four boxes. */
@media (max-width: 640px) {
    .page:not(#page-dashboard) :is(.g3, .g4, .g5) > .stat-card {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 14px; row-gap: 1px; padding: 12px 16px;
    }
    .page:not(#page-dashboard) :is(.g3, .g4, .g5) > .stat-card > .stat-label { grid-column: 1; grid-row: 1; }
    .page:not(#page-dashboard) :is(.g3, .g4, .g5) > .stat-card > .stat-meta { grid-column: 1; grid-row: 2; }
    .page:not(#page-dashboard) :is(.g3, .g4, .g5) > .stat-card > .stat-val { grid-column: 2; grid-row: 1 / span 2; margin: 0; text-align: right; font-size: 18px; overflow-wrap: anywhere; }
    .loan-card { padding: 18px 16px; }
    .loan-top { flex-wrap: wrap; }
    .mhero { padding: 20px 18px 12px; }
}

/* ═════════════════ 24. TOOLS AND TRACKING ═══════════════════════════════════ */
/* An explainer at the top of a tool: quiet, neutral, readable in both themes (it was a gold-bordered box with fixed colours). */
.wf-note { background: var(--wf-card-2); border: 1px solid var(--wf-line); border-radius: var(--wf-r-md); padding: 14px 16px; font-size: 12.5px; line-height: 1.65; color: var(--wf-text-2); }
.wf-note .wf-note-h { display: block; margin-bottom: 4px; font-size: 13.5px; font-weight: 650; color: var(--wf-text); }
.wf-note b:not(.wf-note-h) { color: var(--wf-text); font-weight: 600; }

/* ═════════════════ 25. PAGE TOOLBARS AND MID-WIDTH TOP BAR ════════════════════════════════════════ */
/* The top bar names the page, so a page's toolbar is its whole header row: the actions take that row and sit at its end.
   Left to size to their content, a wrapping flex container came out ~40px narrower than the controls inside it, and the
   last control (the primary "Add …" button) dropped onto a row of its own at every desktop width. */
.page > .sh > .sh-actions { flex: 1 1 auto; justify-content: flex-end; }
/* On the busiest headers (Income, Expenses) the sort control and the primary button travel together: when the row is
   too narrow they wrap as one unit, so the primary button is never left alone on a row. */
.sh-actions > .sh-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }

/* Tablets and small laptops: the same controls, a little tighter. */
@media (max-width: 1180px) {
    .sh-actions, .sh-actions > .sh-end { gap: 6px; }
    .sh-actions .sort-bar .sb-btn, .sh-actions .exp-view-toggle .exp-vbtn { padding: 0 9px; }
    .sh-actions .sort-bar, .sh-actions .exp-view-toggle { gap: 1px; }
}

/* The top bar at small-laptop and tablet-landscape widths (sidebar still open, up to 1180 px): the 260px search field
   crushed the page title to a few pixels and wrapped the month badge. Search collapses to its icon button (Ctrl K and the
   button both still open it), the title never shrinks, and the month badge stays on one line. */
.month-badge { white-space: nowrap; }
@media (min-width: 901px) { .tb-left { flex-shrink: 0; } }
@media (min-width: 901px) and (max-width: 1180px) {
    .wf-search { display: none; }
    .wf-search-btn { display: inline-flex; }
}

/* Phones: the primary action and the month picker share the first row, then the History button and the view switch,
   then the sort pills as a segmented control. Nothing is hidden and no button is left alone on a row. */
@media (max-width: 540px) {
    .sh-actions > .sh-end { display: contents; }
    :is(#page-incRecv, #page-expenses) .sh-actions .btn-primary { order: -2; flex: 0 0 auto; }
    :is(#page-incRecv, #page-expenses) .sh-actions > select { order: -1; flex: 1 1 150px; min-width: 0; max-width: none !important; width: auto !important; }
    :is(#page-incRecv, #page-expenses) .sh-actions > .exp-view-toggle { flex: 1 1 180px; min-width: 0; }
    :is(#page-incRecv, #page-expenses) .sh-actions > .exp-view-toggle .exp-vbtn { flex: 1 1 0; justify-content: center; }
    :is(#page-incRecv, #page-expenses, #page-cheques, #page-cconetime) .sh-actions .sort-bar { flex: 1 1 100%; }
    :is(#page-incRecv, #page-expenses, #page-cheques, #page-cconetime) .sh-actions .sort-bar .sb-btn { flex: 1 1 0; justify-content: center; text-align: center; }
    /* Cheques and One-Time payments: the primary button leads the first row beside History, the sort control sits under them. */
    :is(#page-cheques, #page-cconetime) .sh-actions .btn-primary { order: -1; }
}

/* A table that slides sideways keeps its action buttons (mark done, edit, delete) pinned to the right edge, so they never
   scroll out of sight on a phone, a tablet or a narrow laptop. On a wide screen nothing overflows and nothing changes. */
.tbl-wrap table:has(> tbody > tr > td:last-child > :is(.act-btns, .ib)) :is(thead th, tbody td):last-child:not(:first-child) {
    position: sticky; right: 0; z-index: 2; box-shadow: -10px 0 10px -10px rgba(0, 0, 0, .4);
}
.tbl-wrap table:has(> tbody > tr > td:last-child > :is(.act-btns, .ib)) tbody td:last-child:not(:first-child) { background: var(--wf-card); }
.tbl-wrap table:has(> tbody > tr > td:last-child > :is(.act-btns, .ib)) thead th:last-child:not(:first-child) { background: var(--wf-card-2); z-index: 3; }
.tbl-wrap table:has(> tbody > tr > td:last-child > :is(.act-btns, .ib)) tbody tr:hover > td:last-child:not(:first-child) { background: linear-gradient(var(--wf-hover), var(--wf-hover)), var(--wf-card); }
[data-theme="light"] .tbl-wrap table:has(> tbody > tr > td:last-child > :is(.act-btns, .ib)) :is(thead th, tbody td):last-child:not(:first-child) { box-shadow: -10px 0 10px -10px rgba(16, 24, 40, .16); }

/* Tables on tablets and small laptops: headers may wrap and cells are a little tighter, so a table with eight columns
   needs far less sideways sliding (the headers were the widest thing in their columns). */
@media (max-width: 1180px) {
    .tbl-wrap table thead th { white-space: normal; padding: 10px 10px; line-height: 1.3; vertical-align: bottom; }
    .tbl-wrap table tbody td { padding: 12px 10px; }
    .tbl-wrap table .act-btns { gap: 2px; }
}

/* ═════════════════ 20b. COMPACT MODE ════════════════════════════════════
   Settings → Compact Mode adds body.wf-compact. The base rules for it live in index.html and lose to the
   rules above (the summary bar's id selector, the card family's own padding), so the switch moved the page
   gutter and little else. These are the same intent, written where they win. */
body.wf-compact .card, body.wf-compact .loan-card, body.wf-compact .inc-card,
body.wf-compact .chq-card, body.wf-compact .tgt-card, body.wf-compact .sub-card { padding: 14px; }
body.wf-compact .card-header { margin-bottom: 12px; }
body.wf-compact #dashStats .stat-card { padding: 12px 14px 10px; }

/* Settings → Cloud Sync status pill. It changes text and colour with every save (Syncing, Connected, Offline); as three
   differently sized boxes it moved the row, and on a phone the row changed height, so every switch nudged the page. */
.wf-sync-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 118px; white-space: nowrap; flex: none; }
/* the AI services row: one badge box for every reading ("Checking…" to "Not measured yet") and a line that is as tall as the longest thing it can say */
.wf-ai-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 150px; white-space: nowrap; flex: none; }
.wf-ai-detail-stack { display: grid; }
.wf-ai-detail-stack > * { grid-area: 1 / 1; }
.wf-ai-detail-ghost { visibility: hidden; pointer-events: none; }

/* ═════════════════ 26. SETTINGS CONTROLS ═══════════════════════════════════ */
/* A select shows the whole of its chosen option ("LKR — Sri Lanka", "3 (default)") instead of a cut-off word: the fixed
   120 to 160px widths in the page left about 67px for the text once the arrow's room was taken. Anything still too long ends in an ellipsis. */
select.fi, select.fs { text-overflow: ellipsis; }
#page-settings select.fi { width: auto !important; min-width: 120px; max-width: 100%; }
/* The "Last Backup" card holds an icon, the text and Backup Now in one row; on a phone that left the text a ~100px column. */
@media (max-width: 540px) {
    .wf-bk-card { flex-wrap: wrap; }
    .wf-bk-card > div:nth-child(2) { flex: 1 1 calc(100% - 60px); }
    .wf-bk-card > button { flex: 1 1 100%; justify-content: center; }
    /* AI Advisor header: the status chip takes its own row, the two buttons share the next, and the icon-only Clear chat
       keeps its icon size (it was stretched into an empty-looking full-width bar). */
    #page-ai .sh-actions #aiPersonaStatus { flex: 1 1 100%; }
    #page-ai .sh-actions .btn-ghost { flex: 0 0 auto; }
    .wf-acct-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (min-width: 541px) { .wf-acct-stats { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; } }
/* AI Advisor "Your books today": two tiles a row on a phone, and a last tile that would sit alone takes the whole row. */
@media (max-width: 700px) {
    .ai-brief-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ai-brief-stats > .ai-brief-stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* A row of four stat cards never leaves one orphan on a second row: on a tablet or small laptop (where the auto-fit grid
   would fit three) they sit two by two, and the Monthly Plan's six figures sit three by three until the screen is wide enough for one row. */
@media (min-width: 541px) and (max-width: 1100px) {
    :is(.g3, .g4):has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 541px) and (max-width: 1400px) {
    .mh-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ═════════════════ 21. MOTION PREFERENCES ═══════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ═════════════════ 27. BACKUP PROGRESS ══════════════════════════════════════ */
/* Backup Now / Backup to Drive: one panel, a bar that moves only when a step has really finished (index.html _wfBkPaint, wealthflow-backup.js makeProgress). */
.wf-bkp { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); transform: translateX(-50%); width: min(calc(100vw - 32px), 380px); max-height: 60vh; overflow: auto; z-index: 10050;
    background: var(--wf-card); color: var(--wf-text); border: 1px solid var(--wf-line-2); border-radius: var(--wf-r-md); box-shadow: var(--wf-shadow-1); padding: 12px 14px; font-family: var(--wf-font); font-size: 13px; }
@media (max-width: 900px) { .wf-bkp { bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); } }
.wf-bkp-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wf-bkp-h button { appearance: none; border: 0; background: none; color: var(--wf-text-3); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.wf-bkp-bar { height: 6px; border-radius: 99px; background: var(--wf-line); overflow: hidden; margin: 10px 0 8px; }
.wf-bkp-bar > i { display: block; height: 100%; background: var(--wf-accent); transition: width var(--wf-dur-2) var(--wf-ease); }
.wf-bkp.ok .wf-bkp-bar > i { background: var(--wf-pos); }
.wf-bkp.bad .wf-bkp-bar > i { background: var(--wf-neg); }
.wf-bkp-now { font-weight: 600; overflow-wrap: anywhere; }
.wf-bkp.bad .wf-bkp-now { color: var(--wf-neg); }
.wf-bkp ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 12px; color: var(--wf-text-3); }
.wf-bkp li.run { color: var(--wf-text); font-weight: 600; }
.wf-bkp li.ok { color: var(--wf-text-2); }
.wf-bkp li.bad { color: var(--wf-neg); font-weight: 600; }
.wf-bkp li small { color: var(--wf-text-3); font-weight: 400; }
.wf-bkp li svg { width: 12px; height: 12px; vertical-align: -1px; }

/* ═════════════════ 28. CALM AND COMFORT ═════════════════════════════════════
   Presentation only: no script, no copy, no data, no new hex. Two ideas and two preferences.
   1. Bad news should be clear, not loud. A tinted frame round every warning makes the whole page read as
      an alarm. The tone now lives on the left edge, the icon and the amount; the frame itself is the same
      quiet hairline as every other card. Nothing is hidden or reworded.
   2. Things that can be picked answer a press the same way, at once (a soft 1.5% dip), and only for the
      press: nothing is added on hover, so a touch screen never keeps a "lifted" card after a tap.
   3. People who ask for more contrast get a firmer hairline and darker secondary text.
   4. In forced-colors (Windows high contrast) box-shadow is dropped by the browser, so the focus ring
      (a box-shadow in §1) would vanish; there it becomes a real outline. */

/* 1. Warnings: tone on the edge, icon and amount, not on a coloured frame. */
.wfx { border-color: var(--wf-line) !important; transition: border-color var(--wf-dur-2) var(--wf-ease); }
.wfx-t { text-wrap: balance; }
.wfx-b { max-width: 70ch; text-wrap: pretty; }

/* 2. One press feel. */
:root { caret-color: var(--wf-accent); }
.ai-persona-card:active, .scan-mode-card:active, .wfx-a:active { transform: scale(.985); }

/* 3 and 4. Preferences the person has already told the system. */
@media (prefers-contrast: more) {
    .card, .loan-card, .inc-card, .chq-card, .tgt-card, .sub-card, .tbl-wrap, .wfx { border-color: var(--wf-line-3) !important; }
    .wfx-b, .card-sub, .stat-meta, .fhint { color: var(--wf-text-2); }
}
@media (forced-colors: active) {
    :focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
    .wfx::before { forced-color-adjust: none; }
}
@media (prefers-reduced-motion: reduce) {
    .ai-persona-card:active, .scan-mode-card:active, .wfx-a:active { transform: none; }
}

/* ==========================================================================
   29. REACH (touch comfort, nothing moves)
   The page sweep (22 pages, 5 widths, 2 themes) found a few controls whose tap area is 26-28px tall on a
   phone: "Confirm Received", "Past months", the attention-tile action, and every on/off switch. A small
   target makes people tap twice and doubt the app. The drawn size stays exactly as it is; only the area
   that answers a tap grows (an invisible 8px skin), and only for fingers. Long search placeholders end in
   an ellipsis instead of being cut mid-word.
   ========================================================================== */
@media (pointer: coarse) {
    .income-received-btn, .income-past-btn, .wfx-a, .toggle { position: relative; }
    .income-received-btn::before, .income-past-btn::before, .wfx-a::before, .toggle::before {
        content: ''; position: absolute; inset: -8px -6px;
    }
}
input.fi, input[type="search"], input[type="text"] { text-overflow: ellipsis; }

/* ==========================================================================
   30. NEW TAG (wealthflow-new-badge.js)
   A screen or an option that is new wears this for 7 days, and the script takes it off again. One quiet gold pill, the same gold as the logo: it is information, not an alarm, so it does not pulse,
   does not count as "needs attention", and appears once with a short fade. Same pill in the sidebar, in the phone More sheet (top corner of the tile) and beside an option in Settings.
   ========================================================================== */
.wf-new {
    display: inline-flex; align-items: center; flex: none; margin-left: 8px; padding: 2px 7px 1px; border-radius: 999px;
    font: 700 9.5px/1.5 var(--wf-font); letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; vertical-align: middle;
    color: var(--wf-accent-ink); background: linear-gradient(135deg, var(--wf-accent-fill), var(--wf-accent-fill-2));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 0 0 1px var(--wf-accent-line);
    animation: wfNewIn .5s var(--wf-ease) both;
}
.nav-item > .wf-new { margin-left: auto; }
.wf-item .wf-badge.wf-badge-new {
    min-width: 0; height: auto; padding: 2px 6px 1px; right: calc(50% - 34px); font-size: 9px; line-height: 1.5; letter-spacing: .09em;
    color: var(--wf-accent-ink); background: linear-gradient(135deg, var(--wf-accent-fill), var(--wf-accent-fill-2)); box-shadow: 0 0 0 1px var(--wf-accent-line);
}
@keyframes wfNewIn { from { opacity: 0; transform: scale(.85); } }
@media (prefers-reduced-motion: reduce) { .wf-new { animation: none; } }
@media (forced-colors: active) { .wf-new, .wf-item .wf-badge.wf-badge-new { forced-color-adjust: none; } }

/* ==========================================================================
   31. CARD TABS (wealthflow-card-tabs.js)
   CC One-Time and CC Instalments show one tab per credit card once the owner holds more than one: the bank's name, the card's last four digits, the rows and what is due. It replaces the row of
   hand-coloured bank chips (every bank its own hue, no card number, two cards of one bank merged). The same restraint as the rest of the app: one gold accent for the chosen card, red only for
   money that is overdue, figures in tabular numerals, a quiet monogram instead of a decoration. On a phone the row scrolls sideways and each tab snaps into place.
   ========================================================================== */
.wf-ctabs {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(232px, 1fr); gap: var(--wf-s2);
    margin: 0 0 var(--wf-s4); padding: 2px 2px var(--wf-s2);
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin;
}
.wf-ctab {
    position: relative; scroll-snap-align: start; min-height: 44px; min-width: 0;
    display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: var(--wf-s3); row-gap: 1px; align-items: center; text-align: left;
    padding: var(--wf-s3) var(--wf-s4) var(--wf-s3) var(--wf-s3); border: 1px solid var(--wf-line-2); border-radius: var(--wf-r-md);
    background: var(--wf-card); color: var(--wf-text-2); font: inherit; cursor: pointer;
    transition: background var(--wf-dur-1) var(--wf-ease), border-color var(--wf-dur-1) var(--wf-ease), transform var(--wf-dur-1) var(--wf-ease);
}
.wf-ctab:hover { background: var(--wf-card-2); color: var(--wf-text); }
.wf-ctab:active { transform: translateY(1px); }
.wf-ctab:focus-visible { outline: 2px solid var(--wf-accent); outline-offset: 2px; }
.wf-ctab.is-on { background: var(--wf-accent-soft); border-color: var(--wf-accent-line); color: var(--wf-text); }
.wf-ctab.is-on::after { content: ''; position: absolute; left: var(--wf-s4); right: var(--wf-s4); bottom: -1px; height: 2px; border-radius: 2px; background: var(--wf-accent); }
.wf-ctab-mark {
    grid-row: 1 / span 3; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--wf-r-sm);
    background: var(--wf-card-3); color: var(--wf-text); font: 700 11px/1 var(--wf-font); letter-spacing: .04em;
}
.wf-ctab.is-on .wf-ctab-mark { background: var(--wf-accent-fill); color: var(--wf-accent-ink); }
.wf-ctab-name { grid-column: 2; font: 600 13px/1.3 var(--wf-font); color: var(--wf-text); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
.wf-ctab-meta { grid-column: 2; font: 500 11.5px/1.3 var(--wf-font); color: var(--wf-text-2); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wf-ctab-due { grid-column: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.wf-ctab-duelbl { font: 500 11px/1.3 var(--wf-font); color: var(--wf-text-3); }
.wf-ctab-amt { font: 700 13px/1.3 var(--wf-font); color: var(--wf-text); white-space: nowrap; }
.wf-ctab-due.is-none .wf-ctab-amt { font-weight: 500; color: var(--wf-text-3); }
.wf-ctab.is-late .wf-ctab-amt { color: var(--wf-neg); }
.wf-ctab-late { font: 600 10.5px/1.3 var(--wf-font); padding: 1px 6px; border-radius: var(--wf-r-pill); color: var(--wf-neg); background: var(--wf-neg-soft); white-space: nowrap; }
@media (max-width: 640px) {
    /* A phone shows every card at once, two to a row ("All cards" across the top). A sideways strip cut the second card in half at the screen edge and nothing said there was more to the right. */
    .wf-ctabs { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-x: visible; }
    .wf-ctabs > .wf-ctab:first-child:nth-last-child(n + 3) { grid-column: 1 / -1; }
    .wf-ctab { padding-right: var(--wf-s3); }
    .wf-ctab-meta { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
    .wf-ctab { transition: none; }
    .wf-ctab:active { transform: none; }
}
@media (forced-colors: active) {
    .wf-ctab.is-on { border-color: Highlight; outline: 1px solid Highlight; }
    .wf-ctab.is-on::after { background: Highlight; }
}

/* ---------------------------------------------------------------------------
 * 31. READABLE AND REACHABLE (test/e2e/a11y-audit.mjs, 2026-11-07)
 * Found by measuring every screen in both themes: text under 4.5:1 (3:1 for large text), controls whose focus
 * ring vanished against their own fill, and no way past the sidebar. Colours that are tokens were changed in
 * wf-tokens.css (light: --wf-neg, --wf-accent, --wf-text-3, --wf-pos; dark: --wf-text-3); what is left here is
 * what a token cannot reach.
 * ------------------------------------------------------------------------- */
/* The focus ring is drawn twice: the soft glow above, and a solid line that a coloured fill cannot hide. */
button:focus-visible, .btn:focus-visible, .gf-btn:focus-visible, [role="switch"]:focus-visible, [role="tab"]:focus-visible, select:focus-visible, a:focus-visible {
    outline: 2px solid var(--wf-info);
    outline-offset: 2px;
}
.wf-skip {
    position: fixed; left: 12px; top: -64px; z-index: 10000;
    padding: 10px 16px; border-radius: 10px; font-weight: 700; font-size: 14px;
    background: var(--wf-text); color: var(--wf-bg); border: 2px solid var(--wf-info); text-decoration: none;
    transition: top .15s ease;
}
.wf-skip:focus { top: calc(env(safe-area-inset-top, 0px) + 12px); }
@media (prefers-reduced-motion: reduce) { .wf-skip { transition: none; } }
/* White on amber, light blue or grey was 1.7:1 to 3.2:1. */
:root:not([data-theme="light"]) .debt-item .debt-priority { color: var(--wf-bg); }
/* The 3D cash-flow canvas is dark in both themes, so the words laid over it must be light in both. */
#cf3dCanvasWrap > div, #cf3dCanvasWrap #cf3dLegend, #cf3dCanvasWrap > div span { color: rgba(231, 235, 244, .9) !important; }
:root[data-theme="light"] .wf-sw-chip.c-moderate { color: var(--wf-accent); border-color: var(--wf-accent); }
/* Accent-coloured headings and counters were drawn with one colour for both themes: 2.0:1 to 3.3:1 on the light page. Darkening the
   same hue keeps each heading its own colour and makes it readable. */
:root[data-theme="light"] .settings-title, :root[data-theme="light"] #wfIntelMemCount, :root[data-theme="light"] #wfIntelReviewCount { filter: brightness(.62); }

/* ---------------------------------------------------------------------------
 * Accent-coloured text that used to carry a hard-coded colour (Settings headings and counters). The same four hues, from the theme's tokens,
 * so each reads at 4.5:1 or better on both themes. Doubled class on purpose: it must beat a single-class colour in the page's own styles.
 * ------------------------------------------------------------------------- */
.wf-ink-info.wf-ink-info { color: var(--wf-info); }
.wf-ink-violet.wf-ink-violet { color: var(--wf-violet); }
.wf-ink-pos.wf-ink-pos { color: var(--wf-pos); }
.wf-ink-warn.wf-ink-warn { color: var(--wf-warn); }

/* ==========================================================================
   32. MINIMUM PAYMENT DUE (wealthflow-card-tabs.js renderDues)
   The section at the top of CC One-Time: what each card's latest statement asks the owner to pay at the very least, and by when. It is deliberately not a table row (it is not a charge): a plain card with the
   amount large, the date under it, and one chip that says how close it is. Quiet while there is time (gold hairline), amber in the last five days, red once the date has passed; green once the payments since
   the statement cover it. The state is always written in words too, never colour alone.
   ========================================================================== */
.wf-due { margin: 0 0 var(--wf-s4); }
.wf-due-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--wf-s3); margin: 0 0 var(--wf-s2); }
.wf-due-title { margin: 0; font: 700 14px/1.3 var(--wf-font); color: var(--wf-text); }
.wf-due-sub { font: 500 12px/1.4 var(--wf-font); color: var(--wf-text-3); }
.wf-due-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--wf-s3); }
.wf-due-card { display: grid; gap: 3px; padding: var(--wf-s4); border: 1px solid var(--wf-accent-line); border-left-width: 4px; border-radius: var(--wf-r-md); background: var(--wf-card); font-variant-numeric: tabular-nums; }
.wf-due-top { display: flex; align-items: center; justify-content: space-between; gap: var(--wf-s2); }
.wf-due-who { font: 600 13px/1.3 var(--wf-font); color: var(--wf-text-2); overflow-wrap: anywhere; }
.wf-due-chip { flex: none; font: 600 11px/1.3 var(--wf-font); padding: 2px 8px; border-radius: var(--wf-r-pill); color: var(--wf-text-2); background: var(--wf-card-3); white-space: nowrap; }
.wf-due-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--wf-s2); margin-top: 2px; }
.wf-due-lbl { font: 500 12px/1.3 var(--wf-font); color: var(--wf-text-3); }
.wf-due-amt { font: 700 22px/1.2 var(--wf-font); color: var(--wf-text); letter-spacing: -.01em; }
.wf-due-when { font: 500 12.5px/1.4 var(--wf-font); color: var(--wf-text-2); }
.wf-due-note { margin-top: 4px; font: 500 12px/1.5 var(--wf-font); color: var(--wf-text-3); }
.wf-due-act { margin-top: var(--wf-s2); }
.wf-due-act .btn { min-height: 44px; }
.wf-due-card.is-soon { border-color: var(--wf-warn); background: var(--wf-warn-soft); }
.wf-due-card.is-soon .wf-due-chip { color: var(--wf-warn); background: transparent; border: 1px solid var(--wf-warn); }
.wf-due-card.is-late { border-color: var(--wf-neg); background: var(--wf-neg-soft); }
.wf-due-card.is-late .wf-due-chip { color: var(--wf-neg); background: transparent; border: 1px solid var(--wf-neg); }
.wf-due-card.is-late .wf-due-amt { color: var(--wf-neg); }
.wf-due-card.is-covered, .wf-due-card.is-paid { border-color: var(--wf-pos); }
.wf-due-card.is-covered .wf-due-chip, .wf-due-card.is-paid .wf-due-chip { color: var(--wf-pos); background: var(--wf-pos-soft); }
@media (max-width: 640px) { .wf-due-list { grid-template-columns: 1fr; } }
@media (forced-colors: active) { .wf-due-card { border-color: CanvasText; } .wf-due-card.is-late, .wf-due-card.is-soon { border-color: Highlight; } }


/* ==========================================================================
   32. CC INSTALMENTS ROWS ON A PHONE
   The table slides sideways with its Actions column pinned, so on a phone a row showed only the product's name and the three action icons; the amounts were off to the right and nothing said a row could be opened.
   Each row now says what matters under its name (the monthly figure, months paid, status) and carries a Details button that opens the whole plan (wealthflow-cc-instalment-detail.js).
   ========================================================================== */
.wf-cci-sum { margin-top: 3px; font: 500 12px/1.4 var(--wf-font); color: var(--wf-text-2); font-variant-numeric: tabular-nums; }
.wf-cci-open {
    margin-top: 6px; min-height: 36px; padding: 6px 14px; border: 1px solid var(--wf-accent-line); border-radius: var(--wf-r-pill);
    background: var(--wf-accent-soft); color: var(--wf-text); font: 600 12px/1 var(--wf-font); cursor: pointer;
}
.wf-cci-open:active { transform: translateY(1px); }
.wf-cci-open:focus-visible { outline: 2px solid var(--wf-accent); outline-offset: 2px; }
#page-ccinstall .wf-cci-note { white-space: normal; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow-wrap: anywhere; }
@media (min-width: 641px) { .wf-cci-sum { display: none; } }
/* A cell's own max-width does nothing inside a table, so the room is set on what is in it: the pinned Actions column is about 150px, and the name, note and summary must wrap before it instead of running under it. */
.wf-cci-sum { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 640px) { #page-ccinstall tbody td:first-child > * { max-width: max(150px, calc(100vw - 236px)); } }
