@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/vendor/inter/inter-latin-wght-normal.woff2') format('woff2');
}

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e6e8ec;
  --border-strong: #d5d8df;
  --text: #0f172a;
  --text-2: #475467;
  --text-3: #8a93a3;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-50: #eef0ff;
  --primary-100: #e0e3ff;
  --green: #059669;
  --green-50: #ecfdf5;
  --red: #dc2626;
  --red-50: #fef2f2;
  --amber: #b45309;
  --amber-50: #fffbeb;
  --amber-200: #fde68a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .22);
  --sidebar: 244px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 15px; height: 15px; }
.i.xs { width: 13px; height: 13px; }
.i.lg { width: 22px; height: 22px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: none; position: fixed; inset: 0 auto 0 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #6366f1, #4338ca); box-shadow: 0 4px 10px -2px rgba(79, 70, 229, .45);
}
.brand b { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand span { display: block; font-size: 12px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 11px; border-radius: 9px;
  color: var(--text-2); font-weight: 500; transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--primary-50); color: var(--primary-600); font-weight: 600; }
.nav a.on .i { stroke: var(--primary); }
.nav .count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--amber-50); color: var(--amber); font-size: 11.5px; font-weight: 700;
  display: grid; place-items: center; border: 1px solid var(--amber-200);
}
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 18px 11px 6px; }
.sync-mini {
  margin-top: auto; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2);
}
.sync-mini .row { display: flex; align-items: center; gap: 8px; }
.sync-mini .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-50); }
.sync-mini .dot.busy { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .4; } }
.sync-mini .t1 { font-size: 12.5px; font-weight: 600; }
.sync-mini .t2 { font-size: 12px; color: var(--text-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-mini .bar { height: 4px; background: var(--border); border-radius: 4px; margin-top: 9px; overflow: hidden; }
.sync-mini .bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.sync-mini button { margin-top: 10px; width: 100%; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 16px 32px; background: rgba(244, 245, 247, .86); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar h1 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.topbar p { font-size: 13px; color: var(--text-3); margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.view { padding: 8px 32px 48px; max-width: 1320px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, .35), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn-primary:hover { background: var(--primary-600); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: rgba(15, 23, 42, .05); color: var(--text); }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-50); border-color: #fecaca; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.icon-btn { width: 36px; height: 36px; padding: 0; }
.icon-btn.btn-sm { width: 30px; }

.month-switch { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-sm); height: 36px; }
.month-switch button { height: 34px; width: 34px; display: grid; place-items: center; color: var(--text-2); }
.month-switch button:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.month-switch button:disabled { opacity: .35; cursor: default; }
.month-switch .label { width: auto; min-width: 132px; padding: 0 6px; font-weight: 600; font-size: 13.5px; color: var(--text); border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-radius: 0; }

.input, select.input, textarea.input {
  height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  outline: none; transition: border-color .12s, box-shadow .12s; width: 100%; font-size: 13.5px;
}
textarea.input { height: auto; min-height: 72px; padding: 9px 12px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a93a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.search { position: relative; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search .input { padding-left: 36px; }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
kbd { font: 600 11px/1 'Inter', sans-serif; color: var(--text-3); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 3px 5px; background: var(--surface); }

.seg { display: inline-flex; background: #eceef2; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }

/* ---------- cards ---------- */
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
.g-2-1 { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.card-head p { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.link { color: var(--primary); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { color: var(--primary-600); text-decoration: underline; text-underline-offset: 3px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; }
.kpi-label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi-label .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.kpi-hero .kpi-value { font-size: 34px; }
.kpi-foot { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kpi-hero { background: linear-gradient(160deg, #ffffff 40%, #f5f5ff); position: relative; overflow: hidden; }
.kpi-hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(99, 102, 241, .14), transparent 70%); }
.delta { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 7px; border-radius: 99px; font-size: 12px; font-weight: 650; }
.delta.good { background: var(--green-50); color: var(--green); }
.delta.bad { background: var(--red-50); color: var(--red); }
.delta.flat { background: var(--surface-2); color: var(--text-2); }
.kpi-merchant { font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.clickable { cursor: pointer; transition: border-color .12s; }
.kpi.clickable:hover { border-color: var(--border-strong); }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 3px; display: inline-block; }
.legend i.dash { background: repeating-linear-gradient(90deg, #a5acba 0 4px, transparent 4px 7px); }
.axis text { font-size: 11px; fill: var(--text-3); font-family: 'Inter', sans-serif; }
.gridline { stroke: #eef0f3; stroke-width: 1; }

.tooltip {
  position: fixed; pointer-events: none; z-index: 100; background: #0f172a; color: #fff; border-radius: 10px; padding: 9px 11px;
  font-size: 12.5px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(4px); transition: opacity .1s, transform .1s; min-width: 140px;
}
.tooltip.show { opacity: 1; transform: none; }
.tooltip .tt-h { font-weight: 650; margin-bottom: 4px; color: #e2e8f0; }
.tooltip .tt-r { display: flex; align-items: center; gap: 8px; justify-content: space-between; color: #cbd5e1; }
.tooltip .tt-r b { color: #fff; font-weight: 650; }
.tooltip .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }

/* donut + category legend */
.donut-row { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.donut { position: relative; flex: none; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; padding: 0 22px; }
.donut-center .v { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.donut-center .k { font-size: 11.5px; color: var(--text-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.donut circle.seg-arc { transition: stroke-width .15s, opacity .15s; cursor: pointer; }
.cat-list { width: 100%; min-width: 0; display: flex; flex-direction: column; }
.cat-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 9px; cursor: pointer; }
.cat-item:hover, .cat-item.hl { background: var(--surface-2); }
.cat-item .nm { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .sb { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .am { text-align: right; font-weight: 650; font-size: 13px; }
.cat-item .pc { text-align: right; font-size: 11.5px; color: var(--text-3); }
.cat-bar { grid-column: 2 / 4; height: 4px; background: #f0f1f4; border-radius: 4px; overflow: hidden; margin-top: -2px; }
.cat-bar i { display: block; height: 100%; border-radius: 4px; }

.chip-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); }
.chip-ic.lg { width: 44px; height: 44px; border-radius: 12px; }
.chip-ic.lg .i { width: 22px; height: 22px; }

/* calendar heatmap */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .dow { font-size: 11px; color: var(--text-3); text-align: center; font-weight: 600; padding-bottom: 2px; }
.cal .day {
  aspect-ratio: 1; border-radius: 7px; background: #f1f2f5; font-size: 11px; color: var(--text-3); position: relative;
  display: flex; align-items: flex-start; justify-content: flex-start; padding: 4px 5px; cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.cal .day:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary-100); z-index: 1; }
.cal .day.l1 { background: #e0e3ff; color: #4338ca; }
.cal .day.l2 { background: #b9bfff; color: #312e81; }
.cal .day.l3 { background: #8187f7; color: #fff; }
.cal .day.l4 { background: #4f46e5; color: #fff; }
.cal .day.future { background: repeating-linear-gradient(135deg, #f6f7f9 0 4px, #eff0f3 4px 8px); cursor: default; }
.cal .day.future:hover { transform: none; box-shadow: none; }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--text); }
.cal .blank { aspect-ratio: 1; }
.cal-scale { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-3); margin-top: 12px; }
.cal-scale i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* merchant & generic rows */
.rows { display: flex; flex-direction: column; }
.m-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 9px; cursor: pointer; }
.m-row:hover { background: var(--surface-2); }
.m-row .nm { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-row .sb { font-size: 12px; color: var(--text-3); }
.m-row .am { font-weight: 650; font-size: 13px; text-align: right; }

.stackbar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; margin-bottom: 14px; }
.stackbar i { display: block; height: 100%; }
.pm-row { display: flex; align-items: center; gap: 9px; padding: 6px 2px; font-size: 13px; }
.pm-row .sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.pm-row .nm { flex: 1; color: var(--text-2); }
.pm-row .am { font-weight: 650; }
.pm-row .pc { width: 38px; text-align: right; color: var(--text-3); font-size: 12px; }

/* ---------- transactions ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px; }
.toolbar .search { flex: 1; min-width: 220px; }
.toolbar select.input { width: auto; min-width: 150px; }
.summary-line { display: flex; align-items: center; gap: 18px; padding: 4px 4px 12px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.summary-line b { color: var(--text); font-weight: 650; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: 99px; background: var(--primary-50); color: var(--primary-600); font-weight: 600; font-size: 12.5px; }
.filter-chip button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; }
.filter-chip button:hover { background: var(--primary-100); }

.tx-list { padding: 0; overflow: hidden; }
.day-group + .day-group { border-top: 1px solid var(--border); }
.day-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--border); }
.tx {
  display: grid; grid-template-columns: 40px minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(110px, auto); gap: 14px; align-items: center;
  padding: 11px 20px; cursor: pointer; transition: background .1s; border-bottom: 1px solid #f1f2f5;
}
.tx:last-child { border-bottom: 0; }
.tx:hover { background: #fafbff; }
.tx .chip-ic { width: 38px; height: 38px; border-radius: 11px; }
.tx-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 7px; min-width: 0; }
.tx-title .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.tx-cat { min-width: 0; }
.tx-cat .c { font-size: 13px; font-weight: 550; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-cat .s { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-amt { text-align: right; font-weight: 650; font-size: 14px; }
.tx-amt .orig { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.amt-in { color: var(--green); }
.amt-neutral { color: var(--text-2); }

.pill { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 99px; font-size: 11px; font-weight: 650; white-space: nowrap; flex: none; }
.pill.review { background: var(--amber-50); color: var(--amber); border: 1px solid var(--amber-200); }
.pill.manual { background: #f1f5f9; color: #475569; }
.pill.kind { background: #f1f5f9; color: #475569; }
.pill.kind.income, .pill.kind.refund { background: var(--green-50); color: var(--green); }
.pill.kind.expense { background: var(--primary-50); color: var(--primary-600); }
.pill.hidden-pill { background: #f1f5f9; color: var(--text-3); }

.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty .ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.empty h4 { font-size: 15px; color: var(--text); margin-bottom: 4px; }

/* ---------- review ---------- */
.review-intro { display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: linear-gradient(120deg, #fffbeb, #fff 70%); border-color: var(--amber-200); }
.review-intro .ic { width: 40px; height: 40px; border-radius: 12px; background: #fef3c7; color: var(--amber); display: grid; place-items: center; flex: none; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.rv-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.rv-top { display: flex; align-items: center; gap: 12px; }
.rv-top .nm { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-top .sb { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-top .am { margin-left: auto; font-weight: 700; font-size: 15px; text-align: right; flex: none; }
.rv-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.rv-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 12.5px; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.rv-facts .k { color: var(--text-3); font-size: 11.5px; }
.rv-facts .v { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-src { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rv-actions { display: flex; gap: 8px; margin-top: auto; }
.rv-actions .btn { flex: 1; }

/* ---------- sync / settings ---------- */
.stat { padding: 16px 18px; }
.stat .k { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.progress { height: 8px; background: #eceef2; border-radius: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #4f46e5); border-radius: 8px; transition: width .4s; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv .k { color: var(--text-3); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 0 8px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 8px; border-bottom: 1px solid #f1f2f5; }
.table td.r, .table th.r { text-align: right; }
.table tr:last-child td { border-bottom: 0; }

/* ---------- drawer ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .32); z-index: 60; opacity: 0; transition: opacity .18s; }
.backdrop.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100vw); background: var(--surface); z-index: 61;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.drawer.show { transform: none; }
.drawer-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.drawer-head .t { flex: 1; min-width: 0; }
.drawer-head .nm { font-size: 17px; font-weight: 700; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; }
.drawer-head .sb { font-size: 13px; color: var(--text-3); }
.drawer-amount { font-size: 30px; font-weight: 750; letter-spacing: -.03em; margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drawer-amount .orig { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.drawer-foot { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.drawer-foot .spacer { flex: 1; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.banner.warn { background: var(--amber-50); border: 1px solid var(--amber-200); color: #78350f; }
.banner.info { background: #f1f5f9; border: 1px solid var(--border); color: var(--text-2); }
.banner .grow { flex: 1; }
.section-title { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.items { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.items .it { display: flex; gap: 10px; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid #f1f2f5; }
.items .it:last-child { border-bottom: 0; }
.items .it .q { color: var(--text-3); width: 28px; }
.items .it .n { flex: 1; }
.items .it .a { font-weight: 600; }
.email-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.email-card .from { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.email-card .subj { font-weight: 600; font-size: 13.5px; }
.email-card .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.email-card details summary { font-size: 12.5px; color: var(--primary); cursor: pointer; font-weight: 600; }
.email-card pre { white-space: pre-wrap; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 10px; margin-top: 8px; max-height: 260px; overflow: auto; }
.conf { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.conf .progress { flex: 1; height: 6px; }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 40px); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateY(10px) scale(.98); opacity: 0; transition: transform .18s, opacity .18s;
}
.modal.show { transform: none; opacity: 1; }
.modal-head { display: flex; align-items: center; padding: 18px 22px 0; }
.modal-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -.015em; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 16px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }
.ai-box {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 12px;
  background: linear-gradient(120deg, #f5f3ff, #eef2ff); border: 1px solid #ddd6fe;
}
.ai-box .i { color: #7c3aed; }
.ai-box input { flex: 1; border: 0; background: transparent; outline: none; height: 34px; font-size: 13.5px; min-width: 0; }
.ai-box input::placeholder { color: #8b7fbf; }
.ai-hint { font-size: 12px; color: var(--text-3); margin-top: -6px; }
.amount-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 14px; padding: 0 16px; height: 62px; transition: border-color .12s, box-shadow .12s; }
.amount-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.amount-input span { font-size: 20px; font-weight: 600; color: var(--text-3); }
.amount-input input { flex: 1; border: 0; outline: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; background: transparent; min-width: 0; font-variant-numeric: tabular-nums; }
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.cat-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--border); font-size: 11.5px; font-weight: 600; color: var(--text-2); text-align: center; line-height: 1.2; transition: border-color .1s, background .1s; }
.cat-tile:hover { border-color: var(--border-strong); background: var(--surface-2); }
.cat-tile.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, white); color: var(--text); box-shadow: 0 0 0 1px var(--c); }
.cat-tile .chip-ic { width: 32px; height: 32px; }

/* ---------- toasts, skeleton ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); animation: tin .2s ease-out; }
.toast .i { color: #86efac; }
.toast.err .i { color: #fca5a5; }
.toast button { color: #a5b4fc; font-weight: 650; margin-left: 6px; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.sk { background: linear-gradient(90deg, #eef0f3 25%, #f6f7f9 50%, #eef0f3 75%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- mobile ---------- */
.tabbar { display: none; }
@media (max-width: 1180px) {
  .g-kpi { grid-template-columns: 1fr 1fr; }
  .g-3 { grid-template-columns: 1fr 1fr; }
  .g-3 > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 72px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar h1 { font-size: 18px; }
  .topbar p { display: none; }
  .view { padding: 4px 14px 32px; }
  .g-2-1, .g-1-2, .g-3 { grid-template-columns: 1fr; }
  .g-3 > :last-child { grid-column: auto; }
  .btn-add-label { display: none; }
  .donut-row { flex-direction: column; align-items: stretch; }
  .donut { align-self: center; }
  .tx { grid-template-columns: 38px minmax(0, 1fr) auto; padding: 11px 14px; }
  .tx-cat { display: none; }
  .day-head { padding: 9px 14px; top: 61px; }
  .fields { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
    border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--text-3); padding: 4px 0; position: relative; }
  .tabbar a.on { color: var(--primary); }
  .tabbar .count { position: absolute; top: 0; left: 55%; background: var(--amber); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; }
  .kpi-hero .kpi-value { font-size: 28px; }
}
@media (max-width: 520px) {
  .g-kpi { grid-template-columns: 1fr; }
  .month-switch .label { min-width: 110px; }
  .review-grid { grid-template-columns: 1fr; }
}
