/* Finance Flaviu — tokeni extrași din Figma (Payreal UI Kit, light mode) */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --primary: #1e6bf0;
  --primary-2: #1a48c8;
  --primary-soft: #e0ecff;
  --cyan: #22d3ee;
  --green: #22c55e;
  --green-soft: #dcfce7;
  --green-text: #16a34a;
  --red: #ef4444;
  --red-soft: #fee2e2;
  --sky-soft: #e0f2fe;
  --grad-income: linear-gradient(180deg, #5ba0ff, #1d5fe0);
  --grad-expense: linear-gradient(180deg, #2ed8f2, #0ea5e9);
  --grad-primary: linear-gradient(180deg, #1e6bf0, #1a48c8);
  --grad-deep: linear-gradient(135deg, #1c5fe8, #0b2a75);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 12px rgba(15, 23, 42, .04);
  --shadow-lg: 0 8px 20px rgba(30, 107, 240, .2);
  --sidebar: 188px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(180deg, #3b8cff, #1552d8); color: #fff; box-shadow: var(--shadow-lg);
}
.brand-mark svg.i { width: 17px; height: 17px; }
.brand-lg { font-size: 24px; justify-content: center; }
.brand-lg .brand-mark { width: 44px; height: 44px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow); display: grid; gap: 14px; text-align: center;
}
.login-card p { margin: 0; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
@media (min-width: 901px) {
  /* fundalul sidebar-ului continuă pe toată înălțimea paginii */
  .layout { background: linear-gradient(90deg, var(--surface) calc(var(--sidebar) - 1px), var(--border) 0 var(--sidebar), transparent 0); }
}
.sidebar {
  width: var(--sidebar); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  padding: 26px 12px 24px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.sidebar > .brand { padding: 0 10px; margin-bottom: 32px; }
.nav { display: grid; gap: 14px; }
.nav a {
  display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-radius: 12px;
  color: var(--text-2); font-weight: 500; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow-lg); }
.nav-sep { height: 1px; background: var(--border); margin: 28px 16px; }
.promo {
  margin-top: auto; background: var(--grad-deep); color: #fff; border-radius: var(--radius);
  padding: 20px 18px; display: grid; gap: 6px;
}
.promo small { opacity: .75; font-size: 12px; font-weight: 500; }
.promo b { font-size: 26px; letter-spacing: -.02em; }
.promo span { font-size: 12px; opacity: .85; line-height: 1.4; }

.main { flex: 1; min-width: 0; padding: 22px 22px 40px 30px; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-bottom: 26px; }
.topbar-brand { display: none; margin-right: auto; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--text-2); transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg.i { width: 18px; height: 18px; }
.user { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--border); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700;
}
.user-text { display: grid; line-height: 1.25; }
.user-text b { font-weight: 600; }
.user-text small { color: var(--muted); font-size: 12px; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 8px; font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 0; color: var(--text-2); }
.page-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.today { color: var(--text-2); font-weight: 500; }
.month-picker {
  display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 12px; padding: 4px; box-shadow: var(--shadow);
}
.month-picker button { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); }
.month-picker button:hover { background: var(--surface-2); }
.month-picker button:disabled { opacity: .3; cursor: default; background: none; }
.month-picker span { display: flex; align-items: center; gap: 8px; padding: 0 8px; font-weight: 600; min-width: 140px; justify-content: center; }
.month-picker svg.i { width: 18px; height: 18px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.card-head p { margin: 6px 0 0; color: var(--text-2); font-size: 13px; }
.link { color: var(--primary); font-weight: 500; font-size: 13.5px; }
.link:hover { text-decoration: underline; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.kpi { display: flex; gap: 16px; align-items: flex-start; padding: 22px 20px; }
.kpi-icon { width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.kpi-icon svg.i { width: 24px; height: 24px; }
.kpi-icon.blue { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.red { background: var(--red-soft); color: var(--red); }
.kpi-icon.sky { background: var(--sky-soft); color: #0ea5e9; }
.kpi-label { color: var(--text-2); font-weight: 500; font-size: 13px; margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--text-2); margin-left: 3px; }
.kpi-body { min-width: 0; flex: 1; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 6px; font-weight: 600; font-size: 12px; }
.delta svg.i { width: 12px; height: 12px; stroke-width: 2.4; }
.delta.good { background: var(--green-soft); color: var(--green-text); }
.delta.bad { background: var(--red-soft); color: var(--red); }
.delta.flat { background: var(--surface-2); color: var(--text-2); }

.grid-main { display: grid; grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.col { display: grid; gap: 20px; min-width: 0; }

/* ---------- Cash flow chart ---------- */
.legend { display: flex; gap: 18px; justify-content: flex-end; font-size: 13px; color: var(--text-2); margin: -6px 0 6px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.chart { position: relative; height: 250px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .gridline { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .zero { stroke: var(--text-2); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .col-g.dim rect.bar { opacity: .6; }
.chart .col-g:hover rect.bar { opacity: 1; }
.chart .cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart-tip {
  position: fixed; z-index: 50; pointer-events: none; background: #0e1830; color: #fff; border-radius: 9px;
  padding: 10px 12px; font-size: 12px; box-shadow: 0 8px 20px rgba(15,23,42,.25); min-width: 140px;
}
.chart-tip .t { color: var(--muted); margin-bottom: 6px; }
.chart-tip .r { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-top: 3px; }
.chart-tip .r span { display: flex; align-items: center; gap: 6px; color: #c3cee2; }
.chart-tip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.select {
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 9px 12px; font: inherit;
  color: var(--text); font-size: 13px; font-weight: 500;
}

/* ---------- Fixed costs card (ex „My Card”) ---------- */
.fixed { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: center; }
.bank-card {
  background: var(--grad-deep); color: #fff; border-radius: 12px; padding: 18px 16px; min-height: 126px;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.bank-card::after {
  content: ''; position: absolute; right: -40px; top: -50px; width: 160px; height: 160px; border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.bank-card .top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; opacity: .9; }
.bank-card .amt { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.bank-card .bottom { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; letter-spacing: .04em; opacity: .85; text-transform: uppercase; }
.fixed-stats { display: grid; gap: 14px; }
.stat small { display: block; color: var(--text-2); font-size: 12px; margin-bottom: 4px; }
.stat b { font-size: 22px; letter-spacing: -.02em; }
.stat b.sm { font-size: 15px; }
.bar-row { display: flex; justify-content: space-between; align-items: baseline; }
.bar-row em { font-style: normal; color: var(--primary); font-size: 12px; font-weight: 500; }
.progress { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .4s; }
.progress.warn > i { background: #f59e0b; }
.progress.over > i { background: var(--red); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }

/* ---------- Budget ring (ex „Savings Goals”) ---------- */
.budget { display: flex; gap: 18px; align-items: center; }
.ring { position: relative; width: 92px; height: 92px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 17px; font-weight: 700; }
.budget-body { flex: 1; min-width: 0; }
.budget-body h3 { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; }
.budget-body .big { font-size: 16px; font-weight: 700; }
.budget-body .big small { color: var(--muted); font-weight: 500; font-size: 12px; }
.budget-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.budget-meta div { display: flex; gap: 8px; align-items: center; }
.budget-meta svg.i { width: 16px; height: 16px; color: var(--text-2); }
.budget-meta small { display: block; color: var(--muted); font-size: 11px; }
.budget-meta b { font-size: 12.5px; font-weight: 600; }

/* ---------- Donut ---------- */
.donut-wrap { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 20px; align-items: center; }
.donut { position: relative; width: 172px; height: 172px; }
.wheel .seg { cursor: pointer; transition: opacity .15s, stroke-width .15s; }
.wheel.focus .seg:not(.on) { opacity: .25; }
.wheel .seg.on { stroke-width: 28px; }
.wheel .center { pointer-events: none; padding: 0 30px; }
.wheel .center small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.cat-legend li { cursor: default; transition: opacity .15s; }
.wheel.focus .cat-legend li:not(.on) { opacity: .4; }
.wheel .cat-legend li.on .n { color: var(--text); font-weight: 600; }
.delta-btn { cursor: pointer; border: 0; font: inherit; font-size: 12px; font-weight: 600; }
.delta-btn:hover { background: var(--primary-soft); color: var(--primary); }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut .center b { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.donut .center small { color: var(--text-2); font-size: 11px; margin-top: 2px; }
.cat-legend { display: grid; gap: 10px; font-size: 13px; }
.cat-legend li { display: grid; grid-template-columns: minmax(0, 1fr) 38px auto; gap: 8px; align-items: center; }
.cat-legend .n { display: flex; align-items: center; gap: 8px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-legend .n i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cat-legend .p { color: var(--muted); text-align: right; font-size: 12px; }
.cat-legend .v { font-weight: 600; text-align: right; }
ul.clean { list-style: none; margin: 0; padding: 0; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.tx { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tx th {
  text-align: left; font-weight: 500; color: var(--text-2); font-size: 12.5px; background: var(--surface-2);
  padding: 11px 14px; white-space: nowrap;
}
table.tx th:first-child { border-radius: 10px 0 0 10px; }
table.tx th:last-child { border-radius: 0 10px 10px 0; }
table.tx td { padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tx tr:last-child td { border-bottom: 0; }
table.tx tbody tr { cursor: pointer; transition: background .1s; }
table.tx tbody tr:hover { background: #fafcff; }
table.tx .r { text-align: right; }
.desc { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.desc .dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none;
}
.desc .dot svg.i { width: 15px; height: 15px; stroke-width: 2.2; }
.desc .t { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.desc .sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.pill { display: inline-block; padding: 4px 9px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.amount-in { color: var(--green-text); font-weight: 600; }
.amount-out { color: var(--text); font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 13px; }
.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.status.rec i { background: var(--primary); }
.status.off i { background: var(--muted); }
.row-more { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.empty b { display: block; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }

/* Liste mobile (în loc de tabel pe ecran mic) */
.tx-list { display: none; }
.tx-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--border); cursor: pointer; }
.tx-item:last-child { border-bottom: 0; }
.tx-item .desc { flex: 1; min-width: 0; }
.tx-item .desc > span:last-child { min-width: 0; }
.tx-item .desc .t { max-width: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.tx-item .amt { text-align: right; font-weight: 600; white-space: nowrap; }
.tx-item .amt small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

/* ---------- Tabs / toolbar ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 4px; gap: 2px; }
.tabs button { padding: 7px 14px; border-radius: 7px; font-weight: 500; color: var(--text-2); font-size: 13px; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.summary-strip { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.summary-strip b { color: var(--text); font-weight: 600; margin-left: 4px; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 10px; font-weight: 600; font-size: 14px; transition: filter .15s, background .15s; white-space: nowrap;
}
.btn svg.i { width: 17px; height: 17px; stroke-width: 2.2; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(30,107,240,.25); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--red); border: 1px solid var(--red-soft); background: var(--surface); }
.btn-danger:hover { background: var(--red-soft); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }

.input, .form select, .form input, .form textarea {
  width: 100%; height: 44px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; font: inherit;
  font-size: 16px; color: var(--text); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.form textarea { height: 72px; padding: 10px 12px; resize: vertical; }
.input:focus, .form select:focus, .form input:focus, .form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,107,240,.12); }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--red); font-size: 13px; min-height: 0; margin: 0; }
.form-error:empty { display: none; }
.amount-field { position: relative; }
.amount-field input { font-size: 22px; font-weight: 700; height: 54px; padding-right: 56px; }
.amount-field span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 10px; padding: 4px; }
.seg button { height: 38px; border-radius: 7px; font-weight: 600; color: var(--text-2); }
.seg button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.seg button.on[data-v=expense] { color: var(--red); }
.seg button.on[data-v=income] { color: var(--green-text); }
.check { display: flex !important; grid-template-columns: none; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; outline: 2px solid transparent; }
.swatches button.on { outline-color: var(--text); border-color: #fff; }

/* Switch */
.switch { position: relative; width: 38px; height: 22px; display: inline-block; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 22px; transition: background .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 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 + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 40; display: grid; place-items: center; padding: 16px;
  animation: fade .15s;
}
.modal {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 460px; max-height: calc(100dvh - 32px);
  overflow-y: auto; padding: 24px; box-shadow: 0 20px 50px rgba(15,23,42,.25); animation: pop .18s;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .spacer { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #0e1830; color: #fff; z-index: 60;
  padding: 11px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 500; box-shadow: 0 8px 24px rgba(15,23,42,.3);
  max-width: calc(100vw - 32px);
}
.toast.err { background: var(--red); }

/* ---------- Categories page ---------- */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.cat-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.cat-row:last-child { border-bottom: 0; }
.cat-row i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.cat-row span { flex: 1; font-weight: 500; }
.cat-row.archived { opacity: .5; }
.cat-row .badge { font-size: 11px; color: var(--muted); background: var(--surface-2); padding: 3px 7px; border-radius: 5px; }

.skeleton { color: var(--muted); padding: 60px 0; text-align: center; }

/* Bottom nav (mobil) */
.bottom-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .col-side { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .col-side > .card:first-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 18px; }
  .topbar-brand { display: flex; font-size: 18px; }
  .topbar-brand .brand-mark { width: 30px; height: 30px; }
  #quick-add { display: none; }
  .user { border-left: 0; padding-left: 0; }
  .user-text { display: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--border); z-index: 30;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: grid; justify-items: center; gap: 3px; font-size: 10.5px; font-weight: 500; color: var(--muted); padding: 6px 0; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-add {
    width: 50px; height: 50px; border-radius: 50%; background: var(--grad-primary); color: #fff; display: grid;
    place-items: center; justify-self: center; box-shadow: var(--shadow-lg); margin-top: -18px;
  }
  .bottom-add svg.i { width: 24px; height: 24px; stroke-width: 2.4; }
  .page-head h1 { font-size: 24px; }
  .page-head { margin-bottom: 18px; }
  .today { display: none; }
  .table-wrap { display: none; }
  .tx-list { display: block; }
  .cat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .col-side { grid-template-columns: minmax(0, 1fr); }
  .kpis { gap: 12px; margin-bottom: 14px; }
  .grid-main, .col { gap: 14px; }
  .kpi { flex-direction: column; gap: 12px; padding: 16px 14px; }
  .kpi-icon { width: 40px; height: 40px; border-radius: 10px; }
  .kpi-icon svg.i { width: 20px; height: 20px; }
  .kpi-value { font-size: 20px; }
  .kpi-value small { font-size: 12px; }
  .kpi-foot .vs { display: none; }
  .card { padding: 18px 16px; }
  .chart { height: 210px; }
  .fixed { grid-template-columns: minmax(0, 1fr); }
  .donut-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .cat-legend { width: 100%; }
  .page-tools { width: 100%; }
  .month-picker { width: 100%; justify-content: space-between; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92dvh; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
}
@media (max-width: 900px) {
  .toolbar-add { display: none !important; }
  .summary-strip { width: 100%; justify-content: space-between; }
}

/* ---------- Sold total: economii ---------- */
.kpi-click { cursor: pointer; position: relative; transition: border-color .15s, box-shadow .15s; }
.kpi-click:hover { border-color: #c7d7f5; box-shadow: 0 6px 16px rgba(30,107,240,.08); }
.kpi-click:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.kpi-more { position: absolute; top: 14px; right: 14px; color: var(--muted); display: grid; }
.kpi-more svg.i { width: 18px; height: 18px; }
.kpi-note { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bal-preview { background: var(--grad-deep); color: #fff; border-radius: 14px; padding: 16px 18px; display: grid; gap: 4px; }
.bal-preview small { opacity: .75; font-size: 12px; }
.bal-preview b { font-size: 24px; letter-spacing: -.02em; }
.bal-preview span { font-size: 12.5px; opacity: .9; line-height: 1.5; }
.bal-preview span b { font-size: 12.5px; letter-spacing: 0; }
.bal-preview .muted { color: #c3cee2; }
.sav-head { display: grid; gap: 2px; margin-top: 4px; }
.sav-head h4 { margin: 0; font-size: 14px; }
#sav-list { display: grid; gap: 10px; }
.modal:has(#bal-form) { max-width: 560px; }
.sav-row { display: grid; grid-template-columns: minmax(0, 1.2fr) 92px minmax(0, 1.1fr) 40px; gap: 8px; align-items: center; }
.sav-row .amount-field input { font-size: 16px; font-weight: 600; height: 44px; padding-right: 44px; }
.sav-row .amount-field span { font-size: 12px; }
.sav-del { width: 40px; height: 40px; color: var(--muted); }
.sav-del:hover { color: var(--red); background: var(--red-soft); }
.form label > .hint { display: block; margin-top: -2px; }
@media (max-width: 640px) {
  .sav-row { grid-template-columns: 1fr 1fr 40px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
  .sav-row .sav-name { grid-column: 1 / -1; }
  .kpi-note { white-space: normal; }
}
