:root {
  color-scheme: light;
  --bg: #f3f6fa; --bg-soft: #e9eef4; --surface: #ffffff; --surface-soft: #f7f9fc;
  --surface-glass: rgba(255,255,255,.88); --ink: #101820; --muted: #68788a; --line: #dbe3ec;
  --accent: #0ba86f; --accent-strong: #087a55; --accent-soft: #e3f7ef; --gold: #d5a73f;
  --red: #d94f5c; --red-soft: #ffedef; --shadow-sm: 0 4px 16px rgba(23,43,62,.06);
  --shadow: 0 18px 50px rgba(23,43,62,.11); --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080d12; --bg-soft: #0b121a; --surface: #101821; --surface-soft: #141f2a;
  --surface-glass: rgba(12,19,27,.9); --ink: #e9f1f7; --muted: #8da0b2; --line: #253342;
  --accent: #24d28a; --accent-strong: #39e39b; --accent-soft: #102d23; --gold: #e8bb56;
  --red: #ff6875; --red-soft: #341b22; --shadow-sm: 0 5px 18px rgba(0,0,0,.24);
  --shadow: 0 22px 65px rgba(0,0,0,.34);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: linear-gradient(color-mix(in srgb,var(--line) 22%,transparent) 1px,transparent 1px), linear-gradient(90deg,color-mix(in srgb,var(--line) 18%,transparent) 1px,transparent 1px), radial-gradient(circle at 8% -10%,color-mix(in srgb,var(--accent) 9%,transparent),transparent 34%),var(--bg);
  background-size: 42px 42px,42px 42px,auto,auto;
  transition: background-color .25s ease, color .25s ease;
}
button,input,select,textarea { font: inherit; }
body,strong,b,input { font-variant-numeric: tabular-nums; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
[hidden] { display: none !important; }
small { color: var(--muted); }
:focus-visible { outline: 3px solid color-mix(in srgb,var(--accent) 36%,transparent); outline-offset: 2px; }
input,select,textarea { width: 100%; border: 1px solid var(--line); background: var(--surface-soft); color: var(--ink); border-radius: 14px; padding: 13px 14px; outline: none; transition: border-color .18s ease,box-shadow .18s ease,background .18s ease; }
input:focus,select:focus,textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb,var(--accent) 12%,transparent); background: var(--surface); }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; color: var(--muted); }
.primary { border: 0; border-radius: 15px; padding: 15px 20px; background: linear-gradient(135deg,var(--accent-strong),var(--accent)); color: #fff; font-weight: 800; box-shadow: 0 9px 22px color-mix(in srgb,var(--accent) 22%,transparent); transition: transform .18s ease,box-shadow .18s ease; }
.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px color-mix(in srgb,var(--accent) 28%,transparent); }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; position: relative; }
.auth-card { width: min(450px,100%); background: var(--surface-glass); border: 1px solid color-mix(in srgb,var(--line) 84%,transparent); padding: 38px; border-radius: 22px; box-shadow: var(--shadow); text-align: center; backdrop-filter: blur(20px); }
.brand-mark,.mini-brand { display: grid; place-items: center; background: linear-gradient(145deg,#17362a,#07120e); color: var(--gold); font-weight: 900; box-shadow: inset 0 1px rgba(255,255,255,.12),0 10px 24px rgba(4,20,13,.2); }
.brand-mark { width: 68px; height: 68px; margin: auto; border-radius: 16px; font-size: 35px; }
.mini-brand { width: 42px; height: 42px; border-radius: 11px; font-size: 21px; flex: 0 0 auto; }
.auth-card h1 { margin: 18px 0 5px; font-size: 34px; letter-spacing: -.04em; }
.auth-card>p { margin: 0 0 25px; color: var(--muted); }
.stack { display: grid; gap: 16px; margin-top: 20px; text-align: left; }
.segmented { display: flex; padding: 5px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 15px; gap: 4px; }
.segmented button { flex: 1; border: 0; background: transparent; border-radius: 11px; padding: 10px; color: var(--muted); font-weight: 750; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 750; box-shadow: var(--shadow-sm); }
.theme-icon { font-size: 17px; line-height: 1; }
.auth-theme-toggle { position: absolute; right: 24px; top: 24px; }

.app-shell { min-height: 100vh; padding-bottom: 108px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px max(20px,calc((100% - 1180px)/2)); background: var(--surface-glass); border-bottom: 1px solid color-mix(in srgb,var(--line) 75%,transparent); backdrop-filter: blur(18px); }
.topbar-brand,.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar h1 { font-size: 24px; line-height: 1.15; margin: 2px 0 0; letter-spacing: -.025em; }
.topbar small { display: block; font-size: 11px; }
.icon-btn { border: 1px solid var(--line); width: 42px; height: 42px; border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 21px; box-shadow: var(--shadow-sm); }
.content { max-width: 1180px; margin: auto; padding: 22px 20px; }
.page { display: none; animation: page-in .2s ease; }
.page.active { display: block; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } }

.balance-card { min-height: 210px; border-radius: 18px; padding: 30px; background: linear-gradient(125deg,#0b141d 0%,#0e2927 56%,#087a55 130%); color: #fff; display: flex; flex-direction: column; justify-content: flex-end; box-shadow: 0 22px 55px rgba(7,30,42,.25); position: relative; overflow: hidden; isolation: isolate; border: 1px solid rgba(123,255,197,.16); }
.balance-card:after { content: '₸'; position: absolute; right: 24px; top: -54px; font-size: 215px; color: rgba(255,255,255,.055); font-weight: 900; z-index: -1; }
.balance-glow { position: absolute; width: 260px; height: 260px; right: -70px; bottom: -150px; border-radius: 50%; background: rgba(93,255,179,.22); filter: blur(5px); z-index: -1; }
.balance-card small { color: #b9d8ca; text-transform: uppercase; letter-spacing: .1em; font-size: 10px; font-weight: 800; }
.balance-card strong { font-size: clamp(38px,6vw,54px); line-height: 1.08; margin: 10px 0; letter-spacing: -.045em; }
.balance-card span { color: #d4e9df; }
.quick-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin: 16px 0 30px; }
.quick-grid button { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 15px 10px; display: grid; gap: 8px; place-items: center; color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .18s ease,border-color .18s ease; }
.quick-grid button:hover { transform: translateY(-2px); border-color: color-mix(in srgb,var(--accent) 45%,var(--line)); }
.quick-grid b { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-strong); font-size: 21px; }
.quick-grid span { font-size: 13px; font-weight: 700; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 2px 12px; }
.section-head h2,.panel h2 { font-size: 18px; margin: 0; letter-spacing: -.02em; }
.section-head button { border: 0; background: transparent; color: var(--accent-strong); font-weight: 800; padding: 7px; }
.cards-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(205px,1fr)); gap: 12px; }
.account-card { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); padding: 17px 19px 19px; border-radius: 14px; box-shadow: var(--shadow-sm); }
.account-card small { display: block; margin-bottom: 9px; }
.account-card strong { font-size: 22px; letter-spacing: -.025em; }
.empty { padding: 30px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed color-mix(in srgb,var(--muted) 35%,var(--line)); border-radius: 19px; }

.operation-list { display: grid; gap: 9px; }
.operation-item { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 14px; display: grid; grid-template-columns: 48px 1fr auto; gap: 13px; align-items: center; text-align: left; color: inherit; box-shadow: var(--shadow-sm); transition: transform .15s ease,border-color .15s ease; }
.operation-item:hover { transform: translateX(2px); border-color: color-mix(in srgb,var(--accent) 35%,var(--line)); }
.operation-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; font-weight: 850; background: var(--accent-soft); color: var(--accent-strong); }
.operation-item.expense .operation-icon { background: var(--red-soft); color: var(--red); }
.operation-item.transfer .operation-icon { background: color-mix(in srgb,var(--gold) 20%,var(--surface)); color: color-mix(in srgb,var(--gold) 75%,var(--ink)); }
.operation-main { min-width: 0; }
.operation-main b,.operation-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operation-main span,.operation-side small { font-size: 12px; color: var(--muted); }
.operation-side { text-align: right; }
.operation-side b { display: block; }
.operation-item.expense .operation-side b { color: var(--red); }
.operation-item.income .operation-side b { color: var(--accent-strong); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.operation-kind { margin: 0; }
.amount-label input { font-size: 36px; font-weight: 850; padding: 19px; letter-spacing: -.04em; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.hint { line-height: 1.55; }
.directory-grid { display: grid; gap: 16px; }
.inline-form { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin: 17px 0; }
.inline-form button,.report-filters button { border: 0; border-radius: 13px; background: var(--ink); color: var(--surface); padding: 0 17px; font-weight: 800; }
:root[data-theme="dark"] .inline-form button,:root[data-theme="dark"] .report-filters button { background: var(--accent); color: #07130e; }
.simple-list { display: grid; gap: 4px; }
.simple-list>div { display: flex; justify-content: space-between; padding: 12px 2px; border-top: 1px solid var(--line); }
.directory-row { align-items: center; gap: 12px; }
.directory-main { display: grid; gap: 3px; min-width: 0; }
.directory-main b { overflow: hidden; text-overflow: ellipsis; }
.directory-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.directory-actions button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); color: var(--ink); font-size: 18px; }
.directory-actions button.delete { color: var(--red); }
.directory-name-form { grid-template-columns: 1fr auto; }
.directory-name-form button { min-height: 44px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; margin-right: 9px; }

.report-filters { display: flex; gap: 12px; align-items: end; }
.report-filters label { flex: 1; }
.report-list { display: grid; margin-top: 12px; }
.report-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.report-row>span:last-child { text-align: right; }.report-row small { display: block; margin-top: 3px; }
.analytics-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 16px; }.analytics-heading>div>small { color: var(--accent-strong); font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }.analytics-heading h2 { margin: 3px 0; font-size: 29px; }.analytics-heading p { margin: 0; color: var(--muted); }.analytics-heading>button { border: 1px solid var(--line); border-radius: 13px; padding: 11px 15px; background: var(--surface); color: var(--ink); font-weight: 800; box-shadow: var(--shadow-sm); }
.analytics-filter-panel { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: 15px; }.report-presets { display: flex; gap: 5px; padding: 5px; border-radius: 13px; background: var(--surface-soft); overflow-x: auto; scrollbar-width: none; }.report-presets::-webkit-scrollbar { display: none; }.report-presets button { border: 0; border-radius: 9px; padding: 9px 13px; background: transparent; color: var(--muted); white-space: nowrap; font-size: 12px; font-weight: 800; }.report-presets button.active { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-sm); }
.analytics-kpis { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 15px 0; }.analytics-kpi { position: relative; min-width: 0; padding: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow-sm); }.analytics-kpi::after { content:""; position: absolute; right: -30px; bottom: -36px; width: 90px; height: 90px; border-radius: 50%; background: color-mix(in srgb,var(--accent) 8%,transparent); }.analytics-kpi.expense::after { background: color-mix(in srgb,var(--red) 9%,transparent); }.analytics-kpi .kpi-icon { display: grid; place-items: center; width: 29px; height: 29px; margin-bottom: 11px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; font-weight: 900; }.analytics-kpi.expense .kpi-icon { background: var(--red-soft); color: var(--red); }.analytics-kpi small,.analytics-kpi strong,.analytics-kpi em { position: relative; z-index: 1; display: block; }.analytics-kpi strong { margin: 5px 0; font-size: clamp(19px,2.1vw,25px); white-space: nowrap; }.analytics-kpi em { min-height: 17px; color: var(--muted); font-size: 10px; font-style: normal; }.analytics-kpi em.positive { color: var(--accent-strong); }.analytics-kpi em.negative,.negative-value { color: var(--red) !important; }.analytics-kpi em.neutral { color: var(--muted); }
.analytics-insights { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 15px; }.analytics-insights article { display: flex; gap: 11px; min-width: 0; padding: 14px; border: 1px solid color-mix(in srgb,var(--gold) 32%,var(--line)); border-radius: 15px; background: linear-gradient(135deg,var(--surface),color-mix(in srgb,var(--gold) 6%,var(--surface))); }.analytics-insights>article>span { flex: 0 0 auto; display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; background: color-mix(in srgb,var(--gold) 16%,var(--surface)); color: var(--gold); font-weight: 900; }.analytics-insights b { display: block; font-size: 12px; }.analytics-insights p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.analytics-chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }.chart-panel { min-width: 0; padding: 19px; }.chart-wide { grid-column: 1/-1; }.chart-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 13px; }.chart-heading h2 { margin: 2px 0 0; font-size: 18px; }.chart-heading>div>small { text-transform: uppercase; letter-spacing: .08em; font-size: 9px; font-weight: 850; }.chart-heading>strong { font-size: 18px; }.chart-legend { display: flex; gap: 14px; color: var(--muted); font-size: 10px; }.chart-legend span::before { content:""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }.chart-legend .income-dot::before { background: var(--accent); }.chart-legend .expense-dot::before { background: var(--red); }
.chart-canvas { min-height: 280px; }.chart-canvas.compact-chart { min-height: 200px; }.chart-canvas svg { display: block; width: 100%; height: auto; overflow: visible; }.chart-grid line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }.chart-grid text,.axis-label,.chart-canvas svg text { fill: var(--muted); font-size: 9px; }.income-area { fill: color-mix(in srgb,var(--accent) 12%,transparent); }.expense-area { fill: color-mix(in srgb,var(--red) 8%,transparent); }.income-line,.expense-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }.income-line { stroke: var(--accent); }.expense-line { stroke: var(--red); }.income-point { fill: var(--accent); }.expense-point { fill: var(--red); }.zero-line { stroke: var(--line); stroke-width: 1.5; }.positive-bar { fill: var(--accent); }.negative-bar { fill: var(--red) !important; }.chart-empty { min-height: 180px; display: grid; place-items: center; align-content: center; gap: 5px; color: var(--muted); text-align: center; }.chart-empty span { font-size: 35px; color: var(--line); }.chart-empty p { margin: 0; font-size: 12px; }
.donut-layout { display: grid; grid-template-columns: minmax(170px,.8fr) 1.2fr; gap: 18px; align-items: center; min-height: 260px; }.donut-chart { display: grid; place-items: center; }.donut-ring { width: min(210px,100%); aspect-ratio: 1; padding: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--line) 60%,transparent); }.donut-ring>div { width: 100%; height: 100%; display: grid; place-items: center; align-content: center; border-radius: 50%; background: var(--surface); text-align: center; box-shadow: 0 0 0 1px var(--line),var(--shadow-sm); }.donut-ring strong { font-size: 15px; }.donut-ring small { font-size: 9px; }.donut-legend { display: grid; gap: 9px; }.donut-legend>div { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; font-size: 11px; }.donut-legend i { width: 9px; height: 9px; border-radius: 3px; }.donut-legend span small { display: block; margin-top: 2px; }.donut-legend b { font-size: 11px; }
.horizontal-chart { display: grid; gap: 13px; min-height: 260px; align-content: start; }.hbar-row { display: grid; gap: 5px; }.hbar-row>div:first-child { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }.hbar-row>div:first-child span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.hbar-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--bg-soft); }.hbar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--accent-strong),var(--accent)); }.hbar-row small { font-size: 9px; }.detailed-list { max-height: 390px; overflow: auto; padding-right: 3px; }.detailed-list .report-row:first-child { border-top: 0; }
.advanced-report { margin-top: 15px; }.advanced-report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }.advanced-report-grid h3 { margin: 0 0 14px; font-size: 14px; }.plan-fact-chart { display: grid; gap: 12px; }.plan-fact-chart>div { display: grid; gap: 5px; }.plan-fact-chart span { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }.plan-fact-chart span b { color: var(--ink); }.plan-fact-chart i { height: 10px; overflow: hidden; border-radius: 999px; background: var(--bg-soft); }.plan-fact-chart em { display: block; height: 100%; border-radius: inherit; background: var(--gold); }.plan-fact-chart em.paid { background: var(--accent); }.plan-fact-chart em.overdue { background: var(--red); }.obligation-report-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }.obligation-report-metrics>div { padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }.obligation-report-metrics small,.obligation-report-metrics b { display: block; }.obligation-report-metrics b { margin-top: 5px; font-size: 14px; }.obligation-report-metrics .danger b { color: var(--red); }.analytics-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 15px; }
.profile { display: flex; align-items: center; gap: 15px; }
.avatar { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(145deg,var(--accent-strong),var(--accent)); color: #fff; font-size: 23px; font-weight: 850; }
.profile h2 { margin-bottom: 4px; }
.menu-list { display: grid; padding: 5px 19px; margin-top: 16px; }
.menu-list button { display: flex; justify-content: space-between; padding: 18px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.menu-list button:last-child { border: 0; }
.danger { color: var(--red) !important; }
.version { text-align: center; color: var(--muted); font-size: 12px; }

.bottom-nav { position: fixed; z-index: 20; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; width: min(640px,calc(100% - 24px)); padding: 8px; border: 1px solid color-mix(in srgb,var(--line) 85%,transparent); border-radius: 18px; background: var(--surface-glass); box-shadow: 0 18px 48px rgba(4,14,22,.22); backdrop-filter: blur(20px); }
.bottom-nav button { flex: 1; display: grid; place-items: center; gap: 2px; border: 0; background: transparent; color: var(--muted); padding: 6px 2px; border-radius: 15px; }
.bottom-nav b { font-size: 21px; line-height: 1; }
.bottom-nav span { font-size: 10px; font-weight: 750; }
.bottom-nav button.active { color: var(--accent-strong); background: var(--accent-soft); }
.bottom-nav .add-nav { background: transparent; }
.bottom-nav .add-nav b { background: linear-gradient(145deg,var(--accent-strong),var(--accent)); color: #fff; width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 10px 22px color-mix(in srgb,var(--accent) 30%,transparent); }
dialog { border: 1px solid var(--line); border-radius: 24px; padding: 26px; width: min(540px,calc(100% - 28px)); background: var(--surface); color: var(--ink); box-shadow: 0 28px 90px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(5,12,9,.62); backdrop-filter: blur(4px); }
.dialog-close { position: absolute; right: 13px; top: 12px; border: 1px solid var(--line); background: var(--surface-soft); color: var(--ink); width: 36px; height: 36px; border-radius: 12px; font-size: 20px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.detail-grid div { border-top: 1px solid var(--line); padding-top: 11px; }
.detail-grid small,.detail-grid strong { display: block; }
.toast { position: fixed; z-index: 100; left: 50%; top: 18px; transform: translateX(-50%); max-width: calc(100% - 30px); background: var(--ink); color: var(--surface); padding: 13px 19px; border-radius: 14px; box-shadow: var(--shadow); }

@media (min-width:800px) {
  .balance-card { min-height: 230px; }
  .directory-grid { grid-template-columns: 1fr 1fr; }
  .directory-grid article:nth-child(3) { grid-column: 1/-1; }
}
@media (max-width:1100px) {
  .analytics-kpis { grid-template-columns: repeat(3,1fr); }
  .analytics-insights { grid-template-columns: 1fr 1fr; }
  .analytics-filter-panel { display: grid; }
}
@media (max-width:800px) {
  .analytics-chart-grid,.analytics-tables,.advanced-report-grid { grid-template-columns: 1fr; }
  .chart-wide { grid-column: auto; }
}
@media (max-width:640px) {
  .auth-shell { padding: 18px; }
  .auth-card { padding: 28px 20px; border-radius: 25px; }
  .auth-theme-toggle { right: 14px; top: 14px; }
  .theme-label { display: none; }
  .theme-toggle { width: 42px; padding: 0; }
  .content { padding: 14px 12px; }
  .topbar { padding: 12px 14px; }
  .topbar h1 { font-size: 21px; }
  .mini-brand { width: 38px; height: 38px; border-radius: 12px; }
  .balance-card { min-height: 185px; padding: 24px; border-radius: 24px; }
  .quick-grid { gap: 7px; }
  .quick-grid button { padding: 12px 4px; }
  .quick-grid span { font-size: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .report-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .report-filters button { grid-column: 1/-1; padding: 13px; }
  .analytics-heading { display: grid; align-items: stretch; }.analytics-heading h2 { font-size: 24px; }.analytics-heading>button { width: 100%; }
  .analytics-filter-panel { padding: 11px; }.report-presets { width: 100%; }
  .analytics-kpis { grid-template-columns: 1fr 1fr; }.analytics-kpi { padding: 14px; }.analytics-kpi strong { font-size: 17px; }
  .analytics-insights { grid-template-columns: 1fr; }
  .chart-panel { padding: 15px 13px; }.chart-canvas { min-height: 190px; overflow: visible; }.chart-canvas svg,.chart-canvas.compact-chart svg { min-width: 0; }.chart-canvas svg text { font-size: 17px; }
  .donut-layout { grid-template-columns: 1fr; }.donut-ring { max-width: 180px; }.horizontal-chart { min-height: auto; }
  .obligation-report-metrics { grid-template-columns: 1fr 1fr; }.analytics-tables .panel { padding: 15px 13px; }
  .inline-form { grid-template-columns: 1fr auto; }
  .inline-form select { grid-column: 1/2; }
  .inline-form button { grid-column: 2; grid-row: 1/3; }
  .directory-name-form button { grid-row: 1; }
  .operation-item { grid-template-columns: 42px 1fr auto; padding: 12px 10px; }
  .operation-icon { width: 40px; height: 40px; }
  .operation-side b { font-size: 13px; }
  .bottom-nav { bottom: 10px; }
}
.advanced-home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: -10px 0 26px; }
.advanced-home-grid button { min-width: 0; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; border: 1px solid color-mix(in srgb,var(--accent) 35%,var(--line)); border-radius: 14px; background: linear-gradient(110deg,var(--surface),var(--accent-soft)); color: var(--ink); box-shadow: var(--shadow-sm); }
.advanced-home-grid span { display: grid; gap: 2px; }.advanced-home-grid small { text-transform: uppercase; letter-spacing: .08em; font-size: 9px; }.advanced-home-grid strong { color: var(--accent-strong); white-space: nowrap; }
.advanced-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }.advanced-heading h2 { margin: 3px 0 4px; font-size: 28px; }.advanced-heading p { margin: 0; color: var(--muted); }.advanced-heading>div>small { color: var(--accent-strong); font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.obligation-summary,.obligation-metrics { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }.obligation-summary article,.obligation-metrics article { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }.obligation-summary strong,.obligation-metrics strong { display: block; margin-top: 7px; font-size: 19px; }.summary-danger strong { color: var(--red); }
.section-head.compact { margin: 0; }.obligation-list { display: grid; gap: 10px; margin-top: 18px; }.obligation-card { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; padding: 17px 18px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 14px; background: var(--surface); color: var(--ink); text-align: left; box-shadow: var(--shadow-sm); }.obligation-card.overdue { border-left-color: var(--red); }.obligation-card-main,.obligation-card-side { display: grid; gap: 4px; }.obligation-card-main b { font-size: 17px; }.obligation-card-main span { color: var(--muted); font-size: 12px; }.obligation-card-side { justify-items: end; }.obligation-card-side strong { font-size: 20px; }.obligation-card-side em { color: var(--muted); font-size: 11px; font-style: normal; }
.status-pill { display: inline-flex; width: max-content; padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 10px; font-weight: 800; }.status-pill.overdue { background: var(--red-soft); color: var(--red); }.status-pill.partial { background: color-mix(in srgb,var(--gold) 20%,var(--surface)); color: var(--gold); }.status-pill.cancelled,.status-pill.moved { background: var(--bg-soft); color: var(--muted); }
.advanced-dialog { width: min(1120px,calc(100% - 24px)); max-height: calc(100vh - 24px); overflow: auto; }.obligation-detail-head { padding-right: 40px; }.obligation-detail-head h2 { margin: 3px 0; font-size: 27px; }.obligation-detail-head p { margin: 0 0 17px; color: var(--muted); }.obligation-metrics { grid-template-columns: repeat(6,minmax(0,1fr)); }.advanced-dialog h3 { margin: 20px 0 10px; font-size: 16px; }.schedule-table { display: grid; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }.schedule-table>div { display: grid; grid-template-columns: 110px 1.25fr 1fr 1fr 120px; gap: 10px; align-items: center; padding: 11px 13px; border-top: 1px solid var(--line); }.schedule-table .schedule-head { border: 0; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }.schedule-table span { display: grid; }.schedule-table small { font-size: 10px; }.advanced-history { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }.fact-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); }.fact-row span { display: grid; gap: 2px; text-align: right; }.fact-row span:first-child { text-align: left; }.compact-empty { padding: 15px; }.advanced-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }.advanced-form { margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }.advanced-form:last-child { grid-column: 1/-1; }.advanced-form h3 { margin: 0; }
.advanced-tabs { display: flex; width: max-content; max-width: 100%; gap: 5px; margin-bottom: 20px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); overflow-x: auto; scrollbar-width: none; }.advanced-tabs::-webkit-scrollbar { display: none; }.advanced-tabs button { border: 0; border-radius: 9px; padding: 9px 14px; background: transparent; color: var(--muted); white-space: nowrap; font-weight: 750; }.advanced-tabs button.active { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-sm); }
.recurring-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }.recurring-summary article { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }.recurring-summary strong { display: block; margin-top: 7px; font-size: 19px; }
.recurring-layout { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(280px,.75fr); gap: 22px; margin-top: 22px; }.recurring-periods,.recurring-series { display: grid; gap: 10px; }.recurring-period,.recurring-template { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }.recurring-period.overdue { border-left-color: var(--red); }.recurring-period.paid { border-left-color: var(--accent); opacity: .78; }.recurring-period.skipped { border-left-color: var(--muted); opacity: .68; }.recurring-period-main,.recurring-period-side,.recurring-template>div { display: grid; gap: 4px; }.recurring-period-main b,.recurring-template b { font-size: 16px; }.recurring-period-main span,.recurring-template span { color: var(--muted); font-size: 12px; }.recurring-period-side { justify-items: end; }.recurring-period-side strong { font-size: 19px; }.period-actions { display: flex; gap: 6px; margin-top: 5px; }.period-actions button { width: auto; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; background: var(--surface-soft); color: var(--ink); font-size: 11px; font-weight: 750; }.period-actions button.primary { border-color: transparent; background: var(--accent); color: #fff; }.recurring-template { border-left-width: 1px; }.recurring-template .directory-actions { align-self: start; }
.status-pill.paid { background: var(--accent-soft); color: var(--accent-strong); }.status-pill.skipped { background: var(--bg-soft); color: var(--muted); }
@media (max-width:850px) { .obligation-summary { grid-template-columns: repeat(2,1fr); }.obligation-summary article:last-child { grid-column: 1/-1; }.obligation-metrics { grid-template-columns: repeat(3,1fr); }.advanced-detail-grid,.advanced-history,.recurring-layout { grid-template-columns: 1fr; }.advanced-form:last-child { grid-column: auto; }.schedule-table { overflow-x: auto; }.schedule-table>div { min-width: 720px; } }
@media (max-width:640px) { .advanced-heading { display: grid; align-items: stretch; }.advanced-heading .primary { width: 100%; }.advanced-heading h2 { font-size: 23px; }.obligation-summary,.recurring-summary { grid-template-columns: 1fr 1fr; }.obligation-card,.recurring-period { grid-template-columns: 1fr; }.obligation-card-side,.recurring-period-side { justify-items: start; }.obligation-metrics { grid-template-columns: 1fr 1fr; }.advanced-dialog { padding: 18px 14px; }.advanced-home-grid { grid-template-columns: 1fr; margin-top: -8px; }.advanced-home-grid button { align-items: start; }.recurring-template { align-items: start; } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
