/* ==========================================================================
   FIRE Debt Manager — core styles
   Premium fintech UI · dark/light · Inter
   ========================================================================== */

/* ---------- Tokens ---------- */
:root{
  --bg:            #f4f6f9;
  --bg-soft:       #eceff4;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --surface-3:     #eef2f7;
  --border:        #e2e7ee;
  --border-strong: #d3dae4;
  --text:          #0d1420;
  --muted:         #64748b;
  --muted-2:       #94a3b8;

  --accent:        #0aa06e;
  --accent-2:      #0d9488;
  --accent-soft:   rgba(10,160,110,.10);
  --accent-ink:    #ffffff;

  --ok:            #16a34a;
  --warn:          #d97706;
  --danger:        #dc2626;
  --info:          #4f46e5;

  --ok-soft:       rgba(22,163,74,.12);
  --warn-soft:     rgba(217,119,6,.12);
  --danger-soft:   rgba(220,38,38,.10);
  --info-soft:     rgba(79,70,229,.10);

  --shadow-sm: 0 1px 2px rgba(13,20,32,.05);
  --shadow:    0 1px 3px rgba(13,20,32,.06), 0 8px 24px -12px rgba(13,20,32,.14);
  --shadow-lg: 0 24px 60px -20px rgba(13,20,32,.28);

  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 26px;

  --sidebar-w: 264px;
  --gap: 18px;
  --page-pad: 28px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --num: 'Inter', ui-monospace, SFMono-Regular, monospace;
}

[data-theme="dark"]{
  --bg:            #080a0f;
  --bg-soft:       #0b0e14;
  --surface:       #11151d;
  --surface-2:     #161b25;
  --surface-3:     #1c2230;
  --border:        #232a37;
  --border-strong: #303950;
  --text:          #e9eef7;
  --muted:         #8a95a8;
  --muted-2:       #626d81;

  --accent:        #22d39a;
  --accent-2:      #14b8a6;
  --accent-soft:   rgba(34,211,154,.12);
  --accent-ink:    #04150f;

  --ok:            #34d399;
  --warn:          #fbbf24;
  --danger:        #f87171;
  --info:          #818cf8;

  --ok-soft:       rgba(52,211,153,.14);
  --warn-soft:     rgba(251,191,36,.14);
  --danger-soft:   rgba(248,113,113,.13);
  --info-soft:     rgba(129,140,248,.14);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 12px 32px -16px rgba(0,0,0,.8);
  --shadow-lg: 0 32px 80px -24px rgba(0,0,0,.9);
}

/* ---------- Reset ---------- */
*,*::before,*::after{ box-sizing:border-box; }
/* hidden атрибуты әрқашан жеңуі керек — .auth{display:grid}, .empty{display:flex}
   сияқты ережелер браузердің әдепкі [hidden] ережесін басып кетеді */
[hidden]{ display:none !important; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font);
  font-size:14px;
  line-height:1.5;
  color:var(--text);
  background:var(--bg);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  transition:background-color .25s ease, color .25s ease;
}
h1,h2,h3,h4,p,figure,dl,dd{ margin:0; }
ul,ol{ margin:0; padding:0; list-style:none; }
button{ font:inherit; color:inherit; }
a{ color:var(--accent); }
svg{ width:20px; height:20px; display:block; }
table{ border-collapse:collapse; width:100%; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; border-radius:6px; }
::selection{ background:var(--accent-soft); }

/* Scrollbars */
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-track{ background:transparent; }
*::-webkit-scrollbar-thumb{ background:var(--border-strong); border-radius:10px; border:3px solid transparent; background-clip:content-box; }
*::-webkit-scrollbar-thumb:hover{ background:var(--muted-2); background-clip:content-box; border:3px solid transparent; }

/* ---------- Layout ---------- */
.app{ display:flex; min-height:100vh; }

.sidebar{
  width:var(--sidebar-w);
  flex:0 0 var(--sidebar-w);
  background:var(--surface);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh;
  z-index:60;
}
.brand{ display:flex; align-items:center; gap:12px; padding:20px 18px 18px; }
.brand__mark{
  width:38px; height:38px; border-radius:12px; flex:0 0 38px;
  display:grid; place-items:center;
  background:linear-gradient(140deg, var(--accent), var(--accent-2));
  color:var(--accent-ink);
  box-shadow:0 6px 18px -8px var(--accent);
}
.brand__mark svg{ width:22px; height:22px; }
.brand__text{ display:flex; flex-direction:column; line-height:1.15; }
.brand__name{ font-weight:800; letter-spacing:.08em; font-size:15px; }
.brand__sub{ font-size:11px; color:var(--muted); letter-spacing:.04em; }
.brand .sidebar__close{ display:none; margin-left:auto; }

.nav{ padding:6px 12px; display:flex; flex-direction:column; gap:2px; overflow-y:auto; flex:1; }
.nav__item{
  display:flex; align-items:center; gap:12px;
  padding:10px 12px; border-radius:var(--r-sm);
  background:transparent; border:0; width:100%;
  color:var(--muted); font-weight:500; cursor:pointer;
  transition:background .15s, color .15s;
  text-align:left;
}
.nav__item svg{ width:19px; height:19px; flex:0 0 19px; }
.nav__item:hover{ background:var(--surface-2); color:var(--text); }
.nav__item.is-active{ background:var(--accent-soft); color:var(--accent); font-weight:600; }
.nav__badge{
  margin-left:auto; font-size:11px; font-weight:700; padding:1px 7px; border-radius:20px;
  background:var(--danger-soft); color:var(--danger);
}

.sidebar__foot{ padding:12px; border-top:1px solid var(--border); }
.mini-card{ background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r); padding:12px; }
.mini-card__label{ font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.mini-card__value{ font-size:20px; font-weight:800; margin:4px 0 8px; }
.disclaimer-mini{ font-size:10.5px; color:var(--muted-2); text-align:center; margin-top:10px; }

.main{ flex:1; min-width:0; display:flex; flex-direction:column; }

.topbar{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; gap:14px;
  padding:16px var(--page-pad);
  background:color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter:saturate(180%) blur(14px);
  -webkit-backdrop-filter:saturate(180%) blur(14px);
  border-bottom:1px solid var(--border);
}
.topbar .topbar__menu{ display:none; }
.topbar__titles{ min-width:0; }
.topbar__title{ font-size:20px; font-weight:750; letter-spacing:-.01em; }
.topbar__sub{ font-size:12.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topbar__actions{ margin-left:auto; display:flex; align-items:center; gap:10px; }

.views{ padding:var(--page-pad); flex:1; }
.view{ display:flex; flex-direction:column; gap:var(--gap); max-width:1360px; }
.view[hidden]{ display:none; }

.scrim{ position:fixed; inset:0; background:rgba(4,6,10,.6); z-index:55; backdrop-filter:blur(2px); }
.bottom-nav{ display:none; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 16px; border-radius:var(--r-sm);
  border:1px solid transparent; background:var(--surface-3); color:var(--text);
  font-weight:600; font-size:13.5px; cursor:pointer; white-space:nowrap;
  transition:transform .08s, background .15s, border-color .15s, opacity .15s;
}
.btn svg{ width:17px; height:17px; }
.btn:hover{ background:var(--border); }
.btn:active{ transform:translateY(1px); }
.btn--primary{ background:linear-gradient(140deg,var(--accent),var(--accent-2)); color:var(--accent-ink); box-shadow:0 8px 20px -12px var(--accent); }
.btn--primary:hover{ filter:brightness(1.06); background:linear-gradient(140deg,var(--accent),var(--accent-2)); }
.btn--secondary{ background:var(--surface-2); border-color:var(--border); }
.btn--secondary:hover{ background:var(--surface-3); }
.btn--ghost{ background:transparent; border-color:var(--border); color:var(--muted); }
.btn--ghost:hover{ background:var(--surface-2); color:var(--text); }
.btn--danger{ background:var(--danger-soft); color:var(--danger); border-color:transparent; }
.btn--danger:hover{ background:var(--danger); color:#fff; }
.btn--sm{ padding:7px 12px; font-size:12.5px; border-radius:9px; }
.btn--block{ width:100%; }
.btn[disabled]{ opacity:.5; pointer-events:none; }

.icon-btn{
  width:38px; height:38px; display:grid; place-items:center; flex:0 0 38px;
  border-radius:11px; border:1px solid var(--border); background:var(--surface);
  color:var(--muted); cursor:pointer; transition:background .15s, color .15s;
}
.icon-btn:hover{ background:var(--surface-2); color:var(--text); }
.icon-btn--sm{ width:32px; height:32px; flex:0 0 32px; border-radius:9px; }
.icon-btn--sm svg{ width:16px; height:16px; }
.icon-btn--danger:hover{ background:var(--danger-soft); color:var(--danger); border-color:transparent; }

[data-theme="dark"] .icon-sun{ display:block; }
[data-theme="dark"] .icon-moon{ display:none; }
[data-theme="light"] .icon-sun, :root:not([data-theme="dark"]) .icon-sun{ display:none; }
[data-theme="light"] .icon-moon, :root:not([data-theme="dark"]) .icon-moon{ display:block; }

/* ---------- Cards & grid ---------- */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--r-lg);
  padding:20px;
  box-shadow:var(--shadow-sm);
}
.card__head{ display:flex; align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.card__title{ font-size:15px; font-weight:700; letter-spacing:-.01em; }
.card__badge{
  margin-left:auto; font-size:11px; font-weight:600; padding:4px 9px; border-radius:8px;
  background:var(--surface-3); color:var(--muted); white-space:nowrap;
}
.card__actions{ margin-left:auto; display:flex; gap:8px; flex-wrap:wrap; }
.card--highlight{
  background:
    radial-gradient(120% 140% at 100% 0%, var(--accent-soft) 0%, transparent 55%),
    var(--surface);
  border-color:color-mix(in srgb, var(--accent) 26%, var(--border));
}

.grid{ display:grid; gap:var(--gap); }
.grid--2{ grid-template-columns:repeat(2,minmax(0,1fr)); }
.grid--4{ grid-template-columns:repeat(4,minmax(0,1fr)); }
.grid--sidebar{ grid-template-columns:minmax(0,1fr) minmax(0,1.05fr); align-items:start; }
.stack{ display:flex; flex-direction:column; gap:var(--gap); }

/* ---------- KPI ---------- */
.kpi-grid{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:var(--gap); }
.kpi{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg);
  padding:18px 20px; box-shadow:var(--shadow-sm); position:relative; overflow:hidden;
}
.kpi__top{ display:flex; align-items:center; gap:8px; }
.kpi__label{ font-size:12.5px; color:var(--muted); font-weight:500; }
.kpi__chip{ margin-left:auto; font-size:10.5px; color:var(--muted-2); background:var(--surface-3); padding:2px 7px; border-radius:6px; }
.kpi__value{ font-size:26px; font-weight:800; letter-spacing:-.02em; margin:10px 0 6px; font-variant-numeric:tabular-nums; }
.kpi__hint{ font-size:12px; color:var(--muted); }
.kpi--accent{
  background:linear-gradient(145deg, color-mix(in srgb, var(--accent) 88%, #000) 0%, var(--accent-2) 100%);
  border-color:transparent; color:var(--accent-ink);
}
.kpi--accent .kpi__label,.kpi--accent .kpi__hint{ color:color-mix(in srgb, var(--accent-ink) 72%, transparent); }
.kpi--accent .kpi__chip{ background:color-mix(in srgb, var(--accent-ink) 16%, transparent); color:var(--accent-ink); }

/* ---------- Bars ---------- */
.bar{ height:8px; border-radius:20px; background:var(--surface-3); overflow:hidden; margin:8px 0; }
.bar--sm{ height:6px; margin:6px 0 0; }
.bar--lg{ height:12px; }
.bar__fill{
  height:100%; border-radius:20px; width:0;
  background:linear-gradient(90deg,var(--accent),var(--accent-2));
  transition:width .5s cubic-bezier(.4,0,.2,1);
}
.bar__fill--ok{ background:linear-gradient(90deg,var(--ok),var(--accent)); }
.bar__fill--warn{ background:linear-gradient(90deg,var(--warn),#f59e0b); }
.bar__fill--danger{ background:linear-gradient(90deg,var(--danger),#f97316); }
.bar__fill--info{ background:linear-gradient(90deg,var(--info),#8b5cf6); }
.kpi--accent .bar{ background:color-mix(in srgb, var(--accent-ink) 18%, transparent); }
.kpi--accent .bar__fill{ background:var(--accent-ink); }

.progress-block{ margin-top:16px; }
.progress-block__top{ display:flex; justify-content:space-between; align-items:baseline; font-size:12.5px; color:var(--muted); }
.progress-block__top strong{ font-size:16px; color:var(--text); font-variant-numeric:tabular-nums; }
.progress-block__bottom{ font-size:12px; color:var(--muted); }

/* ---------- Health gauge ---------- */
.health{ display:flex; gap:22px; align-items:flex-start; }
.gauge{ position:relative; width:132px; height:132px; flex:0 0 132px; }
.gauge__svg{ width:132px; height:132px; transform:rotate(-90deg); }
.gauge__track{ fill:none; stroke:var(--surface-3); stroke-width:11; }
.gauge__value{
  fill:none; stroke:var(--accent); stroke-width:11; stroke-linecap:round;
  stroke-dasharray:326.7; stroke-dashoffset:326.7;
  transition:stroke-dashoffset .8s cubic-bezier(.4,0,.2,1), stroke .3s;
}
.gauge__center{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.gauge__num{ font-size:32px; font-weight:800; letter-spacing:-.03em; line-height:1; font-variant-numeric:tabular-nums; }
.gauge__den{ font-size:11px; color:var(--muted); margin-top:2px; }
.health__body{ flex:1; min-width:0; }
.health__text{ font-size:13px; color:var(--muted); margin-bottom:12px; }

.factors{ display:flex; flex-direction:column; gap:7px; }
.factor{ display:flex; align-items:center; gap:10px; font-size:12.5px; }
.factor__name{ color:var(--muted); flex:0 0 auto; min-width:130px; }
.factor__bar{ flex:1; height:6px; background:var(--surface-3); border-radius:20px; overflow:hidden; }
.factor__fill{ height:100%; border-radius:20px; background:var(--accent); transition:width .6s; }
.factor__val{ font-variant-numeric:tabular-nums; font-weight:600; min-width:52px; text-align:right; font-size:12px; }
.factor--bad .factor__fill{ background:var(--danger); }
.factor--warn .factor__fill{ background:var(--warn); }
.factor--good .factor__fill{ background:var(--ok); }

/* ---------- Next step / today ---------- */
.next{ display:flex; flex-direction:column; gap:14px; }
.next__name{ font-size:22px; font-weight:800; letter-spacing:-.02em; }
.next__why{ font-size:13px; color:var(--muted); }
.next__stats{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.next__stat{ background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r); padding:12px; }
.next__stat span{ display:block; font-size:11.5px; color:var(--muted); margin-bottom:4px; }
.next__stat strong{ font-size:16px; font-weight:750; font-variant-numeric:tabular-nums; letter-spacing:-.01em; }
.next__stat strong.pos{ color:var(--ok); }

.steps{ display:flex; flex-direction:column; gap:10px; margin-top:14px; }
.step-item{ display:flex; gap:12px; align-items:flex-start; padding:12px 14px; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r); }
.step-item__num{
  width:24px; height:24px; flex:0 0 24px; border-radius:8px; display:grid; place-items:center;
  background:var(--accent-soft); color:var(--accent); font-weight:700; font-size:12px;
}
.step-item__text{ font-size:13px; }
.step-item__text b{ display:block; margin-bottom:2px; font-weight:650; }
.step-item__text span{ color:var(--muted); font-size:12.5px; }
.callout{ padding:14px 16px; border-radius:var(--r); font-size:13.5px; line-height:1.55; border:1px solid transparent; }
.callout--warn{ background:var(--warn-soft); color:var(--warn); border-color:color-mix(in srgb, var(--warn) 25%, transparent); }
.callout--danger{ background:var(--danger-soft); color:var(--danger); border-color:color-mix(in srgb, var(--danger) 25%, transparent); }
.callout--ok{ background:var(--ok-soft); color:var(--ok); border-color:color-mix(in srgb, var(--ok) 25%, transparent); }
.callout--info{ background:var(--info-soft); color:var(--info); border-color:color-mix(in srgb, var(--info) 25%, transparent); }
.callout b{ font-weight:700; }

/* ---------- Mini stats ---------- */
.grid--mini .mini,.mini{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--r);
  padding:14px 16px; display:flex; flex-direction:column; gap:2px;
}
.mini__label{ font-size:11.5px; color:var(--muted); }
.mini__value{ font-size:19px; font-weight:750; letter-spacing:-.01em; font-variant-numeric:tabular-nums; }
.mini__hint{ font-size:11.5px; color:var(--muted-2); }
.mini__value.pos{ color:var(--ok); } .mini__value.neg{ color:var(--danger); }

/* ---------- Charts ---------- */
.chart-box{ position:relative; height:260px; }
.chart-box--wide{ height:300px; }
.chart-fallback{
  position:absolute; inset:0; display:grid; place-items:center; text-align:center;
  color:var(--muted); font-size:13px; padding:20px;
}

/* ---------- Toolbar / segmented ---------- */
.toolbar{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.toolbar__left{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.seg{ display:inline-flex; background:var(--surface-2); border:1px solid var(--border); border-radius:11px; padding:3px; }
.seg__btn{
  border:0; background:transparent; color:var(--muted); cursor:pointer;
  padding:7px 14px; border-radius:8px; font-size:13px; font-weight:600; transition:all .15s;
}
.seg__btn.is-active{ background:var(--surface); color:var(--text); box-shadow:var(--shadow-sm); }
.seg-hint{ font-size:12.5px; color:var(--muted); }
.toolbar .btn--primary{ margin-left:auto; }

/* ---------- Credit cards ---------- */
.banks{ display:flex; flex-direction:column; gap:22px; }
.bank__head{ display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.bank__logo{
  width:34px; height:34px; border-radius:10px; display:grid; place-items:center;
  font-weight:800; font-size:13px; color:#fff; flex:0 0 34px; letter-spacing:-.02em;
}
.bank__name{ font-size:16px; font-weight:700; }
.bank__meta{ font-size:12px; color:var(--muted); }
.bank__total{ margin-left:auto; text-align:right; }
.bank__total strong{ display:block; font-size:15px; font-variant-numeric:tabular-nums; }
.bank__total span{ font-size:11.5px; color:var(--muted); }
.bank__grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:var(--gap); }

.credit{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--r-lg);
  padding:18px; display:flex; flex-direction:column; gap:14px; box-shadow:var(--shadow-sm);
  transition:border-color .2s, transform .12s, box-shadow .2s;
}
.credit:hover{ border-color:var(--border-strong); box-shadow:var(--shadow); }
.credit--high{ border-left:3px solid var(--danger); }
.credit--medium{ border-left:3px solid var(--warn); }
.credit--low{ border-left:3px solid var(--ok); }
.credit__head{ display:flex; align-items:flex-start; gap:10px; }
.credit__title{ font-size:15px; font-weight:700; letter-spacing:-.01em; }
.credit__type{ font-size:11.5px; color:var(--muted); margin-top:2px; display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.credit__actions{ margin-left:auto; display:flex; gap:6px; }
.prio{ display:inline-flex; align-items:center; gap:5px; font-size:11px; font-weight:700; padding:3px 8px; border-radius:7px; letter-spacing:.02em; }
.prio--high{ background:var(--danger-soft); color:var(--danger); }
.prio--medium{ background:var(--warn-soft); color:var(--warn); }
.prio--low{ background:var(--ok-soft); color:var(--ok); }
.tag{ font-size:11px; padding:2px 7px; border-radius:6px; background:var(--surface-3); color:var(--muted); }
.tag--diff{ background:var(--info-soft); color:var(--info); }
.tag--rank{ background:var(--accent-soft); color:var(--accent); font-weight:700; }

.credit__rows{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px 14px; }
.crow{ display:flex; flex-direction:column; gap:2px; }
.crow__label{ font-size:11.5px; color:var(--muted); }
.crow__value{ font-size:14.5px; font-weight:650; font-variant-numeric:tabular-nums; letter-spacing:-.01em; }
.crow__value--save{ color:var(--ok); }
.crow__value--warn{ color:var(--warn); }

.credit__progress{ display:flex; flex-direction:column; gap:4px; }
.credit__progress-top{ display:flex; justify-content:space-between; font-size:11.5px; color:var(--muted); }
.credit__note{ font-size:12px; color:var(--muted); background:var(--surface-2); padding:8px 10px; border-radius:9px; border:1px solid var(--border); }
.credit__alert{ font-size:12px; color:var(--warn); display:flex; gap:6px; align-items:flex-start; }

/* ---------- Tables ---------- */
.table-wrap{ overflow-x:auto; margin:0 -4px; padding:0 4px; }
.table th,.table td{ padding:10px 12px; text-align:left; border-bottom:1px solid var(--border); font-size:13px; }
.table th{ font-size:11.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); font-weight:600; white-space:nowrap; }
.table td.num,.table th.num{ text-align:right; font-variant-numeric:tabular-nums; }
.table tbody tr:hover{ background:var(--surface-2); }
.table tfoot td{ font-weight:700; border-top:2px solid var(--border); border-bottom:0; }
.table .cell-input{
  width:120px; text-align:right; padding:6px 9px; border-radius:8px;
  border:1px solid transparent; background:var(--surface-2); color:var(--text);
  font-variant-numeric:tabular-nums; font-family:inherit; font-size:13px;
}
.table .cell-input:hover{ border-color:var(--border); }
.table .cell-input:focus{ border-color:var(--accent); background:var(--surface); outline:none; }
.cat-dot{ width:9px; height:9px; border-radius:3px; display:inline-block; margin-right:9px; vertical-align:middle; }
.delta.pos{ color:var(--ok); } .delta.neg{ color:var(--danger); }

/* ---------- Forms ---------- */
.field{ margin-bottom:14px; }
.field--inline{ display:flex; align-items:center; gap:14px; margin-bottom:18px; flex-wrap:wrap; }
.field--inline .label{ margin:0; }
.field--inline .input{ max-width:220px; }
.field-row{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.field-row--3{ grid-template-columns:repeat(3,minmax(0,1fr)); }
.label{ display:block; font-size:12.5px; font-weight:550; color:var(--muted); margin-bottom:6px; }
.input{
  width:100%; padding:11px 13px; border-radius:var(--r-sm);
  border:1px solid var(--border); background:var(--surface-2); color:var(--text);
  font-family:inherit; font-size:14px; font-variant-numeric:tabular-nums;
  transition:border-color .15s, background .15s;
  appearance:none;
}
.input::placeholder{ color:var(--muted-2); }
.input:hover{ border-color:var(--border-strong); }
.input:focus{ outline:none; border-color:var(--accent); background:var(--surface); box-shadow:0 0 0 3px var(--accent-soft); }
select.input{
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat:no-repeat; background-position:right 11px center; background-size:16px; padding-right:36px;
}
textarea.input{ resize:vertical; min-height:76px; font-variant-numeric:normal; }
.input.is-invalid{ border-color:var(--danger); box-shadow:0 0 0 3px var(--danger-soft); }
.error{ display:none; font-size:12px; color:var(--danger); margin-top:5px; }
.error.is-shown{ display:block; }
.hint{ display:block; font-size:11.5px; color:var(--muted-2); margin-top:5px; }
.warn-inline{ display:none; font-size:12px; color:var(--warn); margin-top:5px; }
.warn-inline.is-shown{ display:block; }

/* Ай сайынғы тұрақты табыс блогы */
.income-form{ display:flex; flex-wrap:wrap; align-items:flex-end; gap:14px; }
.income-form .field{ flex:1 1 240px; min-width:0; margin:0; }
.income-form__actions{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; padding-bottom:2px; }
.income-status{ font-size:12.5px; color:var(--muted); }
.income-status.is-dirty{ color:var(--warn); font-weight:600; }

/* Дифференцированный кредиттің алдын ала кестесі (формада) */
.diff-preview{
  background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-sm, 8px);
  padding:10px 12px; font-size:12.5px; line-height:1.55; color:var(--text);
  font-variant-numeric:tabular-nums; min-height:42px;
}
.check{ display:flex; gap:10px; align-items:flex-start; font-size:13px; color:var(--muted); cursor:pointer; }
.check input{ width:17px; height:17px; margin:1px 0 0; accent-color:var(--accent); flex:0 0 17px; cursor:pointer; }
.form-actions{ display:flex; gap:10px; margin-top:18px; flex-wrap:wrap; }

/* ---------- Big values ---------- */
.big-value{ font-size:34px; font-weight:800; letter-spacing:-.03em; font-variant-numeric:tabular-nums; }
.big-value--sm{ font-size:26px; }
.big-hint{ font-size:12.5px; color:var(--muted); margin-top:4px; }

/* ---------- Result grid (calculator) ---------- */
.res-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.res{ background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r); padding:14px; }
.res__label{ font-size:11.5px; color:var(--muted); display:block; margin-bottom:4px; }
.res__value{ font-size:19px; font-weight:750; font-variant-numeric:tabular-nums; letter-spacing:-.02em; }
.res--accent{ background:var(--accent-soft); border-color:color-mix(in srgb,var(--accent) 28%, transparent); }
.res--accent .res__value{ color:var(--accent); }
.scenario-table{ margin-top:16px; }

/* ---------- Roadmap ---------- */
.roadmap{ display:flex; flex-direction:column; gap:0; }
.rstep{ display:flex; gap:16px; position:relative; padding-bottom:22px; }
.rstep:last-child{ padding-bottom:0; }
.rstep__rail{ display:flex; flex-direction:column; align-items:center; flex:0 0 40px; }
.rstep__dot{
  width:40px; height:40px; border-radius:13px; display:grid; place-items:center;
  background:var(--surface-2); border:1px solid var(--border); color:var(--muted);
  font-weight:700; font-size:13px; z-index:1;
}
.rstep__line{ width:2px; flex:1; background:var(--border); margin:6px 0 -6px; border-radius:2px; }
.rstep:last-child .rstep__line{ display:none; }
.rstep--done .rstep__dot{ background:var(--accent); border-color:var(--accent); color:var(--accent-ink); }
.rstep--done .rstep__line{ background:var(--accent); }
.rstep--active .rstep__dot{ background:var(--accent-soft); border-color:var(--accent); color:var(--accent); box-shadow:0 0 0 4px var(--accent-soft); }
.rstep__body{ flex:1; min-width:0; padding-top:2px; }
.rstep__head{ display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.rstep__title{ font-size:15px; font-weight:700; }
.rstep__pct{ margin-left:auto; font-weight:750; font-variant-numeric:tabular-nums; }
.rstep__desc{ font-size:12.5px; color:var(--muted); margin:4px 0 8px; }
.rstep__tasks{ display:flex; flex-direction:column; gap:6px; margin-top:10px; }
.rtask{ display:flex; gap:9px; align-items:center; font-size:12.5px; color:var(--muted); }
.rtask__box{
  width:16px; height:16px; flex:0 0 16px; border-radius:5px; border:1.5px solid var(--border-strong);
  display:grid; place-items:center; color:transparent;
}
.rtask--done .rtask__box{ background:var(--accent); border-color:var(--accent); color:var(--accent-ink); }
.rtask--done{ color:var(--text); }
.rtask__box svg{ width:11px; height:11px; }

/* ---------- Goals ---------- */
.goals{ display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:var(--gap); }
.goal{ background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r); padding:16px; }
.goal__head{ display:flex; align-items:flex-start; gap:8px; margin-bottom:10px; }
.goal__title{ font-weight:650; font-size:14px; }
.goal__sub{ font-size:11.5px; color:var(--muted); }
.goal__pct{ margin-left:auto; font-weight:750; font-variant-numeric:tabular-nums; }
.goal__vals{ display:flex; justify-content:space-between; font-size:12px; color:var(--muted); margin-top:6px; font-variant-numeric:tabular-nums; }

/* ---------- Empty states ---------- */
.empty{
  text-align:center; padding:48px 24px; border:1px dashed var(--border-strong);
  border-radius:var(--r-lg); background:var(--surface); display:flex; flex-direction:column;
  align-items:center; gap:8px;
}
.empty--sm{ padding:28px 20px; border-radius:var(--r); }
.empty__icon{ font-size:34px; }
.empty h3{ font-size:16px; font-weight:700; }
.empty p{ font-size:13px; color:var(--muted); max-width:380px; }
.empty .btn{ margin-top:8px; }

/* ---------- Badges & misc ---------- */
.badge{ font-size:11px; font-weight:700; padding:5px 10px; border-radius:8px; letter-spacing:.02em; }
.badge--demo{ background:var(--warn-soft); color:var(--warn); }
.note{ font-size:11.5px; color:var(--muted-2); margin-top:12px; line-height:1.5; }
.legal{ font-size:13px; color:var(--muted); line-height:1.65; margin-bottom:10px; }
.legal:last-child{ margin-bottom:0; }
.legal strong{ color:var(--text); }
.kv{ display:grid; grid-template-columns:auto 1fr; gap:8px 16px; margin-top:18px; font-size:12.5px; }
.kv dt{ color:var(--muted); }
.kv dd{ text-align:right; font-variant-numeric:tabular-nums; font-weight:600; }
.data-actions{ display:flex; flex-direction:column; gap:10px; }
.data-actions .btn{ justify-content:flex-start; }

/* ---------- Modal ---------- */
.modal-backdrop{
  position:fixed; inset:0; z-index:100; background:rgba(4,6,10,.62);
  backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px);
  display:grid; place-items:center; padding:20px;
  animation:fade .18s ease;
}
.modal{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--r-xl);
  width:min(620px,100%); max-height:calc(100vh - 40px); overflow-y:auto;
  box-shadow:var(--shadow-lg); animation:pop .2s cubic-bezier(.2,.9,.3,1.2);
}
.modal--sm{ width:min(430px,100%); }
.modal__head{
  display:flex; align-items:center; gap:12px; padding:20px 22px 14px;
  position:sticky; top:0; background:var(--surface); z-index:2; border-radius:var(--r-xl) var(--r-xl) 0 0;
}
.modal__title{ font-size:17px; font-weight:750; letter-spacing:-.01em; }
.modal__body{ padding:0 22px 20px; }
.modal__foot{
  display:flex; gap:10px; justify-content:flex-end; padding:16px 22px 20px;
  position:sticky; bottom:0; background:var(--surface); border-top:1px solid var(--border);
}
.modal__text{ font-size:14px; color:var(--muted); line-height:1.6; }
.modal__text strong{ color:var(--text); }
@keyframes fade{ from{ opacity:0 } }
@keyframes pop{ from{ opacity:0; transform:translateY(10px) scale(.98) } }

/* Menu sheet (mobile) */
.sheet-list{ display:flex; flex-direction:column; gap:4px; }
.sheet-list .nav__item{ padding:13px 14px; font-size:14.5px; }

/* ---------- Toasts ---------- */
.toasts{ position:fixed; bottom:22px; right:22px; z-index:200; display:flex; flex-direction:column; gap:10px; pointer-events:none; }
.toast{
  background:var(--surface); border:1px solid var(--border); border-left:3px solid var(--accent);
  border-radius:var(--r); padding:12px 16px; box-shadow:var(--shadow-lg);
  font-size:13px; max-width:340px; animation:slide .22s cubic-bezier(.2,.9,.3,1.1);
  pointer-events:auto;
}
.toast--error{ border-left-color:var(--danger); }
.toast--warn{ border-left-color:var(--warn); }
.toast.is-out{ animation:slideOut .2s forwards; }
@keyframes slide{ from{ opacity:0; transform:translateX(20px) } }
@keyframes slideOut{ to{ opacity:0; transform:translateX(20px) } }

/* ---------- Utilities ---------- */
.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
.text-muted{ color:var(--muted); }
.text-ok{ color:var(--ok); } .text-danger{ color:var(--danger); } .text-warn{ color:var(--warn); }
.nowrap{ white-space:nowrap; }

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
