/* ka-ching mockup — Telegram Mini App, 390px phone width */
:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --surface-2: #ececef;
  --text: #0b0b0c;
  --muted: #8e8e94;
  --faint: #c4c4c9;
  --line: #ececef;
  --ok: #17a864;
  --warn: #e0921f;
  --over: #e5484d;
  --accent: #2f6fed;
  --ink-btn: #2b2b2e;
  --ink-btn-text: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --r: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0e0e10;
  --surface: #1a1a1d;
  --surface-2: #26262a;
  --text: #f4f4f5;
  --muted: #8b8b93;
  --faint: #4a4a50;
  --line: #232327;
  --ok: #3ccf8e;
  --warn: #f0a93c;
  --over: #ff6369;
  --ink-btn: #f4f4f5;
  --ink-btn-text: #0e0e10;
  --shadow: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; max-width: 480px; margin: 0 auto; position: relative; }
/* default icon size; charts and other big SVGs override it by class */
svg { width: 20px; height: 20px; flex-shrink: 0; }
.choice .check { width: 22px; height: 22px; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.cur { color: var(--muted); font-weight: 400; margin-right: .06em; }
.muted { color: var(--muted); }

.screen { padding: 20px 20px 120px; min-height: 100vh; }
.screen.sub { padding-top: 12px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; height: 44px; margin-bottom: 8px; }
.topbar h2 { font-size: 17px; font-weight: 600; }
.iconbtn { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--muted); }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn.tint-edit { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.spacer { width: 36px; }

.title { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.section-label { font-size: 13px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 32px 4px 10px; display: flex; justify-content: space-between; }

/* pills + segmented */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 500; }
.seg { display: inline-flex; background: var(--surface); border-radius: 999px; padding: 3px; }
.seg button { height: 30px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ── Dashboard hero ─────────────────────────────── */
.hero { padding: 8px 4px 0; }
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.hero-month { font-size: 15px; font-weight: 600; }
.hero-amount { font-size: 46px; font-weight: 600; margin-top: 18px; line-height: 1; }
.hero-amount .cur { font-size: 30px; }
.hero-sub { margin-top: 8px; font-size: 15px; color: var(--muted); }
.hero-sub b { color: var(--text); font-weight: 500; }

/* month timeline: fill = time elapsed */

/* latest expense chip */
.latest { margin-top: 24px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); }
.latest .emoji-tile { width: 36px; height: 36px; font-size: 18px; border-radius: 10px; }
.latest-text { flex: 1; min-width: 0; font-size: 14px; }
.latest-text .l1 { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.latest-text .l2 { color: var(--muted); font-size: 13px; margin-top: 2px; }
.latest-amt { font-size: 15px; font-weight: 600; }

/* ── Budget cards ─────────────────────────────── */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bcard { background: var(--surface); border-radius: var(--r); padding: 16px 14px 16px; display: block; position: relative; }
.bcard-name { font-size: 16px; font-weight: 600; display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; }
.bcard-status { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin-top: 18px; }
.bcard-status.ok { color: var(--ok); } .bcard-status.warn { color: var(--warn); } .bcard-status.over { color: var(--over); }
.bcard-left { font-size: 24px; font-weight: 600; margin-top: 4px; line-height: 1.1; white-space: nowrap; }
.bcard-left .cur { font-size: 16px; }
.bcard-left.over { color: var(--over); }
.bcard-cap { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* the bar: fill = money LEFT. marker = time left. fill left of marker → spending too fast. */
.bar { margin-top: 14px; height: 22px; border-radius: 11px; background: var(--surface-2); position: relative; }
.bcard .bar { background: color-mix(in srgb, var(--surface-2) 80%, var(--bg)); }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 11px; background: var(--c); transition: width 900ms cubic-bezier(.2,.8,.2,1); }
.bar-dip { position: absolute; top: 0; bottom: 0; border-radius: 0 11px 11px 0; background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 55%, transparent) 0 3px, transparent 3px 6px); }
.bar-marker { position: absolute; top: -7px; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--text); transform: translateX(-5px); }
.bar.big { height: 40px; border-radius: 14px; margin-top: 22px; }
.bar.big .bar-fill { border-radius: 14px; }
.bar.big .bar-marker { top: -9px; border-left-width: 6px; border-right-width: 6px; border-top-width: 8px; transform: translateX(-6px); }
.bar-over { position: absolute; inset: 0; border-radius: inherit; background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--over) 22%, transparent) 0 4px, transparent 4px 8px); }

.bcard.flash.go { animation: flash 1.6s ease-out 1; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }

.addcard { border: 1.5px dashed var(--faint); background: transparent; border-radius: var(--r); display: grid; place-items: center; color: var(--muted); font-size: 15px; font-weight: 500; min-height: 150px; }

/* no-limit list */
.plain-list { background: var(--surface); border-radius: var(--r); padding: 2px 16px; }
.plain-row { display: flex; align-items: center; gap: 12px; height: 52px; border-bottom: 1px solid var(--line); font-size: 16px; }
.plain-row:last-child { border-bottom: 0; }
.plain-row .n { flex: 1; }
.plain-row .v { font-weight: 500; }
.plain-row .chev { color: var(--faint); }

/* ── Transactions ─────────────────────────────── */
.day { margin-top: 28px; }
.day-head { display: flex; justify-content: space-between; font-size: 14px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 0 2px 10px; border-bottom: 1px solid var(--line); }
.tx { display: flex; align-items: center; gap: 14px; padding: 12px 2px; }
.emoji-tile { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--c) 30%, var(--bg)); flex: none; }
.tx-body { flex: 1; min-width: 0; }
.tx-title { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 14px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.tx-amt { font-size: 17px; font-weight: 500; white-space: nowrap; }
.tx.new { background: color-mix(in srgb, var(--c) 10%, transparent); border-radius: 14px; margin: 0 -8px; padding: 12px 10px; }

.who { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; font-weight: 700; color: #fff; flex: none; }

/* ── Expenses hero ─────────────────────────────── */
.xhero { text-align: center; padding-top: 8px; }
.xhero .lbl { font-size: 17px; display: inline-flex; gap: 6px; align-items: center; }
.xhero .amt { font-size: 52px; font-weight: 500; margin-top: 10px; line-height: 1; }
.xhero .amt .cur { font-size: 36px; }
.filters { display: flex; justify-content: center; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; background: var(--surface); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); }

/* ── Category detail ─────────────────────────────── */
.cd-head { text-align: center; margin-top: 4px; }
.cd-head .name { font-size: 22px; font-weight: 600; }
.cd-head .pill { margin-top: 10px; color: var(--muted); }
.cd-nums { display: flex; justify-content: space-between; margin-top: 30px; gap: 12px; }
.cd-nums .big { font-size: 26px; font-weight: 600; line-height: 1; white-space: nowrap; }
.cd-nums .big .cur { font-size: 18px; }
.cd-nums .cap { font-size: 14px; color: var(--muted); margin-top: 6px; }
.cd-nums .r { text-align: right; }
.cd-scale { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; }
.cd-split { display: flex; gap: 10px; margin-top: 20px; }
.cd-split .cell { flex: 1; background: var(--surface); border-radius: 14px; padding: 12px 14px; }
.cd-split .cell .k { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.cd-split .cell .v { font-size: 17px; font-weight: 600; margin-top: 4px; }
.periodnav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 30px; font-size: 18px; font-weight: 600; }

/* ── Tab bar ─────────────────────────────── */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; display: flex; justify-content: space-around; align-items: center; padding: 10px 12px 28px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tab { width: 56px; height: 44px; display: grid; place-items: center; color: var(--faint); }
.tab svg { width: 26px; height: 26px; }
.tab.on { color: var(--text); }
.tab-add { width: 88px; height: 48px; border-radius: 16px; background: var(--ink-btn); color: var(--ink-btn-text); display: grid; place-items: center; }
.tab-add svg { width: 24px; height: 24px; }

/* ── Grouped list (settings) ─────────────────────────────── */
.group { background: var(--surface); border-radius: 16px; overflow: hidden; }
.group-label { font-size: 13px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 28px 16px 8px; }
.row { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 16px; position: relative; font-size: 17px; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; height: 1px; background: var(--line); }
.group.plain .row + .row::before { left: 16px; }
.row .ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; }
.row .ico svg { width: 18px; height: 18px; }
.row .lbl { flex: 1; }
.row .val { color: var(--muted); }
.row .chev { color: var(--faint); width: 14px; }
.row .check { color: var(--text); }
.row .code { width: 48px; color: var(--muted); font-weight: 500; }
.row .swatch { width: 28px; height: 28px; border-radius: 8px; }
.row .emoji { font-size: 22px; width: 30px; text-align: center; }
.row .lim { font-size: 14px; color: var(--muted); }
.footnote { font-size: 13px; color: var(--muted); margin: 8px 16px 0; line-height: 1.4; }

.toggle { width: 51px; height: 31px; border-radius: 16px; background: var(--surface-2); position: relative; flex: none; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: left .2s; }
.toggle.on { background: var(--ok); }
.toggle.on::after { left: 22px; }

.search { height: 40px; border-radius: 12px; background: var(--surface); display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--muted); font-size: 16px; margin-bottom: 12px; }

/* ── Flows (set budget) ─────────────────────────────── */
.flow { padding: 12px 24px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.flow h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin-top: 18px; }
.flow .lead { font-size: 17px; color: var(--muted); margin-top: 8px; line-height: 1.35; }
.steps { display: flex; gap: 6px; }
.steps i { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-2); }
.steps i.on { background: var(--text); }
.choice { margin-top: 40px; background: var(--bg); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; border: 1px solid var(--line); }
.choice button { width: 100%; height: 56px; padding: 0 16px; font-size: 19px; display: flex; justify-content: space-between; align-items: center; border-radius: 12px; }
.choice button.on { background: var(--surface); }
.cta { margin-top: auto; height: 56px; border-radius: 16px; background: var(--ink-btn); color: var(--ink-btn-text); font-size: 18px; font-weight: 600; width: 100%; }
.amount-entry { text-align: center; font-size: 60px; font-weight: 500; margin-top: 56px; }
.amount-entry .cur { font-size: 40px; }
.amount-hint { text-align: center; color: var(--muted); font-size: 15px; margin-top: 10px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: auto; }
.keypad button { height: 64px; border-radius: 14px; background: var(--surface); font-size: 28px; }
.keypad button.ok { background: var(--ink-btn); color: var(--ink-btn-text); }

/* ── Category edit ─────────────────────────────── */
.ce-emoji { width: 88px; height: 88px; border-radius: 24px; font-size: 44px; display: grid; place-items: center; margin: 12px auto 0; background: color-mix(in srgb, var(--c) 30%, var(--bg)); }
.ce-name { text-align: center; font-size: 24px; font-weight: 600; margin-top: 14px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; padding: 16px; }
.swatches i { aspect-ratio: 1; border-radius: 50%; }
.swatches i.on { outline: 3px solid var(--text); outline-offset: 2px; }
.danger { color: var(--over); text-align: center; font-weight: 500; }

/* ── Expense detail ─────────────────────────────── */
.receipt { margin-top: 18px; border-radius: 16px; overflow: hidden; height: 200px; background: var(--surface) center/cover; position: relative; }
.receipt span { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 8px; }
.items .row { font-size: 16px; min-height: 46px; }
.bubble-quote { margin-top: 18px; border-left: 3px solid var(--faint); padding: 2px 0 2px 12px; font-size: 15px; color: var(--muted); font-style: italic; }

/* ── Stats ─────────────────────────────── */
.stat-hero { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 20px; }
.stat-hero .amt { font-size: 36px; font-weight: 600; line-height: 1; }
.stat-hero .amt .cur { font-size: 22px; }
.delta { font-size: 14px; font-weight: 600; }
.delta.up { color: var(--over); } .delta.down { color: var(--ok); }
.cols { display: flex; align-items: flex-end; gap: 8px; height: 150px; margin-top: 24px; }
.cols .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.cols .col i { width: 100%; border-radius: 6px; background: var(--surface-2); display: block; }
.cols .col.cur-m i { background: var(--text); }
.cols .col span { font-size: 11px; color: var(--muted); }
.split { display: flex; gap: 10px; margin-top: 12px; }
.split .cell { flex: 1; background: var(--surface); border-radius: 14px; padding: 14px; }
.split .cell .k { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.split .cell .v { font-size: 20px; font-weight: 600; margin-top: 6px; }
.split .cell .p { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Empty ─────────────────────────────── */
.empty { text-align: center; padding: 70px 24px 0; }
.empty p { color: var(--muted); font-size: 16px; margin-top: 8px; line-height: 1.4; }

/* ── Telegram chat mock ─────────────────────────────── */
.chat { background: #cfe0c3 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40'><circle cx='20' cy='20' r='1.5' fill='%23b5cba6'/></svg>"); min-height: 100vh; padding: 0 0 90px; }
:root[data-theme="dark"] .chat { background: #0f1a14; }
.chat-head { background: var(--bg); display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-head .av { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #17a864, #0c7a48); display: grid; place-items: center; color: #fff; font-size: 20px; }
.chat-head .t { font-weight: 600; font-size: 16px; }
.chat-head .s { font-size: 13px; color: var(--muted); }
.msgs { padding: 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 8px 12px 6px; border-radius: 16px; font-size: 15px; line-height: 1.35; background: var(--bg); color: var(--text); box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.msg.me { align-self: flex-end; background: #e1fec6; }
:root[data-theme="dark"] .msg.me { background: #2b5278; color: #fff; }
.msg .time { float: right; font-size: 11px; color: var(--muted); margin: 6px 0 0 10px; }
.msg.photo { padding: 3px; }
.msg.photo .img { width: 220px; height: 280px; border-radius: 13px; background: #eee center/cover; }
.msg .kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 2px; font-size: 14px; }
.msg .kv span:nth-child(odd) { color: var(--muted); }
.msg .mini-bar { height: 8px; border-radius: 4px; background: var(--surface-2); position: relative; margin: 8px 0 4px; }
.msg .mini-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.inline-kb { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-width: 82%; }
.inline-kb button { background: rgba(0,0,0,.18); color: #fff; font-size: 14px; font-weight: 500; height: 38px; border-radius: 10px; }
.inline-kb button.wide { grid-column: 1 / -1; }
.composer { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: var(--bg); display: flex; align-items: center; gap: 10px; padding: 8px 10px 28px; border-top: 1px solid var(--line); }
.composer .open-app { height: 36px; padding: 0 14px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; }
.composer .inp { flex: 1; height: 36px; border-radius: 18px; border: 1px solid var(--line); padding: 0 14px; display: flex; align-items: center; color: var(--muted); font-size: 15px; }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); top: 12px; background: var(--ink-btn); color: var(--ink-btn-text); padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 5; white-space: nowrap; }
.toast.show { opacity: 1; }

/* ── additions ─────────────────────────────── */
:root { --pa: #d9488f; --pk: #2f6fed; }
.who.p-a { background: var(--pa); } .who.p-k { background: var(--pk); }
.who.big { width: 32px; height: 32px; font-size: 14px; }
.avs { display: inline-flex; gap: 2px; vertical-align: middle; }
.inl { width: 14px; height: 14px; vertical-align: -2px; }
.src-ic { width: 13px; height: 13px; color: var(--faint); }
.dim { opacity: .7; font-weight: 400; }
.center { text-align: center; }
.actions { display: flex; gap: 8px; }
.add-inline { width: 26px; height: 26px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--muted); }
.add-inline svg { width: 16px; height: 16px; }
.addcard { flex-direction: column; gap: 6px; display: flex; align-items: center; justify-content: center; }
.addcard svg { width: 22px; height: 22px; }
.bar-dip { transition: opacity .8s; }
.bar-dip.fade { opacity: 0; }
.bar-fill { z-index: 1; } .bar-marker { z-index: 2; }

.ce-emoji.sm { width: 64px; height: 64px; font-size: 32px; border-radius: 18px; margin: 0 auto 10px; }
.emoji-tile.lg { width: 72px; height: 72px; font-size: 36px; border-radius: 20px; margin: 4px auto 0; }
.txd-amt { font-size: 40px; font-weight: 600; margin-top: 14px; }
.txd-amt .cur { font-size: 26px; }
.cd-head .name { margin-top: 6px; }
.cd-nums .big.over { color: var(--over); }
.cd-nums.single { justify-content: center; text-align: center; }
.setlimit { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 18px auto 0; height: 40px; padding: 0 16px; width: max-content; border-radius: 999px; background: var(--surface); font-weight: 500; font-size: 15px; }
.setlimit svg { width: 16px; height: 16px; }
.empty.small { padding: 40px 0 0; }

.whosplit { display: flex; gap: 3px; height: 4px; width: 160px; margin: 14px auto 0; border-radius: 2px; overflow: hidden; }
.whosplit i { display: block; }

.cols .col em { font-style: normal; font-size: 11px; color: var(--muted); }
.cols .col.cur-m em { color: var(--text); font-weight: 600; }
.plain-row .v { min-width: 64px; text-align: right; }
.row.total { font-weight: 600; }
.split .cell .k svg { width: 15px; height: 15px; color: var(--muted); }

button.row { width: 100%; text-align: left; }
.danger { display: block; width: 100%; margin-top: 32px; height: 50px; border-radius: 14px; background: var(--surface); }
.search input { border: 0; background: none; outline: none; font: inherit; color: var(--text); flex: 1; height: 100%; }
.search svg { width: 18px; height: 18px; }
input.ce-name { display: block; width: 100%; border: 0; background: none; outline: none; color: var(--text); font-family: inherit; }
.iconbtn.ok { background: var(--ink-btn); color: var(--ink-btn-text); }

/* flows */
.flow .topbar .pill { font-size: 13px; }
.catchips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 48px 0 32px; }
.catchip { height: 44px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); font-size: 17px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.catchip.on { border-color: var(--text); background: var(--surface); }
.catchip.ghost { color: var(--muted); border-style: dashed; }
.catchip svg { width: 16px; height: 16px; }
a.cta { display: grid; place-items: center; }
.cta.disabled { background: var(--surface); color: var(--faint); pointer-events: none; }
.amount-hint.bad { color: var(--over); }

/* manual add */
.flow.add { padding-bottom: 20px; }
.flow.add .seg button { display: inline-flex; align-items: center; gap: 6px; }
.add-amount { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; }
.add-amount .amount-entry { margin-top: 0; }
.notebtn { margin-top: 14px; height: 38px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 8px; max-width: 90%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.notebtn svg { width: 18px; height: 18px; flex: none; }
.add-row { display: flex; gap: 10px; margin-bottom: 10px; }
.pillbtn { height: 48px; border-radius: 14px; border: 1.5px solid var(--line); padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; white-space: nowrap; }
.pillbtn:first-child { flex: 1; }
.pillbtn .muted { margin-left: auto; font-weight: 500; }
.pillbtn svg { width: 18px; height: 18px; color: var(--muted); }
.pillbtn.set { background: color-mix(in srgb, var(--c) 20%, var(--bg)); border-color: transparent; }
.picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.picker .catchip { height: 38px; font-size: 15px; padding: 0 12px; }
.flow.add .keypad { margin-top: 0; }
.flow.add .keypad button { height: 58px; }
.keypad button svg { width: 26px; height: 26px; }
.tip { margin-top: 14px; }

/* chat */
.chat-head .iconbtn { margin-right: 2px; }
.msgs .sys { align-self: center; background: rgba(0,0,0,.2); color: #fff; font-size: 13px; padding: 3px 10px; border-radius: 10px; }
.msg.alert { border-left: 3px solid var(--warn); }
.msg .mini-bar { width: 200px; }
.msg.photo .img { overflow: hidden; }
.msg.photo .img svg { width: 100%; height: 100%; display: block; }
.msg .time { position: relative; top: 2px; }
.cmp { width: 22px; height: 22px; color: var(--muted); }
.receipt > svg { width: 100%; height: 100%; display: block; }
svg.chev { width: 16px; height: 16px; flex: none; color: var(--faint); }
.plain-row .v, .tx-amt, .latest-amt { white-space: nowrap; }
.plain-row .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cols .col .track { flex: 1; width: 100%; position: relative; display: block; }
.cols .col .track i { position: absolute; left: 0; right: 0; bottom: 0; }

/* ── charts ─────────────────────────────── */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .pace { fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 4 5; }
.chart .proj { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 1 5; stroke-linecap: round; opacity: 0; animation: fadein .5s 1.2s forwards; }
.chart .proj.bad { stroke: var(--over); }
.chart .zero { stroke: var(--over); stroke-width: 1; opacity: .4; }
.chart .ref { fill: none; stroke: var(--faint); stroke-width: 2; stroke-dasharray: 5 5; }
.chart .ref-dot { fill: var(--faint); }
.chart .area { opacity: 0; animation: fadein .8s .6s forwards; }
.chart .draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.2s cubic-bezier(.4,0,.2,1) forwards; }
.chart .dot { opacity: 0; animation: fadein .3s 1.1s forwards; }
.chart .dot-pulse { fill: none; stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; animation: pulse 2s 1.3s 3; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }
@keyframes pulse { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(3); } }

.hero-chart { margin-top: 20px; }
.chart-scale { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 6px; }
.hero-pace { font-size: 14px; color: var(--muted); margin-top: 10px; }
.hero-pace .good { color: var(--ok); font-weight: 600; }
.hero-pace .bad { color: var(--over); font-weight: 600; }
.hero-pace .cur { color: inherit; opacity: .75; }
.card-chart { background: var(--surface); border-radius: var(--r); padding: 16px 14px 14px; margin-top: 12px; }
.card-chart.flat { background: none; padding: 0 2px; margin-top: 22px; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--muted); }
.lg-line { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.lg-dash { display: inline-block; width: 14px; height: 0; border-top: 2px dashed var(--faint); margin-left: 6px; }
.muted-r { text-transform: none; letter-spacing: 0; }

/* daily columns */
.dcols { display: flex; align-items: flex-end; gap: 2px; }
.dcol { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.dcol i { display: block; width: 100%; border-radius: 3px; background: var(--faint); transform-origin: bottom; animation: grow .6s cubic-bezier(.2,.8,.2,1) both; }
.dcol.hi i { background: var(--accent); }
.dcol.fut i { background: var(--surface-2); }
@keyframes grow { from { transform: scaleY(0); } }

/* month columns */
.cols .col .track i { transform-origin: bottom; animation: grow .7s cubic-bezier(.2,.8,.2,1) both; }

/* donut */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { position: relative; width: 150px; height: 150px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-bg { fill: none; stroke: var(--surface); stroke-width: 16; }
.donut .seg { fill: none; stroke-width: 16; stroke-dasharray: 0 100; stroke-dashoffset: var(--o); animation: seg .9s cubic-bezier(.3,.7,.2,1) forwards; }
@keyframes seg { to { stroke-dasharray: var(--p) 100; } }
.donut-centre { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.dc-l { font-size: 11px; color: var(--muted); }
.dc-v { font-size: 22px; font-weight: 700; }
.donut-top { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.donut-top a { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.donut-top a i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.donut-top a span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar { display: block; height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.hbar i { display: block; height: 100%; border-radius: 2px; transform-origin: left; animation: growx .8s cubic-bezier(.2,.8,.2,1) both; }
@keyframes growx { from { transform: scaleX(0); } }
.plain-list .plain-row:has(.hbar) { height: 60px; }

/* heat calendar */
.heat-head, .heat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.heat-head b { font-size: 11px; font-weight: 500; color: var(--muted); text-align: center; margin-bottom: 4px; }
.heat-grid i { aspect-ratio: 1; border-radius: 8px; background: color-mix(in srgb, var(--accent) calc(var(--a) * 100%), var(--surface-2)); display: grid; place-items: center; animation: pop .4s cubic-bezier(.2,.8,.2,1.4) both; }
.heat-grid i span { font-size: 11px; font-style: normal; color: var(--muted); }
.heat-grid i.lt span { color: #fff; }
.heat-grid i.blank { background: none; animation: none; }
.heat-grid i.fut { background: none; outline: 1px dashed var(--line); outline-offset: -1px; }
.heat-grid i.today { outline: 2px solid var(--text); outline-offset: 1px; }
.heat-note { font-size: 13px; color: var(--muted); margin-top: 12px; }
.heat-note b { color: var(--text); font-weight: 600; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* who bar */
.whobar { display: flex; gap: 3px; height: 10px; border-radius: 5px; overflow: hidden; margin-bottom: 4px; }
.whobar i { display: block; transform-origin: left; animation: growx .9s cubic-bezier(.2,.8,.2,1) both; }
.whobar .p-a { background: var(--pa); } .whobar .p-k { background: var(--pk); }

.delta { display: flex; flex-direction: column; align-items: flex-end; font-size: 16px; }
.delta span { font-size: 12px; font-weight: 400; color: var(--muted); }
.stat-hero .amt { margin-top: 4px; }

/* dip stripe waits until the second step */
.bar-dip.wait { opacity: 0; }
.bar-dip { transition: opacity .4s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition: none !important; }
  .chart .draw { stroke-dashoffset: 0; }
}
.emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 10px; }
.emojis button { aspect-ratio: 1; border-radius: 10px; font-size: 22px; }
.emojis button.on { background: var(--bg); box-shadow: 0 0 0 2px var(--text); }
.toggle { pointer-events: none; }
.tabbar, .periodnav, .composer { z-index: 10; } .toast { z-index: 20; }
.day-head .num { text-transform: none; }
.keypad .ok { grid-column: 1 / -1; height: 56px; font-size: 18px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.keypad .ok svg { width: 22px; height: 22px; }
.hero-amount.over { color: var(--over); }
.hero-sub .bad { color: var(--over); }
