:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1d2639;
  --ink-2: #3c475e;
  --muted: #7a8599;
  --line: #e4e8f0;
  --line-2: #eef1f6;
  --primary: #3b6ef0;
  --primary-hover: #2f5fdb;
  --primary-soft: #ebf1fe;
  --primary-ink: #ffffff;
  --in: #15965a;
  --in-soft: #e7f6ee;
  --out: #e0544a;
  --out-soft: #fdeeec;
  --mv: #6d5fd3;
  --mv-soft: #f0eefc;
  --amber: #e9a23b;
  --focus: rgba(59, 110, 240, .2);
  --shadow: 0 1px 2px rgba(29, 38, 57, .04), 0 2px 8px rgba(29, 38, 57, .04);
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --r: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 12px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 24px 16px 20px; background: var(--card); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 21px; letter-spacing: -.01em; padding: 0 8px; }
.mark { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: var(--primary); fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; }
.mark .x { stroke: #ffd36b; stroke-width: 2.4; }
.org { color: var(--muted); font-size: 13px; margin: 4px 8px 0 50px; }
.new-entry { margin: 24px 0 16px; justify-content: center; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px;
}
.nav a:hover { background: var(--bg); }
.nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.who { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.who-name { font-weight: 600; }
.who-out { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; margin-top: 4px; font-size: 13px; }
.who-out .ic { width: 15px; height: 15px; }
.who-out:hover { color: var(--ink); }

.main { padding: 32px 40px 60px; max-width: 1120px; width: 100%; min-width: 0; }
.topbar, .tabbar { display: none; }

/* ---------- Page head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.page-head .kicker { color: var(--muted); font-size: 14px; margin-bottom: 2px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.period-select { padding: 9px 36px 9px 14px !important; font-weight: 600; font-size: 14.5px !important; border-radius: 10px !important; width: auto !important; }

.periods { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.periods > a, .custom-range summary {
  padding: 7px 14px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500;
  background: var(--card); border: 1px solid var(--line); cursor: pointer; list-style: none;
}
.custom-range summary::-webkit-details-marker { display: none; }
.periods > a:hover, .custom-range summary:hover { border-color: #c9d1e0; }
.periods > a.on, .custom-range.on summary { background: var(--ink); border-color: var(--ink); color: #fff; }
.custom-range { position: relative; }
.range-form {
  position: absolute; z-index: 20; top: 44px; left: 0; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px;
  box-shadow: 0 12px 32px rgba(29,38,57,.12); white-space: nowrap;
}
.range-form input { width: auto; padding: 7px 8px; font-size: 14px; }
.range-form span { color: var(--muted); font-size: 13px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px; min-width: 0; }
.card + .card { margin-top: 18px; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-h h2 { font-size: 17px; font-weight: 700; }
.card-h .aside, .card-h a.aside { font-size: 13.5px; color: var(--primary); text-decoration: none; font-weight: 600; }
.card-h .aside.muted { color: var(--muted); font-weight: 500; }

/* Big three numbers */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { border-radius: var(--r); padding: 20px 22px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.stat .lbl { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.stat .lbl i { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 17px; }
.stat.in .lbl i { background: var(--in-soft); color: var(--in); }
.stat.out .lbl i { background: var(--out-soft); color: var(--out); }
.stat.left .lbl i { background: var(--primary-soft); color: var(--primary); }
.stat .big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat.in .big { color: var(--in); }
.stat.out .big { color: var(--out); }

.lede { font-size: 15.5px; line-height: 1.6; color: var(--ink-2); margin: 16px 2px 0; }
.lede strong { color: var(--ink); }

/* Quick actions */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.quick a {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); text-decoration: none;
  font-weight: 600; font-size: 15px; border: 1px solid transparent; transition: transform .08s ease;
}
.quick a:hover { transform: translateY(-1px); }
.quick a i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-style: normal; font-size: 20px; font-weight: 700; color: #fff; flex: none; }
.quick a small { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); }
.quick .q-in { background: var(--in-soft); color: #0f6f43; }
.quick .q-in i { background: var(--in); }
.quick .q-out { background: var(--out-soft); color: #b23b32; }
.quick .q-out i { background: var(--out); }
.quick .q-mv { background: var(--mv-soft); color: #4f43ad; }
.quick .q-mv i { background: var(--mv); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.grid-2 > .card + .card { margin-top: 0; }
.mt { margin-top: 18px; }

/* Simple list rows */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.list li:first-child { border-top: 0; padding-top: 2px; }
.list .name { font-weight: 600; min-width: 0; }
.list .name small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.list .amt { text-align: right; font-weight: 600; white-space: nowrap; }
.list .amt small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.list .amt .sub { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.list a.name:hover { color: var(--primary); }
.list li.total { border-top: 1px solid var(--line); font-weight: 700; padding-top: 14px; }

/* Business tiles */
.biz { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.biz-tile { border: 1px solid var(--line); border-radius: 10px; padding: 16px; text-decoration: none; display: block; }
.biz-tile:hover { border-color: #c9d1e0; }
.biz-tile h3 { font-size: 15.5px; font-weight: 700; margin-bottom: 10px; }
.biz-tile dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14px; }
.biz-tile dt { color: var(--muted); }
.biz-tile dd { margin: 0; text-align: right; font-weight: 600; }
.biz-tile .verdict { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 13.5px; font-weight: 600; display: flex; justify-content: space-between; }

.pos { color: var(--in); }
.neg { color: var(--out); }
.mv { color: var(--mv); }
.muted { color: var(--muted); }
.arrow { color: var(--muted); }

/* Legacy section headers, restyled as card headings */
.section { margin-top: 26px; min-width: 0; }
.section-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.section-h h2 { font-size: 18px; font-weight: 700; }
.section-h .aside { font-size: 13.5px; color: var(--muted); }
.section-h a.aside { text-decoration: none; color: var(--primary); font-weight: 600; }
.cols { display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; }
.cols-even { grid-template-columns: 1fr 1fr; }
.explain { font-size: 13.5px; color: var(--muted); margin: 12px 0 0; max-width: 72ch; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 4px 18px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th {
  text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 12px 14px 10px 0;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 13px 14px 13px 0; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tfoot td { border-top: 1px solid var(--line); border-bottom: 0; font-weight: 700; }
.tbl .r, .tbl th.r { text-align: right; }
.tbl td:last-child, .tbl th:last-child { padding-right: 0; }
.tbl .sub { display: block; font-size: 13px; color: var(--muted); }
.tbl .t-main { font-weight: 600; }
.tbl a.row-link { text-decoration: none; }
.tbl a.row-link:hover .t-main { color: var(--primary); }
.tbl tr.dim td { color: var(--muted); }
.card .tbl-wrap, .section .card .tbl-wrap { border: 0; box-shadow: none; padding: 0; }
.nowrap { white-space: nowrap; }
.col-date { width: 100px; white-space: nowrap; color: var(--muted); }
.sm-date { display: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.dot.income, .dot.partner_in { background: var(--in); }
.dot.expense, .dot.partner_out { background: var(--out); }
.dot.transfer { background: var(--mv); }

/* ---------- Bars ---------- */
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 9px 0; font-size: 14.5px; }
.bars .val { text-align: right; font-weight: 600; }
.bars .val small { color: var(--muted); font-size: 12.5px; margin-left: 6px; font-weight: 500; }
.track { grid-column: 1 / -1; height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.track i { display: block; height: 100%; background: #f08a80; border-radius: 4px; }
.track.ads i { background: var(--amber); }

/* ---------- Chart ---------- */
.chart-box { margin-top: 8px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line-2); stroke-width: 1; }
.chart .grid.base { stroke: var(--line); }
.chart .ax { fill: var(--muted); font: 11px var(--font); }
.chart .b-in { fill: #3fb67c; }
.chart .b-out { fill: #f08a80; }
.chart .hit { fill: transparent; }
.chart g:hover .hit { fill: var(--line-2); opacity: .6; }
.legend { display: flex; gap: 18px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 14.5px/1.2 var(--font);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #c4cbdb; }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-big { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 7px 12px; font-size: 13.5px; }
.btn-link { border: 0; background: none; padding: 0; color: var(--primary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.btn-danger { color: var(--out); }
.btn-danger:hover { border-color: var(--out); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field > .label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--out); font-weight: 500; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font: 15px/1.3 var(--font);
}
select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237a8599' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.has-err input, .has-err select { border-color: var(--out); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.inline-form { display: inline; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 14.5px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--primary); width: 16px; height: 16px; }

.money-input { position: relative; display: flex; }
.money-input input { padding-right: 60px; font-size: 17px; font-weight: 600; }
.money-input .cur { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; font-weight: 700; pointer-events: none; }
.amount-big input { font-size: 30px; padding: 14px 70px 14px 16px; letter-spacing: -.01em; }
.amount-big .cur { font-size: 15px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: var(--shadow); }
.form-narrow { max-width: 680px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 4px; }
.form-actions .spacer { flex: 1; }

details.more { border-top: 1px solid var(--line-2); padding-top: 14px; }
details.more summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: 14px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: '+ '; }
details.more[open] summary::before { content: '- '; }
details.more .stack { margin-top: 16px; }

/* Type picker: three big choices */
.typepick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.typepick label {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 16px; cursor: pointer;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card); min-width: 0;
}
.typepick input { position: absolute; opacity: 0; pointer-events: none; }
.typepick .t { display: block; font-weight: 700; font-size: 15.5px; }
.typepick .h { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; line-height: 1.35; }
.typepick i { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-style: normal; font-size: 21px; font-weight: 700; flex: none; }
.typepick .k-income i, .typepick .k-partner_in i { background: var(--in-soft); color: var(--in); }
.typepick .k-expense i, .typepick .k-partner_out i { background: var(--out-soft); color: var(--out); }
.typepick .k-transfer i { background: var(--mv-soft); color: var(--mv); }
.typepick label:hover { border-color: #c9d1e0; }
.typepick label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.typepick label:has(input:focus-visible) { outline: 3px solid var(--focus); }
.typepick.partners { margin-top: 12px; grid-template-columns: repeat(2, 1fr); }
.partner-toggle { font-size: 14px; margin-top: 10px; }

.flash { padding: 12px 16px; border-radius: 10px; background: var(--in-soft); color: #0f6f43; margin-bottom: 18px; font-size: 14.5px; font-weight: 500; }
.flash-err { background: var(--out-soft); color: #b23b32; }

/* ---------- Welcome / empty ---------- */
.empty { padding: 28px 0; color: var(--muted); }
.empty h3 { font-size: 20px; color: var(--ink); margin-bottom: 6px; }
.welcome { text-align: center; padding: 56px 24px; }
.welcome h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 10px; }
.welcome p { color: var(--muted); font-size: 16px; max-width: 520px; margin: 0 auto 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 auto 26px; max-width: 560px; }
.chips span { padding: 6px 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 18px 0 0; max-width: 620px; }
.steps li { counter-increment: s; position: relative; padding: 12px 0 12px 44px; color: var(--ink-2); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 9px; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.steps li a { color: var(--primary); font-weight: 600; }

/* ---------- Filters ---------- */
.filters { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr auto; gap: 10px; margin-bottom: 8px; align-items: end; }
.filters select, .filters input { padding: 9px 12px; font-size: 14px; }
.filters select { padding-right: 34px; }
.totals-line { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; color: var(--muted); padding: 10px 2px 14px; }
.totals-line strong { font-weight: 700; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 18px; align-items: center; font-size: 14px; color: var(--muted); }

/* ---------- Accounts ---------- */
.check-input { width: 140px !important; padding: 7px 10px !important; font-size: 14px !important; text-align: right; }
.check-out { display: block; font-size: 12.5px; margin-top: 4px; min-height: 1em; font-weight: 500; }
.kind { font-size: 12.5px; color: var(--muted); }

/* ---------- Settings ---------- */
.set-grid { display: grid; grid-template-columns: 190px 1fr; gap: 32px; }
.set-nav { position: sticky; top: 24px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
.set-nav a { padding: 7px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.set-nav a:hover { background: var(--card); }
.set-sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 24px; margin-bottom: 18px; scroll-margin-top: 20px; }
.set-sec h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.set-sec > p { color: var(--muted); font-size: 14px; max-width: 64ch; }
.set-sec .lbl { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.edit-rows { display: flex; flex-direction: column; }
.edit-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.edit-row input[type=text] { flex: 1 1 200px; padding: 9px 11px; font-size: 14.5px; }
.edit-row select { flex: 0 0 auto; width: auto; padding: 9px 34px 9px 11px; font-size: 14px; }
.edit-row .small-num { width: 110px; flex: none; }
.edit-row.add { border-bottom: 0; padding-top: 14px; }
.edit-row .check { font-size: 13.5px; white-space: nowrap; }
.edit-row.off input[type=text] { color: var(--muted); text-decoration: line-through; }

/* ---------- Auth ---------- */
body.auth { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-wrap { width: 100%; max-width: 440px; }
.auth-wrap.wide { max-width: 620px; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 28px; font-weight: 700; margin-bottom: 24px; }
.auth-brand .mark { width: 40px; height: 40px; padding: 8px; border-radius: 11px; }
.auth h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.auth .intro { color: var(--muted); margin-bottom: 22px; }

/* ---------- Partners ---------- */
.split-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 18px 0 8px; background: var(--line-2); }
.split-bar i:nth-child(1) { background: var(--primary); }
.split-bar i:nth-child(2) { background: var(--amber); }
.split-bar i:nth-child(3) { background: var(--mv); }
.split-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.split-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ledger { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.ledger > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.ledger .lbl { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.ledger .big { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .cols, .cols-even, .grid-2 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .q { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .side { display: none; }
  .topbar {
    display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 30;
    padding: 12px 16px; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  }
  .topbar .brand { font-size: 19px; padding: 0; }
  .topbar .mark { width: 28px; height: 28px; }
  .main { padding: 20px 14px 100px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0; font-size: 11px; color: var(--muted); text-decoration: none; font-weight: 500; }
  .tabbar a.on { color: var(--primary); font-weight: 700; }
  .tabbar .ic { width: 22px; height: 22px; }
  .page-head h1 { font-size: 24px; }
  .stats { grid-template-columns: 1fr; gap: 10px; }
  .stat { padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .stat .big { margin-top: 0; font-size: 22px; grid-row: 1 / 3; grid-column: 2; }
  .stat .sub { grid-column: 1; }
  .quick { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .quick a { flex-direction: column; text-align: center; gap: 6px; padding: 12px 6px; font-size: 13.5px; }
  .quick a small { display: none; }
  .ledger { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ledger .big { font-size: 21px; }
  .typepick { grid-template-columns: 1fr; gap: 8px; }
  .typepick.partners { grid-template-columns: 1fr; }
  .typepick label { padding: 12px 14px; }
  .row, .row-3 { grid-template-columns: 1fr; }
  .panel, .card { padding: 18px; }
  .set-grid { grid-template-columns: 1fr; gap: 0; }
  .set-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
  .set-sec { padding: 18px; }
  .hide-sm { display: none; }
  .col-date { display: none; }
  .sm-date { display: inline; }
  .tbl { font-size: 14px; }
  .tbl-wrap { padding: 2px 14px; }
  .chart-box { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart { min-width: 600px; }
  .range-form { flex-wrap: wrap; white-space: normal; left: auto; right: 0; }
  .amount-big input { font-size: 26px; }
}
