[hidden] { display: none !important; }
:root {
  --bg: #f2f0f3; --card: #ffffff; --card2: #f6f5f7; --ink: #111113; --muted: #8b8a90; --faint: #c9c7cd; --line: #ecebee;
  --accent: #111113; --ok: #1f8a5b; --warn: #c27a1a; --bad: #d1453b;
  --grad: linear-gradient(135deg, #c9b8f2 0%, #f2b8d8 55%, #f8d0b0 100%);
  --radius: 22px; --shadow: 0 1px 2px rgba(17, 17, 19, .04), 0 8px 24px rgba(17, 17, 19, .04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f0f11; --card: #1a1a1d; --card2: #222226; --ink: #f2f1f4; --muted: #8f8e95; --faint: #4a4950; --line: #2a2a2e;
    --accent: #f2f1f4; --ok: #5cc795; --warn: #e5a34a; --bad: #ff7a6e; --shadow: none; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 Inter, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: -20% -10% auto auto; width: 70vw; height: 60vh; background: var(--grad); filter: blur(90px); opacity: .35; z-index: -1; pointer-events: none; }
#app { max-width: 560px; margin: 0 auto; padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
h1 { font-size: 20px; font-weight: 600; margin: 4px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 22px 4px 8px; }
h3 { font-size: 15px; font-weight: 500; margin: 0 0 6px; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; padding: 40px 0; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }

/* шапка и экран */
.top { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.top .title { font-size: 16px; font-weight: 500; }
.iconbtn { background: none; border: 0; padding: 8px; color: var(--ink); border-radius: 12px; display: inline-flex; cursor: pointer; }
.iconbtn:active { background: var(--line); }
.hello { margin: 6px 0 0; } .hello b { font-weight: 600; font-size: 17px; } .hello p { margin: 2px 0 0; color: var(--muted); }

/* крупные суммы */
.money { font-weight: 300; letter-spacing: -.03em; line-height: 1; white-space: nowrap; }
.money .cur { color: var(--faint); font-weight: 300; margin-left: .12em; font-size: .55em; }
.hero { padding: 26px 0 10px; position: relative; isolation: isolate; }
.hero::after { content: ""; position: absolute; right: -10px; top: 10px; width: 62%; height: 120px; background: var(--grad); filter: blur(42px); opacity: .55; z-index: -1; border-radius: 50%; } .hero .money { font-size: 52px; }
.hero .sub { margin-top: 8px; font-size: 13px; color: var(--muted); } .hero .sub b { color: var(--ink); font-weight: 500; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 6px; }
.trio > div > span:first-child { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; } .trio .money { font-size: 21px; font-weight: 400; }

/* карточки */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 8px 0; box-shadow: var(--shadow); }
.card.soft { background: var(--card2); box-shadow: none; }
.card.grad { background: var(--grad); color: #1a1420; }
.card.grad .muted, .card.grad .cap { color: rgba(26, 20, 32, .65); }
.cap { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rowcard { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.rowcard .money { font-size: 20px; font-weight: 400; margin-top: 4px; }
.rowcard .go { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; }
.tile .money { font-size: 30px; }
.tile .foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; color: var(--ink); }
.dots { display: inline-flex; gap: 4px; } .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); opacity: .2; } .dots i.on { opacity: 1 !important; }

/* полоски прогресса */
.bar { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.bar i.over { background: var(--bad); } .bar i.near { background: var(--warn); }
.line { padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; } .line:last-child { border-bottom: 0; padding-bottom: 2px; } .line:first-child { padding-top: 2px; }
.line .name { font-size: 14px; } .line .val { font-size: 14px; white-space: nowrap; }
.line .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.line .pct { font-size: 12px; color: var(--muted); }
.note { background: var(--card2); border-radius: 14px; padding: 10px 12px; font-size: 13px; margin-top: 10px; }
.note.bad { background: rgba(209, 69, 59, .08); color: var(--ink); }

/* кнопки и поля */
button, .btn { font: inherit; border: 0; border-radius: 16px; padding: 15px 16px; background: var(--accent); color: var(--bg); cursor: pointer; font-weight: 500; }
button.ghost { background: var(--card); color: var(--ink); box-shadow: var(--shadow); } button.danger { background: rgba(209, 69, 59, .1); color: var(--bad); }
button.link { background: none; color: var(--ink); padding: 4px 0; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
button:disabled { opacity: .4; }
.wide { width: 100%; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 4px; }
.actions button { background: var(--card); color: var(--ink); box-shadow: var(--shadow); padding: 12px 4px; font-size: 12px; font-weight: 400; display: flex; flex-direction: column; align-items: center; gap: 6px; border-radius: 18px; }
input, select, textarea { font: inherit; width: 100%; padding: 14px; border: 0; border-radius: 14px; background: var(--card2); color: var(--ink); outline: none; }
input:focus, select:focus { box-shadow: 0 0 0 1.5px var(--ink) inset; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 2px 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; } .chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 9px 14px; border-radius: 99px; background: var(--card); color: var(--ink); font-size: 13.5px; font-weight: 400; box-shadow: var(--shadow); }
.chip.on { background: var(--ink); color: var(--bg); }
.seg { display: inline-flex; gap: 18px; } .seg button { background: none; color: var(--muted); padding: 6px 0; font-weight: 400; border-radius: 0; } .seg button.on { color: var(--ink); font-weight: 500; }

/* ввод суммы: аватары категорий + клавиатура */
.avatars { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.avatars::-webkit-scrollbar { display: none; }
.av { flex: none; width: 64px; background: none; color: var(--ink); padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; font-weight: 400; border-radius: 0; }
.av b { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--card2); font-weight: 500; font-size: 14px; }
.av.on b { background: var(--grad); box-shadow: 0 0 0 2px var(--ink); }
.av span { line-height: 1.15; text-align: center; color: var(--muted); } .av.on span { color: var(--ink); }
.amount-big { text-align: center; padding: 18px 0 4px; } .amount-big .money { font-size: 56px; }
.amount-big .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 8px 0 12px; }
.keypad button { background: none; color: var(--ink); font-size: 26px; font-weight: 300; padding: 12px 0; border-radius: 14px; }
.keypad button:active { background: var(--line); }

/* списки операций */
.tx { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.tx:last-child { border-bottom: 0; }
.tx .t1 { font-size: 14px; } .tx .t2 { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tx .amt { white-space: nowrap; font-size: 14px; } .amt.plus { color: var(--ok); } .amt.neutral { color: var(--muted); }
.daychart { display: flex; align-items: flex-end; gap: 3px; height: 96px; margin: 18px 0 6px; }
.daychart i { flex: 1; background: var(--faint); border-radius: 2px; min-height: 2px; } .daychart i.today { background: var(--ink); } .daychart i.over { background: var(--bad); }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

/* «Могу?» */
.verdict { border-radius: var(--radius); padding: 20px; margin-top: 10px; }
.verdict h2 { margin: 0 0 6px; font-size: 22px; color: inherit; font-weight: 500; letter-spacing: -.01em; }
.v-yes { background: var(--grad); color: #1a1420; } .v-maybe, .v-later, .v-cushion { background: var(--card); box-shadow: var(--shadow); } .v-no { background: var(--ink); color: var(--bg); }
.v-no .muted { color: var(--faint); }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; } th, td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: right; font-weight: 400; } th { color: var(--muted); } th:first-child, td:first-child { text-align: left; }
.scroll { overflow-x: auto; }

/* нижнее меню, шторка, уведомление */
nav#nav { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); z-index: 5; }
nav#nav button { background: none; color: var(--muted); font-size: 10.5px; font-weight: 400; padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 0; }
nav#nav button.on { color: var(--ink); }
nav#nav button.plus .pl { background: var(--ink); color: var(--bg); width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; margin-top: -10px; }
#sheet { position: fixed; inset: 0; background: rgba(17, 17, 19, .28); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
#sheet > div { background: var(--bg); width: 100%; max-width: 560px; max-height: 94vh; overflow: auto; border-radius: 26px 26px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 16px; font-size: 13.5px; z-index: 20; max-width: 92vw; }
.menu button { width: 100%; background: var(--card); color: var(--ink); box-shadow: var(--shadow); margin: 6px 0; display: flex; align-items: center; gap: 12px; font-weight: 400; text-align: left; }
.menu button .grow { flex: 1; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 12px; background: var(--card); box-shadow: var(--shadow); }
.avgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 6px; padding: 4px 0 8px; }
.avgrid .av { width: auto; }
