:root {
    --bg: #f8faf9;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --emerald: #059669;
    --emerald-dark: #047857;
    --emerald-light: #d1fae5;
    --emerald-soft: #ecfdf5;
    --danger: #dc2626;
    --radius: 14px;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --font: "DM Sans", system-ui, sans-serif;
    --display: "Outfit", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--emerald-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
    width: min(960px, 100%);
    margin: 0 auto;
    padding: 1rem 1.25rem 3rem;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: var(--emerald);
    color: #fff;
    font-size: .95rem;
}

.topnav {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    font-size: .92rem;
}

.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--emerald-dark); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .65rem 1.15rem;
    border: none;
    border-radius: 999px;
    background: var(--emerald);
    color: #fff !important;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    transition: background .15s, transform .1s;
}

.btn:hover { background: var(--emerald-dark); }
.btn:active { transform: scale(.98); }
.btn-sm { padding: .45rem .85rem; font-size: .88rem; }
.btn-lg { padding: .85rem 1.5rem; font-size: 1.02rem; }
.btn-ghost {
    background: transparent;
    color: var(--emerald-dark) !important;
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--emerald-soft); }
.btn.disabled, .btn:disabled { opacity: .55; pointer-events: none; }

.linkish {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--muted);
    cursor: pointer;
    text-decoration: underline;
}
.linkish.danger { color: var(--danger); }

.inline { display: inline; }

.flash {
    padding: .85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .92rem;
}
.flash.ok { background: var(--emerald-light); color: var(--emerald-dark); }
.flash.err { background: #fee2e2; color: var(--danger); }
.flash ul { margin: 0; padding-left: 1.2rem; }

.muted { color: var(--muted); }
.tiny { font-size: .82rem; }
.center { text-align: center; }
.positive { color: var(--emerald-dark); }
.negative { color: var(--danger); }

/* Landing */
.page-landing { background: linear-gradient(180deg, #ecfdf5 0%, var(--bg) 35%); }

.hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.eyebrow {
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--emerald-dark);
    margin: 0 0 .75rem;
}

.hero h1 {
    font-family: var(--display);
    font-size: clamp(2rem, 6vw, 3.2rem);
    line-height: 1.1;
    margin: 0 0 1rem;
    font-weight: 800;
}

.hero h1 em {
    font-style: normal;
    color: var(--emerald);
}

.lede {
    font-size: 1.08rem;
    color: var(--muted);
    max-width: 34rem;
    margin: 0 auto 1.5rem;
}

.cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.hero-mockup { display: flex; justify-content: center; }

.mock-card {
    background: var(--surface);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
    min-width: 260px;
}

.mock-label { font-size: .85rem; color: var(--muted); }
.mock-amount { display: block; font-family: var(--display); font-size: 2.4rem; color: var(--emerald); margin: .25rem 0; }
.mock-sub { color: var(--muted); font-size: .9rem; }
.mock-bar {
    height: 8px;
    background: var(--border);
    border-radius: 99px;
    margin: 1rem 0 .5rem;
    overflow: hidden;
}
.mock-bar span { display: block; height: 100%; background: var(--emerald); border-radius: 99px; }

.section {
    padding: 2.5rem 0;
    border-top: 1px solid var(--border);
}

.section h2 {
    font-family: var(--display);
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin: 0 0 1.25rem;
    line-height: 1.2;
}

.section-grid {
    display: grid;
    gap: 2rem;
}

@media (min-width: 720px) {
    .section-grid { grid-template-columns: 1.2fr 1fr; align-items: start; }
}

blockquote {
    margin: 1rem 0 0;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--emerald);
    background: var(--emerald-soft);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-weight: 500;
}

.problem-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: .75rem;
}

.problem-list li {
    background: var(--surface);
    padding: 1rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.steps-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.step-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.step-num {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--emerald-light);
    color: var(--emerald-dark);
    font-weight: 700;
    font-size: .85rem;
    margin-bottom: .5rem;
}

.step-card h3 { margin: 0 0 .35rem; font-size: 1rem; }
.step-card p { margin: 0; font-size: .88rem; color: var(--muted); }

.how-list {
    padding-left: 1.25rem;
    display: grid;
    gap: .65rem;
}

.dashboard-preview {
    display: grid;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

@media (min-width: 640px) {
    .dashboard-preview { grid-template-columns: 180px 1fr; }
}

.preview-sidebar { display: grid; gap: .75rem; }
.preview-stat {
    background: var(--bg);
    padding: .75rem;
    border-radius: var(--radius);
    font-size: .82rem;
}
.preview-stat strong { display: block; font-size: 1.1rem; margin-top: .15rem; }

.preview-days, .days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .35rem;
}

.day-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: .78rem;
    line-height: 1.1;
}

.day-cell.today {
    background: var(--emerald);
    color: #fff;
    border-color: var(--emerald);
    font-weight: 700;
}

.day-cell.past.ok { background: var(--emerald-soft); border-color: var(--emerald-light); }
.day-cell.past.bad { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.day-cell.future { opacity: .55; }
.day-num { font-weight: 600; }

.plan-table-wrap { overflow-x: auto; }
.plan-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.plan-table th, .plan-table td {
    padding: .85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.plan-table th { background: var(--emerald-soft); font-weight: 600; }
.plan-table tr:last-child td { border-bottom: none; }

.badge-soon {
    display: inline-block;
    font-size: .72rem;
    padding: .15rem .45rem;
    border-radius: 99px;
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

.faq-list { display: grid; gap: .65rem; }
.faq-list details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .85rem 1rem;
}
.faq-list summary { cursor: pointer; font-weight: 600; }
.faq-list p { margin: .65rem 0 0; color: var(--muted); font-size: .92rem; }

.cta-bottom { text-align: center; padding-bottom: 3rem; }

/* App pages */
.page-app .wrap { max-width: 720px; }

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

.page-head h1 {
    font-family: var(--display);
    font-size: 1.65rem;
    margin: 0;
}

.today-card {
    background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
    color: #fff;
    border-radius: 20px;
    padding: 1.5rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.today-label { margin: 0; opacity: .85; font-size: .88rem; }
.today-amount {
    font-family: var(--display);
    font-size: clamp(2.2rem, 8vw, 3rem);
    font-weight: 800;
    margin: .25rem 0;
    line-height: 1;
}
.today-amount.negative { color: #fecaca; }
.today-sub { margin: 0 0 1rem; opacity: .9; }

.progress-bar {
    height: 10px;
    background: rgba(255,255,255,.25);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: .5rem;
}
.progress-bar span {
    display: block;
    height: 100%;
    background: #fff;
    border-radius: 99px;
    transition: width .3s;
}
.progress-bar span.over { background: #fecaca; }
.today-meta { margin: 0; font-size: .85rem; opacity: .85; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .65rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .85rem;
    font-size: .82rem;
}
.stat-card strong { display: block; font-size: 1.05rem; margin-top: .2rem; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
    margin-bottom: 1rem;
}

.panel h2 {
    font-family: var(--display);
    font-size: 1.1rem;
    margin: 0 0 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: .85rem;
}

.field span { font-size: .88rem; font-weight: 500; }

.field input, .field select, .field textarea {
    padding: .65rem .85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fff;
    width: 100%;
}

.field input:focus, .field select:focus {
    outline: 2px solid var(--emerald-light);
    border-color: var(--emerald);
}

.form-row {
    display: grid;
    gap: .75rem;
}

@media (min-width: 520px) {
    .form-row { grid-template-columns: 1fr 1fr; }
}

.stack-form { max-width: 100%; }
.bordered-top { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

.fixed-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: grid;
    gap: .5rem;
}

.fixed-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem .75rem;
    background: var(--bg);
    border-radius: 10px;
    font-size: .92rem;
}

.fixed-actions { display: flex; align-items: center; gap: .5rem; }

.expense-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: .65rem;
}

.expense-main {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    font-size: .95rem;
}

.expense-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    font-size: .82rem;
    color: var(--muted);
    margin-top: .2rem;
}

.auth-card, .onboarding-wrap {
    max-width: 440px;
    margin: 2rem auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.75rem 1.5rem;
    box-shadow: var(--shadow);
}

.auth-card h1, .onboarding-wrap h1 {
    font-family: var(--display);
    margin: 0 0 .5rem;
    font-size: 1.65rem;
}

.radio-grid {
    display: grid;
    gap: .5rem;
    margin-bottom: 1rem;
}

.radio-card {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

.radio-card:has(input:checked) {
    border-color: var(--emerald);
    background: var(--emerald-soft);
}

.radio-card input { accent-color: var(--emerald); }

fieldset {
    border: none;
    padding: 0;
    margin: 0 0 1.25rem;
}

legend {
    font-weight: 600;
    margin-bottom: .65rem;
    font-size: .95rem;
}

.fixed-row input {
    padding: .65rem .85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    width: 100%;
}

#add-fixed {
    margin-top: .75rem;
}

.plan-cards {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.plan-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.plan-card.active { border-color: var(--emerald); box-shadow: 0 0 0 2px var(--emerald-light); }
.plan-card h2 { margin: 0 0 .35rem; font-family: var(--display); }
.plan-price { font-size: 1.35rem; font-weight: 700; color: var(--emerald-dark); margin: 0 0 1rem; }
.plan-card ul { padding-left: 1.1rem; margin: 0 0 1rem; font-size: .92rem; }
.plan-card li { margin-bottom: .35rem; }

.check { display: flex; align-items: center; gap: .5rem; font-size: .9rem; margin-bottom: 1rem; }
.check input { accent-color: var(--emerald); }

@media (max-width: 520px) {
    .topnav a:not(.btn) { display: none; }
    .topnav .btn { margin-left: auto; }
}
