/* ===== Design tokens ===== */
:root {
  --brand: #3F8F6B; --brand-2: #2F7558; --brand-3: #5DAA86; --brand-ink: #fff;
  --brand-grad: linear-gradient(135deg, #4FA27C 0%, #2F7558 100%);
  --accent: #FFC93C; --accent-2: #FFB31A; --accent-ink: #3B2C00;
  --accent-grad: linear-gradient(135deg, #FFD45C 0%, #FFB31A 100%);
  --bg: #F3F4F1; --card: #FFFFFF; --card-2: #F7F8F6; --text: #1C211E; --muted: #848C87; --line: #E9ECE8;
  --danger: #E5533D; --ok: #24A06B; --chip: #EDF2EE; --chip-ink: #2E5E47;
  --shadow-sm: 0 1px 2px rgba(22, 40, 30, .05), 0 2px 8px rgba(22, 40, 30, .05);
  --shadow: 0 2px 4px rgba(22, 40, 30, .04), 0 8px 24px rgba(22, 40, 30, .07);
  --shadow-lg: 0 10px 40px rgba(22, 40, 30, .18);
  --r-sm: 12px; --r: 20px; --r-lg: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.16, 1, .3, 1);
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 68px;
  color-scheme: light;
}
:root.dark {
  --brand: #3E8C68; --brand-2: #2A684E; --brand-3: #57A07E;
  --brand-grad: linear-gradient(135deg, #357D5D 0%, #22553F 100%);
  --bg: #0F1311; --card: #1A1F1C; --card-2: #212723; --text: #E9EEEA; --muted: #8B958F; --line: #2A312D;
  --chip: #232C27; --chip-ink: #9FD4B9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 6px 20px rgba(0,0,0,.35); --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.4 Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; font-feature-settings: "tnum" 1, "cv11" 1; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
input, select, textarea { font: inherit; color: var(--text); }
a { color: var(--brand); }
#app { min-height: 100vh; }
.boot { display: grid; place-items: center; height: 100vh; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tap feedback on every interactive surface */
.row, .btn, .chip, .icon-btn, .fab, .cat-cell .bubble, .period button, .calc-keys button, .pin-pad button, .icon-grid button, .bnav button, .link-btn, .sheet .opt {
  transition: transform .16s var(--ease), background-color .2s, box-shadow .2s, opacity .2s, color .2s;
}
.row:active, .btn:active:not(:disabled), .chip:active, .fab:active, .calc-keys button:active, .pin-pad button:active, .icon-grid button:active, .sheet .opt:active { transform: scale(.97); }
.icon-btn:active { transform: scale(.9); }

/* top loading bar */
body::before { content: ''; position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent-grad); z-index: 200; opacity: 0; transition: opacity .2s; }
body.loading::before { opacity: 1; animation: load 1.2s var(--ease) infinite; }
@keyframes load { 0% { width: 0; left: 0; } 50% { width: 60%; left: 20%; } 100% { width: 0; left: 100%; } }

/* ===== Header ===== */
.hdr { background: var(--brand-grad); color: var(--brand-ink); padding: calc(var(--safe-top) + 10px) 10px 0; border-radius: 0 0 var(--r-lg) var(--r-lg);
  position: sticky; top: 0; z-index: 20; box-shadow: 0 6px 24px rgba(30, 90, 62, .22); view-transition-name: hdr; }
.hdr-row { display: flex; align-items: center; min-height: 48px; gap: 4px; }
.hdr-title { flex: 1; text-align: center; font-weight: 650; font-size: 18px; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; font-size: 21px; flex: none; }
.icon-btn:active { background: rgba(255,255,255,.18); }
.icon-btn svg { width: 24px; height: 24px; }
.acc-switch { display: flex; flex-direction: column; align-items: center; flex: 1; gap: 1px; }
.acc-switch .name { font-weight: 600; font-size: 15px; display: flex; gap: 6px; align-items: center; opacity: .92; padding: 3px 10px; border-radius: 20px; background: rgba(255,255,255,.14); }
.acc-switch .bal { font-weight: 750; font-size: 28px; letter-spacing: -.6px; margin-top: 2px; }
.neg { color: #FFC4B5; }
.card .neg, .list-group .neg, .sheet .neg, .row .neg { color: var(--danger); }
.tabs { display: flex; margin: 6px 6px 0; position: relative; }
.tabs button { flex: 1; padding: 12px 0 14px; -webkit-user-select: none; user-select: none; font-weight: 650; letter-spacing: .5px; opacity: .6; text-transform: uppercase; font-size: 13.5px; transition: opacity .25s; }
.tabs button.on { opacity: 1; }
.tab-ind { position: absolute; bottom: 7px; height: 3px; border-radius: 3px; background: #fff; width: calc(100% / var(--n) * .5);
  left: calc(100% / var(--n) * var(--i) + 100% / var(--n) * .25); transition: left .35s var(--spring); view-transition-name: tab-ind; }
.hdr.plain { padding-bottom: 8px; }

/* ===== Layout ===== */
.page { padding: 14px 14px calc(var(--safe-bottom) + 110px); }
#app:has(.bnav) .page { padding-bottom: calc(var(--safe-bottom) + var(--nav-h) + 40px); }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card.flush { padding: 0; overflow: hidden; }

/* period: segmented control */
.period { display: flex; background: var(--card-2); border-radius: 14px; padding: 4px; gap: 2px; }
.period button { flex: 1; white-space: nowrap; padding: 9px 2px; border-radius: 11px; font-size: 14px; font-weight: 550; color: var(--muted); }
.period button.on { background: var(--card); color: var(--brand); box-shadow: var(--shadow-sm); }
:root.dark .period button.on { background: #2B332E; }
.period-nav { display: flex; align-items: center; justify-content: center; position: relative; margin: 12px 0 4px; min-height: 36px; }
.period-nav .lbl { color: var(--text); font-size: 15px; font-weight: 600; padding: 6px 12px; border-radius: 10px; }
.period-nav .lbl:active { background: var(--chip); }
.period-nav .arr { position: absolute; width: 40px; height: 36px; border-radius: 12px; color: var(--muted); font-size: 24px; line-height: 1; background: var(--card-2); }
.period-nav .arr.l { left: 0; } .period-nav .arr.r { right: 0; }
.period-nav .arr:active { transform: scale(.9); }

/* donut */
.donut-wrap { position: relative; display: grid; place-items: center; margin: 8px 0 4px; }
.donut-wrap svg { animation: donutIn .7s var(--spring) both; overflow: visible; }
.donut-wrap svg circle[stroke-dasharray] { animation: draw .9s var(--ease) both; }
@keyframes donutIn { from { transform: rotate(-35deg) scale(.82); opacity: 0; } }
@keyframes draw { from { stroke-dasharray: 0 2000; } }
.donut-center { position: absolute; text-align: center; pointer-events: none; }
.donut-center .sum { font-size: 26px; font-weight: 750; letter-spacing: -.6px; }
.donut-center .cap { font-size: 13px; color: var(--muted); margin-top: 2px; }
.fab { position: absolute; right: 10px; bottom: 10px; width: 58px; height: 58px; border-radius: 20px; background: var(--accent-grad); color: var(--accent-ink);
  font-size: 32px; font-weight: 300; line-height: 1; box-shadow: 0 8px 20px rgba(255, 170, 0, .38); display: grid; place-items: center; }
.float-fab { position: fixed; right: 18px; bottom: calc(var(--safe-bottom) + 20px); z-index: 30; animation: pop .45s var(--spring) .1s both; }
#app:has(.bnav) .float-fab { bottom: calc(var(--safe-bottom) + var(--nav-h) + 22px); }
.float-fab .fab { position: static; width: 60px; height: 60px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* rows */
.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; min-height: 64px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow-sm); margin-bottom: 9px; }
.row .main { flex: 1; min-width: 0; }
.row .t1 { font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.row .t3 { font-size: 13px; color: var(--muted); margin-top: 3px; }
.row .pct { color: var(--muted); font-size: 13px; font-weight: 600; min-width: 40px; text-align: right; background: var(--card-2); padding: 3px 7px; border-radius: 8px; }
.row .amt { font-weight: 700; text-align: right; white-space: nowrap; font-size: 15.5px; }
.row .amt small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); margin-top: 1px; }
.row .amt small.over { color: var(--danger); }
.list-group { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.list-group .row { box-shadow: none; border-radius: 0; margin: 0; position: relative; }
.list-group .row:not(:last-child)::after { content: ''; position: absolute; left: 66px; right: 0; bottom: 0; height: 1px; background: var(--line); }
.list-group .row:active { transform: none; background: var(--card-2); }
.group-title { font-size: 13px; font-weight: 650; color: var(--muted); margin: 18px 6px 8px; text-transform: uppercase; letter-spacing: .4px; }

/* staggered entrance for lists & cards */
.page > .card, .page > .row, .page > .list-group, .page > .group-title, .page > .toolbar, .page > .chips { animation: rise .45s var(--spring) both; }
.page > :nth-child(1) { animation-delay: 0s; } .page > :nth-child(2) { animation-delay: .03s; } .page > :nth-child(3) { animation-delay: .06s; }
.page > :nth-child(4) { animation-delay: .09s; } .page > :nth-child(5) { animation-delay: .12s; } .page > :nth-child(6) { animation-delay: .15s; }
.page > :nth-child(7) { animation-delay: .18s; } .page > :nth-child(8) { animation-delay: .2s; } .page > :nth-child(n+9) { animation-delay: .22s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.enter-fade .page > * { animation: none; }

.bubble { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 21px; flex: none; }
.bubble.lg { width: 60px; height: 60px; font-size: 30px; border-radius: 20px; }
.bubble.sm { width: 32px; height: 32px; font-size: 16px; border-radius: 11px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 8px; background: var(--chip); color: var(--muted); margin-left: 4px; vertical-align: 1px; }
.badge.warn { background: #FFF1D6; color: #9A6B00; } .badge.dup { background: #FDE4DF; color: #B2412C; } .badge.new { background: #DCF3E6; color: #1E7A4C; }
:root.dark .badge.warn { background: #3A2F12; color: #E9C267; } :root.dark .badge.dup { background: #3C211C; color: #F09A88; } :root.dark .badge.new { background: #183324; color: #7FD3A3; }
.empty { text-align: center; color: var(--muted); padding: 44px 24px; line-height: 1.5; animation: rise .5s var(--spring) both; }
.empty .ico { font-size: 52px; margin-bottom: 10px; animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }

/* ===== Forms ===== */
.field { padding: 13px 4px; border-bottom: 1px solid var(--line); }
.field label, .lbl-sm { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; letter-spacing: .2px; }
.field .val { color: var(--brand); font-weight: 600; font-size: 16px; }
.field[data-acc], .field[data-pick], .field[data-cal], .field[data-period], .field[data-start], .field[data-end], .field[data-cat], .field[data-date] { cursor: pointer; border-radius: 12px; transition: background .2s; }
.field[data-acc]:active, .field[data-pick]:active, .field[data-cal]:active, .field[data-period]:active, .field[data-cat]:active { background: var(--chip); }
.field input, .field textarea, .field select { width: 100%; border: 0; background: none; outline: none; padding: 3px 0; font-size: 17px; }
.field textarea { resize: none; min-height: 24px; }
.field.err { border-color: var(--danger); } .field .errmsg { color: var(--danger); font-size: 12px; }
.amount-input { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px 0 10px; }
.amount-input input { width: 190px; text-align: center; font-size: 40px; font-weight: 750; letter-spacing: -1px; border: 0; border-bottom: 3px solid var(--brand); background: none; outline: none; padding: 2px 0; transition: border-color .2s; }
.amount-input input:focus { border-color: var(--accent-2); }
.amount-input .cur { color: var(--brand); font-weight: 750; font-size: 26px; min-width: 32px; }
.amount-input .calc { font-size: 24px; width: 44px; height: 44px; border-radius: 14px; background: var(--chip); }
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 6px; padding: 10px 0; }
.cat-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; text-align: center; min-width: 0; }
.cat-cell span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-cell .bubble { width: 58px; height: 58px; font-size: 28px; border-radius: 20px; box-shadow: var(--shadow-sm); transition: transform .25s var(--spring), box-shadow .25s; }
.cat-cell.on .bubble { box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--accent-2); transform: scale(1.06); }
.cat-cell:active .bubble { transform: scale(.9); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { min-height: 40px; padding: 8px 14px; border-radius: 13px; background: var(--chip); color: var(--chip-ink); font-size: 14.5px; font-weight: 600; text-align: center; line-height: 1.15; }
.chip small { display: block; font-size: 11px; font-weight: 500; opacity: .75; }
.chip.on { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(47, 117, 88, .3); }
.chip.outline { background: none; box-shadow: inset 0 0 0 1.5px var(--brand); color: var(--brand); }
.btn { display: block; width: 100%; min-height: 56px; padding: 16px; border-radius: 18px; background: var(--accent-grad); color: var(--accent-ink); font-weight: 700; font-size: 17px; text-align: center;
  box-shadow: 0 8px 22px rgba(255, 170, 0, .32); }
.btn:disabled { opacity: .45; box-shadow: none; }
.btn.secondary { background: var(--chip); color: var(--text); box-shadow: none; }
.btn.danger { background: none; color: var(--danger); box-shadow: none; }
.btn.brand { background: var(--brand-grad); color: #fff; box-shadow: 0 8px 22px rgba(47, 117, 88, .3); }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(var(--safe-bottom) + 14px); background: linear-gradient(transparent, var(--bg) 35%); z-index: 25; animation: barIn .4s var(--spring) both; }
@keyframes barIn { from { transform: translateY(100%); } }
.link-btn { color: var(--brand); font-weight: 700; text-transform: uppercase; font-size: 14px; letter-spacing: .3px; padding: 14px 4px; }
.link-btn.danger { color: var(--danger); }
.toggle { position: relative; width: 52px; height: 32px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: #CDD3CF; border-radius: 16px; transition: background .25s; cursor: pointer; }
:root.dark .toggle span { background: #3A423D; }
.toggle span::after { content: ''; position: absolute; width: 26px; height: 26px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .3s var(--spring); box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.toggle input:checked + span { background: var(--brand); }
.toggle input:checked + span::after { transform: translateX(20px); }
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.icon-grid button { aspect-ratio: 1; border-radius: 16px; background: var(--chip); font-size: 23px; display: grid; place-items: center; }
.icon-grid button.on { box-shadow: 0 0 0 3px var(--accent-2); }
.colors { display: flex; gap: 12px; flex-wrap: wrap; }
.colors button { width: 36px; height: 36px; border-radius: 50%; transition: transform .25s var(--spring); }
.colors button.on { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--text); transform: scale(1.08); }
.thumbs { display: flex; gap: 10px; }
.thumb { width: 82px; height: 82px; border-radius: 16px; background: var(--chip); display: grid; place-items: center; font-size: 30px; color: var(--muted); overflow: hidden; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; animation: fadeIn .3s; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; }
.search { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.2); border-radius: 14px; padding: 0 12px; flex: 1; min-height: 44px; }
.search svg { width: 20px; height: 20px; opacity: .85; }
.search input { flex: 1; background: none; border: 0; outline: none; color: #fff; padding: 10px 4px; font-size: 17px; }
.search input::placeholder { color: rgba(255,255,255,.75); }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin: 6px 4px 10px; font-size: 14.5px; }
.toolbar .total { font-weight: 700; }
.sel { color: var(--brand); font-weight: 600; padding: 6px 10px; border-radius: 10px; background: var(--chip); }

/* ===== Bottom navigation ===== */
.bnav { position: fixed; left: 10px; right: 10px; bottom: calc(var(--safe-bottom) + 10px); height: var(--nav-h); z-index: 40; display: flex; align-items: center; justify-content: space-around;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border-radius: 24px; box-shadow: var(--shadow-lg); view-transition-name: bnav; animation: barIn .45s var(--spring) both; }
.bnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 0; }
.bnav button .ic { font-size: 22px; filter: grayscale(1) opacity(.7); transition: filter .25s, transform .3s var(--spring); }
.bnav button.on { color: var(--brand); }
.bnav button.on .ic { filter: none; transform: translateY(-2px) scale(1.1); }
.bnav .bnav-mic { flex: none; width: 64px; height: 64px; margin-top: -30px; border-radius: 22px; background: var(--brand-grad); font-size: 28px; color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(47, 117, 88, .45), 0 0 0 5px var(--bg); }
.bnav .bnav-mic:active { transform: scale(.92); }

/* ===== Drawer ===== */
.drawer-bg { position: fixed; inset: 0; background: rgba(8, 14, 11, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 60; animation: fadeIn .25s; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(84vw, 330px); background: var(--brand-grad); color: #fff; z-index: 61; padding: calc(var(--safe-top) + 22px) 0 calc(var(--safe-bottom) + 16px);
  display: flex; flex-direction: column; animation: slideIn .38s var(--spring); border-radius: 0 var(--r-lg) var(--r-lg) 0; box-shadow: var(--shadow-lg); }
.drawer.out { animation: slideOut .2s var(--ease) forwards; } .drawer-bg.out { animation: fadeOut .2s forwards; }
.drawer .who { display: flex; gap: 14px; align-items: center; padding: 0 20px 18px; border-bottom: 1px solid rgba(255,255,255,.2); }
.drawer .who .ava { width: 52px; height: 52px; border-radius: 18px; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: 24px; overflow: hidden; }
.drawer .who .ava img { width: 100%; height: 100%; object-fit: cover; }
.drawer nav { flex: 1; overflow: auto; padding: 10px 10px; }
.drawer nav button { display: flex; gap: 14px; align-items: center; width: 100%; padding: 13px 14px; font-size: 16px; font-weight: 500; text-align: left; border-radius: 14px;
  animation: rise .4s var(--spring) both; transition: background .2s; }
.drawer nav button:nth-child(2) { animation-delay: .03s; } .drawer nav button:nth-child(3) { animation-delay: .06s; } .drawer nav button:nth-child(4) { animation-delay: .09s; }
.drawer nav button:nth-child(5) { animation-delay: .12s; } .drawer nav button:nth-child(6) { animation-delay: .15s; } .drawer nav button:nth-child(n+7) { animation-delay: .18s; }
.drawer nav button:active, .drawer nav button.on { background: rgba(255,255,255,.16); }
.drawer nav .ico { width: 26px; text-align: center; font-size: 20px; }
.drawer .foot { padding: 0 22px; font-size: 12px; opacity: .75; }
@keyframes slideIn { from { transform: translateX(-100%); } }
@keyframes slideOut { to { transform: translateX(-100%); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }

/* ===== Sheets & dialogs ===== */
.sheet-bg { position: fixed; inset: 0; background: rgba(8, 14, 11, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 70; animation: fadeIn .22s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 90vh; background: var(--card); border-radius: var(--r-lg) var(--r-lg) 0 0; z-index: 71;
  padding: 10px 18px calc(var(--safe-bottom) + 18px); overflow: auto; animation: sheetUp .42s var(--spring); box-shadow: var(--shadow-lg); }
.sheet.out { animation: sheetDown .2s var(--ease) forwards; } .sheet-bg.out { animation: fadeOut .2s forwards; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { margin: 2px 0 14px; font-size: 20px; letter-spacing: -.3px; }
.sheet .opt { display: flex; align-items: center; gap: 12px; padding: 14px 8px; min-height: 56px; border-radius: 14px; width: 100%; text-align: left; font-size: 16px; }
.sheet .opt + .opt { border-top: 1px solid var(--line); }
.sheet .opt.on { color: var(--brand); font-weight: 650; }
.sheet .opt .chk { margin-left: auto; color: var(--brand); } .sheet .opt .chk svg { width: 22px; height: 22px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet .actions .btn { flex: 1; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
.calc-disp { text-align: right; padding: 12px 6px; }
.calc-disp .expr { color: var(--muted); font-size: 15px; min-height: 20px; }
.calc-disp .res { font-size: 40px; font-weight: 750; letter-spacing: -1px; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.calc-keys button { height: 62px; border-radius: 18px; background: var(--chip); font-size: 24px; font-weight: 600; color: var(--brand); }
.calc-keys button.eq { background: var(--accent-grad); color: var(--accent-ink); }
#toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 100px); transform: translate(-50%, 20px) scale(.96); background: rgba(24, 30, 27, .94);
  color: #fff; padding: 13px 18px; border-radius: 16px; font-size: 15px; font-weight: 500; z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .4s var(--spring); max-width: 92vw; text-align: center; box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#toast button { color: var(--accent); font-weight: 700; margin-left: 12px; pointer-events: auto; }

/* ===== Charts ===== */
.chart-scroll { overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.chart-scroll::-webkit-scrollbar { display: none; }
.chart-scroll svg { display: block; }
.chart-scroll svg rect[fill]:not([fill="transparent"]) { transform-box: fill-box; transform-origin: bottom; animation: grow .7s var(--spring) both; }
@keyframes grow { from { transform: scaleY(0); } }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }

/* ===== Voice ===== */
.rec { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 36px 0 14px; }
.rec-btn { width: 124px; height: 124px; border-radius: 40px; background: var(--brand-grad); color: #fff; font-size: 50px; display: grid; place-items: center;
  box-shadow: 0 16px 40px rgba(47, 117, 88, .4); position: relative; transition: transform .3s var(--spring), border-radius .4s var(--spring), background .3s; }
.rec-btn:active { transform: scale(.93); }
.rec-btn.on { background: linear-gradient(135deg, #F06A55, #D8402B); border-radius: 62px; box-shadow: 0 16px 40px rgba(216, 64, 43, .4); }
.rec-btn.on::before, .rec-btn.on::after { content: ''; position: absolute; inset: -12px; border-radius: 50%; border: 3px solid rgba(229, 83, 61, .45); transform: scale(var(--lvl, 1)); transition: transform .08s; }
.rec-btn.on::after { inset: -26px; border-width: 2px; opacity: .5; animation: ring 1.6s ease-out infinite; }
@keyframes ring { from { transform: scale(.85); opacity: .6; } to { transform: scale(1.25); opacity: 0; } }
.rec-time { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 14.5px; text-align: center; line-height: 1.5; }
.said { font-style: italic; background: var(--card); box-shadow: var(--shadow-sm); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; animation: rise .4s var(--spring) both; }

/* ===== Lock ===== */
.lock { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; gap: 26px; background: var(--brand-grad); color: #fff; animation: fadeIn .3s; }
.dots { display: flex; gap: 16px; }
.dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid #fff; transition: background .2s, transform .25s var(--spring); }
.dots i.f { background: #fff; transform: scale(1.15); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 78px); gap: 16px; }
.pin-pad button { height: 78px; border-radius: 50%; background: rgba(255,255,255,.16); font-size: 28px; font-weight: 500; color: #fff; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }

/* ===== Screen transitions ===== */
.enter-fwd > :not(.hdr):not(.bnav):not(.bottom-bar) { animation: inFwd .38s var(--spring) both; }
.enter-back > :not(.hdr):not(.bnav):not(.bottom-bar) { animation: inBack .38s var(--spring) both; }
.enter-tab > :not(.hdr):not(.bnav) { animation: fadeIn .25s both; }
@keyframes inFwd { from { transform: translateX(28px); opacity: 0; } }
@keyframes inBack { from { transform: translateX(-28px); opacity: 0; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .32s; animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
:root[data-nav="fwd"]::view-transition-old(root) { animation-name: vtOutL; }
:root[data-nav="fwd"]::view-transition-new(root) { animation-name: vtInR; }
:root[data-nav="back"]::view-transition-old(root) { animation-name: vtOutR; }
:root[data-nav="back"]::view-transition-new(root) { animation-name: vtInL; }
::view-transition-group(hdr), ::view-transition-group(bnav), ::view-transition-group(tab-ind) { animation-duration: .35s; animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
@keyframes vtOutL { to { transform: translateX(-12%); opacity: 0; } }
@keyframes vtInR { from { transform: translateX(16%); opacity: 0; } }
@keyframes vtOutR { to { transform: translateX(12%); opacity: 0; } }
@keyframes vtInL { from { transform: translateX(-16%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.muted { color: var(--muted); } .center { text-align: center; } .mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.spacer { height: 14px; }
.drag-handle { color: var(--muted); font-size: 22px; padding: 4px 8px; touch-action: none; }
.dragging { opacity: .6; transform: scale(1.02); box-shadow: var(--shadow-lg); }

/* ===== Calendar ===== */
.cal { overflow: hidden; touch-action: pan-y; }
.cal.slide-l .cal-grid { animation: calL .32s var(--spring); } .cal.slide-r .cal-grid { animation: calR .32s var(--spring); }
@keyframes calL { from { transform: translateX(30%); opacity: 0; } } @keyframes calR { from { transform: translateX(-30%); opacity: 0; } }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.cal-head b { font-size: 17px; }
.cal-arr { width: 44px; height: 40px; border-radius: 12px; background: var(--chip); font-size: 24px; color: var(--brand); }
.cal-arr:active { transform: scale(.9); }
.cal-wd, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-wd span { font-size: 12px; font-weight: 600; color: var(--muted); padding-bottom: 6px; }
.cal-grid { row-gap: 4px; }
.cd { height: 44px; border-radius: 14px; font-size: 16px; font-weight: 500; transition: background .2s, color .2s, transform .15s; }
.cd:active { transform: scale(.88); }
.cd.today { box-shadow: inset 0 0 0 2px var(--brand-3); color: var(--brand); font-weight: 700; }
.cd.in { background: var(--chip); border-radius: 0; }
.cd.sel { background: var(--brand); color: #fff; font-weight: 700; box-shadow: 0 4px 12px rgba(47, 117, 88, .35); }
.cd.start { border-radius: 14px 0 0 14px; } .cd.end { border-radius: 0 14px 14px 0; }
.range-lbl { text-align: center; font-weight: 650; margin-bottom: 8px; min-height: 22px; }
.date-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; scrollbar-width: none; scroll-snap-type: x proximity; }
.date-strip::-webkit-scrollbar { display: none; }
.ds { flex: none; min-width: 62px; height: 58px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; scroll-snap-align: start; transition: transform .15s, background .2s, color .2s; }
.ds b { font-size: 15px; font-weight: 700; } .ds small { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.ds.on { background: var(--brand); color: #fff; box-shadow: 0 6px 14px rgba(47, 117, 88, .35); } .ds.on small { color: rgba(255,255,255,.85); }
.ds:active { transform: scale(.94); }
.ds.cal-btn { background: var(--chip); box-shadow: none; }

/* ===== In-place updates: no replayed entrances, just a soft cross-fade ===== */
.still .page > *, .still .bnav, .still .float-fab, .still .bottom-bar, .still .empty, .still .empty .ico { animation: none !important; }
.still .donut-wrap svg { animation: none; }
.still .donut-wrap svg circle[stroke-dasharray] { animation-duration: .55s; }
.soft .page { animation: fadeIn .18s ease-out; }
:root[data-nav="none"]::view-transition-old(root), :root[data-nav="none"]::view-transition-new(root) { animation-duration: .2s; animation-timing-function: ease-out; }
:root[data-nav="tab"]::view-transition-old(root) { animation: fadeOut .16s ease-in both; }
:root[data-nav="tab"]::view-transition-new(root) { animation: fadeIn .22s ease-out both; }
::view-transition-group(*) { animation-timing-function: cubic-bezier(.16, 1, .3, 1); }

/* ===== Voice drafts ===== */
.rec-cancel { animation: pop .3s var(--spring) both; background: #FDE4DF; color: #B2412C; }
:root.dark .rec-cancel { background: #3C211C; color: #F09A88; }
.draft { padding: 14px 14px 6px; animation: rise .4s var(--spring) both; transition: transform .22s var(--ease), opacity .22s; }
.draft.removing { transform: translateX(110%); opacity: 0; }
.draft-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.seg { display: flex; background: var(--card-2); border-radius: 12px; padding: 3px; }
.seg button { padding: 7px 14px; border-radius: 10px; font-size: 14px; font-weight: 650; color: var(--muted); transition: background .2s, color .2s; }
.seg button.on { background: var(--card); color: var(--brand); box-shadow: var(--shadow-sm); }
:root.dark .seg button.on { background: #2B332E; }
.draft-x { width: 36px; height: 36px; border-radius: 12px; background: var(--card-2); color: var(--muted); font-size: 15px; }
.draft-amount { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 12px 0 10px; }
.draft-amount .sign { font-size: 30px; font-weight: 700; color: var(--muted); }
.draft-amount input { width: 170px; font-size: 38px; font-weight: 800; letter-spacing: -1px; text-align: center; border: 0; border-bottom: 3px solid var(--brand); background: none; outline: none; }
.draft-amount button { font-size: 26px; font-weight: 750; color: var(--brand); padding: 0 6px; }
.draft-rows { border-top: 1px solid var(--line); margin-top: 6px; }
.draft-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 2px; border-bottom: 1px solid var(--line); text-align: left; }
.draft-row:last-child { border-bottom: 0; }
.draft-row .k { width: 108px; flex: none; font-size: 14px; color: var(--muted); font-weight: 500; }
.draft-row .v { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15.5px; min-width: 0; }
.draft-row .chev { color: var(--muted); font-size: 22px; }
.draft-row input { flex: 1; border: 0; outline: none; background: none; font-size: 15.5px; font-weight: 500; padding: 8px 0; min-width: 0; }
.draft-row .need { color: var(--danger); }
.dup-banner { background: #FFF1D6; color: #8A5E00; font-size: 13.5px; font-weight: 500; padding: 9px 12px; border-radius: 12px; margin-bottom: 10px; }
.dup-banner.hard { background: #FDE4DF; color: #A3381F; }
:root.dark .dup-banner { background: #3A2F12; color: #E9C267; } :root.dark .dup-banner.hard { background: #3C211C; color: #F09A88; }
.voice-actions { display: flex; gap: 10px; margin-top: 6px; }
.voice-actions .btn { flex: 1; }
.voice-actions .btn.secondary { flex: .6; }

/* ===== Home quick actions ===== */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.quick button { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow-sm); text-align: left; transition: transform .16s var(--ease); }
.quick button:active { transform: scale(.97); }
.quick .qi { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; flex: none; }
.quick b { display: block; font-size: 14.5px; } .quick small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
:root.dark .quick .qi { background: var(--chip) !important; }
