/* ------------------------------------------------------------------
   FinTrack — Inter, hairline structure, one accent.
   Type scale: 12 meta · 14 labels/nav/table · 15 body · 16/22/26 heads.
   ------------------------------------------------------------------ */

:root {
    --canvas: #F7F8FA;
    --surface: #FFFFFF;
    --sunk: #F1F3F6;
    --ink: #14161C;
    --ink-2: #5A6270;
    --ink-3: #878E9C;
    --line: #E4E7EC;
    --line-2: #EFF1F4;
    --accent: #3A46E0;
    --accent-soft: #EDEEFD;
    --on-accent: #FFFFFF;
    --pos: #0B8A5B;
    --neg: #C8382E;
    --warn: #9A6B0B;
    --warn-soft: #FBF4E4;
    --r: 12px;
    --r-sm: 8px;
    --rail: 236px;
    --shadow: 0 1px 2px rgba(20, 22, 28, .05);
    --shadow-2: 0 1px 2px rgba(20, 22, 28, .05), 0 8px 24px -12px rgba(20, 22, 28, .16);
    --ring: 0 0 0 3px var(--accent-soft);
    /* Content width. Steps up on large displays — see the width ladder below. */
    --page: 1120px;
    --pad: 28px;
    --gap: 10px;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --canvas: #0D0F14;
        --surface: #14171E;
        --sunk: #1A1E27;
        --ink: #E9ECF2;
        --ink-2: #99A1B0;
        --ink-3: #6C7482;
        --line: #242935;
        --line-2: #1D2129;
        --accent: #8A93FF;
        --accent-soft: #1D2140;
        --on-accent: #0D0F14;
        --pos: #37C288;
        --neg: #F0736A;
        --warn: #D6A63F;
        --warn-soft: #241E10;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
    }
}

/* Width ladder. The page keeps its proportions on a 1440p panel and then
   actually uses a 4K one, instead of stranding content in a 1080px column. */
@media (min-width: 1500px) {
    :root {
        --page: 1360px;
        --pad: 36px;
        --gap: 12px
    }
}

@media (min-width: 2000px) {
    :root {
        --page: 1720px;
        --pad: 44px;
        --gap: 14px
    }
}

@media (min-width: 2560px) {
    :root {
        --page: 2160px;
        --pad: 56px;
        --gap: 16px
    }

    body {
        font-size: 16px
    }

    h1 {
        font-size: 30px
    }

    .stat-value {
        font-size: 26px
    }

    table, .nav-link, .btn {
        font-size: 15px
    }
}

* {
    box-sizing: border-box
}

html, body {
    margin: 0;
    padding: 0
}

body {
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none
}

    a:hover {
        text-decoration: underline
    }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

.ico {
    flex: none;
    vertical-align: -.16em
}

/* Figures are the display type here: tabular, tightened, never reflowing. */
.num, .stat-value, .rail-bottom, .bar-num, .alloc-item b, .alloc-item em, .sip-day, .mask {
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}

/* ---------------- shell ---------------- */

.app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column
}

.head {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.head-in {
    max-width: var(--page);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 0 var(--pad);
    height: 58px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--ink);
    flex: none;
}

    .brand:hover {
        text-decoration: none
    }

.brand-mark {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent));
    color: var(--on-accent);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 600;
}

.head-nav {
    display: flex;
    gap: 2px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none
}

    .head-nav::-webkit-scrollbar {
        display: none
    }

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-radius: var(--r-sm);
    font-size: 14px;
    color: var(--ink-2);
    white-space: nowrap;
}

.nav-link {
    transition: background .12s ease, color .12s ease
}

    .nav-link:hover {
        background: var(--sunk);
        color: var(--ink);
        text-decoration: none
    }

    .nav-link.on {
        background: var(--accent-soft);
        color: var(--accent);
        font-weight: 500
    }

.signout {
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    flex: none;
}

.wrap {
    flex: 1;
    width: 100%;
    max-width: var(--page);
    margin: 0 auto;
    padding: 32px var(--pad) 72px
}

.foot {
    max-width: var(--page);
    margin: 0 auto;
    width: 100%;
    padding: 18px var(--pad) 40px;
    font-size: 12px;
    color: var(--ink-3);
    border-top: 1px solid var(--line-2);
}

/* Bottom tab bar: phones only. */
.tabbar {
    display: none
}

/* ---------------- type ---------------- */

h1 {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -.025em;
    margin: 0
}

h2 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -.01em;
    margin: 38px 0 14px
}

.eyebrow {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 4px;
}

.lede {
    color: var(--ink-2);
    font-size: 14px;
    max-width: 68ch;
    margin: -6px 0 16px
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

    .page-head .back {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 14px
    }

/* ---------------- panels ---------------- */

.panel, .card, .table-wrap, .stat, .empty {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
    gap: var(--gap)
}

.stat {
    padding: 16px 18px;
    transition: box-shadow .14s ease, border-color .14s ease
}

    .stat:hover {
        box-shadow: var(--shadow-2)
    }

    .stat.lead {
        border-color: color-mix(in srgb, var(--accent) 28%, var(--line))
    }

.stat-label {
    font-size: 12px;
    color: var(--ink-3);
    font-weight: 500
}

.stat-value {
    font-size: 22px;
    font-weight: 600;
    margin: 6px 0 2px;
    letter-spacing: -.03em
}

.stat-sub {
    font-size: 12px;
    color: var(--ink-3)
}

.stat.lead .stat-value {
    color: var(--accent)
}

/* ---------------- tables ---------------- */

.table-wrap {
    overflow-x: auto
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px
}

th {
    text-align: left;
    font-weight: 500;
    font-size: 12px;
    color: var(--ink-3);
    padding: 12px 15px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: var(--surface);
}

td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--line-2);
    vertical-align: top
}

tr:last-child td {
    border-bottom: none
}

tbody tr {
    transition: background .1s ease
}

    tbody tr:hover td {
        background: color-mix(in srgb, var(--sunk) 70%, transparent)
    }

.num {
    text-align: right;
    white-space: nowrap
}

th.num {
    text-align: right
}

td.pos {
    color: var(--pos)
}

td.neg {
    color: var(--neg)
}

.dim {
    color: var(--ink-2);
    font-size: 13px
}

.sub {
    display: block;
    color: var(--ink-3);
    font-size: 12px;
    margin-top: 2px
}

.mask {
    font-size: 12px;
    color: var(--ink-3);
    margin-left: 6px
}

.row-edit {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px
}

/* ---------------- bits ---------------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    line-height: 1.5;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--ink-2);
    margin-left: 6px;
    white-space: nowrap;
}

    .chip.warn {
        border-color: transparent;
        background: var(--warn-soft);
        color: var(--warn)
    }

    .chip.bad {
        border-color: transparent;
        background: color-mix(in srgb, var(--neg) 12%, transparent);
        color: var(--neg)
    }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--accent);
    color: var(--on-accent);
    border: 1px solid transparent;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--r-sm);
    box-shadow: 0 1px 2px rgba(20, 22, 28, .12);
    transition: filter .12s ease, transform .08s ease, box-shadow .12s ease;
}

    .btn:hover {
        filter: brightness(1.08);
        text-decoration: none;
        color: var(--on-accent)
    }

    .btn:active {
        filter: brightness(.94);
        transform: translateY(1px)
    }

    .btn.ghost {
        background: var(--surface);
        color: var(--ink);
        border-color: var(--line)
    }

        .btn.ghost:hover {
            background: var(--sunk);
            filter: none;
            color: var(--ink)
        }

.link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    padding: 0;
}

    .link.danger {
        color: var(--neg)
    }

.notice {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    background: var(--warn-soft);
    border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
    border-radius: var(--r);
    padding: 13px 16px;
    margin-bottom: 22px;
    font-size: 14px;
}

    .notice > .ico {
        color: var(--warn);
        margin-top: 3px
    }

    .notice ul {
        margin: 8px 0 0;
        padding-left: 17px;
        line-height: 1.8;
        color: var(--ink-2)
    }

    .notice.plain {
        background: var(--sunk);
        border-color: var(--line)
    }

        .notice.plain > .ico {
            color: var(--ink-3)
        }

.error {
    background: color-mix(in srgb, var(--neg) 9%, transparent);
    border: 1px solid color-mix(in srgb, var(--neg) 25%, transparent);
    color: var(--neg);
    border-radius: var(--r);
    padding: 11px 14px;
    margin-bottom: 16px;
    font-size: 14px;
}

.empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--ink-2);
    font-size: 14px
}

    .empty p {
        margin: 0
    }

.btn-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 18px
}

/* ---------------- maturity ladder (signature) ---------------- */

/* The ladder goes multi-column once there is room, instead of one long strip. */
.ladder {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap)
}

@media (min-width: 1500px) {
    .ladder {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media (min-width: 2000px) {
    .ladder {
        grid-template-columns: repeat(3, 1fr)
    }
}

.rail-card {
    display: block;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 15px 17px;
    box-shadow: var(--shadow);
    transition: border-color .12s ease;
}

.rail-card {
    transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease
}

    .rail-card:hover {
        text-decoration: none;
        border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
        box-shadow: var(--shadow-2);
        transform: translateY(-1px);
    }

.rail-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    font-weight: 500
}

.rail-bank {
    color: var(--ink-3);
    font-weight: 400
}

.rail-track {
    position: relative;
    height: 3px;
    background: var(--line);
    border-radius: 3px;
    margin: 14px 0
}

.rail-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px
}

.rail-marker {
    position: absolute;
    top: -3.5px;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    background: var(--surface);
    border: 2px solid var(--accent);
    border-radius: 50%;
}

.rail-bottom {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--ink-3);
}

.rail-mid {
    color: var(--ink-2)
}

.soon {
    color: var(--warn)
}

/* ---------------- allocation ---------------- */

.alloc {
    display: flex;
    height: 10px;
    gap: 2px;
    margin-bottom: 12px
}

.alloc-seg {
    height: 100%;
    border-radius: 3px;
    min-width: 3px
}

.seg-Equity {
    background: var(--accent)
}

.seg-Deposits {
    background: #2E9C8E
}

.seg-Cash {
    background: #9AA3B2
}

.seg-Hybrid {
    background: #7E6BD6
}

.seg-Debt {
    background: #3D7DB8
}

.seg-Gold {
    background: #C08A2B
}

.alloc-key {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    font-size: 13px;
    color: var(--ink-2)
}

.alloc-item {
    display: flex;
    align-items: center;
    gap: 7px
}

    .alloc-item i {
        width: 8px;
        height: 8px;
        border-radius: 2px;
        display: inline-block
    }

    .alloc-item b {
        color: var(--ink);
        font-weight: 600
    }

    .alloc-item em {
        font-style: normal;
        color: var(--ink-3)
    }

/* ---------------- bar rows ---------------- */

.bars {
    display: flex;
    flex-direction: column;
    gap: 12px
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 2fr auto;
    gap: 16px;
    align-items: center;
    font-size: 14px
}

.bar {
    height: 6px;
    background: var(--sunk);
    border-radius: 3px;
    overflow: hidden
}

.bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px
}

    .bar-fill.over {
        background: var(--neg)
    }

.bar-num {
    font-size: 13px;
    text-align: right;
    color: var(--ink-2)
}

/* ---------------- sip calendar ---------------- */

.sips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--gap)
}

.sip {
    display: flex;
    gap: 14px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 12px 14px;
    box-shadow: var(--shadow);
}

.sip-day {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    min-width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    background: var(--accent-soft);
    display: grid;
    place-items: center;
}

.sip-name {
    font-size: 14px;
    font-weight: 500
}

.sip-amt {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 1px
}

/* ---------------- forms ---------------- */

.card {
    padding: 24px
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px
}
/* Forms stay readable rather than stretching a single row across a 4K panel. */
@media (min-width: 1500px) {
    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

.form-grid label, .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
}

input[type=text], input[type=number], input[type=date], input[type=password], select {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 9px 11px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 400;
    border-radius: var(--r-sm);
    width: 100%;
    min-height: 40px;
    transition: border-color .12s ease, box-shadow .12s ease;
}

    input:hover, select:hover {
        border-color: var(--ink-3)
    }

    input:focus, select:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: var(--ring);
    }

    input:disabled, select:disabled {
        background: var(--sunk);
        color: var(--ink-3)
    }

.form-grid label.check, .check {
    flex-direction: row;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    font-weight: 400;
    color: var(--ink);
}

    .check input {
        width: auto;
        min-height: 0;
        accent-color: var(--accent)
    }

.form-foot {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 22px;
    border-top: 1px solid var(--line-2);
    padding-top: 18px;
}

.spacer {
    flex: 1
}
/* One line under the control it belongs to. Hidden until it has something to say. */
.field-err {
    display: block;
    color: var(--neg);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    margin-top: -1px;
}

    .field-err:empty {
        display: none
    }

input.input-validation-error, select.input-validation-error {
    border-color: var(--neg);
}

    input.input-validation-error:focus, select.input-validation-error:focus {
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--neg) 16%, transparent);
    }

.val {
    color: var(--neg);
    font-size: 13px;
    font-weight: 400
}

    .val ul {
        margin: 0 0 10px;
        padding-left: 17px
    }

        .val ul.validation-summary-valid {
            display: none
        }

/* ---------------- sign in ---------------- */

/* Signed out: the card sits in the middle of the viewport, nothing else competing. */
.app-plain {
    justify-content: center
}

    .app-plain .wrap {
        display: flex;
        align-items: center;
        justify-content: center;
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .app-plain .foot {
        display: none
    }

.login {
    width: 100%;
    max-width: 380px;
    margin: 0
}

    .login .card {
        box-shadow: var(--shadow-2)
    }

    .login .brand {
        justify-content: center;
        padding: 0 0 6px;
        font-size: 17px
    }

    .login .tagline {
        text-align: center;
        color: var(--ink-3);
        font-size: 14px;
        margin: 0 0 22px
    }

    .login .field {
        margin-bottom: 15px
    }

    .login .btn {
        width: 100%;
        justify-content: center;
        padding: 11px;
        margin-top: 4px
    }

/* ---------------- mobile ---------------- */

@media (max-width: 900px) {
    :root {
        --page: 100%;
        --pad: 16px;
        --gap: 8px
    }

    .head-in {
        padding: 0 var(--pad);
        height: 52px;
        gap: 12px
    }

    .head-nav {
        display: none
    }

    .signout span {
        display: none
    }

    .signout {
        padding: 8px
    }

    .tabbar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        background: color-mix(in srgb, var(--surface) 94%, transparent);
        backdrop-filter: blur(12px);
        border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 9px 2px 8px;
        font-size: 12px;
        color: var(--ink-3);
        min-height: 56px;
        justify-content: center;
    }

        .tab:hover {
            text-decoration: none
        }

        .tab.on {
            color: var(--accent);
            font-weight: 500
        }

            .tab.on .ico {
                stroke-width: 2.1
            }

    .wrap {
        padding: 22px 16px 40px
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px
    }

    .stat {
        padding: 13px 14px
    }

    .stat-value {
        font-size: 19px
    }

    .stat.lead {
        grid-column: 1 / -1
    }

    .foot {
        padding: 16px 16px 96px
    }

    h1 {
        font-size: 22px
    }

    /* Tables become records: each row a card, each cell a labelled line. */
    .table-wrap {
        border: none;
        background: none;
        box-shadow: none;
        overflow: visible
    }

    table, tbody, tr, td {
        display: block;
        width: 100%
    }

    thead {
        display: none
    }

    tbody tr {
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--r);
        box-shadow: var(--shadow);
        padding: 4px 14px;
        margin-bottom: 10px;
    }

        tbody tr:hover td {
            background: none
        }

    td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 16px;
        padding: 8px 0;
        border-bottom: 1px solid var(--line-2);
        text-align: right;
    }

        td:last-child {
            border-bottom: none
        }

        td::before {
            content: attr(data-label);
            font-size: 12px;
            color: var(--ink-3);
            font-weight: 500;
            text-align: left;
            flex: none;
        }

        td.lead {
            display: block;
            text-align: left;
            font-weight: 500;
            padding-top: 12px;
        }

            td.lead::before {
                content: none
            }

    .bar-row {
        grid-template-columns: 1fr;
        gap: 6px
    }

    .bar-num {
        text-align: left
    }

    .page-head {
        align-items: flex-start
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important
    }
}
