:root {
    --purple: #6D34E3;
    --purple-deep: #4F1BC5;
    --purple-dark: #34088F;
    --coral: #FF5A6A;
    --coral-deep: #E23B55;
    --teal: #14B8A6;
    --orange: #F5A524;
    --lavender: #8B6CF6;
    --ink: #1C1433;
    --muted: #6B6280;
    --bg: #F3F0F8;
    --card: #ffffff;
    --line: rgba(80, 40, 140, 0.1);
    --shadow: 0 1px 2px rgba(28, 20, 51, 0.04), 0 14px 36px rgba(77, 36, 160, 0.07);
    --radius: 22px;
    --display: "Outfit", "Plus Jakarta Sans", sans-serif;
    --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(900px 420px at 110% -8%, rgba(109, 52, 227, 0.14), transparent 58%),
        radial-gradient(640px 360px at -12% 8%, rgba(255, 90, 106, 0.1), transparent 55%),
        var(--bg);
}
a { color: var(--purple-deep); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3 {
    font-family: var(--display);
    letter-spacing: -0.03em;
    margin: 0 0 .4rem;
}
h3 { font-size: 1.05rem; font-weight: 650; }
strong, b, .stats strong, .big { font-variant-numeric: tabular-nums; }

html, body { width: 100%; }
.shell { display: flex; width: 100%; min-height: 100vh; }
.sidebar {
    width: 268px;
    background: linear-gradient(185deg, #4B1AD0 0%, #34088F 72%);
    color: #fff;
    padding: 22px 16px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand img {
    width: 168px;
    border-radius: 20px;
    display: block;
    margin: 0 auto 18px;
    background: #fff;
    padding: 8px;
    box-shadow: 0 12px 28px rgba(16, 0, 48, 0.28);
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; padding-right: 2px; }
.nav-link, .nav-link.as-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.82);
    background: transparent;
    border: 0;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-weight: 550;
}
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.nav-link.active, .nav-link:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}
.nav-link.active { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.side-foot { margin-top: auto; padding-top: 12px; }
.side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 4px 4px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.1);
}
.side-user strong, .side-user small { display: block; }
.side-user small { color: rgba(255, 255, 255, 0.7); font-size: .78rem; }
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(160deg, var(--coral), #FF8A5B);
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    flex: none;
}
.main { flex: 1 1 auto; min-width: 0; width: 100%; }
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 28px 8px;
    position: sticky;
    top: 0;
    background: rgba(243, 240, 248, 0.82);
    backdrop-filter: blur(16px);
    z-index: 2;
}
.topbar h1 { font-size: 1.45rem; flex: 1; font-weight: 650; }
.who { color: var(--ink); font-size: .92rem; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.content { width: 100%; max-width: none; padding: 8px 28px 48px; }
.icon-btn {
    width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line);
    background: #fff; display: none; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: var(--shadow);
}
.icon-btn svg { width: 20px; height: 20px; }
#close-more { display: inline-flex; box-shadow: none; }

.hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(420px 180px at 92% 0%, rgba(255, 90, 106, 0.55), transparent 60%),
        radial-gradient(360px 200px at 0% 100%, rgba(20, 184, 166, 0.4), transparent 62%),
        linear-gradient(135deg, #34088F 0%, #4F1BC5 46%, #6D34E3 100%);
    color: white;
    border-radius: 28px;
    padding: 28px;
    margin-bottom: 16px;
    box-shadow: 0 18px 40px rgba(52, 8, 143, 0.22);
}
.hero::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    right: -70px;
    top: -80px;
    border-radius: 48%;
    background: rgba(255, 255, 255, 0.08);
}
.hero > * { position: relative; z-index: 1; }
.hero h2 { font-size: clamp(1.7rem, 2.4vw, 2.15rem); line-height: 1.12; font-weight: 650; max-width: 22ch; }
.eyebrow { opacity: .82; margin: 0 0 6px; font-weight: 600; letter-spacing: .02em; font-size: .92rem; }
.stats, .stats.slim { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.hero .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stats div, .worth, .card, .advice {
    background: rgba(255, 255, 255, .14);
    border-radius: 18px;
    padding: 14px;
}
.hero .stats div {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(10px);
}
.stats span, .muted { color: var(--muted); font-size: .84rem; }
.hero .stats span { color: rgba(255, 255, 255, .78); }
.stats strong { display: block; font-size: 1.2rem; margin-top: 4px; letter-spacing: -0.03em; }
.stats.slim { margin: 0 0 16px; }
.stats.slim div { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.slim-hero { margin-bottom: 16px; }

.worth, .card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}
.worth {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    background:
        linear-gradient(#fff, #fff) padding-box,
        linear-gradient(120deg, var(--purple), var(--coral) 55%, var(--teal)) border-box;
    border: 1px solid transparent;
}
.big { font-family: var(--display); font-size: 2.15rem; display: block; letter-spacing: -0.04em; line-height: 1.1; }
.highlight { background: #F7F3FF; }
.highlight span { color: var(--muted); }
.highlight strong { display: block; font-size: 1.8rem; color: var(--purple-deep); }
.notice { background: linear-gradient(180deg, #F4FFFC, #fff); border-color: rgba(20, 184, 166, 0.28); }
.fold { padding: 0; }
.fold > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    font-family: var(--display);
    font-size: 1.05rem;
    font-weight: 650;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
    content: "";
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-right: 2px solid var(--purple);
    border-bottom: 2px solid var(--purple);
    transform: rotate(45deg);
    margin-bottom: 4px;
}
.fold[open] > summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
.fold-body { padding: 0 20px 18px; }
.fold.bare { background: transparent; border: 0; box-shadow: none; margin-bottom: 14px; }
.fold.bare > summary { padding: 8px 4px; }
.debt-fold { border-top: 1px solid var(--line); }
.debt-fold:first-of-type { border-top: 0; }
.debt-fold > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}
.debt-fold > summary::-webkit-details-marker { display: none; }
.debt-fold > summary .row-card { flex: 1; }
.debt-fold > summary::after {
    content: "";
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-right: 2px solid var(--purple);
    border-bottom: 2px solid var(--purple);
    transform: rotate(45deg);
    margin-bottom: 4px;
}
.debt-fold[open] > summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
.pay-block { margin: 4px 0 10px; }
.pay-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
}
.pay-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pay-line > .inline-form { margin: 0; }
.pay-panel { display: none; margin-top: 8px; }
.pay-toggle:checked ~ .pay-panel { display: block; }
.pay-toggle:focus-visible + .pay-line > .btn { box-shadow: 0 0 0 4px rgba(109, 52, 227, 0.16); }
.pay-item {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}
.pay-item div { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.pay-item span { color: var(--muted); font-size: .84rem; }
.pay-item .inline-form { margin: 0; }
.fold-body > .muted:first-child { margin-top: 0; }
.notice.legal { background: linear-gradient(180deg, #FFF7F6, #fff); border-color: rgba(255, 90, 106, 0.28); }

.tile-grid, .sheet-grid, .goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.tile {
    border-radius: 22px;
    min-height: 132px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: transform .16s ease, box-shadow .16s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 18px 36px rgba(77, 36, 160, 0.12); }
.tile svg {
    width: 40px;
    height: 40px;
    padding: 9px;
    border-radius: 14px;
    background: var(--purple);
    color: #fff;
}
.tile span { font-family: var(--display); font-weight: 650; letter-spacing: -0.02em; }
.tile small { color: var(--muted); line-height: 1.35; }
.tile-coral svg { background: var(--coral); }
.tile-teal svg { background: var(--teal); }
.tile-orange svg { background: var(--orange); color: #3b2500; }
.tile-lavender svg { background: var(--lavender); }
.tile-purple svg { background: var(--purple); }
.link-card { display: block; color: inherit; }
.section-title { margin: 10px 0 12px; font-size: 1.15rem; }

.row-card {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 4px;
    border-top: 1px solid var(--line);
}
.row-card:first-of-type { border-top: 0; }
.row-card div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-card span { color: var(--muted); font-size: .84rem; }
.row-card.flat { border: 0; padding-bottom: 4px; }
.stack-row { flex-wrap: wrap; }
.in { color: #0C9A78; }
.out { color: var(--coral-deep); }
.pill {
    display: inline-flex;
    align-items: center;
    background: #F1EAFF;
    color: var(--purple-deep);
    border-radius: 999px;
    padding: 3px 9px;
    font-size: .75rem;
    font-weight: 650;
    width: fit-content;
}
.pill-approved, .pill-settled { background: #E5FBF4; color: #0C8A6A; }
.pill-pending, .pill-queried, .pill-awaiting { background: #FFF4DE; color: #9A6200; }
.pill-rejected { background: #FFE8EA; color: var(--coral-deep); }

.bar { height: 8px; background: #EFEAF8; border-radius: 99px; overflow: hidden; margin: 4px 0; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #5EEAD4); border-radius: inherit; }
.bar.warn span { background: linear-gradient(90deg, #F5A524, #FFD36A); }
.bar.over span { background: linear-gradient(90deg, var(--coral-deep), #FF8A96); }
.bad { color: var(--coral-deep); }
.warn { color: #9A6200; }
.budget { margin-bottom: 14px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: .92rem; }
.field span { font-weight: 650; font-size: .82rem; color: #3d3358; }
.field small { color: var(--coral-deep); }
input, select, textarea {
    width: 100%;
    border: 1px solid transparent;
    background: #F6F4FB;
    border-radius: 14px;
    padding: 12px 14px;
    transition: background .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(109, 52, 227, 0.16);
}
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0 14px; color: var(--muted); }
.check input { width: auto; accent-color: var(--purple); }
.btn {
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .12s ease, filter .12s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn-primary {
    background: linear-gradient(180deg, #FF6D7C, var(--coral-deep));
    color: white;
    box-shadow: 0 10px 20px rgba(226, 59, 85, 0.28);
}
.btn-teal { background: linear-gradient(180deg, #2DD4BF, #0F9F90); color: white; box-shadow: 0 10px 20px rgba(20, 184, 166, 0.25); }
.btn-orange { background: linear-gradient(180deg, #FFC14D, var(--orange)); color: #3b2500; }
.btn-ghost { background: #F3EDFF; color: var(--purple-deep); }
.btn-small { padding: 8px 12px; border-radius: 12px; box-shadow: none; }
.btn-block { width: 100%; }
.btn-row, .inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select, .stack-form input, .stack-form select { width: auto; min-width: 120px; }
.stack-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.split-page { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.month-switch {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 10px 12px;
    box-shadow: var(--shadow);
    width: fit-content;
    max-width: 100%;
}
.flash { background: #E9FBF3; border: 1px solid #B7EBD2; padding: 12px 14px; border-radius: 16px; margin-bottom: 12px; }
.flash-bad { background: #FFF0F1; border-color: #FFC9CE; }
.plain { padding-left: 18px; color: var(--muted); }
.card-list { display: grid; gap: 10px; margin-bottom: 14px; }
.advice { margin: 0; }
.trend { display: flex; align-items: flex-end; gap: 6px; height: 72px; }
.trend i {
    display: block;
    width: 12px;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, var(--lavender), var(--purple-deep));
}
.tree { list-style: none; margin: 0; padding-left: 16px; border-left: 2px solid #E4DBF7; }
.tree .person { padding: 6px 0; }
.draft { white-space: pre-wrap; font-family: inherit; line-height: 1.55; }
.goal strong { display: block; font-size: 1.4rem; }
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.project-grid .goal {
    min-width: 0;
    overflow: hidden;
}
.project-grid .goal h3,
.project-grid .goal p,
.project-grid .goal .muted,
.project-figure {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.project-figure {
    display: block;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.tabbar { display: none; }
.sheet {
    position: fixed;
    inset: 0;
    background: rgba(22, 8, 48, 0.46);
    backdrop-filter: blur(4px);
    z-index: 20;
    display: flex;
    align-items: flex-end;
}
.sheet[hidden] { display: none; }
.sheet-card {
    background: #F7F5FB;
    width: 100%;
    border-radius: 28px 28px 0 0;
    padding: 12px 16px 28px;
    max-height: 82vh;
    overflow: auto;
}
.sheet-card::before {
    content: "";
    display: block;
    width: 44px;
    height: 5px;
    border-radius: 99px;
    background: #DDD4EE;
    margin: 2px auto 12px;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 255, 255, .16), transparent 26%),
        radial-gradient(circle at 88% 12%, rgba(255, 90, 106, .55), transparent 22%),
        radial-gradient(circle at 78% 86%, rgba(20, 184, 166, .45), transparent 24%),
        linear-gradient(165deg, var(--purple-dark), var(--purple-deep) 48%, #6D34E3);
}
.login-card {
    width: min(440px, 100%);
    background: white;
    border-radius: 28px;
    padding: 28px 24px;
    box-shadow: 0 24px 60px rgba(20, 0, 60, .28);
}
.login-logo { width: 148px; display: block; border-radius: 22px; background: #fff; padding: 6px; }
.login-card h1, .auth-panel h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.05; }
.login-card h2 { font-size: 1.8rem; }
.lede, .login-card .eyebrow { color: var(--muted); }
.login-card .eyebrow { opacity: 1; }
.demo-label { margin-top: 18px; color: var(--muted); font-size: .9rem; }
.demo-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    border: 1px solid var(--line);
    background: #F7F4FF;
    border-radius: 999px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
}
.chip:hover { background: #EFE7FF; }

.auth-screen {
    display: block;
    padding: 0;
    background: var(--bg);
}
.auth-stage { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.auth-panel {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 12px;
    background:
        radial-gradient(420px 220px at 80% 12%, rgba(255, 90, 106, .55), transparent 60%),
        radial-gradient(380px 240px at 10% 90%, rgba(20, 184, 166, .4), transparent 62%),
        linear-gradient(160deg, #2A0678 0%, #4F1BC5 55%, #6D34E3 100%);
}
.auth-panel::after {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    right: -80px;
    bottom: -90px;
    border-radius: 46%;
    background: rgba(255, 255, 255, 0.08);
}
.auth-panel > * { position: relative; z-index: 1; }
.auth-panel p { max-width: 34ch; margin: 0; font-size: 1.05rem; color: rgba(255, 255, 255, 0.86); }
.auth-panel .login-logo { margin-bottom: auto; }
.auth-screen .login-card {
    margin: auto;
    width: min(440px, calc(100% - 48px));
    box-shadow: var(--shadow);
}

.child-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
}
.child-bar img { width: 64px; border-radius: 16px; background: #fff; }
.child-bar strong { flex: 1; font-family: var(--display); }
.child-content { width: 100%; max-width: none; padding: 16px 28px 48px; margin: 0; }
.child-hero h2 { font-size: clamp(2.2rem, 6vw, 3rem); max-width: none; }

@media (max-width: 900px) {
    .sidebar { display: none; }
    .icon-btn { display: inline-flex; }
    .split-page, .form-grid, .stats, .stats.slim { grid-template-columns: 1fr 1fr; }
    .content { padding: 8px 16px 112px; }
    .topbar { padding: 14px 16px 6px; }
    .tabbar {
        display: flex;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(16px);
        border: 1px solid rgba(255, 255, 255, 0.7);
        border-radius: 22px;
        justify-content: space-around;
        padding: 8px 6px;
        z-index: 5;
        box-shadow: 0 14px 40px rgba(52, 8, 143, 0.16);
    }
    .tabbar a, .tabbar button {
        background: none;
        border: 0;
        color: var(--muted);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        font-size: .7rem;
        font-weight: 650;
        text-decoration: none;
        cursor: pointer;
        min-width: 56px;
        padding: 4px 0;
        border-radius: 14px;
    }
    .tabbar svg { width: 22px; height: 22px; }
    .tabbar .active { color: var(--purple); background: #F3EDFF; }
    .who { display: none; }
    .auth-stage { grid-template-columns: 1fr; }
    .auth-panel { min-height: 240px; padding: 24px; }
    .auth-panel .login-logo { width: 112px; }
    .auth-screen .login-card { margin: 16px auto 28px; }
}
@media (max-width: 640px) {
    .split-page, .form-grid, .stats, .stats.slim { grid-template-columns: 1fr; }
    .inline-form input, .inline-form select { width: 100%; }
    .pay-line .inline-form input { width: auto; min-width: 0; flex: 1 1 96px; }
    .month-switch { width: 100%; }
    .worth { align-items: flex-start; flex-direction: column; }
}
