/* app.css — the whole visual system.
 *
 * Two ideas hold it together:
 *   1. Surfaces are translucent and layered, so depth comes from blur and
 *      shadow rather than from borders and boxes.
 *   2. Everything that moves uses the same easing curve. Consistent motion is
 *      most of what makes an interface feel like one piece of software.
 */

/* ── Tokens ───────────────────────────────────────────────────────────────── */
:root {
  --tint: #5A5AE6;
  --tint-soft: rgba(90, 90, 230, .12);
  --green: #14A06B;
  --red: #E1394A;
  --orange: #E8830C;
  --indigo: #5A5AE6;
  --purple: #8E4EC6;
  --grey: #8A8A94;

  --bg: #F4F4F7;
  --bg-2: #EDEDF2;
  --card: rgba(255, 255, 255, .78);
  --card-solid: #FFFFFF;
  --raised: rgba(255, 255, 255, .92);
  --text: #0C0C11;
  --text-2: #6C6C78;
  --text-3: #9A9AA6;
  --line: rgba(10, 10, 25, .075);
  --line-2: rgba(10, 10, 25, .045);
  --ring-track: rgba(10, 10, 25, .08);
  --shadow-s: 0 1px 2px rgba(12, 12, 25, .05), 0 4px 12px rgba(12, 12, 25, .045);
  --shadow-m: 0 2px 6px rgba(12, 12, 25, .06), 0 12px 32px rgba(12, 12, 25, .09);
  --shadow-l: 0 8px 24px rgba(12, 12, 25, .1), 0 32px 64px rgba(12, 12, 25, .16);
  --blur: saturate(180%) blur(24px);

  /* One curve for movement, one for springy affordances. */
  --ease: cubic-bezier(.32, .72, 0, 1);
  --spring: cubic-bezier(.34, 1.4, .48, 1);
  --fast: .18s;
  --base: .34s;
  --slow: .52s;

  --gutter: 18px;
  --radius: 22px;
  --radius-s: 14px;
  --tabbar-h: 60px;
}

:root[data-theme="dark"], :root:not([data-theme="light"]) {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tint: #7C7AFF;
    --tint-soft: rgba(124, 122, 255, .18);
    --green: #35D08A;
    --red: #FF5A66;
    --orange: #FFA023;
    --indigo: #7C7AFF;
    --purple: #B77CE8;
    --grey: #8E8E98;

    --bg: #08080B;
    --bg-2: #101016;
    --card: rgba(28, 28, 36, .72);
    --card-solid: #16161C;
    --raised: rgba(38, 38, 48, .86);
    --text: #F5F5F8;
    --text-2: #9E9EAC;
    --text-3: #6E6E7C;
    --line: rgba(255, 255, 255, .085);
    --line-2: rgba(255, 255, 255, .05);
    --ring-track: rgba(255, 255, 255, .1);
    --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-m: 0 4px 16px rgba(0, 0, 0, .5);
    --shadow-l: 0 16px 48px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --tint: #7C7AFF; --tint-soft: rgba(124,122,255,.18); --green: #35D08A; --red: #FF5A66;
  --orange: #FFA023; --indigo: #7C7AFF; --purple: #B77CE8; --grey: #8E8E98;
  --bg: #08080B; --bg-2: #101016; --card: rgba(28,28,36,.72); --card-solid: #16161C;
  --raised: rgba(38,38,48,.86); --text: #F5F5F8; --text-2: #9E9EAC; --text-3: #6E6E7C;
  --line: rgba(255,255,255,.085); --line-2: rgba(255,255,255,.05); --ring-track: rgba(255,255,255,.1);
  --shadow-s: 0 1px 2px rgba(0,0,0,.4); --shadow-m: 0 4px 16px rgba(0,0,0,.5); --shadow-l: 0 16px 48px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; overscroll-behavior-y: none; }

body {
  font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}

/* A quiet mesh behind everything, so glass has something to refract. */
body::before {
  content: ''; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42% 32% at 12% 4%, color-mix(in srgb, var(--tint) 18%, transparent), transparent 70%),
    radial-gradient(38% 28% at 92% 12%, color-mix(in srgb, var(--purple) 14%, transparent), transparent 70%),
    radial-gradient(46% 34% at 60% 96%, color-mix(in srgb, var(--green) 10%, transparent), transparent 70%),
    var(--bg);
  filter: saturate(140%);
}

body.locked { overflow: hidden; }
body.booting #app { opacity: 0; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
h1, h2, h3, h4 { font-weight: 640; letter-spacing: -.022em; line-height: 1.15; }
svg.ico { width: 22px; height: 22px; flex: none; }

::-webkit-scrollbar { width: 0; height: 0; }

/* ── App shell ────────────────────────────────────────────────────────────── */
#app {
  position: fixed; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--gutter);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 40px);
  transition: opacity var(--base) var(--ease);
  scroll-behavior: smooth;
}
#app > * { max-width: 560px; margin-inline: auto; }

@keyframes slideL { from { opacity: 0; transform: translate3d(22px, 0, 0); } }
@keyframes slideR { from { opacity: 0; transform: translate3d(-22px, 0, 0); } }
#app.slide-l { animation: slideL var(--base) var(--ease); }
#app.slide-r { animation: slideR var(--base) var(--ease); }

@keyframes rise { from { opacity: 0; transform: translate3d(0, 14px, 0) scale(.985); } }
.rise { animation: rise var(--slow) var(--ease) backwards; animation-delay: var(--d, 0ms); }

.tail { height: 20px; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 16px) 0 14px;
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(var(--bg) 62%, transparent);
  backdrop-filter: blur(6px);
}
.topbar-titles { flex: 1; min-width: 0; }
.topbar h1 { font-size: 27px; font-weight: 700; letter-spacing: -.03em; }
.topbar p { font-size: 13.5px; color: var(--text-2); margin-top: 1px; }
.topbar-actions { display: flex; gap: 6px; }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%; color: var(--text);
  background: var(--card); backdrop-filter: var(--blur);
  border: .5px solid var(--line);
  transition: transform var(--fast) var(--spring), background var(--fast);
}
.icon-btn:active { transform: scale(.9); }
.icon-btn:disabled { opacity: .3; }
.icon-btn.tiny { width: 28px; height: 28px; border: 0; background: none; color: var(--text-3); }
.icon-btn.tiny .ico { width: 17px; height: 17px; }

/* ── Surfaces ─────────────────────────────────────────────────────────────── */
.glass {
  background: var(--card);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: .5px solid var(--line);
  box-shadow: var(--shadow-s);
}
.card {
  background: var(--card); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: .5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-s); overflow: hidden;
}
.pad-card { padding: 16px 14px; }

.block { margin-top: 26px; }
.block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 4px 10px;
}
.block-head h3 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.link {
  font-size: 14px; color: var(--tint); font-weight: 550;
  display: inline-flex; align-items: center; gap: 1px;
}
.link .ico { width: 15px; height: 15px; }
.link:active { opacity: .5; }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  margin-top: 4px; padding: 22px 20px 18px; border-radius: 26px;
  position: relative; overflow: hidden;
}
.hero-label { font-size: 13px; color: var(--text-2); font-weight: 500; letter-spacing: -.005em; }
.hero-amount {
  font-size: clamp(34px, 10.5vw, 46px); font-weight: 700; letter-spacing: -.038em;
  margin-top: 4px; line-height: 1.05;
}
.hero.small .hero-amount { font-size: clamp(28px, 8.5vw, 36px); }
.hero-meta { display: flex; align-items: baseline; gap: 7px; margin-top: 6px; font-size: 14px; }
.hero-meta small { color: var(--text-2); font-size: 13px; }
.hero-spark { margin: 10px -20px -18px; opacity: .95; }
.hero-spark svg { display: block; width: 100%; height: 64px; }

.split { display: flex; gap: 22px; margin-top: 14px; padding-top: 14px; border-top: .5px solid var(--line-2); }
.split div { display: flex; flex-direction: column; gap: 1px; }
.split small { font-size: 12px; color: var(--text-2); }
.split b { font-size: 16px; font-weight: 620; letter-spacing: -.02em; }

/* ── Stats ────────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat {
  padding: 13px 14px 12px; border-radius: 18px; text-align: left;
  display: flex; flex-direction: column; gap: 2px; position: relative;
  transition: transform var(--fast) var(--spring);
}
.stat:active { transform: scale(.96); }
.stat-ico {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--tint-soft); color: var(--tint); margin-bottom: 5px;
}
.stat-ico .ico { width: 15px; height: 15px; }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.stat-value { font-size: 19px; font-weight: 650; letter-spacing: -.028em; }

.tone-tint .stat-ico { background: var(--tint-soft); color: var(--tint); }
.tone-green .stat-ico { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.tone-orange .stat-ico { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); }
.tone-indigo .stat-ico { background: color-mix(in srgb, var(--indigo) 14%, transparent); color: var(--indigo); }

/* ── Today ────────────────────────────────────────────────────────────────── */
.today { margin-top: 10px; padding: 14px 16px; border-radius: 18px; }
.today-head { display: flex; justify-content: space-between; align-items: baseline; }
.today-head b { font-size: 14px; font-weight: 620; }
.today-head small { font-size: 12.5px; color: var(--text-2); }
.today-bars { display: flex; gap: 10px; margin-top: 10px; }
.tb { flex: 1; padding: 9px 12px; border-radius: 12px; background: var(--line-2); }
.tb span { font-size: 11.5px; color: var(--text-2); display: block; }
.tb b { font-size: 16px; font-weight: 620; letter-spacing: -.02em; }
.tb-in { background: color-mix(in srgb, var(--green) 11%, transparent); }
.tb-in b { color: var(--green); }
.tb-out { background: color-mix(in srgb, var(--red) 9%, transparent); }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alerts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.alert {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 11px 14px; border-radius: 14px; font-size: 14px;
  background: color-mix(in srgb, var(--orange) 12%, transparent);
  color: color-mix(in srgb, var(--orange) 92%, var(--text));
  border: .5px solid color-mix(in srgb, var(--orange) 22%, transparent);
}
.alert.over { background: color-mix(in srgb, var(--red) 12%, transparent); color: color-mix(in srgb, var(--red) 92%, var(--text)); border-color: color-mix(in srgb, var(--red) 24%, transparent); }
.alert .ico { width: 18px; height: 18px; flex: none; }
.alert:active { transform: scale(.985); }

/* ── Horizontal scrollers ─────────────────────────────────────────────────── */
.hscroll {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity;
  margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px;
}
.hscroll > * { scroll-snap-align: start; }

.ringcard {
  position: relative; flex: none; width: 108px; padding: 14px 10px 12px;
  border-radius: 20px; background: var(--card); border: .5px solid var(--line);
  backdrop-filter: var(--blur); box-shadow: var(--shadow-s);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: transform var(--fast) var(--spring);
}
.ringcard:active { transform: scale(.95); }
.ringcard b { font-size: 12.5px; font-weight: 600; margin-top: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ringcard small { font-size: 11px; color: var(--text-2); }
.ringcard-emoji { position: absolute; top: 30px; font-size: 19px; }

/* ── Rows and lists ───────────────────────────────────────────────────────── */
.list > *:not(:last-child) { border-bottom: .5px solid var(--line-2); }
.list.dim { opacity: .55; }
.list.plain { background: none; }

.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 14px; text-align: left; position: relative;
  background: var(--card-solid);
  transition: background var(--fast);
}
.card .row { background: transparent; }
.row-tap:active { background: var(--line-2); }
.row.static { cursor: default; }

.row-face {
  width: 38px; height: 38px; flex: none; border-radius: 12px;
  display: grid; place-items: center; font-size: 18px;
  background: color-mix(in srgb, var(--c, var(--grey)) 14%, transparent);
  color: var(--c, var(--text-2));
}
.row-face .ico { width: 18px; height: 18px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-main b { font-size: 15.5px; font-weight: 520; letter-spacing: -.012em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-amt { font-size: 15.5px; font-weight: 600; letter-spacing: -.02em; flex: none; }
.row > .ico { color: var(--text-3); width: 17px; }

.tone-in .row-face, .tone-save .row-face { background: color-mix(in srgb, var(--green) 13%, transparent); color: var(--green); }
.tone-out .row-face { background: color-mix(in srgb, var(--red) 11%, transparent); color: var(--red); }
.tone-move .row-face { background: color-mix(in srgb, var(--tint) 12%, transparent); color: var(--tint); }
.tone-owe .row-face { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--orange); }
.tone-due .row-face { background: color-mix(in srgb, var(--green) 13%, transparent); color: var(--green); }
.tone-settle .row-face { background: color-mix(in srgb, var(--indigo) 13%, transparent); color: var(--indigo); }

.good { color: var(--green); }
.bad { color: var(--red); }
.muted { color: var(--text-3); }
.danger-text { color: var(--red) !important; }

.day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 14px 5px; font-size: 12.5px; color: var(--text-2); font-weight: 550;
  letter-spacing: -.005em; background: transparent;
}
.day-head b { font-size: 12.5px; font-weight: 600; }
.list > .day-head { border-bottom: 0 !important; }

/* ── Swipe to reveal ──────────────────────────────────────────────────────────
 * The row and its buttons are laid out side by side in a track wider than the
 * row, and the row clips. Nothing is stacked, so the buttons can never show
 * through a translucent row — they are genuinely off-screen until revealed. */
.swipe-row { overflow: hidden; }
.swipe-track {
  display: flex; align-items: stretch; width: 100%;
  transition: transform var(--base) var(--ease); will-change: transform;
}
.swipe-surface { flex: 0 0 100%; min-width: 0; }
.swipe-actions { flex: none; display: flex; }
.swipe-actions button {
  width: 76px; display: grid; place-items: center; color: #fff;
  transition: filter var(--fast);
}
.swipe-actions button:active { filter: brightness(.85); }
.swipe-edit { background: var(--grey); }
.swipe-del { background: var(--red); }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty { padding: 40px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty-ico {
  width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center;
  background: var(--line-2); color: var(--text-3); margin-bottom: 8px;
}
.empty-ico .ico { width: 25px; height: 25px; }
.empty h3 { font-size: 16.5px; }
.empty p { font-size: 14px; color: var(--text-2); max-width: 30ch; }
.empty .btn { margin-top: 14px; }

/* ── Distribution ─────────────────────────────────────────────────────────── */
.stackbar { display: flex; gap: 3px; height: 10px; padding: 14px 14px 0; }
.stackbar i {
  display: block; height: 10px; border-radius: 5px; background: var(--c);
  width: var(--w); min-width: 6px;
  animation: growW var(--slow) var(--ease) backwards; animation-delay: var(--d);
}
@keyframes growW { from { width: 0; opacity: 0; } }

.dist { padding: 6px 0 4px; }
.dist-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 14px; font-size: 14.5px; text-align: left;
}
.dist-row:active { background: var(--line-2); }
.dist-row i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.dist-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-row b { font-weight: 600; letter-spacing: -.02em; }

/* ── Insight teaser + nudge ───────────────────────────────────────────────── */
.insight-teaser {
  display: flex; align-items: center; gap: 12px; width: 100%;
  margin-top: 22px; padding: 14px 16px; border-radius: 18px; text-align: left;
  transition: transform var(--fast) var(--spring);
}
.insight-teaser:active { transform: scale(.98); }
.it-ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--tint-soft); color: var(--tint); }
.it-text { flex: 1; display: flex; flex-direction: column; }
.it-text b { font-size: 15px; font-weight: 600; }
.it-text small { font-size: 12.5px; color: var(--text-2); }
.insight-teaser > .ico { color: var(--text-3); width: 18px; }

.nudge {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  margin-top: 14px; padding: 12px 15px; border-radius: 14px; font-size: 13.5px;
  background: color-mix(in srgb, var(--orange) 11%, transparent);
  color: color-mix(in srgb, var(--orange) 90%, var(--text));
  border: .5px solid color-mix(in srgb, var(--orange) 20%, transparent);
}
.nudge .ico { width: 18px; height: 18px; flex: none; }

/* ── Accounts ─────────────────────────────────────────────────────────────── */
.acc { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; }
.acc:active { background: var(--line-2); }
.acc-face {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-size: 20px; background: color-mix(in srgb, var(--c) 15%, transparent); flex: none;
}
.acc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acc-main b { font-size: 16px; font-weight: 560; letter-spacing: -.015em; }
.acc-main small { font-size: 12.5px; color: var(--text-2); }
.acc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.acc-right b { font-size: 16px; font-weight: 640; letter-spacing: -.022em; }
.acc-spark { color: var(--c); opacity: .55; height: 22px; }

.quickrow { display: flex; gap: 9px; margin-top: 12px; }
.quick {
  flex: 1; padding: 12px 6px; border-radius: 16px; display: flex; flex-direction: column;
  align-items: center; gap: 5px; font-size: 12.5px; font-weight: 550;
  background: var(--card); border: .5px solid var(--line); backdrop-filter: var(--blur);
  transition: transform var(--fast) var(--spring);
}
.quick:active { transform: scale(.94); }
.quick .ico { width: 19px; height: 19px; color: var(--tint); }

/* ── Search + chips ───────────────────────────────────────────────────────── */
.searchwrap { margin-top: 4px; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px;
  border-radius: 13px; background: var(--card); border: .5px solid var(--line);
  backdrop-filter: var(--blur); color: var(--text-3);
}
.search input { flex: 1; border: 0; outline: 0; background: none; font-size: 15.5px; color: var(--text); min-width: 0; }
.search .ico { width: 18px; height: 18px; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.chips-scroll {
  flex-wrap: nowrap; overflow-x: auto;
  margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter);
}
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 540;
  background: var(--card); border: .5px solid var(--line); color: var(--text-2);
  backdrop-filter: var(--blur);
  transition: transform var(--fast) var(--spring), background var(--fast), color var(--fast);
}
.chip:active { transform: scale(.93); }
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }

.result-count { font-size: 12.5px; color: var(--text-2); margin: 14px 4px 8px; }

/* ── Month bar ────────────────────────────────────────────────────────────── */
.monthbar {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  padding: 7px 8px; border-radius: 16px;
}
.monthbar-mid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0; }
.monthbar-mid b { font-size: 15px; font-weight: 620; letter-spacing: -.015em; }
.monthbar-mid small { font-size: 12px; color: var(--text-2); }
.monthbar-mid:active { opacity: .55; }

/* ── Budgets ──────────────────────────────────────────────────────────────── */
.bigbudget {
  margin-top: 12px; padding: 22px 20px 18px; border-radius: 26px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.bb-ring { position: relative; display: grid; place-items: center; }
.bb-centre { position: absolute; display: flex; flex-direction: column; align-items: center; }
.bb-centre b { font-size: 24px; font-weight: 680; letter-spacing: -.03em; }
.bb-centre small { font-size: 12px; color: var(--text-2); }
.bb-note { font-size: 13.5px; color: var(--text-2); text-align: center; max-width: 32ch; }
.bigbudget.over .bb-note { color: var(--red); }
.bigbudget.close .bb-note, .bigbudget.fast .bb-note { color: var(--orange); }

.budget { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 14px; text-align: left; }
.budget:active { background: var(--line-2); }
.budget-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.budget-main b { font-size: 15px; font-weight: 560; }
.budget-main small { font-size: 12.5px; color: var(--text-2); }
.budget-note { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.budget-note.over { color: var(--red); }
.budget-note.close, .budget-note.fast { color: var(--orange); }
.budget-left { font-size: 15.5px; font-weight: 640; letter-spacing: -.02em; }

/* ── Goals ────────────────────────────────────────────────────────────────── */
.goals { display: flex; flex-direction: column; gap: 11px; margin-top: 12px; }
.goal {
  padding: 15px 16px 14px; border-radius: 20px; text-align: left; width: 100%;
  background: var(--card); border: .5px solid var(--line);
  backdrop-filter: var(--blur); box-shadow: var(--shadow-s);
  transition: transform var(--fast) var(--spring);
}
.goal:active { transform: scale(.98); }
.goal-top { display: flex; align-items: center; gap: 11px; }
.goal-emoji {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-size: 19px; background: color-mix(in srgb, var(--c) 15%, transparent); flex: none;
}
.goal-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.goal-name b { font-size: 15.5px; font-weight: 580; letter-spacing: -.015em; }
.goal-name small { font-size: 12.5px; color: var(--text-2); }
.goal-pct { font-size: 13px; font-weight: 620; color: var(--c); }
.goal-bar { height: 7px; border-radius: 4px; background: var(--ring-track); margin: 12px 0 8px; overflow: hidden; }
.goal-bar i {
  display: block; height: 100%; border-radius: 4px; width: var(--w);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 70%, white), var(--c));
  animation: growW .8s var(--ease) backwards .1s;
}
.goal-foot { display: flex; align-items: baseline; gap: 6px; }
.goal-foot b { font-size: 16px; font-weight: 640; letter-spacing: -.022em; }
.goal-foot small { font-size: 12.5px; color: var(--text-2); }
.goal.done { border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.goal.done .goal-pct { color: var(--green); }

.goalview { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gv-ring { position: relative; display: grid; place-items: center; margin: 6px 0; }
.gv-centre { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.gv-centre i { font-size: 24px; font-style: normal; }
.gv-centre b { font-size: 22px; font-weight: 680; letter-spacing: -.03em; }
.gv-centre small { font-size: 12px; color: var(--text-2); }
.gv-line { font-size: 14px; color: var(--text-2); text-align: center; max-width: 34ch; margin-bottom: 8px; }

/* ── Charts ───────────────────────────────────────────────────────────────── */
.chart { display: block; width: 100%; overflow: visible; }
.chart-line { animation: draw 1.1s var(--ease) backwards; }
@keyframes draw { from { stroke-dasharray: 0 2000; } to { stroke-dasharray: 2000 0; } }
.chart-area { animation: fade .8s var(--ease) backwards .2s; }
.chart-dot { animation: fade .4s var(--ease) backwards .7s; }
@keyframes fade { from { opacity: 0; } }
.chart-zero { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart-cursor { transition: opacity var(--fast); }
.chart-cursor-line { stroke: var(--line); stroke-width: 1.5; }
.chart-cursor-dot { stroke: var(--card-solid); stroke-width: 3; }

.chart-bars { height: 150px; }
.bar { animation: growH .7s var(--ease) backwards; animation-delay: var(--d); transform-box: fill-box; transform-origin: bottom; }
@keyframes growH { from { transform: scaleY(0); opacity: 0; } }
.bar-in { fill: var(--green); }
.bar-out { fill: color-mix(in srgb, var(--red) 78%, transparent); }
.bar-label { font-size: 10px; fill: var(--text-3); font-weight: 500; }

.ring-fill, .ring-over { transition: stroke-dashoffset .9s var(--ease); }
.donut { display: block; margin-inline: auto; }
.donut-seg { animation: fade .6s var(--ease) backwards; animation-delay: var(--d); transition: stroke-width var(--fast); }
.spark { display: block; height: 22px; width: 64px; }

.donutwrap { position: relative; display: grid; place-items: center; padding: 6px 0 14px; }
.donut-centre { position: absolute; display: flex; flex-direction: column; align-items: center; }
.donut-centre b { font-size: 20px; font-weight: 680; letter-spacing: -.03em; }
.donut-centre small { font-size: 11.5px; color: var(--text-2); }

.legend { display: flex; gap: 14px; margin-bottom: 8px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 3px; }
.sw-in { background: var(--green); }
.sw-out { background: color-mix(in srgb, var(--red) 78%, transparent); }

.legend-list { display: flex; flex-direction: column; gap: 2px; }
.lg-row { display: flex; align-items: center; gap: 9px; font-size: 14px; padding: 5px 0; }
.lg-row i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.lg-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-row b { font-weight: 600; letter-spacing: -.02em; }
.lg-row small { font-size: 12px; color: var(--text-3); width: 34px; text-align: right; }

.scrub { display: flex; flex-direction: column; margin-bottom: 6px; }
.scrub b { font-size: 22px; font-weight: 680; letter-spacing: -.03em; }
.scrub small { font-size: 12.5px; color: var(--text-2); }
.insight-line { font-size: 13.5px; color: var(--text-2); margin-top: 10px; }

.mini-head { font-size: 13px; color: var(--text-2); font-weight: 600; margin: 18px 0 6px; }

/* ── Tab bar ──────────────────────────────────────────────────────────────── */
#tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  width: min(calc(100% - 24px), 460px); height: var(--tabbar-h);
  display: flex; align-items: center; z-index: 60;
  background: var(--card); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: .5px solid var(--line); border-radius: 26px; box-shadow: var(--shadow-m);
  padding: 0 6px;
}
.tab {
  flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; color: var(--text-3); position: relative; z-index: 2;
  transition: color var(--base) var(--ease), transform var(--fast) var(--spring);
}
.tab span { font-size: 10px; font-weight: 550; letter-spacing: -.005em; }
.tab .ico { width: 21px; height: 21px; transition: transform var(--base) var(--spring); }
.tab.on { color: var(--tint); }
.tab.on .ico { transform: translateY(-1px) scale(1.06); }
.tab:active { transform: scale(.92); }

/* The highlight slides between tabs rather than appearing under each one. */
.tab-pill {
  position: absolute; z-index: 1; top: 6px; bottom: 6px;
  width: calc((100% - 12px) / 5); left: 6px;
  border-radius: 20px; background: var(--tint-soft);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform .42s var(--spring), opacity var(--base);
  opacity: 1;
}
#tabbar[style*="--i: -1"] .tab-pill, #tabbar[style*="--i:-1"] .tab-pill { opacity: 0; }

.fab {
  position: fixed; right: 20px;
  bottom: calc(env(safe-area-inset-bottom) + var(--tabbar-h) + 22px);
  width: 56px; height: 56px; border-radius: 20px; z-index: 55;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tint) 88%, white), var(--tint));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--tint) 42%, transparent), var(--shadow-m);
  transition: transform var(--base) var(--spring), box-shadow var(--base);
}
.fab .ico { width: 26px; height: 26px; stroke-width: 2.3; }
.fab:active { transform: scale(.88) rotate(45deg); }

/* ── Sheets ───────────────────────────────────────────────────────────────── */
#sheets { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.sheet-layer { position: absolute; inset: 0; pointer-events: auto; display: flex; align-items: flex-end; justify-content: center; }
.scrim {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .38);
  opacity: 0; transition: opacity var(--base) var(--ease);
  backdrop-filter: blur(2px);
}
.sheet-layer.in .scrim { opacity: 1; }
.sheet-layer.out .scrim { opacity: 0; }

.sheet {
  position: relative; width: min(100%, 520px);
  max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--raised);
  backdrop-filter: saturate(180%) blur(34px); -webkit-backdrop-filter: saturate(180%) blur(34px);
  border-radius: 30px 30px 0 0;
  border-top: .5px solid var(--line);
  box-shadow: var(--shadow-l);
  transform: translateY(100%);
  transition: transform .46s var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
  will-change: transform;
}
.sheet-layer.in .sheet { transform: translateY(0); }
.sheet-layer.out .sheet { transform: translateY(100%); }
.sheet.tall { height: 92dvh; }
.sheet.auto { max-height: 86dvh; }
.sheet.compact { max-height: 60dvh; }

.grabber { padding: 9px 0 3px; display: grid; place-items: center; touch-action: none; cursor: grab; }
.grabber i { width: 36px; height: 5px; border-radius: 3px; background: var(--line); display: block; }

.sheet-head { display: flex; align-items: flex-start; gap: 10px; padding: 6px 20px 10px; touch-action: none; }
.sheet-titles { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 20px; font-weight: 680; letter-spacing: -.028em; }
.sheet-head p { font-size: 13.5px; color: var(--text-2); margin-top: 1px; }

.sheet-body { flex: 1; overflow-y: auto; padding: 4px 20px 16px; -webkit-overflow-scrolling: touch; }
.sheet-actions {
  display: flex; gap: 10px; padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: .5px solid var(--line-2);
  background: linear-gradient(transparent, var(--raised) 40%);
}
.sheet-actions .btn { flex: 1; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  height: 50px; padding: 0 20px; border-radius: 16px; font-size: 16px; font-weight: 600;
  letter-spacing: -.015em; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform var(--fast) var(--spring), opacity var(--fast), background var(--fast);
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .35; transform: none; }
.btn .ico { width: 19px; height: 19px; }
.btn-primary { background: var(--tint); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--tint) 34%, transparent); }
.btn-ghost { background: var(--line-2); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn.full { width: 100%; margin-top: 14px; }

/* ── Action grid ──────────────────────────────────────────────────────────── */
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-bottom: 6px; }
.action {
  padding: 15px 14px; border-radius: 20px; text-align: left;
  background: var(--card); border: .5px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
  animation: pop .42s var(--spring) backwards; animation-delay: var(--d);
  transition: transform var(--fast) var(--spring);
}
@keyframes pop { from { opacity: 0; transform: scale(.86) translateY(10px); } }
.action:active { transform: scale(.94); }
.action.dim { opacity: .42; }
.action b { font-size: 15.5px; font-weight: 600; margin-top: 7px; }
.action small { font-size: 12px; color: var(--text-2); line-height: 1.3; }
.action-ico {
  width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--grey) 14%, transparent); color: var(--text-2);
}
.action-ico.tone-in { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.action-ico.tone-out { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.action-ico.tone-move { background: color-mix(in srgb, var(--tint) 13%, transparent); color: var(--tint); }
.action-ico.tone-save { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.action-ico.tone-owe { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); }
.action-ico.tone-due { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.action-ico.tone-settle { background: color-mix(in srgb, var(--indigo) 14%, transparent); color: var(--indigo); }

/* ── Composer ─────────────────────────────────────────────────────────────── */
.sheet.composer .sheet-body { padding-top: 0; display: flex; }
.comp { display: flex; flex-direction: column; width: 100%; gap: 10px; }
.comp-top { display: flex; align-items: center; justify-content: space-between; }
.comp-verb {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px 6px 10px;
  border-radius: 999px; font-size: 13.5px; font-weight: 600;
  background: color-mix(in srgb, var(--grey) 13%, transparent);
}
.comp-verb .ico { width: 16px; height: 16px; }
.comp-verb.tone-in, .comp-verb.tone-due, .comp-verb.tone-save { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.comp-verb.tone-out { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.comp-verb.tone-move { background: color-mix(in srgb, var(--tint) 13%, transparent); color: var(--tint); }
.comp-verb.tone-owe { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); }
.comp-verb.tone-settle { background: color-mix(in srgb, var(--indigo) 14%, transparent); color: var(--indigo); }
.comp-switch { font-size: 13.5px; color: var(--tint); font-weight: 550; display: inline-flex; align-items: center; gap: 2px; }
.comp-switch .ico { width: 15px; height: 15px; }

.comp-amount {
  display: flex; align-items: baseline; justify-content: center; gap: 3px;
  padding: 10px 0 4px; font-weight: 680; letter-spacing: -.04em;
  font-size: var(--size, 62px); line-height: 1.1;
  transition: font-size var(--base) var(--ease), color var(--base);
}
.comp-amount .cur { font-size: .52em; font-weight: 600; color: var(--text-2); }
.comp-amount.zero { color: var(--text-3); }
.comp-amount .val { transition: opacity var(--fast); }

.comp-quick { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; min-height: 32px; }
.chip-add { padding: 6px 12px; font-size: 12.5px; }
.chip-clear { padding: 6px 9px; }
.chip-clear .ico { width: 14px; height: 14px; }

.comp-fields { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }

/* ── Fields ───────────────────────────────────────────────────────────────── */
.field {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border-radius: 14px; text-align: left;
  background: var(--line-2); transition: background var(--fast);
  min-height: 46px;
}
.field:active { background: var(--line); }
.field-label { font-size: 14px; color: var(--text-2); flex: none; display: inline-flex; align-items: center; gap: 6px; }
.field-label .ico { width: 16px; height: 16px; }
.field-value { flex: 1; text-align: right; font-size: 15px; font-weight: 520; display: flex; flex-direction: column; align-items: flex-end; }
.field-value small { font-size: 11.5px; color: var(--text-2); font-weight: 400; }
.field-chev { color: var(--text-3); width: 16px; flex: none; }
.field-input { cursor: text; }
.field-text {
  flex: 1; border: 0; outline: 0; background: none; text-align: right;
  font-size: 15.5px; font-weight: 500; min-width: 0;
}
.field-text.num { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.field-text::placeholder { color: var(--text-3); font-weight: 400; }
.field-repeat.on { background: var(--tint-soft); }
.field-repeat.on .field-label { color: var(--tint); }

.mini-acc { display: inline-flex; align-items: center; gap: 6px; }
.mini-acc i { font-style: normal; font-size: 15px; }

/* ── Keypad ───────────────────────────────────────────────────────────────── */
.pad {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: auto; padding-top: 12px;
}
.key {
  height: 54px; border-radius: 16px; font-size: 23px; font-weight: 480;
  background: var(--card-solid); box-shadow: var(--shadow-s);
  display: grid; place-items: center;
  transition: transform .1s var(--spring), background .1s;
  letter-spacing: -.02em;
}
.key:active { transform: scale(.93); background: var(--tint-soft); }
.key-back { grid-column: 4; grid-row: 1; background: transparent; box-shadow: none; color: var(--text-2); }
.key-back .ico { width: 22px; height: 22px; transform: rotate(0); }
.key-save {
  grid-column: 4; grid-row: 2 / span 3; height: auto;
  background: var(--tint); color: #fff; font-size: 14px; font-weight: 640;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--tint) 36%, transparent);
  padding: 8px;
}
.key-save span { writing-mode: vertical-rl; text-orientation: mixed; letter-spacing: .01em; }
.key-save:disabled { opacity: .3; background: var(--grey); box-shadow: none; }
.key-save:active:not(:disabled) { transform: scale(.96); background: var(--tint); }

@media (max-width: 340px) { .key { height: 46px; font-size: 21px; } }

/* ── Picker ───────────────────────────────────────────────────────────────── */
.picker { display: flex; flex-direction: column; gap: 2px; }
.pick-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border-radius: 14px; text-align: left;
  animation: rise .4s var(--ease) backwards; animation-delay: var(--d);
  transition: background var(--fast);
}
.pick-row:active { background: var(--line-2); }
.pick-row.on { background: var(--tint-soft); }
.pick-emoji { font-size: 21px; width: 30px; text-align: center; flex: none; }
.pick-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.pick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-text b { font-size: 15.5px; font-weight: 520; }
.pick-text small { font-size: 12.5px; color: var(--text-2); }
.pick-right { font-size: 14px; color: var(--text-2); }
.pick-check { color: var(--tint); display: grid; place-items: center; }
.pick-check .ico { width: 19px; height: 19px; stroke-width: 2.4; }
.pick-footer { color: var(--tint); }
.pick-footer .ico { width: 20px; margin-left: 5px; }

/* ── Editors ──────────────────────────────────────────────────────────────── */
.editor { display: flex; flex-direction: column; gap: 9px; }
.ed-preview { display: grid; place-items: center; padding: 6px 0 10px; }
.ed-avatar {
  width: 66px; height: 66px; border-radius: 22px; display: grid; place-items: center;
  font-size: 31px; background: color-mix(in srgb, var(--c) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  transition: background var(--base), border-color var(--base);
}

.seg { display: flex; gap: 3px; padding: 3px; border-radius: 13px; background: var(--line-2); }
.seg button {
  flex: 1; height: 36px; border-radius: 10px; font-size: 14px; font-weight: 540;
  color: var(--text-2); transition: background var(--base) var(--ease), color var(--base);
}
.seg button.on { background: var(--card-solid); color: var(--text); box-shadow: var(--shadow-s); }

.swatches { display: flex; gap: 7px; flex-wrap: wrap; padding: 2px 0; }
.swatch {
  width: 30px; height: 30px; border-radius: 10px; background: var(--c);
  border: 2px solid transparent; transition: transform var(--fast) var(--spring);
}
.swatch.on { transform: scale(1.14); box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--c); }
.swatch:active { transform: scale(.9); }
.swatch-i {
  width: 36px; height: 36px; border-radius: 11px; font-size: 19px;
  display: grid; place-items: center; background: var(--line-2);
  transition: transform var(--fast) var(--spring), background var(--fast);
}
.swatch-i.on { background: var(--tint-soft); transform: scale(1.08); }
.swatch-i:active { transform: scale(.9); }

.hint { font-size: 12.5px; color: var(--text-2); line-height: 1.45; padding: 2px 4px; }
.hint.warn { color: var(--orange); }
.hint.pad { padding: 16px; }

.tog { width: 46px; height: 28px; appearance: none; border-radius: 999px; background: var(--line); position: relative; transition: background var(--base) var(--ease); flex: none; }
.tog::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-s); transition: transform var(--base) var(--spring); }
.tog:checked { background: var(--green); }
.tog:checked::after { transform: translateX(18px); }

/* ── Confirm ──────────────────────────────────────────────────────────────── */
.confirm { padding: 16px 6px 8px; text-align: center; }
.confirm h3 { font-size: 19px; margin-bottom: 7px; }
.confirm p { font-size: 14.5px; color: var(--text-2); line-height: 1.45; max-width: 34ch; margin-inline: auto; }

/* ── Detail ───────────────────────────────────────────────────────────────── */
.detail { padding-top: 4px; }
.detail-hero { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 20px; }
.detail-ico { width: 40px; height: 40px; padding: 9px; border-radius: 14px; background: color-mix(in srgb, var(--grey) 13%, transparent); }
.detail-hero.tone-in .detail-ico, .detail-hero.tone-due .detail-ico, .detail-hero.tone-save .detail-ico { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.detail-hero.tone-out .detail-ico { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.detail-hero.tone-move .detail-ico { background: color-mix(in srgb, var(--tint) 13%, transparent); color: var(--tint); }
.detail-hero.tone-owe .detail-ico { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); }
.detail-hero.tone-settle .detail-ico { background: color-mix(in srgb, var(--indigo) 14%, transparent); color: var(--indigo); }
.detail-hero b { font-size: 13.5px; color: var(--text-2); font-weight: 550; margin-top: 8px; }
.detail-amt { font-size: 36px; font-weight: 700; letter-spacing: -.035em; }

.detail-rows { display: flex; flex-direction: column; }
.detail-rows > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 2px; border-bottom: .5px solid var(--line-2); }
.detail-rows dt { font-size: 14px; color: var(--text-2); flex: none; }
.detail-rows dd { font-size: 14.5px; font-weight: 520; text-align: right; min-width: 0; overflow-wrap: anywhere; }

.detail-acts { display: flex; gap: 8px; margin-top: 18px; }
.detail-acts .btn { flex: 1; font-size: 13.5px; height: 46px; padding: 0 8px; flex-direction: column; gap: 3px; }
.detail-acts .btn .ico { width: 18px; height: 18px; }

/* ── Debt view ────────────────────────────────────────────────────────────── */
.debt-hero { text-align: center; padding: 10px 0 18px; display: flex; flex-direction: column; gap: 3px; }
.debt-amt { font-size: 36px; font-weight: 700; letter-spacing: -.035em; }
.debt-hero.tone-due .debt-amt { color: var(--green); }
.debt-hero.tone-owe .debt-amt { color: var(--orange); }
.debt-hero small { font-size: 13px; color: var(--text-2); }

.debt-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: .5px solid var(--line-2); }
.debt-item b { font-size: 15.5px; font-weight: 600; display: block; }
.debt-item small { font-size: 12.5px; color: var(--text-2); }
.pill { font-size: 11.5px; padding: 4px 10px; border-radius: 999px; background: var(--line-2); color: var(--text-2); white-space: nowrap; }
.pill-late { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }

.debt-hist { display: flex; flex-direction: column; }
.debt-hrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 9px 0; border-bottom: .5px solid var(--line-2); font-size: 14px; }
.debt-hrow b { font-weight: 600; }
.debt-hrow small { grid-column: 1 / -1; font-size: 12px; color: var(--text-3); }

/* ── Onboarding ───────────────────────────────────────────────────────────── */
.onboard { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; }
.ob-mark {
  width: 56px; height: 56px; border-radius: 19px; display: grid; place-items: center;
  background: var(--tint-soft); color: var(--tint); margin-bottom: 14px;
  animation: pop .6s var(--spring) backwards .1s;
}
.ob-mark .ico { width: 30px; height: 30px; }
.onboard h1 { font-size: 29px; font-weight: 700; letter-spacing: -.035em; line-height: 1.14; }
.onboard > p { font-size: 15px; color: var(--text-2); line-height: 1.45; margin-bottom: 16px; max-width: 34ch; }
.ob-list { display: flex; flex-direction: column; gap: 8px; }
.ob-emoji { font-style: normal; font-size: 17px; margin-right: 7px; }
.ob-add { display: inline-flex; align-items: center; gap: 6px; color: var(--tint); font-size: 14.5px; font-weight: 550; padding: 12px 4px; }
.ob-add .ico { width: 18px; height: 18px; }

.datepick { display: flex; flex-direction: column; gap: 10px; }
.datepick .chips { margin: 0; }
.datepick input[type="date"] { text-align: right; }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
#toasts {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 200;
  bottom: calc(env(safe-area-inset-bottom) + var(--tabbar-h) + 22px);
  width: min(calc(100% - 32px), 440px); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px; pointer-events: auto;
  padding: 13px 16px; border-radius: 17px; font-size: 14.5px;
  background: color-mix(in srgb, var(--text) 92%, transparent); color: var(--bg);
  backdrop-filter: blur(20px); box-shadow: var(--shadow-l);
  opacity: 0; transform: translateY(16px) scale(.96);
  transition: opacity var(--base) var(--ease), transform var(--base) var(--spring);
}
.toast.in { opacity: 1; transform: none; }
.toast-msg { flex: 1; }
.toast-action { font-weight: 650; color: color-mix(in srgb, var(--tint) 60%, white); flex: none; }
.toast.good { background: color-mix(in srgb, var(--green) 94%, black); color: #fff; }
.toast.good .toast-action { color: #fff; text-decoration: underline; }

.version { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 26px; }

/* ── Accessibility ────────────────────────────────────────────────────────── */
:focus-visible { outline: 2.5px solid var(--tint); outline-offset: 2px; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
  .sheet { transition: transform .01ms !important; }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(10,10,25,.22); --text-2: #45454F; }
  .card, .glass, #tabbar { background: var(--card-solid); }
}

/* Wider screens: the app stays a single readable column, centred. */
@media (min-width: 620px) {
  #app { padding-inline: 24px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
