:root {
  color-scheme: dark;
  --bg: #121516;
  --card: #1b1f20;
  --card-2: #272c2d;
  --line: #33393a;
  --line-2: #485052;
  --text: #f3f3ed;
  --dim: #b4bab6;
  --dim2: #99a39d;
  --acc: #d7f59b;
  --acc2: #c9ec93;
  --good: #ade5b8;
  --bad: #f4ad9d;
  --move: #c1b7eb;
  --ink: #20291c;
  --r: 19px;
  --shadow: 0 12px 40px rgba(0,0,0,.26);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --side: 196px;
  --shell: 1330px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
button:disabled { opacity: .6; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--acc); outline-offset: 3px;
}
button, .btn, .tappable { touch-action: manipulation; }
.hidden { display: none !important; }
.up { color: var(--good); } .down { color: var(--bad); } .mv { color: var(--move); }

/* The same wordmark anchors the phone header, desktop rail and sign-in screen. */
.brand { display: inline-flex; align-items: center; gap: 5px; font-size: 20px; font-weight: 760; letter-spacing: -.8px; white-space: nowrap; }
.brand > span { font-weight: 460; }
.brand-mark { width: 30px; height: 30px; flex: none; margin-right: 3px; background: url("shelves.svg") center / contain no-repeat; }
#app { width: min(100%, 760px); margin: auto; padding: calc(var(--sat) + 10px) 18px calc(158px + var(--sab)); }
.top { display: flex; align-items: center; gap: 8px; min-height: 52px; border-bottom: 1px solid var(--line); padding: 0 0 11px; }
.top .brand { margin-right: auto; }
.hello { display: none; color: var(--dim); font-size: 14px; }
.icon-btn, .mini-btn, .sheet-x {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px;
  background: var(--card); border: 1px solid var(--line); color: var(--dim); border-radius: 12px;
}
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 15px; }
.page-heading h1 { font-size: clamp(32px, 5.1vw, 48px); font-weight: 620; line-height: 1.06; margin: 0; letter-spacing: -.055em; }
.page-heading time { font-size: 13px; color: var(--dim); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 0 0 12px; min-width: 0; }
.card.tight { padding: 14px 17px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-h h3 { font-size: 17px; line-height: 1.25; font-weight: 610; letter-spacing: -.035em; margin: 0; }
.more { color: var(--acc2); cursor: pointer; font-size: 13px; font-weight: 550; padding: 4px 0; white-space: nowrap; }
.section-link { display: inline-flex; align-items: center; gap: 4px; }
.section-link svg { width: 15px; height: 15px; }
.screen { min-width: 0; }

/* Balance and day-to-day cash flow */
.balance-art {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  width: 100%; min-height: 164px; padding: 17px 19px; margin: 0 0 10px; overflow: hidden;
  text-align: left; position: relative; isolation: isolate; color: var(--ink);
  border-radius: var(--r); background: #d7f59b;
}
.balance-art::before, .login-art::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(#52683855 .75px, transparent 1px) right top / 6px 6px;
  mask-image: linear-gradient(100deg, transparent 40%, #000);
}
.balance-art::after, .login-art::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none; right: -5%; top: -9%; height: 120%; width: 50%;
  background: center / contain no-repeat url("/static/planner-orbit.webp");
}
.balance-art .kicker { display: inline-flex; align-items: center; gap: 7px; font-weight: 560; font-size: 13px; }
.balance-label { display: flex; align-items: center; gap: 6px; }
.visibility { color: #46543b; display: grid; place-items: center; width: 32px; height: 30px; border-radius: 8px; }
.visibility:hover { background: #bed888; }
.visibility svg { width: 16px; height: 16px; }
.balance-art button:focus-visible { outline-color: var(--ink); }
.stat-icon { display: inline-flex; align-items: center; }
.entry-excerpt { font-size: 14px; color: var(--dim); }
.kicker svg { width: 17px; height: 17px; }
.balance-figure { display: flex; align-items: baseline; white-space: nowrap; line-height: 1.08; }
.balance-figure strong { font-size: clamp(36px, 9.6vw, 63px); letter-spacing: -.065em; font-weight: 600; }
.balance-figure .fraction { font-size: .60em; letter-spacing: -.045em; }
.balance-figure .unit { font-size: .58em; font-weight: 530; vertical-align: .07em; margin-right: .12em; }
.balance-art .balance-figure { position: relative; z-index: 1; max-width: 100%; }
.balance-art.long-amount::after { opacity: .17; }
.balance-art.long-amount strong { font-size: clamp(28px, 6.5vw, 50px); }
.balance-foot { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #3c4c32; padding: 4px 0; }
.balance-foot svg { width: 14px; height: 14px; }
.cash-day { padding: 13px 16px 15px; }
.cash-day .card-h { margin-bottom: 9px; }
.cash-day .card-h h3 { font-size: 15px; }
.day-net { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.cash-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cash-stat { min-width: 0; }
.cash-stat + .cash-stat { border-left: 1px solid var(--line); padding-left: 16px; }
.stat-label { display: flex; gap: 6px; align-items: center; color: var(--dim); font-size: 12px; }
.stat-label svg { width: 14px; height: 14px; }
.cash-stat strong { display: block; margin-top: 2px; font-size: clamp(20px,5.4vw,27px); font-weight: 600; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.transfer-line { color: var(--dim); font-size: 12px; margin-top: 10px; }
.money-summary { background: var(--acc); color: var(--ink); }
.money-summary .lbl, .money-summary .stat-label { color: #374730; font-size: 13px; }
.money-summary .big { font-size: clamp(32px,6vw,48px); font-weight: 610; letter-spacing: -.055em; margin: 6px 0 14px; }
.money-summary .cash-pair { padding-top: 12px; border-top: 1px solid #9cb578; }
.money-summary .cash-stat + .cash-stat { border-color: #9cb578; }
.money-summary .stat-icon { color: var(--ink); }
.category-line { margin-top: 13px; }
.category-line > div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.overview-top, .overview-bottom, .overview-bottom > div { min-width: 0; }
.section-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 2px 0 8px; }
.section-actions .btn { margin: 0; padding: 9px; font-size: 13px; }

/* Ledger and agenda */
.row-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.row-item:last-child { border-bottom: 0; }
.tappable { cursor: pointer; }
.row-item.tappable { margin: 0 -3px; padding-left: 3px; padding-right: 3px; }
.row-item .ic { width: 36px; height: 36px; display: grid; place-items: center; flex: none; border-radius: 11px; color: var(--dim); background: var(--card-2); }
.ic svg { width: 17px; height: 17px; }
.row-item .ic.income { color: var(--good); background: #2b3c31; }
.row-item .ic.expense { color: var(--bad); background: #3d302d; }
.row-item .ic.transfer_in, .row-item .ic.transfer_out { color: var(--move); background: #34313d; }
.row-item .body { flex: 1; min-width: 0; }
.row-item .t { font-size: 15px; font-weight: 560; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.row-item .s { font-size: 12px; color: var(--dim2); margin-top: 2px; }
.row-item .val { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.chk { width: 23px; height: 23px; border: 1.5px solid var(--line-2); border-radius: 7px; flex: none; display: grid; place-items: center; padding: 0; }
.chk svg { opacity: 0; } .chk.on { background: var(--acc); color: var(--ink); border-color: transparent; } .chk.on svg { opacity: 1; }
.done .t { text-decoration: line-through; color: var(--dim2); }
.tacts { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 10px; }
.tact, .chip { border: 1px solid var(--line); color: var(--dim); background: var(--card-2); border-radius: 9px; }
.tact { padding: 6px 10px; font-size: 12px; } .tact.good { color: var(--good); } .tact.bad { color: var(--bad); }
.chips { display: flex; gap: 6px; margin: 0 0 12px; overflow-x: auto; }
.chip { padding: 8px 13px; font-size: 13px; white-space: nowrap; }
.chip.on { background: var(--acc); color: var(--ink); border-color: transparent; font-weight: 620; }
.empty { padding: 16px 4px; text-align: center; color: var(--dim2); font-size: 14px; }
.empty .e { font-size: 24px; margin-bottom: 6px; }
.empty-line { margin: 10px 0; color: var(--dim); font-size: 14px; }
.kcal { font-size: 26px; font-weight: 600; letter-spacing: -.045em; margin-bottom: 10px; }
.kcal small { font-size: 14px; color: var(--dim); font-weight: 460; letter-spacing: 0; }
.rings { display: flex; gap: 10px; justify-content: space-around; text-align: center; }
.ring { position: relative; width: 66px; height: 66px; }
.ring svg { transform: rotate(-90deg); }
.ring .n { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 620; }
.ring-l { font-size: 12px; color: var(--dim); }
.bar { margin-top: 6px; height: 6px; border-radius: 8px; background: var(--card-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .35s ease; border-radius: inherit; }
.flow-grid { display: flex; gap: 2px; padding: 0 2px; }
.flow-bar { flex: 1; min-width: 0; padding: 0; border-radius: 6px; color: var(--dim2); }
.flow-bar[aria-pressed=true] { color: var(--text); background: var(--card-2); }
.flow-bar .plot { display: block; height: 88px; position: relative; }
.flow-bar .plot::before { content: ""; position: absolute; top: 50%; inset-inline: -1px; height: 1px; background: var(--line-2); }
.plot i { position: absolute; left: 50%; transform: translateX(-50%); width: 62%; max-width: 26px; }
.plot .gain { bottom: 50%; background: var(--good); border-radius: 4px 4px 0 0; }
.plot .loss { top: 50%; background: var(--bad); border-radius: 0 0 4px 4px; }
.flow-bar small { display: block; font-size: 11px; margin: 3px 0; }
.flow output { display: block; font-size: 13px; color: var(--dim); margin-top: 10px; }
.skel { height: 14px; margin: 9px 0; border-radius: 6px; background: var(--card-2); }

/* Voice dock and navigation */
.capture, .nav { position: fixed; left: 0; right: 0; max-width: 760px; margin: auto; }
.capture { z-index: 40; bottom: calc(62px + var(--sab)); padding: 8px 12px; background: linear-gradient(transparent,var(--bg) 86%); pointer-events: none; }
.capture-in, .rec-bar { pointer-events: auto; display: flex; align-items: center; gap: 6px; min-height: 54px; padding: 5px; background: #252a2b; border: 1px solid #434a49; border-radius: 18px; box-shadow: var(--shadow); }
.capture-in input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 9px 2px; font-size: 16px; }
.capture-in input::placeholder { color: var(--dim2); }
.capture-in:focus-within { border-color: var(--acc); }
.capture .mini-btn { border: 0; background: transparent; }
.mic { display: grid; place-items: center; width: 44px; height: 44px; flex: none; color: var(--ink); background: var(--acc); border-radius: 13px; touch-action: none; user-select: none; }
.rec-bar { border-color: var(--bad); padding: 7px 10px; gap: 10px; }
.rec-time { font-variant-numeric: tabular-nums; color: var(--bad); font-weight: 600; }
.wave { flex: 1; min-width: 0; height: 26px; display: flex; align-items: center; gap: 3px; }
.wave i { flex: 1; background: var(--bad); min-height: 2px; border-radius: 2px; }
.nav { bottom: 0; z-index: 50; background: #171a1b; display: flex; padding: 4px 5px calc(4px + var(--sab)); border-top: 1px solid var(--line); }
.nav .rail-brand { display: none; }
.nav button { flex: 1; min-width: 0; min-height: 52px; display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center; border-radius: 12px; font-size: 11px; color: var(--dim2); }
.nav button.on { color: var(--acc); background: #2b3326; font-weight: 620; }
.nav button svg { width: 20px; height: 20px; }
.toast { position: fixed; z-index: 170; left: 50%; bottom: calc(139px + var(--sab)); transform: translate(-50%, 8px); min-width: min(210px, 85vw); max-width: min(90vw, 570px); width: max-content; max-height: 42vh; overflow-y: auto; padding: 12px 16px; border-radius: 14px; background: #272e2b; border: 1px solid var(--line-2); box-shadow: var(--shadow); opacity: 0; pointer-events: none; font-size: 14px; text-align: center; transition: opacity .15s, transform .15s; }
.toast.on { opacity: 1; transform: translate(-50%,0); pointer-events: auto; }
.toast.bad { border-color: var(--bad); } .toast.good { border-color: #657951; }

/* Forms */
.sheet-bg { position: fixed; z-index: 150; inset: 0; background: #070908ad; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet-bg.on { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 151; bottom: 0; left: 0; right: 0; width: min(100%, 590px); margin: auto; padding: 10px 20px calc(22px + var(--sab)); background: #1d2122; border: 1px solid var(--line-2); border-bottom: 0; border-radius: 24px 24px 0 0; transform: translateY(105%); transition: transform .22s ease; max-height: 87vh; max-height: 87dvh; overflow: auto; overscroll-behavior: contain; }
.sheet.on { transform: none; }
.sheet:not(.on) { visibility: hidden; }
.grip { width: 32px; height: 4px; border-radius: 9px; margin: 0 auto 17px; background: var(--line-2); }
.sheet-x { float: right; margin: -3px -4px 0 8px; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; }
.sheet h2 { margin: 0 0 15px; font-weight: 610; font-size: 22px; letter-spacing: -.045em; }
.sheet p { color: var(--dim); }
.btn { display: block; width: 100%; margin-top: 9px; padding: 12px 14px; border: 1px solid transparent; border-radius: 12px; background: var(--acc); color: var(--ink); font-weight: 610; text-align: center; text-decoration: none; }
.btn.ghost { background: var(--card-2); color: var(--text); border-color: var(--line); }
.field { width: 100%; min-width: 0; padding: 12px 13px; margin-bottom: 9px; background: #171a1b; border: 1px solid var(--line-2); border-radius: 11px; outline: none; font-size: 16px; }
.field:focus { border-color: var(--acc); }
select.field option { background: var(--card); color: var(--text); }
.row-sw { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sw { width: 46px; height: 27px; position: relative; flex: none; border-radius: 24px; border: 1px solid var(--line-2); background: var(--card-2); }
.sw i { position: absolute; width: 21px; height: 21px; top: 2px; left: 2px; border-radius: 50%; background: var(--dim); transition: transform .2s; }
.sw.on { border-color: var(--acc); background: var(--acc); } .sw.on i { transform: translateX(19px); background: var(--ink); }
#login { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 18px; }
.login-card { width: min(100%, 420px); border-radius: 24px; overflow: hidden; background: var(--card); border: 1px solid var(--line); }
.login-art { isolation: isolate; position: relative; overflow: hidden; height: 168px; background: var(--acc); color: var(--ink); padding: 23px; }
.login-art::after { width: 62%; right: -6%; height: 145%; top: -18%; }
.login-body { padding: 25px; } .login-body h1 { margin: 0; font-size: 30px; letter-spacing: -.05em; }
.login-body p { color: var(--dim); margin: 8px 0 24px; }
#tgWidget:has(iframe) { margin-bottom: 12px; }
#loginHint:not(:empty) { color: var(--bad); margin-top: 14px; font-size: 13px; }
@media (hover: hover) {
  .btn:hover, .mic:hover { filter: brightness(1.07); }
  .icon-btn:hover, .nav button:not(.on):hover, .row-item.tappable:hover { background: var(--card-2); color: var(--text); }
  .more:hover { text-decoration: underline; }
}
@media (max-width: 359px) {
  #app { padding-left: 12px; padding-right: 12px; } .card { padding: 14px; }
  .balance-art::after { right: -8%; width: 44%; } .nav button { font-size: 10px; }
}
@media (min-width: 900px) {
  body { max-width: var(--shell); margin: 0 auto; }
  #app { margin: 0 0 0 var(--side); width: auto; padding: 20px clamp(24px,3.6vw,55px) 112px; }
  .top { min-height: 45px; justify-content: flex-end; } .top .brand { display: none; }
  .hello { display: block; margin-right: auto; }
  .page-heading { margin: 26px 0 22px; } .page-heading time { font-size: 15px; }
  .nav { top: 0; right: auto; left: max(0px, calc((100vw - var(--shell)) / 2)); width: var(--side); padding: 27px 16px; gap: 4px; border: 0; border-right: 1px solid var(--line); flex-direction: column; }
  .nav .rail-brand { display: inline-flex; align-self: center; margin: 0 0 36px; }
  .nav button { flex: none; justify-content: flex-start; flex-direction: row; gap: 13px; padding: 0 15px; font-size: 14px; min-height: 45px; }
  .capture { bottom: 12px; left: var(--side); max-width: min(650px, calc(100% - var(--side) - 50px)); background: none; }
  .toast { left: calc(50% + var(--side) / 2); bottom: 90px; }
  .sheet { bottom: 20px; border: 1px solid var(--line-2); border-radius: 22px; }
  .overview-top, .overview-bottom { display: grid; grid-template-columns: minmax(0,1.38fr) minmax(0,1fr); gap: 14px; align-items: start; }
  .money-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.2fr); gap: 14px; align-items: start; }
  .overview-top { margin-bottom: 14px; align-items: stretch; }
  .overview-top > * { margin: 0; }
  .balance-art { min-height: 202px; padding: 21px 24px; }
  .cash-day { display: flex; flex-direction: column; justify-content: space-between; padding: 21px; }
  .cash-day .cash-pair { grid-template-columns: 1fr; gap: 8px; }
  .cash-day .cash-stat { display: flex; justify-content: space-between; align-items: center; gap: 7px; }
  .cash-day .cash-stat + .cash-stat { border: 0; border-top: 1px solid var(--line); padding: 8px 0 0; }
  .cash-day .cash-stat strong { font-size: clamp(19px,2.1vw,29px); }
  .card { margin-bottom: 14px; } .overview-top .card { margin-bottom: 0; }
  .row-item { padding-top: 12px; padding-bottom: 12px; } .balance-figure strong { font-size: clamp(34px,4.25vw,60px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }
