/* Paisa – black, minimal, a little playful. Accent: Iris. Font: Outfit. */
@font-face {
  font-family: "Outfit";
  src: url("fonts/outfit-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --bg: #000000;
  --raised: #0e0e10;
  --card: #111114;
  --field: #141417;
  --field-2: #1c1c20;
  --hair: #232327;
  --line: #2c2c31;
  --text: #f5f5f7;
  --muted: #9a9aa1;
  --faint: #6e6e76;
  --accent: #9d8cff;
  --accent-ink: #0d0a24;
  --accent-soft: rgba(157, 140, 255, 0.16);
  --accent-softer: rgba(157, 140, 255, 0.10);
  --red: #ff6961;
  --red-soft: rgba(255, 105, 97, 0.15);
  --amber: #ffb340;
  --amber-soft: rgba(255, 179, 64, 0.15);
  --grey-soft: rgba(154, 154, 161, 0.15);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  /* iOS's collapsible toolbar changes the visible viewport without a layout event on first paint;
     app.js keeps this in sync with the real visible bottom edge so fixed bars don't sit too high until you scroll. */
  --vvb: 0px;
  --font: "Outfit", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --group: #16161a;
  /* Motion: one vocabulary for the whole app so everything moves like it belongs together. */
  --ease-out: cubic-bezier(.22, 1, .36, 1);        /* quick start, soft landing: most things */
  --ease-sheet: cubic-bezier(.32, .72, 0, 1);      /* iOS sheet / navigation curve */
  --ease-spring: cubic-bezier(.34, 1.36, .64, 1);  /* tiny overshoot: toggles, pills, icons */
  --topbar-h: 44px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { touch-action: manipulation; overflow-x: hidden; scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
/* clip, not hidden: "hidden" on body turns it into a second scroll box with its own scrollbar. */
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { overflow-x: clip; }
body { font: 16px/1.4 var(--font); min-height: 100dvh; overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-user-select: none; user-select: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Auth ---------- */
.auth { display: grid; place-items: center; min-height: 100dvh; padding: calc(24px + var(--safe-t)) 20px 24px; }
.auth-card { width: 100%; max-width: 360px; text-align: center; }
.logo { width: 72px; height: 72px; border-radius: 24px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 38px; font-weight: 800; background: var(--accent-soft); color: var(--accent); transform: rotate(-4deg); }
.auth h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.01em; }
.auth form { display: grid; gap: 10px; }
.btn.google { margin-top: 26px; background: var(--text); color: #000; border-color: var(--text); }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--faint); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { min-height: 20px; font-size: 14px; color: var(--muted); margin: 4px 0 0; }
.msg.error { color: var(--red); }
.small-link { font-size: 14px; color: var(--muted); font-weight: 500; justify-self: center; }

/* ---------- Inputs & buttons ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], select {
  width: 100%; padding: 14px 15px; border-radius: 14px; border: 1px solid var(--hair); background: var(--field);
  outline: none; font-size: 16px; -webkit-appearance: none; appearance: none;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus { border-color: var(--line); background: var(--field-2); }
input[type="date"] { min-height: 50px; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9aa1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 20px; padding-right: 40px;
}
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 12px 16px;
  border-radius: 18px; border: 1px solid var(--hair); background: var(--card); font-weight: 700; margin-top: 10px;
  transition: transform .25s var(--ease-out), opacity .15s ease, filter .15s ease;
}
.btn:active { transform: scale(0.97); filter: brightness(.92); transition-duration: .08s; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 600; }
.btn.danger { background: transparent; color: var(--red); border-color: transparent; }
.btn.danger.solid { background: var(--red); color: #1a0504; border-color: var(--red); }
.btn.dashed { background: transparent; border: 1px dashed #3a3a3e; color: var(--accent); justify-content: flex-start; }
.btn svg { width: 20px; height: 20px; stroke-width: 2.6; }
.btn:disabled { opacity: 0.45; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 0; }

/* ---------- Layout ---------- */
/* overflow: clip keeps the sliding page (and its backing) from ever making the page taller or wider. */
.view { max-width: 560px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 20px calc(120px + var(--safe-b)); min-height: 100dvh; overflow: clip; }
.page { position: relative; display: flex; flex-direction: column; gap: 24px; }

/* ---- Page transitions ----
   Tab switch: the new page rises in, its sections a few ms apart.
   Push: new page slides in from the right over the old one, which drifts left and dims (a "ghost" copy
   of the old page, made in app.js, plays that part). Pop: the reverse. */
.page.enter-tab > * { animation: rise .34s var(--ease-out) both; }
.page.enter-tab > *:nth-child(2) { animation-delay: .03s; }
.page.enter-tab > *:nth-child(3) { animation-delay: .06s; }
.page.enter-tab > *:nth-child(4) { animation-delay: .09s; }
.page.enter-tab > *:nth-child(n+5) { animation-delay: .12s; }
.page.enter-push { animation: push-in .42s var(--ease-sheet) both; }
.page.enter-pop { animation: pop-in .42s var(--ease-sheet) both; }
/* The sliding page carries its own black backing (wider than the page, to cover the side gutters)
   so it cleanly covers the page underneath while it slides. */
.page.enter-push::before, .page.swiping::before, .nav-ghost.pop .page::before {
  content: ""; position: absolute; z-index: -1; top: -100vh; bottom: -100vh; left: -20px; right: -20px;
  background: var(--bg); box-shadow: -18px 0 40px rgba(0, 0, 0, .55);
}
.page.enter-push, .page.swiping, .nav-ghost.pop .page { isolation: isolate; }
.page.swiping { will-change: transform; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes push-in { from { transform: translateX(100vw); } to { transform: none; } }
@keyframes pop-in { from { transform: translateX(-28%); opacity: .5; } to { transform: none; opacity: 1; } }

.nav-ghost { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.nav-ghost > .view { position: absolute; left: 0; right: 0; min-height: 0; }
.nav-ghost.push { z-index: 0; animation: ghost-push .42s var(--ease-sheet) both; }
.nav-ghost.pop { z-index: 5; animation: ghost-pop .42s var(--ease-sheet) both; }
.nav-ghost.tab { z-index: 0; animation: ghost-fade .16s ease-out both; }
.nav-ghost.under { z-index: 0; }
#view { position: relative; z-index: 1; }
@keyframes ghost-push { to { transform: translateX(-28%); opacity: .45; } }
@keyframes ghost-pop { to { transform: translateX(100%); } }
@keyframes ghost-fade { to { opacity: 0; } }

/* Bars and meters fill in when a page appears (not on background refreshes). */
.page.enter-tab .bar > span, .page.enter-push .bar > span, .page.enter-pop .bar > span,
.page.enter-tab .segbar > span, .page.enter-push .segbar > span {
  transform-origin: left center; animation: fill .7s var(--ease-out) .12s both;
}
@keyframes fill { from { transform: scaleX(0); } }
.hello { font-size: 15px; color: var(--muted); margin-bottom: -20px; padding-top: 32px; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 32px; }
.hello + .title-row { padding-top: 0; }
.title-row h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.avatar { width: 38px; height: 38px; border-radius: 19px; border: 0; background: var(--accent-soft); color: var(--accent); font-size: 17px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.icon-btn { width: 38px; height: 38px; border-radius: 19px; border: 0; background: #16161a; color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.icon-btn svg { width: 19px; height: 19px; }
.backbar { display: flex; justify-content: space-between; align-items: center; height: 44px; margin-bottom: -12px; }
.backbar button { border: 0; background: none; color: var(--accent); font-size: 16px; font-weight: 600; padding: 0; display: flex; align-items: center; gap: 2px; }
.backbar .back svg { width: 22px; height: 22px; margin-left: -6px; stroke-width: 2.2; }

.big { font-size: 56px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.big.md { font-size: 26px; }
.big.sm { font-size: 22px; }
.caption { font-size: 14px; color: var(--muted); }

.section-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 4px; }
.section-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.section-head span, .section-head button { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.section-head button { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; }
.note { font-size: 13px; color: var(--muted); padding-top: 8px; }

/* rows */
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 0;
  border: 0; border-bottom: 1px solid var(--hair); background: transparent; color: var(--text); text-align: left;
}
.row:last-child { border-bottom: 0; }
.row.slim { min-height: 52px; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub .pill { margin-top: 2px; }
.row .amt { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .amt.credit { color: var(--accent); }
.row .amt.transfer { color: var(--muted); }
.row .val { font-size: 15px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .chev, .frow .chev { width: 13px; height: 13px; flex-shrink: 0; background: no-repeat center / 13px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a4a50' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E"); }
/* Press feedback: list rows get a soft rounded highlight that reaches a little past the text
   (like iOS list cells) instead of just going see-through; it snaps on and eases off. */
.row, .brow, .picker-row, .radio-row, .frow { position: relative; }
.row::after, .brow::after, .picker-row::after, .radio-row::after, .frow::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -12px; right: -12px; border-radius: 14px;
  background: rgba(255, 255, 255, .055); opacity: 0; pointer-events: none; transition: opacity .35s ease;
}
.field-card .frow::after { left: -18px; right: -18px; border-radius: 0; }
.row:active::after, .brow:active::after, .picker-row:active::after, .radio-row:active::after, .frow:active::after { opacity: 1; transition-duration: 0s; }
/* Cards, chips and small buttons give a little squeeze. */
.mcard, .stat, .choice, .chip, .tile, .fchip, .mchip, .seg2 button, .icon-btn, .avatar, .pill-btn, .x-btn, .color-row button, .reward-box, .tip {
  transition: transform .3s var(--ease-out), background-color .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}
.mcard:active, .stat:active, .choice:active, .reward-box:active { transform: scale(.97); transition-duration: .1s; }
.chip:active, .tile:active, .fchip:active, .mchip:active, .seg2 button:active, .icon-btn:active, .avatar:active,
.pill-btn:active, .x-btn:active, .color-row button:active { transform: scale(.93); transition-duration: .1s; }
.backbar button, .section-head button, .link, .nav-btn, .danger-link, .name-edit { transition: opacity .25s ease; }
.backbar button:active, .section-head button:active, .link:active, .nav-btn:active, .danger-link:active, .name-edit:active { opacity: .5; transition-duration: 0s; }
.row.danger .title { color: var(--red); font-weight: 600; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--hair); }
.kv:last-child { border-bottom: 0; }
.kv span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* bubbles (icons in tinted circles) */
.bub { width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; flex-shrink: 0; font-size: 17px; line-height: 1; }
.bub svg { width: 18px; height: 18px; }
.bub.s { width: 32px; height: 32px; border-radius: 16px; }
.bub.s svg { width: 16px; height: 16px; }
.bub.xs { width: 28px; height: 28px; border-radius: 14px; }
.bub.xs svg { width: 14px; height: 14px; }
.bub.grey { background: var(--grey-soft); color: var(--muted); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.pill svg { width: 12px; height: 12px; stroke-width: 2.4; }
.pill.red { color: var(--red); background: var(--red-soft); }
.pill.amber { color: var(--amber); background: var(--amber-soft); }
.pill.grey { color: var(--muted); background: var(--grey-soft); }
.pill.accent { color: var(--accent); background: var(--accent-soft); }

/* bars */
.bar { height: 6px; border-radius: 3px; background: #1f1f23; overflow: hidden; }
.bar.thick { height: 8px; border-radius: 4px; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.bar > span.red { background: var(--red); }
.bar > span.amber { background: var(--amber); }
.segbar { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; background: #1f1f23; }

/* Home */
.hero { display: flex; flex-direction: column; gap: 14px; }
.hero-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.budget-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.budget-line b { font-weight: 700; }
.budget-line b.amber { color: var(--amber); } .budget-line b.red { color: var(--red); } .budget-line b.accent { color: var(--accent); }
.carousel { display: flex; gap: 10px; margin: 6px -20px 0; padding: 0 20px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.mcard {
  flex-shrink: 0; width: 148px; height: 138px; padding: 14px; border-radius: 22px; background: var(--card); border: 1px solid var(--hair);
  color: var(--text); display: flex; flex-direction: column; justify-content: space-between; text-align: left; scroll-snap-align: start;
}
.mcard .mtop { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mcard small { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.dots { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.dots span { width: 10px; height: 10px; border-radius: 5px; background: #3a3a3e; }
.dots span.red { background: var(--red); } .dots span.amber { background: var(--amber); } .dots span.ok { background: var(--accent); }
.allgood { display: flex; align-items: center; gap: 10px; padding: 14px 0; color: var(--muted); font-size: 15px; }
.compare { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.compare svg { width: 14px; height: 14px; stroke-width: 2.6; flex-shrink: 0; }
.compare.less svg, .compare.less b { color: var(--accent); }
.compare.more svg, .compare.more b { color: var(--amber); }
.compare b { font-weight: 700; }
/* This month: 2×2 tiles */
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mgrid .mcard { width: auto; height: 96px; padding: 13px 14px; border-radius: 20px; min-width: 0; }
.mcard .mlabel { font-size: 13px; font-weight: 600; color: var(--muted); }
.mcard .mval { display: block; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard .mval.accent { color: var(--accent); } .mcard .mval.red { color: var(--red); }
.mcard .msub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Activity */
.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 14px; background: var(--field); }
.search svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search input { border: 0; background: transparent; padding: 0; height: 100%; border-radius: 0; }
.search input:focus { background: transparent; }
.filters { display: flex; gap: 8px; overflow-x: auto; margin: -8px -20px 0; padding: 0 20px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.fchip { flex-shrink: 0; height: 32px; padding: 0 11px; border-radius: 16px; border: 1px solid var(--hair); background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 4px; max-width: 70%; }
.fchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip svg { width: 12px; height: 12px; stroke-width: 2.4; flex-shrink: 0; }
.fchip.on { border-color: var(--accent); background: var(--accent-softer); color: var(--accent); }
.fchip.clear { border-color: transparent; color: var(--accent); }
.inout { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -8px; }
.inout span { display: flex; align-items: center; gap: 4px; }
.inout svg { width: 13px; height: 13px; stroke-width: 2.4; }
.inout b { color: var(--text); } .inout b.in { color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 28px 8px; font-size: 15px; }
.io-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: -6px; }
.io { padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--hair); min-width: 0; }
.io span { display: block; font-size: 12px; color: var(--muted); }
.io b { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.io.in b { color: var(--accent); }
.io-note { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }

/* Accounts */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--hair); min-width: 0; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 10px; }
.stat .big { font-size: 24px; overflow: hidden; text-overflow: ellipsis; }

/* Card page */
.card-head { display: flex; flex-direction: column; gap: 8px; }
.card-name { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.reward-box { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 18px; background: var(--accent-softer); }
.reward-box .rules { font-size: 12px; color: var(--muted); text-align: right; line-height: 1.4; }

/* Spending */
.months { display: flex; gap: 8px; align-items: center; margin: -8px -20px 0; padding: 0 20px; overflow-x: auto; scrollbar-width: none; }
.months::-webkit-scrollbar { display: none; }
.months .sep { width: 1px; height: 20px; background: var(--line); flex-shrink: 0; }
.mchip { flex-shrink: 0; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--hair); background: var(--card); color: var(--muted); font-size: 14px; font-weight: 600; }
.mchip.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.mchip.future { border-style: dashed; background: transparent; color: #4a4a50; }
.mchip.year { border: 0; background: var(--field-2); color: var(--text); font-weight: 800; display: flex; align-items: center; gap: 3px; padding: 0 10px 0 12px; }
.mchip.year svg { width: 13px; height: 13px; stroke-width: 2.4; color: var(--muted); }
/* month stepper: ‹ September › */
.mstep { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -6px; }
.mstep-btn { width: 40px; height: 40px; border-radius: 20px; border: 0; padding: 0; background: var(--group); color: var(--text); display: grid; place-items: center; transition: transform .3s var(--ease-out), opacity .2s ease; }
.mstep-btn svg { width: 18px; height: 18px; stroke-width: 2.4; }
.mstep-btn:disabled { opacity: .3; }
.mstep-btn:not(:disabled):active { transform: scale(.9); transition-duration: .1s; }
.mstep-mid { text-align: center; min-width: 0; }
.mstep-name { font-size: 22px; font-weight: 800; }
.from-l { animation: from-l .35s var(--ease-out) both; }
.from-r { animation: from-r .35s var(--ease-out) both; }
@keyframes from-l { from { opacity: 0; transform: translateX(-18px); } }
@keyframes from-r { from { opacity: 0; transform: translateX(18px); } }
.spend-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.spend-total .big.md { font-size: 40px; }
.segbar.big { height: 12px; border-radius: 6px; gap: 3px; margin-top: 12px; }
.brow { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--hair); width: 100%; border-top: 0; border-left: 0; border-right: 0; background: transparent; color: var(--text); text-align: left; }
.brow:last-child { border-bottom: 0; }
.brow .grow { flex: 1; min-width: 0; }
.brow .head { display: flex; justify-content: space-between; gap: 10px; font-size: 16px; }
.brow .head b { font-weight: 700; font-variant-numeric: tabular-nums; }
.brow .bar { margin-top: 8px; }
.brow .foot { margin-top: 7px; font-size: 12px; color: var(--muted); }

/* Profile */
.me { display: flex; align-items: center; gap: 14px; }
.me .avatar { width: 60px; height: 60px; border-radius: 30px; font-size: 26px; }
.name-edit { display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; color: var(--text); max-width: 100%; }
.name-edit .name { font-size: 22px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-edit svg { width: 15px; height: 15px; color: var(--faint); flex-shrink: 0; }
.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; border-radius: 99px; border: 0; background: #39393d; transition: background .2s ease; padding: 0; }
.switch span { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform .4s var(--ease-spring); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(20px); }
.switch:disabled { opacity: .4; }
.footer-note { text-align: center; font-size: 12px; color: var(--faint); }

/* ---------- Tab bar + add button ---------- */
.tabbar {
  position: fixed; z-index: 20; left: 20px; right: 96px; bottom: calc(18px + var(--safe-b) + var(--vvb)); height: 64px; border-radius: 32px;
  background: rgba(24, 24, 28, 0.86); border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-around;
  padding: 0 8px; backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  transition: transform .45s var(--ease-sheet), opacity .3s ease;
}
/* The active tab's pill grows to show its label; the label slides out of the icon rather than popping in. */
.tabbar button {
  height: 44px; border: 0; border-radius: 22px; background: transparent; color: #7c7c84; display: flex; align-items: center; justify-content: center;
  padding: 0 12px; font-size: 14px; font-weight: 700; overflow: hidden;
  transition: background-color .3s ease, color .3s ease, padding .4s var(--ease-out), transform .3s var(--ease-out);
}
.tabbar button svg { width: 22px; height: 22px; stroke-width: 1.9; flex-shrink: 0; }
.tabbar button span { max-width: 0; opacity: 0; white-space: nowrap; overflow: hidden; margin-left: 0; transition: max-width .4s var(--ease-out), opacity .25s ease, margin .4s var(--ease-out); }
.tabbar button.active { background: var(--accent-soft); color: var(--accent); padding: 0 16px 0 13px; }
.tabbar button.active span { max-width: 90px; opacity: 1; margin-left: 7px; }
.tabbar button.active svg { animation: icon-pop .45s var(--ease-spring); }
@keyframes icon-pop { 40% { transform: scale(.82); } 100% { transform: none; } }
.fab {
  position: fixed; z-index: 21; right: 20px; bottom: calc(18px + var(--safe-b) + var(--vvb)); width: 64px; height: 64px; border-radius: 32px; border: 0;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 0 0 var(--accent-soft);
  transition: transform .45s var(--ease-sheet), box-shadow .3s ease, opacity .3s ease;
}
.fab svg { width: 28px; height: 28px; stroke-width: 2.8; transition: transform .35s var(--ease-spring); }
.fab:active { transform: scale(.9); transition-duration: .12s; }
.fab:active svg { transform: rotate(90deg); }
.tabbar button:active { transform: scale(.9); transition-duration: .1s; }
/* Scrolling down a long page tucks the bar and + button away; scrolling up (or reaching the end) brings them back. */
.tabbar.away { transform: translateY(calc(100% + 30px + var(--safe-b))); }
.fab.away { transform: translateY(calc(100% + 30px + var(--safe-b))) rotate(45deg); }
@media (min-width: 600px) { .tabbar { left: calc(50% - 260px); right: calc(50% - 184px); } .fab { right: calc(50% - 260px); } }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; z-index: 19; top: 0; left: 0; right: 0; padding-top: var(--safe-t); pointer-events: none;
  /* Always-on scrim behind the status bar (clock/battery), fading into the page just below it. */
  background: linear-gradient(to bottom, #000 0, #000 var(--safe-t), rgba(0, 0, 0, 0) calc(var(--safe-t) + 14px));
}
.topbar::before {
  content: ""; position: absolute; inset: 0; background: rgba(10, 10, 12, .78);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid var(--hair); opacity: 0; transition: opacity .25s ease;
}
.tb-inner {
  position: relative; max-width: 560px; margin: 0 auto; height: var(--topbar-h); padding: 0 20px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px;
}
.tb-title {
  font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw;
  opacity: 0; transform: translateY(8px); transition: opacity .25s ease, transform .35s var(--ease-out);
}
.tb-left, .tb-right { display: flex; align-items: center; opacity: 0; transition: opacity .25s ease; }
.tb-right { justify-content: flex-end; }
.tb-left button, .tb-right button { border: 0; background: none; color: var(--accent); font-size: 16px; font-weight: 600; padding: 0; display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.tb-left .back svg { width: 22px; height: 22px; margin-left: -6px; stroke-width: 2.2; }
.topbar.show { pointer-events: auto; }
.topbar.show::before, .topbar.show .tb-title, .topbar.show .tb-left, .topbar.show .tb-right { opacity: 1; }
.topbar.show .tb-title { transform: none; }

/* ---------- Add / edit sheet ---------- */
.compose { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55); animation: fade .3s ease-out both; }
.compose-card {
  position: absolute; left: 0; right: 0; bottom: 0; top: calc(10px + var(--safe-t)); max-width: 560px; margin: 0 auto;
  background: var(--raised); border-radius: 20px 20px 0 0; border-top: 1px solid var(--hair);
  display: flex; flex-direction: column; overflow: hidden;
  animation: sheet-up .5s var(--ease-sheet) both; will-change: transform;
}
/* Header: a fixed block above the scrolling form — never moves, always has its hairline. */
.compose-head { flex-shrink: 0; border-bottom: 1px solid #1c1c1f; touch-action: none; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: #3a3a3e; margin: 7px auto 0; }
.sheet-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; padding: 6px 20px 14px; margin-top: 2px; }
.sheet-nav h2 { margin: 0; font-size: 17px; font-weight: 700; text-align: center; }
.nav-btn { justify-self: start; border: 0; background: none; color: var(--muted); font-size: 16px; font-weight: 500; padding: 0; }
.pill-btn { justify-self: end; height: 34px; padding: 0 16px; border-radius: 17px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 800; }
.pill-btn:disabled, .pill-btn.dim { opacity: .45; }
.compose-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding: 0 20px calc(28px + var(--safe-b));
}
.compose-body::-webkit-scrollbar { display: none; }
/* Spent / Received: one pill slides between the two options instead of two backgrounds swapping. */
.type-toggle {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: max-content; margin: 18px auto 0;
  padding: 3px; border-radius: 14px; background: var(--field-2);
}
.type-toggle::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 5px); border-radius: 11px;
  background: var(--red-soft); transition: transform .45s var(--ease-spring), background-color .3s ease;
}
.type-toggle[data-on="credit"]::before { transform: translateX(calc(100% + 4px)); background: var(--accent-soft); }
.seg { position: relative; border: 0; height: 32px; padding: 0 18px; border-radius: 11px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; transition: color .3s ease; }
.seg svg { width: 14px; height: 14px; stroke-width: 2.4; }
.seg.active { font-weight: 700; }
.seg.active[data-type="debit"] { color: var(--red); }
.seg.active[data-type="credit"] { color: var(--accent); }
.amount-wrap { display: flex; align-items: baseline; justify-content: center; gap: 4px; padding: 26px 0 30px; min-height: 76px; cursor: text; }
.rupee { font-size: 30px; font-weight: 600; color: var(--muted); transition: color .3s ease; }
.compose.has-amount .rupee { color: var(--text); }
#amount {
  border: 0; background: transparent; outline: none; padding: 0; min-width: 1ch; max-width: 100%; border-radius: 0;
  font-size: 68px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; caret-color: var(--accent); text-align: left;
}
#amount:focus { background: transparent; }
#amount::placeholder { color: #3a3a3e; }
#amount.nudge { animation: nudge .4s var(--ease-out); }
@keyframes nudge { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.form { display: flex; flex-direction: column; }
/* Note in one card, Category / Account / Date in another — two clear sections with room between them. */
.field-card { background: var(--group); border-radius: 20px; padding: 0 18px; overflow: hidden; }
.field-card:first-child { padding-top: 4px; padding-bottom: 4px; }
.field-card + .field-card { margin-top: 22px; }
.field-card + #add-tip, .form > #add-tip { margin-top: 20px; }
.form > #add-tip:empty { margin-top: 0; }
.frow { display: flex; align-items: center; gap: 14px; min-height: 64px; width: 100%; padding: 0; border: 0; border-bottom: 1px solid var(--hair); background: transparent; color: var(--text); text-align: left; }
.frow.no-line { border-bottom: 0; }
.frow input[type="text"] { border: 0; background: transparent; padding: 0; height: 64px; border-radius: 0; font-size: 17px; font-weight: 500; }
.field-card .bub { width: 40px; height: 40px; border-radius: 20px; }
.field-card .bub svg { width: 18px; height: 18px; }
.frow .fval { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; font-size: 16px; font-weight: 500; }
.frow .fval .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .fval .placeholder { color: var(--faint); }
.frow .fval .extra { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.frow .flabel { font-size: 15px; color: var(--faint); font-weight: 500; white-space: nowrap; }
.date-row input[type="date"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; z-index: 1; }
/* Suggestions open and close smoothly instead of shoving the rows below them. */
.chips-row {
  display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 0 0 16px; margin: 0 -18px; padding-left: 18px; padding-right: 18px;
  scrollbar-width: none; max-height: 50px; opacity: 1; transition: max-height .3s var(--ease-out), opacity .2s ease, padding .3s var(--ease-out);
}
.chips-row:empty { max-height: 0; opacity: 0; padding-bottom: 0; }
.chips-row::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: var(--field-2); color: var(--text); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; animation: chip-in .3s var(--ease-out) both; }
.chip:nth-child(2) { animation-delay: .03s; } .chip:nth-child(3) { animation-delay: .06s; } .chip:nth-child(n+4) { animation-delay: .09s; }
.chip svg { width: 13px; height: 13px; color: var(--faint); }
.chip.on { border-color: var(--accent); background: var(--accent-softer); color: var(--accent); }
@keyframes chip-in { from { opacity: 0; transform: scale(.9); } }
.tiles {
  display: flex; gap: 8px; padding: 12px 0 18px; flex-wrap: wrap;
  max-height: 90px; opacity: 1; overflow: hidden; transition: max-height .3s var(--ease-out), opacity .2s ease, padding .3s var(--ease-out);
}
.tiles:empty { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
.tile { height: 32px; padding: 0 13px 0 7px; border-radius: 16px; border: 1px dashed #3a3a3e; background: var(--raised); color: var(--muted); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; max-width: 48%; animation: chip-in .3s var(--ease-out) both; }
.tile:nth-child(2) { animation-delay: .04s; }
.tile span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .bub, .field-card .tile .bub { width: 20px; height: 20px; border-radius: 10px; font-size: 11px; }
.tile .bub svg, .field-card .tile .bub svg { width: 11px; height: 11px; }
.fval .bub { transition: background-color .3s ease, color .3s ease; }
.fval.changed .bub { animation: icon-pop .45s var(--ease-spring); }
#add-tip .tip { animation: rise .35s var(--ease-out) both; }

/* ---- Add sheet, compact layout (fits above the phone keyboard) ---- */
.compose .amount-wrap { padding: 22px 0 10px; min-height: 0; transition: padding .3s var(--ease-out); }
#amount { transition: font-size .3s var(--ease-out); }
.add-budget { min-height: 20px; padding: 0 12px 18px; text-align: center; font-size: 13px; color: var(--muted); transition: color .3s ease, opacity .25s ease; }
.add-budget b { color: var(--accent); font-weight: 700; }
.add-budget.warn b { color: var(--amber); }
.add-budget.over, .add-budget.over b { color: var(--red); }
.note-card.field-card, .field-card.note-card:first-child { padding: 0 16px; border-radius: 16px; }
.note-card .frow { min-height: 54px; gap: 12px; }
.note-card .frow::after { display: none; }
.note-card .note-ic { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.note-card input[type="text"] { height: 54px; font-size: 16px; }
.note-block.open .note-card { box-shadow: inset 0 0 0 1.5px var(--accent-soft); }
.note-sugg { display: none; padding-top: 14px; }
.note-block.open.has-sugg .note-sugg { display: block; animation: rise .3s var(--ease-out) both; }
.nsugg-list { background: var(--group); border-radius: 18px; padding: 0 14px; }
.nsug { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 6px 0; border: 0; border-bottom: 1px solid var(--hair); background: transparent; color: var(--text); text-align: left; }
.nsug:last-child { border-bottom: 0; }
.nsug .bub { width: 34px; height: 34px; }
.nsug .grow { flex: 1; min-width: 0; }
.nsug .title { display: block; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nsug .sub { display: block; font-size: 13px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nsug .usual { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.nsug::after { content: ""; position: absolute; inset: 0 -14px; background: rgba(255,255,255,.05); opacity: 0; transition: opacity .35s ease; pointer-events: none; }
.nsug:active::after { opacity: 1; transition-duration: 0s; }
/* while typing a note, the amount steps back to one small line so the suggestions get the room */
.compose.noting .amount-wrap { padding: 10px 0 8px; }
.compose.noting #amount { font-size: 34px !important; }
.compose.noting .rupee { font-size: 20px; }
.compose.noting .add-budget { opacity: 0; min-height: 0; height: 0; padding: 0; overflow: hidden; }
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.pick {
  height: 58px; min-width: 0; padding: 0 12px; border: 0; border-radius: 16px; background: var(--group); color: var(--text);
  display: flex; align-items: center; text-align: left; transition: transform .3s var(--ease-out), background-color .2s ease;
}
.pick:active { transform: scale(.97); background: #1b1b20; transition-duration: .1s; }
.pick .fval { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.pick .fval .bub { width: 32px; height: 32px; border-radius: 16px; }
.pick .fval .bub svg { width: 16px; height: 16px; }
.pick .txt { min-width: 0; display: flex; flex-direction: column; }
.pick .lbl { font-size: 11px; font-weight: 600; color: var(--faint); }
.pick .name, .pick .placeholder { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .placeholder { color: var(--faint); }
.date-chips { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.dchip {
  position: relative; height: 34px; padding: 0 12px; border: 0; border-radius: 17px; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background-color .25s ease, color .25s ease, transform .3s var(--ease-out);
}
.dchip svg { width: 14px; height: 14px; stroke-width: 2.2; }
.dchip.on { background: var(--field-2); color: var(--text); }
.dchip:active { transform: scale(.94); transition-duration: .1s; }
.sheet .dchip input[type="date"], .dchip input[type="date"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; }
.add-reward { margin-left: auto; display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.add-reward svg { width: 13px; height: 13px; }
.add-reward:not(:empty) { animation: rise .3s var(--ease-out) both; }
.form > #add-tip:not(:empty) { margin-top: 16px; }
.tip { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--accent-softer); font-size: 13px; line-height: 1.5; width: 100%; border: 0; color: var(--text); text-align: left; }
.tip svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.tip b { color: var(--accent); }
.tip.warn { background: var(--amber-soft); } .tip.warn svg, .tip.warn b { color: var(--amber); }
.tip.over { background: var(--red-soft); } .tip.over svg, .tip.over b { color: var(--red); }
.tip .go { margin-left: auto; color: var(--accent); font-weight: 700; white-space: nowrap; }
.danger-link { margin-top: 18px; border: 0; background: none; color: var(--red); font-weight: 600; padding: 10px 0; }

/* ---------- Sheet (small modals) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 40; animation: fade .3s ease-out both; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto; max-height: 88dvh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--raised); border: 1px solid var(--hair); border-bottom: 0; border-radius: 24px 24px 0 0;
  animation: sheet-up .5s var(--ease-sheet) both; will-change: transform;
}
/* Handle + header: never scroll, always there. Drag it down to dismiss. */
.sheet-top { flex-shrink: 0; padding: 8px 20px 0; touch-action: none; }
.sheet .sheet-handle { margin: 0 auto; }
.sheet-head { display: grid; align-items: center; }
.sheet-head:empty { display: none; }
.sheet .sheet-head h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head.form { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; margin: 0 -20px; padding: 10px 20px 14px; border-bottom: 1px solid #1c1c1f; }
.sheet-head.form h2 { font-size: 17px; font-weight: 700; text-align: center; max-width: 56vw; }
.sheet-head.choose { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px 0 6px; }
.sheet-head.choose h2 { font-size: 22px; font-weight: 800; }
.sheet-x { width: 32px; height: 32px; border-radius: 16px; border: 0; padding: 0; background: #1f1f24; color: var(--muted); display: grid; place-items: center; transition: transform .3s var(--ease-out), background-color .2s ease; }
.sheet-x svg { width: 14px; height: 14px; stroke-width: 2.8; }
.sheet-x:active { transform: scale(.9); background: #29292f; transition-duration: .1s; }
.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding: 12px 20px calc(22px + var(--safe-b));
}
.sheet-body.after-form { padding-top: 20px; }
.sheet-body::-webkit-scrollbar { display: none; }
.sheet-body > .sub-h:first-child { margin-top: 0; }

/* Grouped rows, like iOS Settings: used by the card and budget sheets. */
.sheet form.grouped { display: block; }
.sheet form.grouped > * + * { margin-top: 20px; }
.sheet form.grouped > .group-label + .group, .sheet form.grouped > div > .group-label + .group { margin-top: 0; }
.group { background: var(--group); border-radius: 18px; padding: 0 16px; }
.group-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 0 4px 8px; }
.group-foot { font-size: 13px; line-height: 1.45; color: var(--faint); padding: 8px 4px 0; margin: 0; }
.sheet label.grow-row, .grow-row {
  display: flex; align-items: center; gap: 12px; min-height: 54px; border-bottom: 1px solid var(--hair);
  font-size: 16px; font-weight: 500; color: var(--text);
}
.group > .grow-row:last-child, .group > :last-child > .grow-row:last-child, .group .rules:empty + .grow-row { border-bottom: 0; }
.grow-row .grow { flex: 1; min-width: 0; }
.sheet input.plain, .sheet select.plain {
  background: transparent; border: 0; border-radius: 0; padding: 0; min-height: 0; height: 44px; font-size: 16px; font-weight: 500;
}
.sheet select.plain { flex: 1; min-width: 0; background-position: right 0 center; padding-right: 26px; }
.sheet input.plain.right { text-align: right; width: 110px; flex-shrink: 0; color: var(--muted); }
.sheet input.plain.right:focus { color: var(--text); }
.sheet input.plain.name-in { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; }
.pct { display: flex; align-items: center; gap: 2px; height: 34px; padding: 0 10px; border-radius: 10px; background: #1f1f24; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.sheet .pct input.plain { width: 40px; height: 34px; text-align: right; color: var(--text); font-weight: 600; }
.row-x { width: 30px; height: 30px; border-radius: 15px; border: 0; padding: 0; background: transparent; color: var(--faint); display: grid; place-items: center; flex-shrink: 0; }
.row-x svg { width: 16px; height: 16px; stroke-width: 2.6; }
.add-row { width: 100%; border: 0; background: transparent; padding: 0; color: var(--accent); font-size: 15px; font-weight: 600; text-align: left; }
.add-row svg { width: 17px; height: 17px; stroke-width: 2.6; }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border-radius: 14px; background: var(--field-2); position: relative; }
.seg3 button { height: 36px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; position: relative; z-index: 1; transition: color .25s ease; }
.seg3 button.on { color: var(--accent); font-weight: 700; }
.seg3::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 14px) / 3); border-radius: 11px; background: var(--accent-soft);
  transform: translateX(calc(var(--i, 0) * (100% + 4px))); transition: transform .45s var(--ease-spring);
}
.group.colors { display: flex; justify-content: space-between; gap: 4px; padding: 14px 16px; }
.group.colors button { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; border: 0; padding: 0; }
.group.colors button.active { box-shadow: 0 0 0 2px var(--group), 0 0 0 4px var(--text); }
.danger-link.center { display: block; width: 100%; text-align: center; }

/* Budgets sheet */
.bsum { text-align: center; }
.bsum .big { font-size: 34px; }
.bsum .big small { font-size: 17px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.bline { padding: 14px 0; border-bottom: 1px solid var(--hair); }
.bline:last-child { border-bottom: 0; }
.bline .top { display: flex; align-items: center; gap: 12px; }
.bline .nm { flex: 1; min-width: 0; }
.bline .nm b { display: block; font-size: 16px; font-weight: 500; }
.bline .nm small { display: block; font-size: 13px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bline .nm small.warn { color: var(--amber); } .bline .nm small.over { color: var(--red); }
.bline .amt-in { display: flex; align-items: center; height: 38px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--field-2); flex-shrink: 0; }
.bline .amt-in span { color: var(--muted); font-weight: 600; }
.sheet .bline .amt-in input { width: 58px; height: 36px; border: 0; background: transparent; padding: 0 0 0 2px; border-radius: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.bline .bar { margin: 12px 0 0 48px; height: 5px; }
.bline.new { animation: rise .35s var(--ease-out) both; }
.bchips { display: flex; flex-wrap: wrap; gap: 8px; }
.bchip { height: 36px; padding: 0 12px 0 10px; border-radius: 18px; border: 1px dashed #3a3a3e; background: transparent; color: var(--text); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: transform .3s var(--ease-out), opacity .2s ease; }
.bchip svg { width: 14px; height: 14px; stroke-width: 2.6; color: var(--accent); }
.bchip span { color: var(--faint); }
.bchip:active { transform: scale(.94); transition-duration: .1s; }

/* Picker: recent picks as big tiles above the full list */
.picker-recent { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 18px; }
.picker-tile {
  height: 78px; border-radius: 16px; border: 1px solid var(--hair); background: var(--group); color: var(--text); padding: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 500;
  transition: transform .3s var(--ease-out);
}
.picker-tile span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-tile.selected { border: 2px solid var(--accent); background: var(--accent-softer); font-weight: 700; }
.picker-tile:active { transform: scale(.95); transition-duration: .1s; }
.picker-list .pill { margin-left: 6px; }
/* Sheet content eases in just behind the sheet itself, so a new sheet reads as one motion, not a pop. */
#sheet-body > * { animation: rise .4s var(--ease-out) .06s both; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { from { transform: translateY(var(--drag, 0px)); } to { transform: translateY(100%); } }
@keyframes up { from { transform: translateY(24px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: var(--from-o, 1); } to { opacity: 0; } }
/* Exit copies of sheets / the add sheet / toasts (made in app.js) play the closing motion while the real
   element is already gone, so the app's state is never stuck waiting on an animation. */
.exit { pointer-events: none !important; }
.exit.sheet, .exit .compose-card { animation: sheet-down .34s var(--ease-sheet) both; }
.exit.sheet-backdrop, .exit.compose { animation: fade-out .3s ease both; }
.exit.compose { background: rgba(0,0,0,.55); }
.exit.toast { animation: toast-out .22s ease-in both; }
@keyframes toast-out { to { opacity: 0; transform: translateX(-50%) translateY(10px) scale(.96); } }
.sheet-handle { width: 36px; height: 5px; border-radius: 3px; background: #3a3a3e; margin: 0 auto 14px; }
.sheet .sheet-handle, .compose-head { cursor: grab; }
.sheet h2 { font-size: 22px; font-weight: 800; margin: 0 0 14px; }
.sheet .sub-h { margin: -10px 0 16px; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sheet form { display: grid; gap: 12px; }
.sheet label { font-size: 13px; color: var(--muted); font-weight: 600; display: grid; gap: 6px; }
.sheet input, .sheet select { background: var(--field-2); border-color: var(--line); }
.sheet .q { font-size: 13px; font-weight: 600; color: var(--muted); margin: 6px 0 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help { font-size: 13px; color: var(--faint); font-weight: 500; margin: -4px 0 0; }
.section-title { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.rules { display: grid; gap: 8px; }
.rule { display: grid; grid-template-columns: 1fr 76px 44px; gap: 8px; align-items: center; }
.rule input { text-align: center; padding-left: 8px; padding-right: 8px; }
.x-btn { height: 48px; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 20px; }
.color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-row button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; }
.color-row button.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--raised) inset; }
.choice-row { display: flex; gap: 8px; }
.choice {
  flex: 1 1 0; min-width: 0; min-height: 64px; border-radius: 16px; border: 1px solid var(--hair); background: var(--field);
  color: var(--text); text-align: left; padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.choice small { font-size: 12px; color: var(--muted); }
.choice b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choice.on { border: 2px solid var(--accent); background: var(--accent-softer); }
.radio-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; border: 0; border-bottom: 1px solid var(--hair); background: transparent; color: var(--text); text-align: left; padding: 0; }
.radio-row .grow { flex: 1; min-width: 0; }
.radio-row .title { font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.radio-row .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.radio { width: 22px; height: 22px; border-radius: 11px; border: 2px solid #3a3a3e; flex-shrink: 0; display: grid; place-items: center; }
.radio-row.on .radio { border: 0; background: var(--accent); color: var(--accent-ink); }
.radio svg { width: 14px; height: 14px; stroke-width: 3; }
.radio-row:not(.on) .radio svg { display: none; }
.budget-list { display: grid; }
.budget-row { display: grid !important; grid-template-columns: 1fr 120px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--hair); }
.budget-row .name { font-size: 15px; color: var(--text); font-weight: 600; display: flex; gap: 10px; align-items: center; min-width: 0; }
.budget-row .name .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-row .last { display: block; font-size: 12px; color: var(--faint); font-weight: 500; }
.budget-row input { text-align: right; }
.sheet p.body { color: var(--muted); font-size: 15px; margin: 0 0 6px; }
.amt-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.seg2 { display: flex; gap: 4px; padding: 3px; border-radius: 14px; background: var(--field-2); }
.seg2 button { flex: 1; height: 38px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg2 button.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* picker */
.picker-search { margin-bottom: 10px; }
.picker-list { display: grid; }
.picker-group { font-size: 13px; color: var(--muted); font-weight: 700; padding: 14px 0 4px; }
.picker-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 6px 0; border: 0; border-bottom: 1px solid var(--hair); background: transparent; text-align: left; color: var(--text); }
.picker-row .grow { flex: 1; min-width: 0; display: grid; }
.picker-row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-row .sub { font-size: 13px; color: var(--muted); }
.picker-row .check { width: 20px; height: 20px; color: var(--accent); stroke-width: 2.6; }
.picker-row.selected .title { color: var(--accent); font-weight: 700; }
.picker-add { color: var(--accent); background: transparent; border: 1px dashed #3a3a3e; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b) + var(--vvb)); z-index: 50;
  background: #26262b; color: var(--text); border: 1px solid var(--line); padding: 12px 16px; border-radius: 16px; font-size: 15px; font-weight: 500;
  display: flex; gap: 16px; align-items: center; max-width: calc(100% - 32px); white-space: nowrap; box-shadow: 0 10px 30px rgba(0,0,0,.6);
  animation: toast-in .45s var(--ease-spring) both; pointer-events: none;
  transition: bottom .45s var(--ease-sheet);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(.94); } to { opacity: 1; transform: translateX(-50%); } }
/* When the tab bar has tucked away, the toast sits lower, where the bar was. */
body.bars-away .toast { bottom: calc(24px + var(--safe-b) + var(--vvb)); }
.toast button { pointer-events: auto; background: none; border: 0; color: var(--accent); font-weight: 800; padding: 0; }
.toast span { overflow: hidden; text-overflow: ellipsis; }
.setup-warning { position: fixed; top: 0; left: 0; right: 0; z-index: 60; padding: 12px 16px; padding-top: calc(12px + var(--safe-t)); background: #3a2a05; color: #fde68a; font-size: 14px; text-align: center; }

/* fixes after first render */
.row .title, .row .sub, .radio-row .sub { display: block; }
.row .sub.wrap, #reminder-sub { white-space: normal; }
.radio-row .title { display: flex; }
.sheet label.frow { display: flex; font-size: 16px; color: var(--text); font-weight: 500; gap: 12px; }
.sheet .frow .flabel { font-weight: 500; }
.reward-box > div:nth-child(2) { min-width: 0; }
.reward-box .caption { white-space: nowrap; }
.reward-box .rules { max-width: 52%; }
.page, .view { min-width: 0; }
#history { display: grid; gap: 18px; }

/* People who've asked their phone for less motion get instant changes (fades at most). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .nav-ghost { display: none; }
}
