:root { --ink:#172033; --muted:#70809a; --paper:#f5f7fb; --line:#e4e9f2; --green:#168568; --red:#d55658; --navy:#172033; --white:#fff; }
* { box-sizing:border-box; }
body { margin:0; background:var(--paper); color:var(--ink); font-family:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font:inherit; }
button { cursor:pointer; }
.app-shell { width:min(100%, 720px); margin:0 auto; padding:28px 18px 104px; }
.topbar, .month-row, .section-title, .modal-head, .balance-details { display:flex; align-items:center; justify-content:space-between; gap:12px; }
h1,h2,p { margin:0; } h1 { font-size:28px; letter-spacing:-.8px; } h2 { font-size:18px; }
.eyebrow { color:var(--muted); letter-spacing:.12em; font-size:11px; font-weight:800; margin-bottom:4px; }
.icon-button { border:0; background:transparent; width:38px; height:38px; border-radius:12px; font-size:26px; color:var(--ink); display:grid; place-items:center; }
.icon-button:hover { background:#e8edf5; }
.month-row { justify-content:center; margin:22px 0 16px; } .month-row strong { width:160px; text-align:center; }
.balance-card { background:var(--navy); color:#fff; border-radius:24px; padding:24px; box-shadow:0 12px 28px #1720332b; }
.balance-card>p:first-child { color:#b6c1d6; font-size:13px; }.balance-card h2 { font-size:36px; letter-spacing:-1.5px; margin:5px 0 14px; }.balance-details { justify-content:flex-start; color:#d7dfed; font-size:14px; }.reserve { margin-top:18px; font-size:13px; color:#a9e4d5; }
.summary-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:14px 0 30px; }.summary { background:#fff; border:1px solid var(--line); border-radius:16px; padding:15px 12px; }.summary p { color:var(--muted); font-size:12px; margin-bottom:7px; }.summary strong { font-size:16px; }.income strong { color:var(--green); }.expense strong { color:var(--red); }
.section { margin-top:29px; }.section-title { margin-bottom:12px; }.section-title span { font-size:12px; color:var(--muted); }.text-button { color:var(--green); background:transparent; border:0; font-weight:700; }
.budget-list { display:grid; gap:11px; }.budget { background:var(--white); border:1px solid var(--line); border-radius:15px; overflow:hidden; }.budget-toggle { display:block; width:100%; padding:14px; border:0; background:transparent; text-align:left; color:inherit; font:inherit; cursor:pointer; }.budget-toggle:active { background:#f6f9fb; }.budget-head { display:flex; justify-content:space-between; font-size:14px; margin-bottom:9px; }.budget-head span { color:var(--muted); }.budget-head b { margin-left:5px; color:var(--green); }.track { height:7px; border-radius:99px; overflow:hidden; background:#e7ecf3; }.track i { display:block; height:100%; border-radius:inherit; background:var(--green); }.track i.over { background:var(--red); }.budget-details { border-top:1px solid var(--line); padding:3px 14px 8px; }.budget-transaction { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); font-size:13px; }.budget-transaction:last-child { border-bottom:0; }.budget-transaction div { display:grid; gap:3px; }.budget-transaction div:last-child { text-align:right; color:var(--red); }.budget-transaction span { color:var(--muted); font-size:12px; }.budget-empty { margin:10px 0; color:var(--muted); font-size:13px; }
.transaction-list { display:grid; gap:2px; }.transaction { display:grid; grid-template-columns:42px 1fr auto; align-items:center; gap:10px; padding:13px 2px; border-bottom:1px solid var(--line); }.transaction-icon { width:38px; height:38px; display:grid; place-items:center; border-radius:12px; background:#e8f4f0; font-size:18px; }.transaction-name { font-weight:700; font-size:14px; }.transaction-meta { color:var(--muted); font-size:12px; margin-top:3px; }.transaction-side { display:flex; align-items:center; gap:5px; }.transaction-amount { font-weight:750; text-align:right; font-size:14px; }.transaction-rub { color:var(--muted); font-size:12px; font-weight:600; margin-top:3px; }.edit-button { border:0; background:#eef2f6; color:var(--muted); width:30px; height:30px; border-radius:9px; font-size:14px; }.edit-button:hover { background:#dce6e4; color:var(--green); }.negative { color:var(--red); }.positive { color:var(--green); }.empty { background:#fff; color:var(--muted); padding:18px; border:1px dashed #ccd5e2; border-radius:14px; font-size:14px; }
.add-button { position:fixed; bottom:22px; left:50%; transform:translateX(-50%); min-height:54px; padding:0 20px; border-radius:17px; border:0; color:#fff; background:var(--green); box-shadow:0 12px 28px #16856866; display:flex; align-items:center; justify-content:center; gap:8px; font-size:15px; font-weight:800; white-space:nowrap; }.add-button span { font-size:25px; font-weight:400; line-height:1; }.add-button:active { transform:translateX(-50%) scale(.97); }
dialog { border:0; border-radius:22px; box-shadow:0 20px 60px #17203355; width:min(94vw, 460px); padding:0; }dialog::backdrop { background:#17203370; }dialog form { display:grid; gap:14px; padding:22px; }.modal-head { margin-bottom:5px; }.modal-head .icon-button { font-size:25px; }.type-switch { display:grid; grid-template-columns:repeat(3,1fr); padding:4px; border-radius:12px; background:#edf1f6; }.type-switch button { border:0; padding:9px 2px; border-radius:9px; background:transparent; font-size:13px; font-weight:700; color:var(--muted); }.type-switch button.active { background:#fff; color:var(--ink); box-shadow:0 1px 4px #1720331a; }label { display:grid; gap:6px; font-size:13px; font-weight:700; }label small { font-weight:400; color:var(--muted); }input,select { border:1px solid #d5dce7; border-radius:10px; padding:11px 12px; background:#fff; color:var(--ink); }.primary-button,.danger-button { border:0; border-radius:12px; padding:13px; font-weight:800; }.primary-button { background:var(--green); color:white; margin-top:5px; }.danger-button { background:#fff1f1; color:#b63c41; }.form-note { color:var(--muted); font-size:13px; line-height:1.45; }
@media (max-width:430px) { .app-shell { padding-top:20px; }.summary-grid { gap:7px; }.summary { padding:13px 9px; }.summary strong { font-size:14px; }.balance-card h2 { font-size:31px; } }
.budget-transaction > div:first-child, .budget-transaction-amount { display:grid; gap:3px; }
.budget-transaction-side { display:flex; align-items:center; gap:7px; }
.budget-transaction-amount { text-align:right; color:var(--red); }
.budget-edit { flex:0 0 auto; }
[hidden] { display:none !important; }
#typeSwitch { grid-template-columns:repeat(2,1fr); }

/* Dark wallet visual system. Layout and ledger logic are preserved. */
:root { color-scheme:dark; --ink:#f4f3ee; --muted:#a3a49f; --paper:#141514; --line:#353632; --green:#dce9a0; --red:#efb6c6; --navy:#222320; --white:#222320; }
body { background:#141514; }
.app-shell { width:min(100%,720px); padding-top:32px; }
h1 { font-size:34px; font-weight:550; letter-spacing:-1.3px; }
h2 { font-weight:550; letter-spacing:-.4px; }
.eyebrow { font-size:10px; font-weight:600; letter-spacing:.18em; }
.topbar { padding:0 4px; }
.icon-button { background:#262723; border-radius:99px; width:42px; height:38px; font-size:24px; }
.icon-button:hover { background:#363830; }
.month-row { margin:26px 0 18px; }
.month-row strong { font-size:14px; font-weight:500; }
.month-row .icon-button { background:transparent; }
.balance-card { position:relative; overflow:hidden; padding:27px; border-radius:30px; color:#20231e; background:radial-gradient(ellipse at 94% 5%,#e9efa6 0,transparent 60%),radial-gradient(ellipse at 3% 20%,#bdd9c5 0,transparent 65%),linear-gradient(130deg,#d5e2d0,#d2d2ed); box-shadow:none; }
.balance-card>p:first-child { color:#454b40; font-size:13px; }
.balance-card h2 { font-size:43px; font-weight:600; letter-spacing:-2px; margin:10px 0 18px; font-variant-numeric:tabular-nums; }
.balance-details { color:#353a31; gap:10px; flex-wrap:wrap; }
.balance-details span { border:1px solid #353a3126; border-radius:20px; padding:6px 11px; font-size:13px; }
.reserve { color:#3e4935; border-top:1px solid #353a3126; padding-top:16px; margin-top:20px; line-height:1.5; }
.summary-grid { gap:1px; background:#34352f; border:1px solid #34352f; border-radius:22px; overflow:hidden; margin:16px 0 32px; }
.summary { border:0; border-radius:0; background:#20211e; padding:18px 12px; }
.summary p { font-size:11px; }
.summary strong { font-weight:550; font-size:16px; font-variant-numeric:tabular-nums; }
.section { margin-top:30px; }
.section-title { margin-bottom:16px; flex-wrap:wrap; }
.section-title h2 { font-size:21px; }
.section-title span { font-size:11px; }
.text-button { color:#e1e9b4; font-weight:500; padding:8px; }
.budget-list { gap:12px; }
.budget { background:#222320; border:1px solid #2b2d27; border-radius:22px; }
.budget-toggle { padding:19px 17px; min-height:80px; }
.budget-toggle:active { background:#2c2e27; }
.budget-head { font-size:14px; gap:12px; align-items:center; margin-bottom:14px; }
.budget-head strong { font-weight:550; }
.budget-head span { font-size:12px; text-align:right; }
.track { background:#121310; height:8px; }
.track i { background:linear-gradient(90deg,#e6efa7,#cdd3ed); }
.budget:nth-child(2) .track i { background:#e4bed2; }
.budget:nth-child(3) .track i { background:#c4dcc5; }
.budget:nth-child(4) .track i { background:#c9c9e9; }
.track i.over { background:#e6afba; }
.budget-details { padding:4px 17px 12px; }
.transaction-list { background:#1c1d1a; border-radius:24px; padding:4px 15px; }
.transaction { padding:17px 0; grid-template-columns:38px minmax(0,1fr) auto; gap:10px; }
.transaction:last-child { border:0; }
.transaction-icon { background:#2d3027; border-radius:50%; width:36px; height:36px; font-size:17px; }
.transaction-name { font-size:13px; font-weight:500; overflow-wrap:anywhere; }
.transaction-meta { font-size:11px; line-height:1.5; }
.transaction-amount { font-size:13px; font-weight:550; }
.transaction-rub { font-size:11px; font-weight:400; }
.edit-button { background:#30322c; color:#c2c5b9; border-radius:50%; }
.edit-button:hover { background:#454a38; }
.empty { background:#20211e; border-color:#43463a; }
.add-button { background:#e2ecac; color:#20251a; border-radius:99px; box-shadow:0 8px 32px #0008; min-height:56px; padding:0 26px; font-weight:600; bottom:max(22px,env(safe-area-inset-bottom)); border:1px solid #f0f5d080; }
button:focus-visible { outline:2px solid #e5efb4; outline-offset:4px; }
dialog { background:#222320; color:var(--ink); border:1px solid #414439; border-radius:28px; max-height:90dvh; }
dialog::backdrop { background:#000a; backdrop-filter:blur(8px); }
dialog form { padding:24px; gap:17px; }
.type-switch { background:#151612; gap:4px; border-radius:16px; }
.type-switch button { font-weight:500; padding:12px 5px; }
.type-switch button.active { background:#dfe8b0; color:#22281b; box-shadow:none; border-radius:12px; }
label { color:#dedfd7; font-weight:500; }
input,select { background:#161713; border:1px solid #44473a; border-radius:13px; min-height:46px; }
input:focus,select:focus { outline:2px solid #dfe8b0; outline-offset:2px; }
.primary-button { background:#dfe8b0; color:#22281b; border-radius:99px; min-height:48px; font-weight:600; }
.danger-button { background:#3e292f; color:#f3bdc7; }
@media(max-width:430px) { .app-shell { padding:24px 16px 110px; } .balance-card { padding:24px; } .balance-card h2 { font-size:37px; } .summary { padding:16px 10px; } .summary strong { font-size:14px; } .budget-head { gap:8px; } .transaction-list { padding:3px 12px; } }
@media(prefers-reduced-motion:no-preference) { button { transition:background .15s ease,transform .15s ease; } }

.budget-list { grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.budget { border-radius:20px; min-width:0; }
.budget-toggle { padding:16px 12px; min-height:155px; display:flex; flex-direction:column; align-items:flex-start; text-align:left; }
.tile-icon { width:33px;height:33px;display:grid;place-items:center;background:#ffffff09;border-radius:50%;font-size:20px;margin-bottom:13px;color:#e3eab9; }
.tile-name { font-size:12px;color:#babdb2;min-height:30px;line-height:1.25;overflow-wrap:anywhere; }
.tile-value { font-size:19px;font-weight:550;letter-spacing:-.7px;margin:8px 0 12px;white-space:nowrap; }
.budget .track { width:100%;height:5px;margin-top:auto; }
.budget-toggle[aria-expanded=true] { background:#34392a; }
.budget.today { background:linear-gradient(145deg,#dfe8aa,#cbd8cd 65%,#cdd0e9);color:#20271a; }
.today .tile-name {color:#414c36}.today .tile-icon {background:#20271a12;color:#20271a}.tile-note {font-size:10px;opacity:.7;margin-top:auto;}
.category-preview { background:#222320;border:1px solid #414638;border-radius:20px;margin-top:12px;padding:20px;line-height:1.6;font-size:13px; }
@media(max-width:430px) { .budget-list {gap:7px;} .budget {border-radius:16px;} .budget-toggle {padding:12px 8px;min-height:144px;} .tile-icon {font-size:18px;margin-bottom:10px;} .tile-name {font-size:10px;min-height:28px;} .tile-value {font-size:13px;letter-spacing:-.4px;} .tile-note {font-size:9px;} }

/* Three independent monthly summary cards. */
.summary-grid { gap:10px; background:transparent; border:0; border-radius:0; overflow:visible; }
.summary { background:#222320; border:1px solid #2f312a; border-radius:20px; padding:20px 14px; min-width:0; }
.summary p { line-height:1.4; min-height:30px; }
@media(max-width:430px) { .summary-grid {gap:7px;} .summary {padding:16px 9px;border-radius:17px;} .summary p {font-size:10px;min-height:28px;} .summary strong {font-size:13px;} }

.balance-card {display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:24px;align-items:stretch;}
.balance-left {min-width:0;}.balance-label {font-size:13px;color:#454b40;}
.balance-card .month-row {display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:7px;margin:0 0 23px;}
.balance-card .month-row strong {text-align:left;width:auto;font-size:16px;font-weight:550;color:#20271a;}
.month-arrows {display:flex;gap:7px;}
.balance-card .month-row .icon-button {background:#26302010;color:#273020;width:36px;height:29px;font-size:24px;border:1px solid #2630201a;}
.balance-card .month-row .icon-button:hover {background:#26302024;}
.balance-card h2 {margin-bottom:0;}
.balance-right {display:flex;flex-direction:column;justify-content:flex-end;align-items:flex-end;min-width:0;padding-left:20px;border-left:1px solid #26302020;}
.balance-right .balance-details {flex-direction:column;align-items:flex-end;gap:10px;}
.balance-right .reserve {text-align:right;max-width:200px;border-top:0;padding-top:0;margin-top:24px;}
@media(max-width:430px) {.balance-card {padding:22px 18px;gap:12px;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);}.balance-card .month-row strong {font-size:13px;}.balance-card h2 {font-size:28px;letter-spacing:-1px;}.balance-right {padding-left:12px;}.balance-details span {font-size:11px;padding:6px 8px;}.balance-right .reserve {font-size:11px;line-height:1.5;}.balance-label {font-size:11px;}}

.balance-card .month-row .icon-button {width:34px;height:34px;padding:0;display:flex;align-items:center;justify-content:center;line-height:1;border-radius:50%;}
.month-arrows svg {display:block;flex:none;}
.balance-right {justify-content:center;align-items:flex-start;}
.accounts-label {font-size:13px;color:#414b38;margin-bottom:17px;}
.balance-right .balance-details {align-items:flex-start;gap:17px;width:100%;}
.currency-balance {display:flex;flex-direction:column;gap:5px;}
.currency-balance small {font-size:11px;color:#505844;}
.balance-right .balance-details span {border:0;padding:0;border-radius:0;font-size:28px;letter-spacing:-.7px;font-weight:550;line-height:1.2;}
.balance-right .reserve {text-align:left;margin-top:19px;font-size:11px;max-width:none;}
@media(max-width:430px) {.accounts-label {font-size:11px;margin-bottom:14px;}.currency-balance small {font-size:9px;}.balance-right .balance-details span {font-size:19px;letter-spacing:-.5px;}.balance-right .balance-details {gap:13px;}.balance-right .reserve {font-size:10px;}}

.sync-status{font-size:12px;color:#d9e4a9}

.pending-ledger #addButton,.pending-ledger #settingsButton{display:none!important}

/* Settings belongs to the balance card on both desktop and phone. */
.balance-card .settings-in-balance{position:absolute;top:18px;right:18px;z-index:2;display:grid;place-items:center;width:38px;height:38px;padding:0;border:1px solid rgba(32,39,26,.12);border-radius:50%;background:rgba(255,255,255,.76);color:#20271a;font-size:22px;line-height:1;box-shadow:0 2px 8px rgba(32,39,26,.07);cursor:pointer}
.balance-card .settings-in-balance:hover{background:#fff}
.balance-card .settings-in-balance:focus-visible{outline:2px solid #20271a;outline-offset:3px}
@media(max-width:430px){.balance-card .settings-in-balance{top:13px;right:13px;width:34px;height:34px;font-size:20px}.balance-right{padding-top:22px}}
