@font-face { font-family: Geist; src: url(/fonts/geist.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f5f6f7; --surface: #ffffff; --surface-2: #f1f2f4; --surface-3: #e8eaed; --line: #e6e8eb; --line-strong: #d3d6db;
  --ink: #101418; --ink-2: #4b5259; --ink-3: #737a82; --accent: #0b7a66; --accent-hover: #09685a; --accent-soft: #e2f3ef; --accent-ink: #ffffff;
  --income: #0a8a5c; --expense: #101418; --transfer: #4b5259; --good: #0a8a5c; --warn: #b26b00; --warn-soft: #fbf1dd; --danger: #cf3535; --danger-soft: #fbe9e9; --good-soft: #e1f4ec; --info-soft: #e7f0fb;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948; --other: #a9acb2;
  --chart-income: #1baf7a; --chart-expense: #eb6834; --chart-net: #2a78d6;
  --shadow-sm: 0 1px 2px rgb(16 20 24 / .05); --shadow: 0 1px 2px rgb(16 20 24 / .06), 0 12px 32px rgb(16 20 24 / .1); --radius: 16px; --radius-sm: 10px;
  --font: Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0d1012; --surface: #15191c; --surface-2: #1d2226; --surface-3: #272d32; --line: #242a2e; --line-strong: #363d43;
  --ink: #eef1f2; --ink-2: #b4bbc1; --ink-3: #868e95; --accent: #2bb79c; --accent-hover: #3ccab0; --accent-soft: #123029; --accent-ink: #06211b;
  --income: #3fcf9b; --expense: #eef1f2; --transfer: #b4bbc1; --good: #3fcf9b; --warn: #e0a33a; --warn-soft: #33270f; --danger: #f07f7e; --danger-soft: #3a1a1a; --good-soft: #10302a; --info-soft: #14283f;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --other: #646b71;
  --chart-income: #199e70; --chart-expense: #d95926; --chart-net: #3987e5;
  --shadow-sm: none; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px rgb(0 0 0 / .5);
} }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1012; --surface: #15191c; --surface-2: #1d2226; --surface-3: #272d32; --line: #242a2e; --line-strong: #363d43;
  --ink: #eef1f2; --ink-2: #b4bbc1; --ink-3: #868e95; --accent: #2bb79c; --accent-hover: #3ccab0; --accent-soft: #123029; --accent-ink: #06211b;
  --income: #3fcf9b; --expense: #eef1f2; --transfer: #b4bbc1; --good: #3fcf9b; --warn: #e0a33a; --warn-soft: #33270f; --danger: #f07f7e; --danger-soft: #3a1a1a; --good-soft: #10302a; --info-soft: #14283f;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --other: #646b71;
  --chart-income: #199e70; --chart-expense: #d95926; --chart-net: #3987e5;
  --shadow-sm: none; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px rgb(0 0 0 / .5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--font); font-feature-settings: "tnum"; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.boot { display: grid; place-items: center; min-height: 100dvh; color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
::selection { background: var(--accent-soft); }

/* shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 2px; padding: 16px 12px 12px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15.5px; letter-spacing: -.01em; padding: 4px 8px 16px; }
.brand img { width: 26px; height: 26px; }
.nav-label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 14px 10px 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 500; text-decoration: none; transition: background .12s, color .12s; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; padding-top: 10px; }
.side-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px; text-align: left; text-decoration: none; min-width: 0; }
.side-user:hover { background: var(--surface-2); }
.side-user span:last-child { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); flex: none; object-fit: cover; display: grid; place-items: center; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.tabbar { display: none; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 10px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); }
.cmd-trigger { display: flex; align-items: center; gap: 9px; flex: 0 1 380px; min-width: 0; height: 36px; padding: 0 10px 0 11px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--ink-3); box-shadow: var(--shadow-sm); text-align: left; font-size: 13.5px; }
.cmd-trigger:hover { border-color: var(--line-strong); }
.cmd-trigger svg { width: 16px; height: 16px; flex: none; }
.cmd-trigger span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
kbd { font: 500 11px/1 var(--font); padding: 3px 5px; border-radius: 5px; background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }
.topbar .spacer { flex: 1; }
.main { padding: 8px 28px 72px; min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* page header */
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 40px; margin-bottom: 16px; }
.head h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.head .sub { color: var(--ink-3); font-size: 13.5px; }
.head .spacer { flex: 1; }
.period { display: inline-flex; align-items: center; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); }
.period b { font-size: 14px; font-weight: 600; min-width: 92px; text-align: center; white-space: nowrap; padding: 0 2px; }
.period .icon-btn { width: 34px; height: 34px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--ink-2); flex: none; transition: background .12s, color .12s; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.period-sub { color: var(--ink-3); font-size: 12.5px; margin: -10px 0 12px; }

.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 11px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; width: fit-content; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { min-width: max-content; padding: 6px 14px; border-radius: 8px; color: var(--ink-2); font-weight: 550; font-size: 13.5px; transition: color .12s; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
.tabs.full { width: 100%; }
.tabs.full button { flex: 1; }
.seg { display: inline-flex; gap: 1px; padding: 2px; background: var(--surface-2); border-radius: 8px; }
.seg button { padding: 3px 9px; font-size: 12.5px; font-weight: 550; border-radius: 6px; color: var(--ink-3); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 1px rgb(0 0 0 / .1); }

/* cards and layout */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow-sm); min-width: 0; }
.card-pad { padding: 18px; }
.card-title { font-size: 13.5px; font-weight: 600; color: var(--ink); padding: 16px 18px 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-title small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.card-title .spacer { flex: 1; }
.card-link { font-size: 12.5px; color: var(--accent); font-weight: 550; text-decoration: none; }
.card-link:hover { text-decoration: underline; }
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.grid > .card { margin-bottom: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; } .g-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; } .stack > .card { margin-bottom: 0; }

.kpi { padding: 14px 16px; min-width: 0; position: relative; }
.kpi small { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 500; margin-bottom: 3px; }
.kpi b { display: block; font-size: 21px; font-weight: 650; letter-spacing: -.02em; overflow-wrap: anywhere; line-height: 1.2; }
.kpi .delta { margin-top: 5px; }
.delta { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; font-size: 12px; font-weight: 550; color: var(--ink-3); }
.delta.good { color: var(--good); } .delta.bad { color: var(--danger); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 16px; padding: 20px 22px; align-items: center; }
.hero small { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.hero .big { font-size: 36px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; margin: 3px 0 5px; overflow-wrap: anywhere; }
.hero-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.hero-meta b { display: block; color: var(--ink); font-weight: 600; font-size: 14px; }

.totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.totals > div, .totals > button { padding: 12px 16px; min-width: 0; text-align: left; }
.totals > * + * { border-left: 1px solid var(--line); }
.totals small { display: block; color: var(--ink-3); font-size: 12.5px; margin-bottom: 1px; }
.totals b { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
.income { color: var(--income); } .expense { color: var(--expense); } .transfer { color: var(--transfer); } .negative { color: var(--danger); }
.muted { color: var(--ink-3); } .small { font-size: 13px; } .right { text-align: right; } .danger { color: var(--danger); } .nowrap { white-space: nowrap; }

/* privacy mode: amounts blur until hovered */
.privacy .row-amt, .privacy .val, .privacy .totals b, .privacy .kpi b, .privacy .hero .big, .privacy .hero-meta b, .privacy .day-totals, .privacy .budget-top b, .privacy .budget-foot, .privacy .money, .privacy .cal-d span:not(.cal-n), .privacy .chart-box, .privacy .delta, .privacy table.data td.n { filter: blur(7px); transition: filter .15s; }
.privacy .row-amt:hover, .privacy .val:hover, .privacy .totals b:hover, .privacy .kpi b:hover, .privacy .hero .big:hover { filter: none; }

/* transaction list */
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.day-head { display: flex; align-items: center; gap: 9px; padding: 9px 16px; background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); border-bottom: 1px solid var(--line); }
.day-num { font-size: 16px; font-weight: 650; line-height: 1; }
.day-week { font-size: 12px; font-weight: 550; color: var(--ink-2); }
.day-month { color: var(--ink-3); font-size: 12px; }
.day-totals { margin-left: auto; display: flex; gap: 14px; font-size: 13px; font-weight: 550; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; text-align: left; border-top: 1px solid var(--line); transition: background .1s; }
.day .row:first-of-type, .list > .row:first-child, .card-title + .row { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); flex: none; font-size: 17px; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tags { display: flex; gap: 4px; flex: none; }
.row-amt { font-weight: 600; text-align: right; flex: none; }
.row-amt small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; }
.row-check { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.chev { color: var(--ink-3); flex: none; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.tag.good { background: var(--good-soft); color: var(--good); } .tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.bad { background: var(--danger-soft); color: var(--danger); } .tag.accent { background: var(--accent-soft); color: var(--accent); }
.bulk { position: sticky; bottom: 14px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin-top: 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.bulk b { margin-right: auto; }

.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-size: 15.5px; font-weight: 600; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }
.empty-art { width: 44px; height: 44px; border-radius: 13px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 12px; font-size: 21px; }
.empty-art svg { width: 55%; height: 55%; }

/* skeleton while loading */
.skel { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; margin-bottom: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.cal-h { padding: 8px 4px; text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.cal-d { min-height: 92px; padding: 7px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); text-align: left; display: flex; flex-direction: column; gap: 1px; font-size: 12px; min-width: 0; line-height: 1.3; transition: background .1s; }
.cal-d:nth-child(7n + 1) { border-left: 0; }
.cal-d:hover:not(:disabled) { background: var(--surface-2); }
.cal-d:disabled { cursor: default; background: var(--bg); }
.cal-n { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.cal-d.today .cal-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.cal-d span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* simple rows */
.line { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 18px; text-align: left; border-top: 1px solid var(--line); text-decoration: none; min-height: 46px; transition: background .1s; }
.card > .line:first-child, .card-title + .line, .group-head + .line { border-top: 0; }
button.line:hover, a.line:hover, summary.line:hover { background: var(--surface-2); }
.line .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.line .val { font-weight: 600; text-align: right; flex: none; }
.line .ctl { flex: none; }
.card > :last-child.line, details:last-child > .line { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.card > :first-child.line { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.sublist .line { padding-left: 34px; background: var(--bg); }
.group-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 18px 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.row-icon.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* progress */
.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s ease-out; }
.bar i.over { background: var(--danger); } .bar i.near { background: var(--warn); }
.bar .pace { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: .55; border-radius: 0; }
.budget-row { padding: 13px 18px; border-top: 1px solid var(--line); display: block; width: 100%; text-align: left; }
.budget-row:first-child, .card-title + .budget-row { border-top: 0; }
.budget-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-weight: 550; }
.budget-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 12.5px; color: var(--ink-3); }
.pct { font-size: 12.5px; color: var(--ink-3); min-width: 42px; text-align: right; flex: none; }
.swatch { width: 11px; height: 11px; border-radius: 3.5px; flex: none; }

/* charts */
.chart-card { display: flex; flex-direction: column; }
.chart-head { display: flex; align-items: flex-start; gap: 6px; padding: 14px 12px 0 18px; }
.chart-head h3 { font-size: 13.5px; font-weight: 600; }
.chart-head p { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.chart-head .titles { flex: 1; min-width: 0; }
.chart-tools { display: flex; align-items: center; gap: 2px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.chart-tools .icon-btn { width: 28px; height: 28px; color: var(--ink-3); }
.chart-tools .icon-btn svg { width: 15px; height: 15px; }
.chart-box { width: 100%; min-width: 0; padding: 4px 8px 8px; }
.chart-table { max-height: 360px; overflow: auto; margin: 8px 18px 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12px; padding: 7px 8px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.data th.n { text-align: right; }
table.data td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.data .n { text-align: right; white-space: nowrap; }
table.data tr.click { cursor: pointer; } table.data tr.click:hover td { background: var(--surface-2); }

@media (min-width: 761px) { .moblinks { display: none; } }

/* filters */
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 9px; background: var(--surface-2); font-size: 13.5px; border: 1px solid transparent; transition: background .1s; }
.chip:hover { background: var(--surface-3); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip.filter { background: var(--accent-soft); color: var(--accent); font-weight: 550; font-size: 12.5px; padding: 4px 8px 4px 10px; }
.chip.filter svg { width: 13px; height: 13px; }
.chip.out { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-sm); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* insights */
.insight { display: flex; gap: 11px; padding: 12px 18px; border-top: 1px solid var(--line); text-decoration: none; }
a.insight:hover { background: var(--surface-2); }
.card-title + .insight { border-top: 0; }
.insight i { width: 28px; height: 28px; border-radius: 9px; flex: none; display: grid; place-items: center; font-style: normal; font-size: 14px; background: var(--info-soft); }
.insight.good i { background: var(--good-soft); } .insight.bad i { background: var(--danger-soft); } .insight.warn i { background: var(--warn-soft); }
.insight b { font-weight: 600; display: block; font-size: 13.5px; }
.insight span { color: var(--ink-3); font-size: 12.5px; }

/* quick add bar */
.quick { display: flex; align-items: center; gap: 8px; padding: 7px 7px 7px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; margin-bottom: 14px; box-shadow: var(--shadow-sm); transition: border-color .12s; }
.quick:focus-within { border-color: var(--accent); }
.quick input[type=text] { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 5px 0; }
.quick > svg { width: 17px; height: 17px; color: var(--accent); flex: none; }

/* goals */
.goal { padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; text-align: left; width: 100%; }
.goal-top { display: flex; align-items: center; gap: 11px; }
.goal-name { font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* assistant */
.chat { display: flex; flex-direction: column; min-height: calc(100dvh - 110px); max-width: 820px; margin: 0 auto; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 18px; padding-bottom: 18px; }
.msg-user { align-self: flex-end; max-width: 80%; background: var(--accent); color: var(--accent-ink); padding: 9px 14px; border-radius: 15px 15px 4px 15px; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-ai { display: flex; gap: 11px; min-width: 0; }
.ai-mark { width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.ai-mark svg { width: 15px; height: 15px; }
.msg-body { flex: 1; min-width: 0; line-height: 1.6; overflow-wrap: anywhere; padding-top: 3px; }
.msg-body p { margin-bottom: 8px; } .msg-body p:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { margin: 4px 0 10px; padding-left: 20px; }
.msg-body h4 { font-size: 14.5px; font-weight: 650; margin: 10px 0 4px; }
.msg-body code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.msg-body .table-wrap { overflow-x: auto; margin: 8px 0; }
.msg-step { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 7px; }
.dot-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite ease-in-out; flex: none; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.75); } }
.chat-input { position: sticky; bottom: 12px; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 15px; box-shadow: var(--shadow); z-index: 4; }
.chat-input textarea { flex: 1; border: 0; background: none; resize: none; outline: none; min-height: 24px; max-height: 140px; padding: 5px 0; }
.chat-hint { font-size: 12px; color: var(--ink-3); text-align: center; padding-top: 16px; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 20px; }
.suggestion { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-align: left; font-size: 13.5px; color: var(--ink-2); transition: border-color .1s, color .1s; box-shadow: var(--shadow-sm); }
.suggestion:hover { border-color: var(--accent); color: var(--ink); }

/* command palette */
dialog.palette { border: 0; padding: 0; background: var(--surface); color: var(--ink); border-radius: 16px; width: min(600px, calc(100vw - 24px)); margin: 12vh auto auto; box-shadow: var(--shadow); overflow: hidden; }
dialog.palette::backdrop { background: rgb(0 0 0 / .35); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 17px; height: 17px; color: var(--ink-3); flex: none; }
.palette-input input { flex: 1; border: 0; background: none; outline: none; font-size: 15px; }
.palette-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px; border-radius: 9px; text-align: left; }
.palette-item svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.palette-item[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.palette-item[aria-selected="true"] svg { color: var(--accent); }

/* buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 10px; font-weight: 550; background: var(--surface); border: 1px solid var(--line-strong); text-decoration: none; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-small svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.fab { display: none; }
.field { display: block; margin-bottom: 13px; }
.field > span, .field-label { display: block; font-size: 12.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 5px; }
.input, select.input { width: 100%; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; min-height: 40px; transition: border-color .12s, box-shadow .12s; }
textarea.input { min-height: 68px; resize: vertical; }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.amount-input { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.switch { width: 38px; height: 22px; appearance: none; border-radius: 11px; background: var(--line-strong); position: relative; cursor: pointer; flex: none; margin: 0; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: -5px 0 13px; }
.keypad button { padding: 10px 0; border-radius: 9px; background: var(--surface-2); font-weight: 600; font-size: 15.5px; }
.keypad button:hover { background: var(--surface-3); }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photo { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button.x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: rgb(0 0 0 / .65); color: #fff; font-size: 13px; line-height: 1; }
.photo-add { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 10px; border: 1px dashed var(--line-strong); color: var(--ink-3); cursor: pointer; }
.photo-add:hover { background: var(--surface-2); }

/* sheet */
dialog.sheet { border: 0; padding: 0; background: var(--bg); color: var(--ink); border-radius: 18px; width: min(520px, calc(100vw - 32px)); max-height: min(90dvh, 880px); box-shadow: var(--shadow); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .18s ease-out; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
dialog.sheet::backdrop { background: rgb(8 12 15 / .45); backdrop-filter: blur(2px); }
dialog.sheet.wide { width: min(820px, calc(100vw - 32px)); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 11px 11px 11px 20px; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.sheet-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; flex: 1; min-width: 0; }
.sheet-body { padding: 16px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 11px 20px calc(11px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); flex: none; }
.sheet-foot .grow { flex: 1; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 11px; border-radius: 9px; font-size: 13.5px; margin-bottom: 12px; }
.form-note { color: var(--accent); background: var(--accent-soft); padding: 8px 11px; border-radius: 9px; font-size: 13.5px; margin-bottom: 12px; }

#toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 8px); z-index: 2000; padding: 9px 15px; background: var(--ink); color: var(--bg); border-radius: 11px; font-size: 13.5px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#tip { display: none; }

/* sign-in and lock */
.gate { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.gate-left { display: grid; place-items: center; padding: 32px 24px; background: var(--surface); }
.gate-card { width: min(380px, 100%); }
.gate-card img.logo { width: 44px; height: 44px; margin-bottom: 22px; }
.gate-card h1 { font-size: 32px; font-weight: 700; letter-spacing: -.03em; line-height: 1.12; margin-bottom: 10px; }
.gate-card p.lead { color: var(--ink-2); margin-bottom: 26px; font-size: 15.5px; }
.gsi { display: flex; min-height: 44px; margin-bottom: 14px; }
.gate-fine { font-size: 12.5px; color: var(--ink-3); }
.gate-right { display: flex; align-items: center; justify-content: center; padding: 40px; background: linear-gradient(145deg, var(--accent-soft), var(--bg)); overflow: hidden; }
.gate-show { display: grid; gap: 12px; width: min(440px, 100%); }
.gate-show .card { margin: 0; }
.mock-bars { display: flex; align-items: flex-end; gap: 7px; height: 92px; padding: 0 18px 16px; }
.mock-bars i { flex: 1; border-radius: 4px 4px 0 0; background: var(--chart-net); }
.mock-bars i:nth-child(even) { background: var(--chart-expense); }
.gate-simple { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; text-align: center; }
.gate-simple .gate-card { text-align: center; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 22px 0; min-height: 14px; }
.pin-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line-strong); transition: background .1s; }
.pin-dots i.on { background: var(--accent); }
.pinpad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; justify-content: center; }
.pinpad button { height: 56px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 20px; font-weight: 600; }
.pinpad button:hover { background: var(--surface-2); }

@media (max-width: 1080px) { .g-2-1, .g-3-2, .g3 { grid-template-columns: minmax(0, 1fr); } .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span-2 { grid-column: auto; } .hero { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .gate { grid-template-columns: minmax(0, 1fr); } .gate-right { display: none; } .g2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .shell { display: block; }
  .side { display: none; }
  .topbar { padding: 8px 14px; }
  .topbar .desktop-only, kbd { display: none; }
  .main { padding: 4px 14px calc(148px + env(safe-area-inset-bottom)); }
  .tabbar { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: var(--ink-3); font-size: 10.5px; font-weight: 550; text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar svg { width: 21px; height: 21px; }
  .fab { position: fixed; right: 14px; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 21; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
  .fab svg { width: 23px; height: 23px; }
  .bulk { bottom: calc(68px + env(safe-area-inset-bottom)); }
  .head h1 { font-size: 20px; }
  .totals b { font-size: 14.5px; }
  .totals > div, .totals > button { padding: 10px 12px; }
  .hero { padding: 16px; } .hero .big { font-size: 30px; }
  .kpi b { font-size: 18px; }
  .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-d { min-height: 62px; padding: 4px 3px; font-size: 10px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 6px 10px; }
  .row-tags { display: none; }
  .chart-head { flex-wrap: wrap; padding-right: 10px; }
  .chart-head .titles { flex: 1 1 100%; }
  .chart-tools { width: 100%; justify-content: flex-start; }
  .suggestions { grid-template-columns: minmax(0, 1fr); }
  .chat { min-height: calc(100dvh - 190px); }
  .chat-input { bottom: calc(62px + env(safe-area-inset-bottom)); }
  .quick .btn-small { padding: 5px 8px; }
  dialog.sheet, dialog.sheet.wide { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .day-totals { gap: 8px; font-size: 12.5px; }
  .bulk .btn { flex: 1; }
}
@media print {
  .side, .tabbar, .fab, .topbar, .chart-tools, .filterbar { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { break-inside: avoid; box-shadow: none; }
}
