/* ════════════════════════════════════════════════════════════════════════
   BOMI Banking — shared design system
   ────────────────────────────────────────────────────────────────────────
   Palette is taken from the BOMI seal (deep navy +
   gold) and keeps the "digital passbook on an atoll" idea of the original
   portal: ledger-style rows, a quiet tideline, serif figures.
   Two themes (dark default, light) driven entirely by the variables below.
   ════════════════════════════════════════════════════════════════════════ */

:root {
    color-scheme: dark;
    --bg: #060F24;
    --bg-2: #0A1A3A;
    --surface: #0D2048;
    --surface-2: #112A5C;
    --raise: rgba(255, 255, 255, 0.035);
    --line: rgba(190, 210, 255, 0.14);
    --line-soft: rgba(190, 210, 255, 0.08);
    --text: #EAF0FC;
    --muted: #A3B3D3;
    --faint: #7487AD;
    --heading: #FFFFFF;
    --gold: #E3B23C;
    --gold-hi: #F0C867;
    --gold-ink: #1B1400;
    --accent: #E3B23C; /* links / focus ring */

    --pos: #5CCDA9;
    --neg: #F2896F;
    --warn-bg: rgba(227, 178, 60, 0.12);
    --warn-bd: rgba(227, 178, 60, 0.45);
    --err-bg: rgba(242, 137, 111, 0.12);
    --err-bd: rgba(242, 137, 111, 0.5);
    --ok-bg: rgba(92, 205, 169, 0.12);
    --ok-bd: rgba(92, 205, 169, 0.5);
    --input-bg: rgba(4, 12, 30, 0.45);
    --shadow: 0 1px 0 rgba(255,255,255,0.05) inset, 0 14px 40px rgba(0,0,0,0.35);
    --wave-1: #0C2757;
    --wave-2: #0A1F47;
    --wave-3: #071530;
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --radius: 10px;
    --radius-sm: 6px;
}

    :root[data-theme="light"] {
        color-scheme: light;
        --bg: #F1F4FA;
        --bg-2: #E8EDF7;
        --surface: #FFFFFF;
        --surface-2: #F4F7FC;
        --raise: rgba(15, 44, 107, 0.04);
        --line: #D9E0EE;
        --line-soft: #E7ECF6;
        --text: #12204A;
        --muted: #53618A;
        --faint: #7A87A8;
        --heading: #0B1B45;
        --gold: #E3B23C;
        --gold-hi: #EBC15B;
        --gold-ink: #1B1400;
        --accent: #0F2C6B;
        --pos: #12795C;
        --neg: #B63F25;
        --warn-bg: #FFF6DD;
        --warn-bd: #E3B23C;
        --err-bg: #FDEEEA;
        --err-bd: #E08A74;
        --ok-bg: #E7F6F0;
        --ok-bd: #7CCBAE;
        --input-bg: #FFFFFF;
        --shadow: 0 1px 2px rgba(15, 44, 107, 0.06), 0 10px 30px rgba(15, 44, 107, 0.10);
        --wave-1: #DCE5F5;
        --wave-2: #E3EAF7;
        --wave-3: #EAF0FA;
    }

* {
    box-sizing: border-box;
}

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

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    line-height: 1.45;
    position: relative;
}

a {
    color: var(--accent);
}

::selection {
    background: var(--gold);
    color: var(--gold-ink);
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

:root:not([data-theme="light"]) :focus-visible {
    outline-color: var(--gold);
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 100;
    background: var(--gold);
    color: var(--gold-ink);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    text-decoration: none;
}

    .skip-link:focus {
        top: 1rem;
    }

/* ── Ambient tideline (quiet texture behind everything) ───────────────── */
body::before {
    content: "";
    position: fixed;
    inset: auto 0 0 0;
    height: 40vh;
    min-height: 240px;
    z-index: 0;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: bottom;
    background-size: 100% 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 500' preserveAspectRatio='none'%3E%3Cpath d='M0,320 C180,270 340,360 540,320 C740,280 860,350 1080,310 C1220,285 1340,300 1440,295 L1440,500 L0,500 Z' fill='%235B86E5' fill-opacity='.07'/%3E%3Cpath d='M0,370 C200,330 360,400 580,365 C800,330 940,390 1160,360 C1280,343 1360,352 1440,350 L1440,500 L0,500 Z' fill='%235B86E5' fill-opacity='.06'/%3E%3Cpath d='M0,420 C220,398 400,435 620,415 C860,393 1000,430 1220,412 C1310,404 1380,410 1440,408 L1440,500 L0,500 Z' fill='%235B86E5' fill-opacity='.08'/%3E%3C/svg%3E");
}

:root[data-theme="light"] body::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 500' preserveAspectRatio='none'%3E%3Cpath d='M0,320 C180,270 340,360 540,320 C740,280 860,350 1080,310 C1220,285 1340,300 1440,295 L1440,500 L0,500 Z' fill='%230F2C6B' fill-opacity='.04'/%3E%3Cpath d='M0,370 C200,330 360,400 580,365 C800,330 940,390 1160,360 C1280,343 1360,352 1440,350 L1440,500 L0,500 Z' fill='%230F2C6B' fill-opacity='.04'/%3E%3Cpath d='M0,420 C220,398 400,435 620,415 C860,393 1000,430 1220,412 C1310,404 1380,410 1440,408 L1440,500 L0,500 Z' fill='%230F2C6B' fill-opacity='.05'/%3E%3C/svg%3E");
}

.shell, .auth-wrap, .topbar {
    position: relative;
    z-index: 1;
}

/* ── Brand lockup (logo + wordmark; always a link back to "/") ────────── */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius-sm);
}

    .brand img {
        width: 44px;
        height: 44px;
        display: block;
        flex-shrink: 0;
    }

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    color: var(--heading);
}

.brand-sub {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.brand:hover .brand-name {
    color: var(--accent);
}

:root:not([data-theme="light"]) .brand:hover .brand-name {
    color: var(--gold-hi);
}

/* ── Logo protection ───────────────────────────────────────────────────── */
.brand img {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-drag: none;
    -ms-user-drag: none;
    user-drag: none;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, var(--gold-hi), var(--gold));
    color: var(--gold-ink);
    font: 700 0.95rem var(--font-body);
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 6px 16px rgba(227,178,60,0.22);
    transition: filter 0.15s ease, transform 0.05s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

    .btn-primary:hover:not(:disabled) {
        filter: brightness(1.05);
    }

    .btn-primary:active:not(:disabled) {
        transform: translateY(1px);
    }

    .btn-primary:disabled {
        opacity: 0.55;
        cursor: default;
        box-shadow: none;
    }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text);
    font: 600 0.82rem var(--font-body);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

    .btn-ghost:hover {
        border-color: var(--gold);
        background: var(--warn-bg);
    }

    .btn-ghost:disabled {
        opacity: 0.5;
        cursor: default;
    }

    .btn-ghost svg, .icon-btn svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

.icon-btn {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

    .icon-btn:hover {
        border-color: var(--gold);
        background: var(--warn-bg);
    }

    .icon-btn[aria-pressed="true"] {
        border-color: var(--gold);
        background: var(--warn-bg);
    }

.text-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent);
    font: 500 0.85rem var(--font-body);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

:root:not([data-theme="light"]) .text-link {
    color: var(--gold-hi);
}

.text-link:hover {
    filter: brightness(1.15);
}

/* ── Alerts ───────────────────────────────────────────────────────────── */
.banner {
    display: none;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    padding: 0.8rem 1rem;
    font-size: 0.86rem;
    margin: 0 0 1.1rem;
}

    .banner.show {
        display: block;
    }

    .banner.error {
        border-color: var(--err-bd);
        background: var(--err-bg);
        color: var(--text);
    }

    .banner.success {
        border-color: var(--ok-bd);
        background: var(--ok-bg);
        color: var(--text);
    }

    .banner.warn {
        border-color: var(--warn-bd);
        background: var(--warn-bg);
        color: var(--text);
    }

    .banner strong {
        color: var(--heading);
    }

/* ── Auth layout (login / forgot / set-password) ──────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}

.auth-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem clamp(2rem, 6vw, 5.5rem);
    background: radial-gradient(90% 70% at 20% 10%, rgba(227,178,60,0.14), transparent 60%), linear-gradient(160deg, #0F2C6B 0%, #091B45 55%, #050E24 100%);
    color: #EAF0FC;
    overflow: hidden;
}

    .auth-aside::after {
        content: "";
        position: absolute;
        inset: auto 0 0 0;
        height: 45%;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        pointer-events: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 500' preserveAspectRatio='none'%3E%3Cpath d='M0,320 C180,270 340,360 540,320 C740,280 860,350 1080,310 C1220,285 1340,300 1440,295 L1440,500 L0,500 Z' fill='%235B86E5' fill-opacity='.10'/%3E%3Cpath d='M0,370 C200,330 360,400 580,365 C800,330 940,390 1160,360 C1280,343 1360,352 1440,350 L1440,500 L0,500 Z' fill='%235B86E5' fill-opacity='.09'/%3E%3Cpath d='M0,420 C220,398 400,435 620,415 C860,393 1000,430 1220,412 C1310,404 1380,410 1440,408 L1440,500 L0,500 Z' fill='%23E3B23C' fill-opacity='.07'/%3E%3C/svg%3E");
    }

    .auth-aside > * {
        position: relative;
        z-index: 1;
    }

    .auth-aside .brand-name {
        color: #fff;
    }

    .auth-aside .brand-sub {
        color: #B9C8E6;
    }

    .auth-aside .brand img {
        width: 64px;
        height: 64px;
    }

    .auth-aside .brand-name {
        font-size: 1.35rem;
    }

.aside-pitch {
    margin-top: clamp(2rem, 8vh, 5rem);
    max-width: 28rem;
}

    .aside-pitch h2 {
        font-family: var(--font-display);
        font-size: clamp(1.7rem, 3.2vw, 2.4rem);
        line-height: 1.15;
        margin: 0 0 0.9rem;
        color: #fff;
    }

    .aside-pitch p {
        margin: 0;
        color: #C3D0EA;
        font-size: 1rem;
        line-height: 1.6;
    }

.aside-points {
    list-style: none;
    margin: 2rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.8rem;
}

    .aside-points li {
        display: flex;
        gap: 0.7rem;
        align-items: flex-start;
        color: #D5DFF3;
        font-size: 0.92rem;
    }

    .aside-points svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
        margin-top: 2px;
        color: var(--gold);
    }

.auth-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem 2rem;
    gap: 1.25rem;
}

.auth-top {
    width: 100%;
    max-width: 26rem;
    display: none; /* shown on small screens, where the aside is hidden */
    justify-content: center;
    margin-bottom: 0.5rem;
}

    .auth-top .brand {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

        .auth-top .brand img {
            width: 76px;
            height: 76px;
        }

    .auth-top .brand-text {
        align-items: center;
    }

.card {
    width: 100%;
    max-width: 26rem;
    padding: 2.25rem 2.1rem 1.75rem;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

    .card h1 {
        font-family: var(--font-display);
        font-size: 1.55rem;
        margin: 0 0 0.35rem;
        color: var(--heading);
    }

    .card .lede {
        margin: 0 0 1.5rem;
        color: var(--muted);
        font-size: 0.92rem;
    }

.field {
    margin-bottom: 1.05rem;
}

    .field > label, .field-label {
        display: block;
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--muted);
        margin-bottom: 0.4rem;
    }

    .field .hint {
        margin: 0.4rem 0 0;
        font-size: 0.76rem;
        color: var(--faint);
    }

    .field .hint-row {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.75rem;
    }

        .field .hint-row .hint {
            flex: 1 1 auto;
        }

.digit-hint {
    flex: none;
    margin-top: 0.4rem;
    font-size: 0.76rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
}

    .digit-hint.valid {
        color: #2ecc40;
    }

    .digit-hint.short {
        color: var(--muted);
    }

    .digit-hint.invalid {
        color: #ff4136;
    }

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.field input {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--heading);
    font: 400 0.98rem var(--font-body);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

    .field input:focus {
        border-color: var(--gold);
        box-shadow: 0 0 0 3px rgba(227,178,60,0.22);
    }

    .field input::placeholder {
        color: var(--faint);
    }

    .field input.has-toggle {
        padding-right: 3rem;
    }

    .field input[aria-invalid="true"] {
        border-color: var(--neg);
    }

.input-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--muted);
    cursor: pointer;
}

    .input-toggle:hover {
        color: var(--heading);
    }

    .input-toggle svg {
        width: 20px;
        height: 20px;
    }

.caps-warn {
    display: none;
    margin: 0.4rem 0 0;
    font-size: 0.76rem;
    color: var(--gold-hi);
}

:root[data-theme="light"] .caps-warn {
    color: #8A6508;
}

.caps-warn.show {
    display: block;
}

.auth-foot {
    margin-top: 1.4rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--line-soft);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.auth-legal {
    width: 100%;
    max-width: 26rem;
    text-align: center;
    font-size: 0.74rem;
    color: var(--faint);
    line-height: 1.5;
}

    .auth-legal a {
        color: inherit;
    }

.method-toggle {
    margin: 0.2rem 0 1.05rem;
}

.secure-note {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    font-size: 0.76rem;
    color: var(--faint);
    margin-top: 1rem;
}

    .secure-note svg {
        width: 14px;
        height: 14px;
    }

.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(27,20,0,0.3);
    border-top-color: var(--gold-ink);
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.theme-corner {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 20;
}

    .theme-corner .icon-btn {
        background: var(--surface);
    }

/* ── Dashboard shell ──────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--line-soft);
}

.topbar-inner {
    max-width: 62rem;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0.65rem 0.3rem 0.3rem;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font: 600 0.84rem var(--font-body);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

    .user-btn:hover, .user-btn[aria-expanded="true"] {
        border-color: var(--gold);
        background: var(--warn-bg);
    }

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #1A3F8F, #0F2C6B);
    color: var(--gold-hi);
    font: 700 0.78rem var(--font-body);
    border: 1px solid rgba(227,178,60,0.55);
}

.user-name {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-btn .caret {
    width: 12px;
    height: 12px;
    color: var(--muted);
}

.menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 15.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.4rem;
    z-index: 40;
}

.menu-head {
    padding: 0.7rem 0.8rem 0.8rem;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 0.3rem;
}

    .menu-head strong {
        display: block;
        color: var(--heading);
        font-size: 0.92rem;
    }

    .menu-head span {
        font-size: 0.78rem;
        color: var(--muted);
    }

.menu button, .menu a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text);
    font: 500 0.88rem var(--font-body);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

    .menu button:hover, .menu a:hover {
        background: var(--raise);
    }

.menu svg {
    width: 17px;
    height: 17px;
    color: var(--muted);
}

.shell {
    max-width: 62rem;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 4rem;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.4rem;
}

    .page-head h1 {
        font-family: var(--font-display);
        font-size: clamp(1.45rem, 3.2vw, 1.9rem);
        margin: 0;
        color: var(--heading);
    }

    .page-head p {
        margin: 0.25rem 0 0;
        color: var(--muted);
        font-size: 0.88rem;
    }

.page-tools {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.updated {
    font-size: 0.78rem;
    color: var(--faint);
}

.badge {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    color: var(--gold-ink);
    background: var(--gold);
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* ── Summary tiles ────────────────────────────────────────────────────── */
.tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem 1.1rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

    .tile::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 3px;
        background: var(--gold);
        opacity: 0.85;
    }

    .tile.tile-loan::before {
        background: #5B86E5;
    }

    .tile.tile-due::before {
        background: var(--neg);
    }

    .tile.tile-ok::before {
        background: var(--pos);
    }

    .tile .t-label {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        font-size: 0.76rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
    }

    .tile .t-value {
        font-family: var(--font-display);
        font-size: clamp(1.55rem, 3.6vw, 2.1rem);
        font-weight: 700;
        color: var(--heading);
        font-variant-numeric: tabular-nums;
        margin: 0.45rem 0 0.2rem;
        line-height: 1.1;
        min-height: 2.3rem;
    }

    .tile .t-sub {
        font-size: 0.78rem;
        color: var(--faint);
    }

    .tile.tile-due .t-value {
        color: var(--neg);
    }

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pos);
    box-shadow: 0 0 0 0 rgba(92,205,169,0.55);
    animation: breathe 2.6s ease-in-out infinite;
    flex-shrink: 0;
}

    .dot.off {
        background: var(--faint);
        animation: none;
    }

@keyframes breathe {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(92,205,169,0.5);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(92,205,169,0);
    }
}

.private .t-value, .private .figure, .private td.num, .private .masked-able {
    filter: blur(9px);
    user-select: none;
}

/* ── Section heading ──────────────────────────────────────────────────── */
.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 2.2rem 0 0.9rem;
}

    .section-heading h2 {
        font-family: var(--font-display);
        font-size: 1.15rem;
        margin: 0;
        color: var(--heading);
    }

    .section-heading .count {
        font-size: 0.8rem;
        color: var(--faint);
    }

/* ── Passbook entry (account / loan) ──────────────────────────────────── */
.entry {
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    margin-bottom: 0.8rem;
    overflow: hidden;
}

.entry-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 1.1rem 1.3rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
    transition: background 0.15s ease;
}

    .entry-row:hover {
        background: var(--raise);
    }

.entry-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--accent);
}

:root:not([data-theme="light"]) .entry-icon {
    color: var(--gold-hi);
}

.entry-icon svg {
    width: 20px;
    height: 20px;
}

.entry-left {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.entry-id {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

    .entry-id .label {
        font-size: 0.98rem;
        font-weight: 600;
        color: var(--heading);
        letter-spacing: 0.01em;
    }

    .entry-id .sub {
        font-size: 0.78rem;
        color: var(--muted);
    }

    .entry-id .sub-row {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

.badge-due {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--neg);
    background: var(--err-bg);
    border: 1px solid var(--err-bd);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-ok {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--pos);
    background: var(--ok-bg);
    border: 1px solid var(--ok-bd);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-joint {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--raise);
    border: 1px solid var(--line);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

:root:not([data-theme="light"]) .badge-joint {
    color: var(--gold-hi);
    border-color: var(--warn-bd);
}

.entry-amount {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

    .entry-amount .figure {
        font-family: var(--font-display);
        font-size: 1.3rem;
        font-weight: 700;
        color: var(--heading);
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

        .entry-amount .figure.muted {
            font-size: 0.85rem;
            font-family: var(--font-body);
            font-weight: 500;
            color: var(--faint);
        }

.chevron {
    width: 9px;
    height: 9px;
    border-right: 1.5px solid var(--muted);
    border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-bottom: 3px;
}

.entry.open .chevron {
    transform: rotate(-135deg);
    margin-bottom: -3px;
}

/* Ledger (expanded activity) */
.ledger-wrap {
    display: none;
    border-top: 1px solid var(--line);
}

.entry.open .ledger-wrap {
    display: block;
}

.ledger-tools {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 0.8rem 1.3rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line-soft);
}

    .ledger-tools input[type="search"] {
        flex: 1 1 11rem;
        min-width: 0;
        max-width: 20rem;
        padding: 0.5rem 0.75rem;
        font: 0.84rem var(--font-body);
        background: var(--input-bg);
        color: var(--heading);
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        outline: none;
    }

        .ledger-tools input[type="search"]:focus {
            border-color: var(--gold);
        }

    .ledger-tools .meta {
        font-size: 0.76rem;
        color: var(--faint);
    }

.ledger-scroll {
    max-height: 30rem;
    overflow: auto;
}

.ledger {
    padding: 0 1.3rem 1.1rem;
}

    .ledger table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.86rem;
    }

    .ledger th {
        position: sticky;
        top: 0;
        background: var(--surface);
        z-index: 1;
        text-align: left;
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--faint);
        padding: 0.85rem 0.5rem 0.5rem;
        border-bottom: 1px solid var(--line);
    }

        .ledger th.num, .ledger td.num {
            text-align: right;
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }

    .ledger td {
        padding: 0.65rem 0.5rem;
        border-bottom: 1px solid var(--line-soft);
        color: var(--text);
        vertical-align: top;
    }

        .ledger td.date {
            white-space: nowrap;
            color: var(--muted);
        }

    .ledger tr:last-child td {
        border-bottom: none;
    }

    .ledger .desc .ref {
        display: block;
        font-size: 0.72rem;
        color: var(--faint);
        margin-top: 0.1rem;
    }

.amt-pos {
    color: var(--pos);
    font-weight: 600;
}

.amt-neg {
    color: var(--neg);
    font-weight: 600;
}

.ledger-empty, .ledger-loading, .ledger-error {
    padding: 1.5rem 0.5rem;
    font-size: 0.86rem;
    color: var(--muted);
    text-align: center;
}

.ledger-error {
    color: var(--neg);
}

.load-more {
    display: block;
    width: 100%;
    margin-top: 0.7rem;
    padding: 0.6rem;
    background: none;
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: 600 0.82rem var(--font-body);
    cursor: pointer;
}

    .load-more:hover {
        border-color: var(--gold);
    }

    .load-more:disabled {
        opacity: 0.5;
        cursor: default;
    }

.acct-actions {
    display: flex;
    gap: 0.5rem;
}

/* ── Empty / skeleton ─────────────────────────────────────────────────── */
.empty {
    padding: 1.75rem;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--muted);
    text-align: center;
    background: var(--raise);
}

.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 37%, var(--surface-2) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.6s ease infinite;
    border-radius: var(--radius-sm);
    display: block;
}

@keyframes shimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.footnote {
    margin: 2.5rem 0 0;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--faint);
    text-align: center;
}

.session-line {
    margin-top: 0.3rem;
}

/* ── Tabs (payments.html) ───────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.5rem;
}

.tab {
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    color: var(--muted);
    font: 600 0.88rem var(--font-body);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

    .tab:hover {
        color: var(--text);
        background: var(--raise);
    }

    .tab.active {
        color: var(--heading);
        background: var(--warn-bg);
        border: 1px solid var(--warn-bd);
    }

    .tab:focus-visible {
        outline: 2px solid var(--gold);
        outline-offset: 2px;
    }

.tab-panel {
    display: block;
}

/* ── Input prefix (dollar sign) ───────────────────────────────────────────── */
.input-prefix {
    position: absolute;
    left: 0.75rem;
    color: var(--muted);
    font-weight: 600;
    pointer-events: none;
    z-index: 1;
}

.input-wrap.has-prefix input {
    padding-left: 1.8rem;
}



/* ── Modal + toast ────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(3, 8, 22, 0.62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.modal {
    width: 100%;
    max-width: 25rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.6rem 1.6rem 1.3rem;
    box-shadow: 0 30px 80px rgba(0,0,0,0.45);
}

    .modal h2 {
        font-family: var(--font-display);
        font-size: 1.25rem;
        margin: 0 0 0.4rem;
        color: var(--heading);
    }

    .modal p {
        margin: 0 0 1rem;
        color: var(--muted);
        font-size: 0.9rem;
    }

.modal-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    margin-top: 1.2rem;
}

    .modal-actions .btn-primary {
        width: auto;
        padding: 0.6rem 1.2rem;
    }

    .modal-actions .btn-ghost {
        padding: 0.6rem 1rem;
    }

.countdown {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--heading);
}

.toast-region {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    display: grid;
    gap: 0.5rem;
}

.toast {
    background: var(--heading);
    color: var(--bg);
    padding: 0.65rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

/* ── Password strength (set-password) ─────────────────────────────────── */
.strength-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--line);
    margin-top: 0.6rem;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
}

.strength-label {
    font-size: 0.75rem;
    margin-top: 0.3rem;
    color: var(--faint);
    min-height: 1rem;
}

.requirements {
    background: var(--raise);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    margin: 0 0 1.2rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.req-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.15rem 0;
}

.req-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--faint);
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 0.6rem;
    transition: all 0.2s;
}

.req-item.met {
    color: var(--text);
}

    .req-item.met .req-icon {
        background: var(--pos);
        border-color: var(--pos);
        color: #fff;
    }

        .req-item.met .req-icon::after {
            content: "✓";
        }

.state-center {
    text-align: center;
    padding: 0.5rem 0;
}

    .state-center h1 {
        margin-top: 0.4rem;
    }

    .state-center p {
        color: var(--muted);
        font-size: 0.92rem;
        margin: 0.5rem 0 0;
    }

.state-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.6rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--warn-bg);
    border: 1px solid var(--warn-bd);
    color: var(--gold);
}

    .state-icon.ok {
        background: var(--ok-bg);
        border-color: var(--ok-bd);
        color: var(--pos);
    }

    .state-icon svg {
        width: 28px;
        height: 28px;
    }

.spinner-lg {
    width: 34px;
    height: 34px;
    margin: 1.2rem auto;
    border: 3px solid var(--line);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.card .btn-link {
    margin-top: 1.1rem;
    text-decoration: none;
    display: inline-flex;
    width: 100%;
}

/* ── Status page (index.html) ─────────────────────────────────────────── */
.status-card .status {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--pos);
    background: var(--ok-bg);
    border: 1px solid var(--ok-bd);
    border-radius: 999px;
    padding: 0.25rem 0.8rem;
    margin-bottom: 1.1rem;
}

.link-list {
    display: grid;
    gap: 0.6rem;
    margin-top: 1.4rem;
}

    .link-list a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.8rem 1rem;
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        color: var(--heading);
        text-decoration: none;
        font-weight: 600;
        font-size: 0.92rem;
        transition: border-color 0.15s ease, background 0.15s ease;
    }

        .link-list a:hover {
            border-color: var(--gold);
            background: var(--warn-bg);
        }

    .link-list .desc {
        font-weight: 400;
        font-size: 0.8rem;
        color: var(--muted);
    }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .auth-wrap {
        grid-template-columns: minmax(0, 1fr);
    }

    .auth-main {
        min-width: 0;
    }

    .auth-aside {
        display: none;
    }

    .auth-top {
        display: flex;
    }

    .auth-main {
        justify-content: flex-start;
        padding-top: 2.5rem;
    }

    .tiles {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

@media (max-width: 560px) {
    .card {
        padding: 1.8rem 1.35rem 1.4rem;
    }

    .topbar-inner {
        padding: 0.6rem 1rem;
    }

    .shell {
        padding: 1.25rem 1rem 3rem;
    }

    .brand-sub {
        display: none;
    }

    .brand img {
        width: 38px;
        height: 38px;
    }

    .user-name {
        display: none;
    }

    .user-btn {
        padding: 0.3rem 0.5rem 0.3rem 0.3rem;
    }

    .entry-row {
        padding: 0.95rem 1rem;
    }

    .entry-icon {
        display: none;
    }

    .entry-amount .figure {
        font-size: 1.1rem;
    }

    .ledger {
        padding: 0 0.8rem 1rem;
    }

    .ledger-tools {
        padding: 0.7rem 0.8rem;
    }

    .ledger th:nth-child(4), .ledger td:nth-child(4) {
        display: none;
    }
    /* running balance hides on phones */
}

/* Long unbroken text (an email address, an account number) must wrap instead of widening the page on a phone. */
.card, .modal, .banner, .lede, .hint, .menu-head, .entry-id, .toast, .footnote {
    overflow-wrap: anywhere;
    min-width: 0;
}

.auth-main > *, .shell > * {
    min-width: 0;
    max-width: 100%;
}

.topbar-inner > * {
    min-width: 0;
}

@media (max-width: 380px) {
    .topbar-inner {
        padding: 0.6rem 0.75rem;
        gap: 0.5rem;
    }

    .topbar-actions {
        gap: 0.35rem;
    }

    .brand {
        gap: 0.5rem;
    }

        .brand img {
            width: 34px;
            height: 34px;
        }

    .tab {
        padding: 0.55rem 0.7rem;
    }
}

.tabs {
    flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}

@media print {
    body::before, .topbar, .page-tools, .acct-actions, .ledger-tools, .toast-region, .theme-corner {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .entry, .tile {
        box-shadow: none;
        border-color: #bbb;
    }

    .ledger-wrap {
        display: block !important;
    }
}

/* ── Payment review dialog ────────────────────────────────────────────── */
.review-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.45rem 1rem;
    margin: 0.4rem 0 1rem;
    font-size: 0.92rem;
}

    .review-list dt {
        color: var(--muted);
    }

    .review-list dd {
        margin: 0;
        color: var(--heading);
        font-weight: 600;
        word-break: break-word;
        text-align: right;
    }

/* ── App download strip ───────────────────────────────────────────────── */
.app-strip {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin: 1.1rem auto 0;
    padding-top: 1rem;
    max-width: 25rem;
    border-top: 1px solid var(--line-soft);
}

.app-strip-qr {
    flex: 0 0 auto;
    line-height: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}
    /* the PNG carries its own white margin */
    .app-strip-qr img {
        width: 200px;
        height: 200px;
        display: block;
    }

.app-strip-text {
    display: grid;
    gap: 0.15rem;
    font-size: 0.85rem;
    min-width: 0;
}

.app-strip-title {
    font-weight: 700;
    color: var(--heading);
}

.app-strip-sub {
    font-size: 0.75rem;
    color: var(--faint);
}

@media (max-width: 640px) {
    .app-strip-qr {
        display: none;
    }

    .app-strip-sub {
        display: none;
    }
}
