/* Steady — calm, ADHD-friendly design. No red anywhere. */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --text: #2b2d2f;
  --muted: #6b6f73;
  --border: #e6e1d8;
  --primary: #3f7f6d;
  --primary-ink: #ffffff;
  --primary-soft: #e3efea;
  --amber: #a86d23;
  --amber-soft: #f6ead8;
  --sky-soft: #e4edf5;
  --shadow: 0 1px 2px rgba(40, 40, 30, 0.05), 0 4px 16px rgba(40, 40, 30, 0.05);
  --radius: 18px;
  --radius-sm: 12px;
  --font-scale: 1;
  --nav-h: 68px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #14181c; --surface: #1d2328; --surface-2: #192025; --text: #eceff1; --muted: #9aa4ab;
    --border: #2c343a; --primary: #7cc0aa; --primary-ink: #0f1d18; --primary-soft: #21332d;
    --amber: #e3b26f; --amber-soft: #382e20; --sky-soft: #1f2b36; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #14181c; --surface: #1d2328; --surface-2: #192025; --text: #eceff1; --muted: #9aa4ab;
  --border: #2c343a; --primary: #7cc0aa; --primary-ink: #0f1d18; --primary-soft: #21332d;
  --amber: #e3b26f; --amber-soft: #382e20; --sky-soft: #1f2b36; --shadow: none; color-scheme: dark;
}
:root[data-text='large'] { --font-scale: 1.15; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: calc(16px * var(--font-scale)); line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
:root[data-motion='reduce'] * { animation: none !important; transition: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, select, textarea {
  width: 100%; padding: 14px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; padding: 0 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) 2px 6px; }
.top h1 { font-size: 1.15rem; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.top .date { color: var(--muted); font-size: 0.9rem; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.icon-btn:active { background: var(--primary-soft); }
.icon-btn.on { color: var(--primary); background: var(--primary-soft); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- banners ---------- */
.banner { background: var(--sky-soft); border-radius: var(--radius-sm); padding: 10px 14px; margin: 8px 0; display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 0.92rem; }
.banner button { color: var(--primary); font-weight: 650; white-space: nowrap; }

/* ---------- hero number ---------- */
.hero { text-align: center; padding: 26px 16px 22px; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); margin: 10px 0 14px; }
.hero .label { color: var(--muted); font-size: 0.95rem; margin: 0; font-weight: 550; }
.hero .big { font-size: calc(64px * var(--font-scale)); font-weight: 750; letter-spacing: -0.03em; margin: 4px 0 2px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hero .sub { color: var(--muted); margin: 6px 0 0; font-size: 0.95rem; }
.hero .note { margin: 12px auto 0; max-width: 34ch; font-size: 0.95rem; background: var(--amber-soft); border-radius: var(--radius-sm); padding: 10px 12px; }
.hero.over .big, .hero.short .big { color: var(--amber); }
.link { color: var(--primary); font-weight: 650; padding: 10px 8px; margin-top: 6px; display: inline-block; }

/* ---------- main log button ---------- */
.log-btn { width: 100%; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 1.1rem; border-radius: var(--radius); padding: 18px; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: var(--shadow); }
.log-btn:active { transform: scale(0.99); }
.log-btn svg { width: 22px; height: 22px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; margin: 14px 0; box-shadow: var(--shadow); }
.card h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; font-weight: 650; }
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 4px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

.step { border: 2px solid var(--primary-soft); }
.step .step-text { font-size: 1.08rem; font-weight: 600; margin: 2px 0 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.btn { border-radius: 999px; padding: 11px 18px; font-weight: 650; background: var(--primary-soft); color: var(--primary); min-height: 44px; }
.btn.solid { background: var(--primary); color: var(--primary-ink); }
.btn.quiet { background: transparent; color: var(--muted); }
.btn.block { width: 100%; padding: 15px; font-size: 1.02rem; }
.btn:disabled { opacity: 0.45; }

.progress { height: 10px; background: var(--primary-soft); border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .main { min-width: 0; flex: 1; }
.list .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { color: var(--muted); font-size: 0.85rem; }
.list .amt { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.list button.item { display: flex; width: 100%; text-align: left; align-items: center; gap: 10px; }
.emoji { width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 1.15rem; flex: none; border: 1px solid var(--border); }
.pill { display: inline-block; font-size: 0.78rem; padding: 3px 9px; border-radius: 99px; background: var(--amber-soft); color: var(--amber); font-weight: 650; }
.pill.calm { background: var(--primary-soft); color: var(--primary); }
.day-head { font-size: 0.85rem; color: var(--muted); margin: 18px 4px 4px; font-weight: 650; }
.empty { text-align: center; padding: 26px 12px; color: var(--muted); }
.empty .big-emoji { font-size: 2.2rem; display: block; margin-bottom: 6px; }

/* ---------- bottom nav ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.nav .inner { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.nav button svg { width: 24px; height: 24px; }
.nav button.active { color: var(--primary); }

/* ---------- bottom sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 20, 20, 0.38); z-index: 40; animation: fade 0.18s ease; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 520px; margin: 0 auto; background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; animation: up 0.22s ease; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--border); margin: 0 auto 10px; }
.sheet h2 { margin: 4px 0 4px; font-size: 1.25rem; }
.sheet .lead { color: var(--muted); margin: 0 0 14px; }
.field { margin: 12px 0; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.95rem; }
.field .hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
@keyframes up { from { transform: translateY(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--border); background: var(--surface); border-radius: 99px; padding: 9px 14px; font-weight: 600; min-height: 42px; }
.chip.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.chip.fav { background: var(--surface-2); }

/* keypad */
.amount-display { text-align: center; font-size: calc(46px * var(--font-scale)); font-weight: 750; font-variant-numeric: tabular-nums; margin: 4px 0 10px; letter-spacing: -0.02em; min-height: 58px; }
.amount-display.placeholder { color: var(--border); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.keypad button { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; height: 56px; font-size: 1.4rem; font-weight: 600; }
.keypad button:active { background: var(--primary-soft); }

/* math explainer */
.math { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
.math td { padding: 10px 2px; border-bottom: 1px solid var(--border); }
.math td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.math tr.total td { border-bottom: 0; font-weight: 750; font-size: 1.05rem; }

/* toast */
.toast { position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; max-width: 488px; justify-content: space-between; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 14px; z-index: 60; display: flex; gap: 14px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.18); animation: up 0.2s ease; }
.toast button { color: var(--primary-soft); font-weight: 700; }

/* onboarding */
.onboard { position: fixed; inset: 0; background: var(--bg); z-index: 50; overflow-y: auto; }
.onboard .wrap { max-width: 480px; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 22px 32px; min-height: 100%; display: flex; flex-direction: column; }
.onboard .dots { display: flex; gap: 6px; margin-bottom: 26px; }
.onboard .dots span { height: 6px; flex: 1; border-radius: 9px; background: var(--border); }
.onboard .dots span.on { background: var(--primary); }
.onboard h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 10px; letter-spacing: -0.02em; }
.onboard p.lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 22px; }
.onboard .grow { flex: 1; }
.onboard .actions { display: grid; gap: 10px; margin-top: 24px; }
.big-input { font-size: 2rem; font-weight: 700; text-align: center; padding: 18px; }
.logo { width: 64px; height: 64px; border-radius: 20px; background: var(--primary); display: grid; place-items: center; margin-bottom: 22px; }
.logo svg { width: 34px; height: 34px; }

.focus-hint { text-align: center; color: var(--muted); font-size: 0.88rem; margin-top: 18px; }
.section-title { font-size: 1.4rem; margin: 10px 2px 4px; letter-spacing: -0.01em; }
.section-lead { color: var(--muted); margin: 0 2px 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- phase 2: calendar, subscriptions, payday ---------- */
.log-btn.alt { background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.note-calm { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin: 4px 0 8px; font-size: 0.95rem; }
.pay-card { border-color: var(--primary); background: var(--primary-soft); }
.pay-card .btn:not(.solid):not(.quiet) { background: var(--surface); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.cal-h { text-align: center; font-size: 0.75rem; color: var(--muted); font-weight: 650; padding: 4px 0; }
.cal-d { aspect-ratio: 1 / 1.05; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-weight: 600; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.cal-d:active { background: var(--primary-soft); }
.cal-d.today { background: var(--primary); color: var(--primary-ink); }
.cal-d.sel { outline: 2px solid var(--primary); outline-offset: -2px; }
.dots { display: flex; gap: 3px; height: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.pay { background: var(--primary); }
.cal-d.today .dot.pay { background: var(--primary-ink); }
.dot.bill { background: var(--amber); }
.dot.paid { background: var(--border); border: 1px solid var(--muted); }
.cal-key { display: flex; gap: 14px; justify-content: center; font-size: 0.8rem; color: var(--muted); margin-top: 10px; }
.cal-key .dot { margin-right: 4px; vertical-align: middle; }
.cal-detail { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.icon-btn { font-size: 1.5rem; line-height: 1; }
.ded { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 8px; display: grid; gap: 8px; background: var(--surface-2); }

/* ---------- phase 3 ---------- */
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.add-grid .log-btn { padding: 15px 10px; font-size: 1rem; }
.fit-btn { width: 100%; text-align: center; padding: 14px 10px; margin-top: 10px; color: var(--muted); border: 1.5px dashed var(--border); border-radius: var(--radius); font-size: 0.95rem; }
.fit-btn b { color: var(--primary); }
.note-amber { background: var(--amber-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin: 4px 0 8px; font-size: 0.95rem; }
.alert-card { border-color: var(--amber-soft); background: var(--surface); }
.alert-card h2 { color: var(--amber); }
.saved-card { text-align: center; background: var(--primary-soft); }
.saved-big { font-size: 2.6rem; font-weight: 750; margin: 0; color: var(--primary); letter-spacing: -0.02em; }
.progress.soft-over > span { background: var(--amber); }
.has-sheet .toast { bottom: auto; top: calc(14px + env(safe-area-inset-top)); }
.paywith { margin: 4px 0 0; } .paywith label { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }

/* ---------- phase 4 ---------- */
.help-btn { font-weight: 750; font-size: 1.05rem; border: 1.5px solid var(--border); width: 36px; height: 36px; }
.chev { color: var(--muted); font-size: 1.4rem; }
.tour { position: fixed; inset: 0; z-index: 70; }
.tour-spot { position: fixed; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(10, 15, 15, 0.6); transition: all 0.25s ease; pointer-events: none; }
.tour-bubble { position: fixed; left: 16px; right: 16px; max-width: 488px; margin: 0 auto; background: var(--surface); border-radius: 18px; padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.tour-bubble p { margin: 0 0 12px; font-size: 1.05rem; }
.timer { text-align: center; font-size: 2rem; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--primary); margin: 4px 0 8px; }
.check-list { padding-left: 20px; margin: 0 0 14px; }
.check-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.check-list li label { font-weight: 600; }
.check-list input[type=checkbox] { width: auto; margin-right: 8px; transform: scale(1.2); }
.check-list .btn { padding: 6px 12px; min-height: 34px; margin-left: 6px; font-size: 0.9rem; }
.note-row { display: flex; gap: 10px; align-items: flex-start; flex: 1; }
.note-row input { width: auto; margin-top: 4px; transform: scale(1.25); }
.note-row.done span { text-decoration: line-through; color: var(--muted); }
textarea { resize: vertical; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.badge { text-align: center; padding: 10px 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); opacity: 0.55; }
.badge.got { opacity: 1; background: var(--primary-soft); border-color: transparent; }
.badge span { font-size: 1.5rem; display: block; }
.badge small { display: block; font-size: 0.72rem; line-height: 1.25; margin-top: 4px; color: var(--muted); }
.badge.got small { color: var(--text); }
.lock { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.lock-inner { width: 100%; max-width: 340px; text-align: center; }
.lock-inner .logo { margin: 0 auto 16px; }
.sheet .lock-inner { margin: 0 auto; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 18px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--primary); }
.pin-dots i.on { background: var(--primary); }
.pin-keys button { height: 62px; font-size: 1.5rem; }

/* ---------- phase 5 ---------- */
.pair-code { text-align: center; font-size: 2.6rem; font-weight: 750; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; margin: 16px 0 8px; color: var(--primary); }
.tick { display: flex; gap: 10px; align-items: center; padding: 8px 0; font-weight: 500; }
.tick input { width: auto; transform: scale(1.2); }
