:root {
    --green: #16a34a;
    --orange: #f59e0b;
    --red: #dc2626;
    --brand: #0F6E5E;
    --brand-light: #E7F5F1;
    --ink: #1f2937;
    --muted: #6b7280;
    --bg: #f6f8f7;
    --card: #ffffff;
    --border: #e5e7eb;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    padding-bottom: 72px;
}
a { color: var(--brand); text-decoration: none; }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--brand); color: #fff; padding: 10px 16px;
    position: sticky; top: 0; z-index: 10;
}
.topbar .brand { color: #fff; font-weight: 700; font-size: 14px; line-height: 1.1; }
.topbar .brand span { font-weight: 400; font-size: 12px; opacity: .85; }
.topbar .logout { color: #fff; opacity: .85; font-size: 13px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px; }

.card {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    padding: 18px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.pulse-score {
    text-align: center; padding: 24px 18px;
}
.pulse-score .num { font-size: 48px; font-weight: 800; }
.pulse-score .band-healthy { color: var(--green); }
.pulse-score .band-watch { color: var(--orange); }
.pulse-score .band-action { color: var(--red); }
.pulse-score .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.pulse-summary { text-align: center; color: var(--ink); margin-top: 6px; font-size: 15px; }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.kpi .kpi-label { font-size: 12px; color: var(--muted); }
.kpi .kpi-value { font-size: 19px; font-weight: 700; margin-top: 2px; }

.section-title { font-size: 14px; font-weight: 700; margin: 22px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; font-size: 14px; }
.alert-red { background: #fef2f2; border: 1px solid #fecaca; }
.alert-orange { background: #fffbeb; border: 1px solid #fde68a; }
.alert-green { background: #f0fdf4; border: 1px solid #bbf7d0; }
.alert-title { font-weight: 700; margin-bottom: 2px; }

.scenario-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.scenario { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 6px; }
.scenario .s-label { font-size: 11px; color: var(--muted); }
.scenario .s-value { font-size: 15px; font-weight: 700; margin-top: 4px; }

.timeline { display: flex; overflow-x: auto; gap: 10px; padding: 4px 0; }
.timeline .point { flex: 0 0 auto; background: var(--brand-light); border-radius: 10px; padding: 10px 14px; text-align: center; min-width: 84px; }
.timeline .point .t-label { font-size: 11px; color: var(--muted); }
.timeline .point .t-value { font-weight: 700; font-size: 14px; margin-top: 2px; }

.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-tap {
    display: block; text-align: center; padding: 18px 10px; border-radius: 14px;
    font-weight: 600; font-size: 15px; border: 1px solid var(--border);
}
.btn-tap.in { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.btn-tap.out { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border);
    display: flex; justify-content: space-around; padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted); gap: 2px; }
.tabbar a span { font-size: 10px; }

form.entry-form label { display: block; font-size: 13px; color: var(--muted); margin-top: 12px; margin-bottom: 4px; }
form.entry-form input, form.entry-form select, form.entry-form textarea {
    width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 16px;
}
.big-amount input { font-size: 28px; font-weight: 700; text-align: center; padding: 18px; }
.btn-primary {
    display: block; width: 100%; text-align: center; background: var(--brand); color: #fff;
    padding: 14px; border-radius: 12px; font-weight: 700; font-size: 16px; border: none; margin-top: 18px;
}

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.flash-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.flash-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

.reckoning-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.reckoning-total { display: flex; justify-content: space-between; padding: 10px 0; font-weight: 700; font-size: 16px; }

table.txn-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.txn-table th, table.txn-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.pill-income { background: #f0fdf4; color: #15803d; }
.pill-expense { background: #fef2f2; color: #b91c1c; }

.auth-card { max-width: 400px; margin: 40px auto; }
