/* ───────── Tokens ───────── */
:root {
  --paper: #F1F3F2;
  --surface: #FFFFFF;
  --surface-2: #F7F8F7;
  --ink: #17201C;
  --ink-2: #4A5650;
  --ink-3: #7D8984;
  --line: #DFE4E1;
  --line-2: #ECEFED;
  --pine: #1D6B57;
  --pine-ink: #0F4436;
  --pine-soft: #E2F0EA;
  --rose: #C23A57;
  --rose-soft: #FBE8EC;
  --amber: #B7791F;
  --amber-soft: #FBF1DE;
  --sky: #2F6FB0;
  --sky-soft: #E5EEF8;
  --focus: #2F6FB0;
  --shadow-pop: 0 18px 48px -12px rgba(15, 40, 32, .28), 0 2px 6px rgba(15, 40, 32, .08);
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --side: 248px;
  --font: "IBM Plex Sans Hebrew", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1412; --surface: #151D1A; --surface-2: #1B2420; --ink: #E8EEEB; --ink-2: #B3BFBA; --ink-3: #7E8B86;
    --line: #26312C; --line-2: #1F2925; --pine: #4FBF9C; --pine-ink: #9BE3CB; --pine-soft: #16302A;
    --rose: #F0708A; --rose-soft: #3A1C24; --amber: #E5B45A; --amber-soft: #352A15; --sky: #6FA8E6; --sky-soft: #172A3D;
    --shadow-pop: 0 18px 48px -12px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E1412; --surface: #151D1A; --surface-2: #1B2420; --ink: #E8EEEB; --ink-2: #B3BFBA; --ink-3: #7E8B86;
  --line: #26312C; --line-2: #1F2925; --pine: #4FBF9C; --pine-ink: #9BE3CB; --pine-soft: #16302A;
  --rose: #F0708A; --rose-soft: #3A1C24; --amber: #E5B45A; --amber-soft: #352A15; --sky: #6FA8E6; --sky-soft: #172A3D;
  --shadow-pop: 0 18px 48px -12px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.3);
  color-scheme: dark;
}

/* ───────── Base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--pine); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.pos { color: var(--pine); }
.neg { color: var(--rose); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ───────── Shell ───────── */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px; border-inline-end: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 17px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--pine); position: relative; flex: none;
}
.brand-mark::after { content: ""; position: absolute; inset: 8px 7px; border-radius: 3px; border: 2px solid var(--surface); border-top-width: 6px; }
.budget-switch {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); cursor: pointer; text-align: start;
}
.budget-switch b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.budget-switch small { color: var(--ink-3); font-size: 12px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2);
  text-decoration: none; font-weight: 500;
}
.nav a svg { width: 19px; height: 19px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--pine-soft); color: var(--pine-ink); }
.nav .sep { height: 1px; background: var(--line-2); margin: 10px 12px; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 0; border-top: 1px solid var(--line-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--sky-soft); color: var(--sky); font-weight: 600; font-size: 14px;
}
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who small { color: var(--ink-3); font-size: 12px; }

.main { min-width: 0; padding: 28px 36px 80px; }
.page { max-width: 1180px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--ink-3); margin-top: 2px; font-size: 14px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.fab {
  position: fixed; inset-inline-start: calc(var(--side) + 28px); bottom: 28px; display: none;
}
.tabbar { display: none; }

/* ───────── Buttons & inputs ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; font-size: 14px;
}
.btn:hover { border-color: var(--ink-3); }
.btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--pine); border-color: var(--pine); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #08201A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #08201A; } }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--rose); }
.btn.danger:hover { border-color: var(--rose); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field > label .req { color: var(--rose); margin-inline-start: 2px; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-soft); }
.input.bad, .field.bad .input { border-color: var(--rose); }
.field .err { color: var(--rose); font-size: 12px; }
.input[type="date"] { direction: rtl; }
.input.ltr { direction: ltr; text-align: right; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--pine); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 .full { grid-column: 1 / -1; }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-weight: 500; font-size: 14px;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
.seg.type button.on[data-v="expense"] { color: var(--rose); }
.seg.type button.on[data-v="income"] { color: var(--pine); }
.seg.type button.on[data-v="transfer"] { color: var(--sky); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13.5px; color: var(--ink-2); white-space: nowrap;
}
.chip:hover { border-color: var(--ink-3); }
.chip.on { border-color: var(--pine); background: var(--pine-soft); color: var(--pine-ink); font-weight: 500; }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-2); white-space: nowrap; }
.tag.pine { background: var(--pine-soft); color: var(--pine-ink); border-color: transparent; }
.tag.rose { background: var(--rose-soft); color: var(--rose); border-color: transparent; }
.tag.amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.tag.sky { background: var(--sky-soft); color: var(--sky); border-color: transparent; }

/* ───────── Panels ───────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; }
.panel-h h2 { font-size: 16px; }
.panel-h .link { font-size: 13px; color: var(--ink-3); text-decoration: none; cursor: pointer; background: none; border: 0; }
.panel-h .link:hover { color: var(--pine); }
.panel-b { padding: 0 20px 18px; }
.empty { padding: 28px 20px; text-align: center; color: var(--ink-3); font-size: 14px; }
.empty .btn { margin-top: 12px; }

/* ───────── Dashboard ───────── */
.month-nav { display: inline-flex; align-items: center; gap: 4px; }
.month-nav b { min-width: 118px; text-align: center; font-weight: 600; }

.hero { padding: 6px 0 26px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: end; }
.hero-label { color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }
.hero-num { font-size: 64px; font-weight: 300; letter-spacing: -.03em; line-height: 1.05; }
.hero-num .cur { font-size: 30px; font-weight: 400; color: var(--ink-3); margin-inline-start: 4px; }
.hero-num.neg { color: var(--rose); }
.ribbon { margin-top: 22px; }
.ribbon-track { position: relative; height: 16px; border-radius: 6px; background: var(--line-2); overflow: visible; }
.ribbon-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 6px; background: var(--pine); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.ribbon-fill.warn { background: var(--amber); }
.ribbon-fill.over { background: var(--rose); }
.ribbon-today { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--ink); border-radius: 1px; }
.ribbon-today::after { content: attr(data-l); position: absolute; top: -22px; transform: translateX(50%); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.ribbon-legend { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.ribbon-msg { margin-top: 12px; font-size: 14px; font-weight: 500; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.kpi { padding: 16px 18px; }
.kpi + .kpi { border-inline-start: 1px solid var(--line-2); }
.kpi .l { font-size: 13px; color: var(--ink-3); }
.kpi .v { font-size: 22px; font-weight: 500; margin-top: 2px; }
.kpi .d { font-size: 12px; margin-top: 2px; }

.dash { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }

.cat-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); cursor: pointer; }
.cat-row:first-child { border-top: 0; }
.cat-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; background: var(--surface-2); }
.cat-name { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.cat-name .num { color: var(--ink-2); font-size: 13px; }
.bar { height: 6px; border-radius: 3px; background: var(--line-2); margin-top: 6px; position: relative; overflow: hidden; }
.bar > i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 3px; background: var(--pine); }
.bar > i.warn { background: var(--amber); } .bar > i.over { background: var(--rose); }
.bar.thick { height: 10px; border-radius: 5px; }
.cat-amt { text-align: end; font-size: 14px; font-weight: 500; min-width: 84px; }
.cat-amt small { display: block; font-size: 12px; font-weight: 400; color: var(--ink-3); }

.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-2); }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .s { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .amt { font-weight: 500; font-size: 14px; }
.date-pill { width: 42px; flex: none; text-align: center; border-radius: 9px; background: var(--surface-2); padding: 4px 0; line-height: 1.15; }
.date-pill b { display: block; font-size: 15px; font-weight: 600; }
.date-pill small { font-size: 11px; color: var(--ink-3); }

.insight { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; margin-top: 8px; }
.insight:first-child { margin-top: 0; }
.insight .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; }

/* chart */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--ink-3); }
.chart .gl { stroke: var(--line-2); }
.chart .b-inc { fill: var(--pine); } .chart .b-exp { fill: var(--rose); opacity: .85; }
.chart .b-cur { opacity: 1; }
.chart rect.hit { fill: transparent; cursor: pointer; }
.chart rect.hit:hover { fill: var(--ink); opacity: .04; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.donut-wrap { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: center; }
.donut-legend .list-row { padding: 6px 0; border: 0; }

/* account & card tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 16px; cursor: pointer; position: relative; display: flex; flex-direction: column; gap: 10px; text-align: start; }
.tile:hover { border-color: var(--ink-3); }
.tile .tile-top { display: flex; align-items: center; gap: 10px; }
.tile .stripe { width: 6px; align-self: stretch; border-radius: 3px; }
.tile .bal { font-size: 24px; font-weight: 400; letter-spacing: -.01em; }
.tile.add { border-style: dashed; display: grid; place-items: center; color: var(--ink-3); min-height: 120px; background: transparent; }
.tile.add:hover { color: var(--pine); border-color: var(--pine); }
.ccard {
  aspect-ratio: 1.586; border-radius: 14px; padding: 16px 18px; color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, var(--cc, #1f2a37), color-mix(in srgb, var(--cc, #1f2a37) 70%, #000)); cursor: pointer; position: relative; overflow: hidden; border: 0; text-align: start;
}
.ccard::before { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; inset-inline-end: -80px; top: -110px; background: rgba(255,255,255,.07); }
.ccard .cc-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; opacity: .9; position: relative; }
.ccard .cc-chip { width: 34px; height: 25px; border-radius: 5px; background: linear-gradient(135deg, #e9d9a6, #b89b57); }
.ccard .cc-num { font-size: 16px; letter-spacing: .14em; opacity: .9; position: relative; }
.ccard .cc-bottom { display: flex; justify-content: space-between; align-items: end; position: relative; }
.ccard .cc-bottom small { display: block; font-size: 11px; opacity: .7; }
.ccard .cc-bottom b { font-size: 17px; font-weight: 500; }
.cc-meter { height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); margin-top: 6px; overflow: hidden; }
.cc-meter i { display: block; height: 100%; background: #fff; border-radius: 2px; }

/* ───────── Data table ───────── */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .input { height: 36px; width: auto; min-width: 0; }
.toolbar .search { flex: 1; min-width: 180px; position: relative; }
.toolbar .search .input { width: 100%; padding-inline-start: 34px; }
.toolbar .search svg { position: absolute; inset-inline-start: 10px; top: 9px; width: 18px; height: 18px; stroke: var(--ink-3); fill: none; stroke-width: 2; }
.bulkbar { display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: var(--sky-soft); border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: 14px; }
.bulkbar .input { height: 32px; width: auto; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: start; font-weight: 500; color: var(--ink-3); font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; z-index: 1;
}
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th .arr { font-size: 10px; margin-inline-start: 4px; }
.tbl td { padding: 0 12px; height: 46px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.tbl tr.sel td { background: var(--sky-soft); }
.tbl td.ed { cursor: text; position: relative; }
.tbl td.ed:hover { box-shadow: inset 0 0 0 1px var(--line); border-radius: 6px; }
.tbl td.ed .input { height: 34px; padding: 0 8px; min-width: 90px; }
.tbl td.amt-c { text-align: end; font-weight: 500; white-space: nowrap; }
.tbl td.act { width: 1%; white-space: nowrap; text-align: end; }
.tbl td .row-actions { opacity: 0; transition: opacity .1s; display: inline-flex; gap: 2px; }
.tbl tr:hover .row-actions, .tbl tr:focus-within .row-actions { opacity: 1; }
.tbl .cell-main { font-weight: 500; }
.tbl .cell-sub { font-size: 12.5px; color: var(--ink-3); }
.tbl .ccell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tbl tfoot td { font-weight: 600; background: var(--surface-2); }
.tbl .flash td { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--pine-soft); } to { background: transparent; } }
.tbl-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; font-size: 13.5px; color: var(--ink-2); flex-wrap: wrap; }
.tbl-foot .sums { display: flex; gap: 18px; }

/* reports heatmap */
.heat td.hm { text-align: center; font-size: 12.5px; padding: 0 6px; }
.heat th { text-align: center; }
.heat th:first-child, .heat td:first-child { text-align: start; position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; }

/* ───────── Modal / sheet ───────── */
.overlay {
  position: fixed; inset: 0; background: rgba(12, 22, 18, .42); z-index: 50; display: grid; place-items: center; padding: 20px;
  animation: fade .15s ease-out;
}
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-pop); animation: pop .18s cubic-bezier(.2,.8,.2,1);
}
.modal.wide { width: min(760px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 6px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-b { padding: 12px 22px 8px; }
.modal-f { display: flex; justify-content: space-between; gap: 8px; padding: 14px 22px 18px; position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line-2); margin-top: 10px; }
.modal-f .end { display: flex; gap: 8px; margin-inline-start: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.amount-in { display: flex; align-items: baseline; gap: 6px; padding: 8px 0 4px; border-bottom: 2px solid var(--line); margin: 6px 0 16px; }
.amount-in:focus-within { border-color: var(--pine); }
.amount-in.bad { border-color: var(--rose); }
.amount-in span { font-size: 28px; color: var(--ink-3); font-weight: 300; }
.amount-in input { border: 0; outline: 0; background: transparent; font-size: 44px; font-weight: 300; width: 100%; direction: ltr; text-align: right; letter-spacing: -.02em; padding: 0; }
.qa-sec { margin-top: 16px; }
.qa-sec > .lbl { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 8px; display: flex; justify-content: space-between; }
.more-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--pine); cursor: pointer; padding: 6px 0; font-weight: 500; margin-top: 14px; }
.cat-chips .chip { height: 34px; }

.toast-wrap { position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-pop);
  display: flex; gap: 12px; align-items: center; animation: pop .2s ease-out; max-width: 380px;
}
.toast.err { background: var(--rose); color: #fff; }
.toast button { background: none; border: 0; color: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

.menu { position: absolute; z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; }
.menu button { display: flex; width: 100%; text-align: start; gap: 10px; align-items: center; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 14px; }
.menu button:hover { background: var(--surface-2); }
.menu button.on { color: var(--pine); font-weight: 600; }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 6px 4px; }

/* ───────── Auth ───────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: var(--pine); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
:root[data-theme="dark"] .auth-art { background: #12352C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-art { background: #12352C; } }
.auth-art h1 { font-size: 40px; font-weight: 300; line-height: 1.15; max-width: 420px; letter-spacing: -.02em; }
.auth-art p { opacity: .8; max-width: 380px; margin-top: 14px; font-size: 16px; }
.auth-ribbon { position: relative; max-width: 420px; }
.auth-ribbon .ribbon-track { background: rgba(255,255,255,.18); }
.auth-ribbon .ribbon-fill { background: #fff; }
.auth-ribbon .ribbon-today { background: #F3D36B; }
.auth-ribbon .ribbon-today::after { color: rgba(255,255,255,.85); }
.auth-ribbon .ribbon-legend { color: rgba(255,255,255,.8); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: min(380px, 100%); }
.auth-box h2 { font-size: 24px; margin-bottom: 6px; }
.auth-box form { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }
.auth-box .btn.primary { height: 44px; margin-top: 6px; }
.form-err { background: var(--rose-soft); color: var(--rose); padding: 10px 12px; border-radius: 10px; font-size: 14px; }

/* settings */
.settings { display: grid; grid-template-columns: 210px 1fr; gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav button { text-align: start; border: 0; background: none; padding: 9px 12px; border-radius: 10px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.settings-nav button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.set-sec { display: flex; flex-direction: column; gap: 16px; }
.set-sec .panel-b { padding-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 90px 90px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.field-row.h { color: var(--ink-3); font-size: 12.5px; border-top: 0; padding-top: 0; }
.field-row > :not(:first-child) { text-align: center; justify-self: center; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 11px; background: var(--line); transition: background .15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--pine); }
.switch input:checked + i::after { transform: translateX(-16px); }
.switch input:disabled + i { opacity: .45; }
.switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }

.member-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; margin: 2px; }
.member-chip select { border: 0; background: transparent; font-size: 12px; color: var(--ink-3); cursor: pointer; }
.member-chip button { border: 0; background: none; cursor: pointer; color: var(--ink-3); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; }
.member-chip button:hover { background: var(--rose-soft); color: var(--rose); }

.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--surface); }

.goal-ring { width: 64px; height: 64px; flex: none; }
.goal-ring circle { fill: none; stroke-width: 7; }
.goal-ring .bg { stroke: var(--line-2); }
.goal-ring .fg { stroke-linecap: round; transition: stroke-dashoffset .6s; }

.loader { display: grid; place-items: center; padding: 80px; color: var(--ink-3); }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--pine); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── Responsive ───────── */
@media (max-width: 1100px) {
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .hero { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 16px 16px 110px; }
  .page-head { margin-bottom: 16px; }
  h1 { font-size: 22px; }
  .hero-num { font-size: 48px; }
  .kpis { grid-template-columns: 1fr 1fr 1fr; }
  .kpi { padding: 12px; } .kpi .v { font-size: 17px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; inset-inline: 0; z-index: 40;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-3); text-decoration: none; background: none; border: 0; padding: 4px 0; cursor: pointer; }
  .tabbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.on { color: var(--pine); }
  .tabbar .plus span { width: 48px; height: 48px; margin-top: -22px; border-radius: 16px; background: var(--pine); display: grid; place-items: center; box-shadow: var(--shadow-pop); }
  .tabbar .plus svg { stroke: #fff; width: 24px; height: 24px; }
  .mobile-top { display: flex !important; }
  .desk-only { display: none !important; }
  .kpi .v { font-size: 15px; }
  .overlay { padding: 0; align-items: end; }
  .modal, .modal.wide { width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; animation: sheet .22s cubic-bezier(.2,.8,.2,1); }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .grid2 { grid-template-columns: 1fr; }
  .toast-wrap { inset-inline: 16px; bottom: 86px; }
  .settings { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .settings-nav button { white-space: nowrap; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 24px; min-height: 0; }
  .auth-art h1 { font-size: 28px; }
  .auth-art .auth-ribbon { display: none; }
  /* transactions table → stacked rows */
  .tbl.stack thead { display: none; }
  .tbl.stack tr { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); align-items: center; }
  .tbl.stack td { display: block; height: auto; padding: 0; border: 0; }
  .tbl.stack td.c-chk { grid-row: span 2; }
  .tbl.stack td.c-desc { grid-column: 2; }
  .tbl.stack td.amt-c { grid-column: 3; grid-row: 1; }
  .tbl.stack td.c-cat { grid-column: 2; font-size: 12.5px; }
  .tbl.stack td.c-date { grid-column: 3; grid-row: 2; text-align: end; font-size: 12.5px; color: var(--ink-3); }
  .tbl.stack td.c-src, .tbl.stack td.c-mem, .tbl.stack td.act { display: none; }
  .tbl.stack tfoot { display: none; }
}
.mobile-top { display: none; align-items: center; justify-content: space-between; margin-bottom: 14px; }
