:root {
  --bg: #0a0b0f; --surface: #13151c; --surface-2: #1b1e27; --line: #262a36;
  --text: #f4f5f7; --muted: #9aa1b0; --faint: #6b7282;
  --accent: #c8f560; --on-accent: #0b0d06; --accent-soft: rgba(200, 245, 96, .12);
  --pos: #3ddc97; --pos-soft: rgba(61, 220, 151, .12);
  --neg: #ff6b6b; --neg-soft: rgba(255, 107, 107, .12);
  --warn: #ffb547; --info: #7aa7ff;
  --r: 18px; --r-sm: 12px; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Bricolage Grotesque', var(--font);
  --nav-h: 68px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f5f0; --surface: #ffffff; --surface-2: #eeeee8; --line: #e1e1d8;
  --text: #121317; --muted: #555c6b; --faint: #8a909c;
  --accent: #c8f560; --on-accent: #0b0d06; --accent-soft: rgba(126, 170, 20, .14);
  --pos: #0b8a57; --pos-soft: rgba(11, 138, 87, .1);
  --neg: #d33a3a; --neg-soft: rgba(211, 58, 58, .09);
  --warn: #b26b00; --info: #2f5fd0;
  --shadow: 0 10px 30px rgba(20, 20, 10, .08);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
svg.i { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 18px; height: 18px; }
svg.i.lg { width: 28px; height: 28px; }

/* shell */
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; position: relative; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 16px 10px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.top h1 { font: 700 20px/1.2 var(--display); margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.top .brand { display: flex; align-items: center; gap: 8px; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font: 800 17px var(--display); }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; color: var(--text); transition: background .15s; flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
main { padding: 4px 16px 0; }
.view-enter { animation: enter .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }

/* bottom nav */
.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--faint); min-height: 52px; justify-content: center; transition: color .15s; }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"] svg { color: var(--accent); }
:root[data-theme="light"] .nav a[aria-current="page"] svg { color: var(--text); }
.nav .fab { width: 58px; height: 58px; border-radius: 20px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; margin: -22px auto 0; box-shadow: 0 8px 24px rgba(200, 245, 96, .35); transition: transform .15s; }
.nav .fab:active { transform: scale(.92); }
.nav .fab svg { width: 28px; height: 28px; stroke-width: 2.5; }

/* type */
.h2 { font: 700 18px/1.25 var(--display); margin: 22px 0 10px; letter-spacing: -.01em; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.h2 a, .link { font: 600 14px var(--font); color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.num { font-variant-numeric: tabular-nums; }
.big { font: 800 40px/1.05 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.hero { background: radial-gradient(120% 140% at 100% 0%, rgba(200, 245, 96, .2), transparent 55%), var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 20px; position: relative; overflow: hidden; }
.hero .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.pill { border-radius: 14px; padding: 10px 12px; background: var(--surface-2); }
.pill b { display: block; font: 700 18px var(--display); font-variant-numeric: tabular-nums; }
.pill span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stack > * + * { margin-top: 10px; }

/* quick bar */
.quick { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 6px 6px 6px 14px; margin-top: 14px; transition: border-color .15s; }
.quick:focus-within { border-color: var(--accent); }
.quick input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 10px 0; font-size: 16px; }
.quick input::placeholder { color: var(--faint); }
.mic { width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; cursor: pointer; flex: none; position: relative; }
.mic.on::after { content: ''; position: absolute; inset: -4px; border-radius: 18px; border: 2px solid var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { opacity: 1; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.3); } }
.mic.ghost { background: var(--surface-2); color: var(--text); }
.hints { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.hints::-webkit-scrollbar { display: none; }
.hint { flex: none; font-size: 13px; padding: 7px 12px; border-radius: 999px; border: 1px dashed var(--line); color: var(--muted); background: none; cursor: pointer; white-space: nowrap; }

/* lists */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; transition: background .12s; }
.row + .row { border-top: 1px solid var(--line); }
.row:hover { background: var(--surface-2); }
.row:active { background: var(--surface-2); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex: none; }
.row .end .k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.row .end .v { font: 700 15px var(--display); font-variant-numeric: tabular-nums; }
.month { font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin: 18px 4px 8px; }
.datebox { width: 40px; text-align: center; flex: none; line-height: 1.05; }
.datebox b { display: block; font: 700 17px var(--display); }
.datebox span { font-size: 11px; color: var(--faint); text-transform: uppercase; font-weight: 600; }

.av { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font: 700 15px var(--display); flex: none; color: #0b0d06; background: hsl(var(--h, 90) 75% 72%); }
.av.sm { width: 28px; height: 28px; border-radius: 10px; font-size: 12px; }
.av.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 22px; }
.cat { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); }
.cat.settle { background: var(--pos-soft); color: var(--pos); }
.avs { display: flex; }
.avs .av { border: 2px solid var(--surface); margin-left: -8px; }
.avs .av:first-child { margin-left: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 650; cursor: pointer; transition: transform .1s, background .15s, opacity .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.danger { color: var(--neg); background: var(--neg-soft); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 12px; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn.busy::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1; }
.sticky-cta { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 10; padding-top: 12px; background: linear-gradient(transparent, var(--bg) 35%); }

/* chips & segmented */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px 0 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 600; transition: all .12s; user-select: none; }
.chip.plain { padding: 0 14px; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
:root[data-theme="light"] .chip[aria-pressed="true"] { border-color: #7aa017; }
.chip .av { width: 26px; height: 26px; border-radius: 50%; font-size: 11px; }
.chip.new { border-style: dashed; color: var(--muted); }
.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button, .seg a { flex: 1; min-height: 38px; padding: 0 10px; border: 0; border-radius: 11px; background: none; font-weight: 650; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; display: grid; place-items: center; }
.seg [aria-selected="true"], .seg [aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }

/* forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin: 0 0 6px 2px; }
.input { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); outline: 0; transition: border-color .15s; font-size: 16px; }
.input:focus { border-color: var(--accent); }
textarea.input { resize: none; min-height: 84px; line-height: 1.45; }
.amount-in { display: flex; align-items: center; gap: 6px; font: 800 36px var(--display); }
.amount-in input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; font: inherit; font-variant-numeric: tabular-nums; padding: 0; }
.amount-in input::placeholder { color: var(--faint); }
.split-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.split-row .name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-row input { width: 110px; min-height: 42px; text-align: right; padding: 8px 10px; }
.split-row .calc { width: 84px; text-align: right; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.check { width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; flex: none; cursor: pointer; background: none; }
.check[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check svg { width: 16px; height: 16px; stroke-width: 3; }
.note { font-size: 13px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.note.warn { background: rgba(255, 181, 71, .12); color: var(--warn); }
.note.ok { background: var(--pos-soft); color: var(--pos); }

.smart { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 12px; }
.smart:focus-within { border-color: var(--accent); }
.smart textarea { width: 100%; border: 0; background: none; outline: 0; resize: none; font-size: 17px; min-height: 56px; line-height: 1.45; padding: 4px 4px 0; }
.smart .bar { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.smart .bar .sp { flex: 1; }
.preview { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 10px; background: var(--surface-2); }
.tag.a { background: var(--accent-soft); color: var(--text); }
.tag.w { background: rgba(255, 181, 71, .14); color: var(--warn); }

/* bars */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row .lbl { display: flex; justify-content: space-between; font-size: 14px; font-weight: 600; margin-bottom: 6px; gap: 8px; }
.track { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transform-origin: left; animation: grow .6s cubic-bezier(.2, .8, .2, 1); }
@keyframes grow { from { transform: scaleX(0); } }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; font-size: 11px; color: var(--faint); font-weight: 600; }
.cols .c i { width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: var(--accent); animation: rise .6s cubic-bezier(.2, .8, .2, 1); transform-origin: bottom; min-height: 3px; }
@keyframes rise { from { transform: scaleY(0); } }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* sheet / toast */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 50; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 51; background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); max-height: 88dvh; overflow-y: auto; animation: up .26s cubic-bezier(.2, .8, .2, 1); }
.sheet::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { font: 700 20px var(--display); margin: 0 0 14px; }
@keyframes up { from { transform: translate(-50%, 100%); } }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); border-radius: 14px; padding: 12px 16px; font-weight: 600; font-size: 14px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); animation: up2 .22s; max-width: calc(100% - 32px); }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 800; cursor: pointer; padding: 4px; }
:root[data-theme="light"] .toast button { color: #a5d63a; }
@keyframes up2 { from { opacity: 0; transform: translate(-50%, 10px); } }

/* skeleton & empty */
.sk { background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 10px; }
@keyframes sh { to { background-position: -200% 0; } }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .art { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 24px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
:root[data-theme="light"] .empty .art { color: #5d7f0e; }
.empty h3 { font: 700 18px var(--display); color: var(--text); margin: 0 0 6px; }

.receipt-img { width: 100%; border-radius: 14px; border: 1px solid var(--line); display: block; max-height: 360px; object-fit: contain; background: var(--surface-2); }
.progress { height: 6px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.item-row { padding: 10px 0; border-top: 1px solid var(--line); }
.item-row:first-child { border-top: 0; }
.item-row .top2 { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.item-row .top2 input { flex: 1; }
.item-row .top2 input.amt { flex: none; width: 96px; text-align: right; }
.item-row .chips .chip { min-height: 32px; font-size: 13px; padding: 0 10px 0 4px; }
.item-row .chips .chip .av { width: 22px; height: 22px; }

.welcome { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px calc(24px + var(--safe-b)); max-width: 480px; margin: 0 auto; }
.welcome h1 { font: 800 44px/1 var(--display); letter-spacing: -.035em; margin: 18px 0 10px; }
.welcome h1 em { font-style: normal; color: var(--accent); }
:root[data-theme="light"] .welcome h1 em { color: #5d7f0e; }
.feat { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; }
.feat .cat { background: var(--accent-soft); color: var(--accent); }
:root[data-theme="light"] .feat .cat { color: #5d7f0e; }

.listen { position: fixed; inset: 0; z-index: 70; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; animation: fade .15s; }
.listen .orb { width: 120px; height: 120px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; animation: breathe 1.4s ease-in-out infinite; margin-bottom: 26px; box-shadow: 0 0 0 0 rgba(200, 245, 96, .5); }
@keyframes breathe { 50% { transform: scale(1.08); box-shadow: 0 0 0 24px rgba(200, 245, 96, 0); } }
.listen .said { font: 600 22px/1.35 var(--display); min-height: 60px; max-width: 420px; }

@media print {
  .nav, .top, .no-print, .toast { display: none !important; }
  body, html { background: #fff; color: #000; }
  .app { max-width: none; padding: 0; }
  .card, .list, .hero { border-color: #ccc; background: #fff; }
  :root { --text: #000; --muted: #444; --surface: #fff; --surface-2: #f2f2f2; --line: #ddd; --pos: #0b7a4b; --neg: #c42; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 600px) { body { background: var(--bg); } main { padding: 4px 20px 0; } }

.no-nav .app { padding-bottom: calc(24px + var(--safe-b)); }
.no-nav .sticky-cta { bottom: calc(10px + var(--safe-b)); }
.no-nav .toast { bottom: calc(90px + var(--safe-b)); }
.check[aria-checked="false"] svg { opacity: 0; }
.toast button { background: var(--accent) !important; color: var(--on-accent) !important; border-radius: 9px; padding: 6px 12px !important; }
.tag { white-space: nowrap; }

/* live checklist */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pl { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 6px 11px 6px 9px; border-radius: 999px; line-height: 1.2; transition: background .25s, color .25s; }
.pl::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; margin-right: 2px; }
.pl b { color: var(--text); font-weight: 650; }
.pl.ok { color: var(--pos); background: var(--pos-soft); }
.pl.as { color: var(--warn); background: rgba(255, 181, 71, .12); }
.pl.bad { color: var(--neg); background: var(--neg-soft); animation: nudge .4s; }
.pl.new { color: var(--text); background: var(--accent-soft); }
.pl.new::before { background: var(--accent); }
@keyframes nudge { 30% { transform: translateX(-3px); } 60% { transform: translateX(3px); } }
.ask { margin-top: 10px; font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: flex-start; color: var(--warn); }
.ask.need { color: var(--neg); }
.ask.done { color: var(--pos); }
.ask svg { margin-top: 1px; }
.listen .pills { justify-content: center; margin: 4px 0 6px; }
.listen .pl { font-size: 14px; padding: 8px 13px 8px 11px; }
.listen .ask { justify-content: center; text-align: left; font-size: 15px; }
.item-row.unread input { border-color: var(--warn); }
.pl[role=button] { cursor: pointer; }
.pl[role=button]:active { transform: scale(.96); }
.row .t svg.i.sm { width: 14px; height: 14px; vertical-align: -2px; }

.heard { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.heard > .faint { width: 100%; font-weight: 600; }
.heard .chip { min-height: 34px; font-size: 13px; padding: 0 8px 0 4px; }
.heard .chip .av { width: 24px; height: 24px; }
.heard .chip svg { width: 14px; height: 14px; opacity: .7; }
#applyst { font-size: 13px; font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
#applyst.applied { color: var(--pos); animation: fade .2s; }
.countdown { width: 16px; height: 16px; border-radius: 50%; flex: none; margin-top: 2px; background: conic-gradient(var(--warn) var(--p, 0%), transparent 0); animation: cd 2s linear forwards; }
@property --p { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
@keyframes cd { to { --p: 100%; } }

/* ============ motion layer ============ */
:root { --spring: cubic-bezier(.34, 1.56, .64, 1); --smooth: cubic-bezier(.2, .8, .2, 1); }

/* press: springy squash on everything tappable */
.btn, .chip, .row, .icon-btn, .mic, .hint, .seg button, .seg a, .pl[role=button] { transition: transform .18s var(--spring), background .2s, border-color .2s, box-shadow .2s, color .2s; }
.btn:active, .chip:active, .icon-btn:active, .mic:active, .hint:active { transform: scale(.94); }
.row:active { transform: scale(.985); }
.has-rip { overflow: hidden; isolation: isolate; }
.rip { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .18; transform: scale(0); animation: rip .55s var(--smooth) forwards; z-index: -1; }
.btn.primary .rip, .mic .rip, .fab .rip { background: #fff; opacity: .45; }
@keyframes rip { to { transform: scale(1); opacity: 0; } }
.chip[aria-pressed="true"] { animation: chipOn .32s var(--spring); }
@keyframes chipOn { 40% { transform: scale(1.08); } }
.check[aria-checked="true"] svg { animation: tick .35s var(--spring); }
@keyframes tick { from { transform: scale(0) rotate(-30deg); } }

/* the smart box: grows, lifts and glows when you start typing */
.smart { transition: border-color .25s, box-shadow .35s var(--smooth), transform .35s var(--spring), padding .3s var(--smooth); }
.smart:focus-within { transform: translateY(-2px) scale(1.012); padding: 16px 14px 14px; box-shadow: 0 0 0 4px var(--accent-soft), 0 18px 40px rgba(0, 0, 0, .35), 0 0 60px -10px rgba(200, 245, 96, .35); }
:root[data-theme="light"] .smart:focus-within { box-shadow: 0 0 0 4px var(--accent-soft), 0 18px 40px rgba(30, 40, 10, .12); }
.smart textarea { transition: height .28s var(--smooth), font-size .25s; overflow-y: auto; }
.smart:focus-within textarea { font-size: 18px; min-height: 88px; }
.smart textarea::placeholder { transition: opacity .25s, transform .3s var(--smooth); }
.smart:focus-within textarea::placeholder { opacity: .55; transform: translateX(4px); }
.quick { transition: border-color .2s, box-shadow .3s var(--smooth), transform .3s var(--spring); }
.quick:focus-within { transform: scale(1.015); box-shadow: 0 0 0 4px var(--accent-soft), 0 12px 30px rgba(0, 0, 0, .3); }
.input { transition: border-color .2s, box-shadow .25s var(--smooth); }
.input:focus { box-shadow: 0 0 0 4px var(--accent-soft); }
.amount-in input { transition: transform .3s var(--spring); }
.amount-in input:focus { transform: scale(1.03); transform-origin: left; }

/* pills: pop when they turn green, shake when they turn red */
.pl { animation: plIn .3s var(--spring) backwards; }
.pills .pl:nth-child(2) { animation-delay: .03s; } .pills .pl:nth-child(3) { animation-delay: .06s; } .pills .pl:nth-child(4) { animation-delay: .09s; } .pills .pl:nth-child(5) { animation-delay: .12s; } .pills .pl:nth-child(6) { animation-delay: .15s; }
@keyframes plIn { from { opacity: 0; transform: translateY(6px) scale(.9); } }
.pl.pop { animation: plPop .5s var(--spring); box-shadow: 0 0 0 0 var(--pos); }
@keyframes plPop { 0% { transform: scale(.85); box-shadow: 0 0 0 0 rgba(61, 220, 151, .6); } 50% { transform: scale(1.12); } 100% { transform: scale(1); box-shadow: 0 0 0 10px rgba(61, 220, 151, 0); } }
.pl.shake { animation: nudge .4s; }
.pl.ok::before { animation: dot .4s var(--spring); }
@keyframes dot { from { transform: scale(0); } }

/* lists cascade in */
.in { animation: rowIn .45s var(--smooth) backwards; animation-delay: calc(var(--i, 0) * 32ms); }
@keyframes rowIn { from { opacity: 0; transform: translateY(10px); } }

/* hero: slow living gradient */
.hero { background-size: 160% 160%; animation: heroDrift 14s ease-in-out infinite alternate; }
@keyframes heroDrift { to { background-position: 100% 30%; } }
.big span[data-count] { display: inline-block; }

/* bottom nav: active pill that slides between tabs (view transition) */
.nav a { position: relative; }
.nav .ind { position: absolute; top: 6px; left: 50%; width: 46px; height: 30px; margin-left: -23px; border-radius: 12px; background: var(--accent-soft); view-transition-name: navind; z-index: -1; }
.nav a[aria-current="page"] svg { animation: tabPop .35s var(--spring); }
@keyframes tabPop { 40% { transform: translateY(-3px) scale(1.12); } }
.nav .fab { transition: transform .3s var(--spring), box-shadow .3s; }
.nav a:hover .fab { box-shadow: 0 10px 30px rgba(200, 245, 96, .5); }
.nav a:active .fab { transform: scale(.9) rotate(90deg); }
.fab { animation: fabBreathe 3.2s ease-in-out infinite; }
@keyframes fabBreathe { 50% { box-shadow: 0 8px 34px rgba(200, 245, 96, .55); } }

/* page transitions */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .32s; animation-timing-function: var(--smooth); }
:root[data-dir="fwd"]::view-transition-old(root) { animation-name: vtOutL; }
:root[data-dir="fwd"]::view-transition-new(root) { animation-name: vtInR; }
:root[data-dir="back"]::view-transition-old(root) { animation-name: vtOutR; }
:root[data-dir="back"]::view-transition-new(root) { animation-name: vtInL; }
@keyframes vtOutL { to { opacity: 0; transform: translateX(-24px) scale(.98); } }
@keyframes vtInR { from { opacity: 0; transform: translateX(28px); } }
@keyframes vtOutR { to { opacity: 0; transform: translateX(24px) scale(.98); } }
@keyframes vtInL { from { opacity: 0; transform: translateX(-28px); } }
::view-transition-group(navind) { animation-duration: .38s; animation-timing-function: var(--spring); }
:root[data-dir="theme"]::view-transition-old(root) { animation: none; }
:root[data-dir="theme"]::view-transition-new(root) { animation: themeReveal .6s var(--smooth); }
@keyframes themeReveal { from { clip-path: circle(0 at var(--tx, 50%) var(--ty, 50%)); } to { clip-path: circle(150% at var(--tx, 50%) var(--ty, 50%)); } }

/* sheet and toast spring */
.sheet { animation: sheetUp .42s var(--spring); }
@keyframes sheetUp { from { transform: translate(-50%, 100%); } }
.toast { animation: toastIn .45s var(--spring); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 18px) scale(.92); } }

/* confetti */
.burst { position: fixed; z-index: 80; pointer-events: none; width: 0; height: 0; }
.burst i { position: absolute; width: 8px; height: 12px; border-radius: 2px; transform: translate(-50%, -50%); animation: confetti .95s var(--smooth) forwards; }
.burst i:nth-child(3n) { width: 7px; height: 7px; border-radius: 50%; }
@keyframes confetti { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.4); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y) + 60px)) rotate(var(--r)) scale(1); } }

/* listening: rings and a waveform around the orb */
.orb-wrap { position: relative; width: 120px; height: 120px; margin-bottom: 18px; display: grid; place-items: center; }
.orb-wrap .orb { margin: 0; position: relative; z-index: 1; }
.orb-wrap .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: ringOut 2.4s var(--smooth) infinite; }
.orb-wrap .ring:nth-child(2) { animation-delay: .8s; } .orb-wrap .ring:nth-child(3) { animation-delay: 1.6s; }
@keyframes ringOut { 0% { transform: scale(.9); opacity: .7; } 100% { transform: scale(1.9); opacity: 0; } }
.wave { display: flex; gap: 4px; align-items: center; height: 28px; margin-bottom: 14px; }
.wave i { width: 4px; height: 100%; border-radius: 4px; background: var(--accent); animation: wave 1s ease-in-out infinite; transform-origin: center; }
.wave i:nth-child(2n) { animation-delay: -.2s; } .wave i:nth-child(3n) { animation-delay: -.45s; } .wave i:nth-child(4n) { animation-delay: -.7s; }
@keyframes wave { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
.listen .said { animation: plIn .3s var(--spring); }

/* empty-state art floats */
.empty .art { animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) rotate(-3deg); } }
.pl.stay:not(.pop):not(.shake), .pl.stay:not(.pop)::before { animation: none; }
.row.hist.flagged { background: var(--neg-soft); }
.row.hist a { color: var(--text); }
.row.hist .pl { font-size: 12px; padding: 4px 9px 4px 7px; }
mark { background: var(--accent-soft); color: var(--text); border-radius: 4px; padding: 0 2px; box-shadow: inset 0 -2px 0 var(--accent); }
#sq::-webkit-search-cancel-button { filter: invert(1); opacity: .5; }
