/* =====================================================================
   Оформление «Стекло» — дизайн-система из скилла ui-ux-pro-max
   (запрос: "personal finance credit card grace period payment reminder tracker").
   Стиль: Glassmorphism · Trust blue #3B82F6 + зелёный для платежей #10B981 · фон Navy.
   Шрифты: Inter + JetBrains Mono (лежат в /static/fonts — без Google Fonts).
   Чек-лист скилла: SVG-иконки, cursor:pointer, hover 150–300 мс, видимый фокус,
   prefers-reduced-motion, контраст ≥ 4.5:1, цели касания ≥ 44 px на мобильных.
   ===================================================================== */
@font-face { font-family: "Inter"; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/inter-cyrillic-wght-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-weight: 100 900; font-display: swap;
  src: url(/static/fonts/inter-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "JetBrains Mono"; font-weight: 100 800; font-display: swap;
  src: url(/static/fonts/jetbrains-mono-cyrillic-wght-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-weight: 100 800; font-display: swap;
  src: url(/static/fonts/jetbrains-mono-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20BD, U+2212; }

:root {
  --bg: #0B1120;
  --glass: rgba(25, 33, 52, .62);
  --glass-solid: #161E30;
  --glass-2: rgba(255, 255, 255, .04);
  --glass-3: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --text: #F1F5F9;
  --muted: #94A3B8;
  --dim: #7C8BA1;
  --primary: #3B82F6;
  --primary-h: #2563EB;
  --primary-2: #60A5FA;
  --primary-bg: rgba(59, 130, 246, .16);
  --cta: #10B981;
  --cta-2: #34D399;
  --cta-bg: rgba(16, 185, 129, .12);
  --bad: #F87171;
  --bad-bg: rgba(248, 113, 113, .13);
  --warn: #FBBF24;
  --warn-bg: rgba(251, 191, 36, .13);
  --mono: "Inter", "Segoe UI", system-ui, sans-serif;
  --r: 16px; --r-sm: 12px;
  --c: var(--primary-2);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); font-feature-settings: "tnum", "cv11";
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40vw 40vw at 8% 0%, rgba(30, 64, 175, .38), transparent 60%),
    radial-gradient(35vw 35vw at 95% 15%, rgba(124, 58, 237, .2), transparent 60%),
    radial-gradient(40vw 30vw at 60% 110%, rgba(16, 185, 129, .1), transparent 60%);
}
a { color: var(--primary-2); text-decoration: none; }
a:hover { color: #93C5FD; }
button { font: inherit; color: inherit; }
h1 { font-size: 26px; line-height: 1.2; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0; font-weight: 650; }
h3 { font-size: 18px; margin: 0; }
b, strong { font-weight: 650; }
[hidden] { display: none !important; }
.mono { font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.bad { color: var(--bad); } .good { color: var(--cta-2); } .warn-t { color: var(--warn); font-weight: 600; }
.ic { flex: none; vertical-align: -3px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.chip-dot { display: inline-block; width: 26px; height: 18px; border-radius: 4px; flex: none; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.chip-dot.sm { width: 18px; height: 12px; border-radius: 3px; }
:is(a, button, summary, select, label.check, .seg label) { cursor: pointer; }
:is(a, button, summary, input, select, textarea):focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.glass {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
}

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow: auto; padding: 22px 16px;
  display: flex; flex-direction: column; gap: 22px;
  border-right: 1px solid var(--line); background: rgba(11, 17, 32, .55);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 0 8px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-logo { flex: none; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--glass-2); color: var(--text); }
.nav a.on { background: var(--primary-bg); color: var(--text); }
.side-h { display: flex; justify-content: space-between; align-items: center; padding: 0 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 600; }
.side-h a { text-transform: none; letter-spacing: 0; font-size: 13px; }
.side-cards { display: grid; gap: 4px; margin-top: 8px; }
.mini { display: grid; gap: 6px; padding: 11px 10px; border-radius: 12px; border: 1px solid transparent; color: var(--text);
  transition: background-color .2s, border-color .2s; }
.mini:hover { background: var(--glass-2); border-color: var(--line); color: var(--text); }
.mini.on { background: var(--glass-2); border-color: var(--line-2); }
.mini-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.mini-name { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.mini-sub b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.bar { height: 4px; border-radius: 99px; background: var(--glass-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--c); }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.side-foot b { color: var(--text); font-family: var(--mono); }

.main { padding: 26px clamp(16px, 2.4vw, 40px) 60px; min-width: 0; max-width: 1760px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.top .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.back:hover { color: var(--text); }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 11px;
  border: 1px solid transparent; background: var(--primary); color: #fff; font-weight: 600; white-space: nowrap;
  transition: background-color .2s, border-color .2s; }
.btn:hover { background: var(--primary-h); color: #fff; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.cta { background: var(--cta); color: #04130D; }
.btn.cta:hover { background: var(--cta-2); color: #04130D; }
.btn.ghost { background: var(--glass-2); border-color: var(--line-2); color: var(--text); }
.btn.ghost:hover { background: var(--glass-3); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.danger-btn { background: #EF4444; color: #fff; }
.btn.danger-btn:hover { background: #DC2626; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; flex: none;
  border: 1px solid transparent; background: transparent; color: var(--muted); transition: background-color .2s, color .2s; }
.icon-btn:hover { background: var(--glass-3); border-color: var(--line); color: var(--text); }
.icon-btn.pay-btn { background: transparent; color: var(--cta-2); border-color: rgba(52, 211, 153, .35); width: 40px; height: 40px; border-radius: 50%; }
.icon-btn.pay-btn:hover { background: rgba(16, 185, 129, .24); }

/* ---------- сетки и панели ---------- */
.grid { display: grid; gap: 18px; }
.row-1 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.row-2 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; margin-top: 18px; }
.stack { display: grid; gap: 18px; align-content: start; }
.panel { padding: 20px 22px; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 14px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--primary-bg); color: var(--primary-2); white-space: nowrap; }
.pill-ok { background: var(--cta-bg); color: var(--cta-2); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-muted { background: var(--glass-3); color: var(--muted); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600;
  background: var(--primary-bg); color: var(--primary-2); }
.card-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px 5px 6px; border-radius: 99px;
  background: var(--glass-2); border: 1px solid var(--line); font-size: 13.5px; font-weight: 500; color: var(--text); }
a.card-chip:hover { border-color: var(--line-2); color: var(--text); }
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-sm); }

/* ---------- ближайший платёж ---------- */
.hero { padding: 26px 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(120deg, rgba(59, 130, 246, .18), transparent 55%); }
.hero.st-soon::after { background: linear-gradient(120deg, rgba(251, 191, 36, .16), transparent 55%); }
.hero.st-overdue::after { background: linear-gradient(120deg, rgba(248, 113, 113, .26), transparent 60%); }
.hero > * { position: relative; z-index: 1; }
.hero.st-overdue .eyebrow { color: var(--bad); }
.hero.st-soon .eyebrow { color: var(--warn); }
.hero-when { font-size: 15px; color: var(--muted); margin: 6px 0 4px; }
.hero-when b { color: var(--text); }
.hero-amt { font-family: var(--mono); font-size: 46px; font-weight: 700; line-height: 1.05; margin: 6px 0 16px; letter-spacing: -.03em; }
.hero-amt small { font-size: 26px; color: var(--muted); font-weight: 600; }
.hero-parts { display: grid; gap: 8px; }
.hero-part { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line); }
.hero-part b { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.hero-part .later { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.hero-ok { font-size: 28px; font-weight: 700; margin: 8px 0 4px; }
.ring { width: 150px; height: 150px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-in { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-in b { font-size: 38px; line-height: 1; display: block; font-family: var(--mono); }
.ring-in span { font-size: 12.5px; color: var(--muted); }

.kpis { display: grid; gap: 12px; }
.kpi { padding: 16px 18px; }
.kpi .v { font-family: var(--mono); font-size: 24px; font-weight: 700; margin: 4px 0 8px; white-space: nowrap; letter-spacing: -.03em; }
.kpi .note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ---------- предупреждения ---------- */
.alerts { display: grid; gap: 8px; margin-top: 18px; }
.alert { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r-sm);
  background: var(--warn-bg); border: 1px solid rgba(251, 191, 36, .3); }
.alert a { color: var(--text); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

/* ---------- шкала льготных периодов ---------- */
.tl { margin-top: 18px; }
.tl-scroll { overflow-x: auto; }
.tl-inner { min-width: 640px; padding-bottom: 24px; }
.tl-head, .tl-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); }
.tl-months { position: relative; height: 44px; }
.tl-months span { position: absolute; white-space: nowrap; }
.tl-mon { top: 0; bottom: 0; padding-left: 7px; border-left: 1px solid var(--line-2); font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tl-mon i { position: absolute; left: 7px; top: 22px; font-style: normal; font-size: 11.5px; font-weight: 500; letter-spacing: 0; color: var(--dim); }
.tl-day { top: 22px; transform: translateX(-50%); font-size: 11.5px; color: var(--dim); font-feature-settings: "tnum"; }
.tl-body { position: relative; }
.tl-row { align-items: center; min-height: 58px; border-top: 1px solid var(--line); }
.tl-name { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; padding-right: 12px; color: var(--text); min-width: 0; }
.tl-name:hover { color: var(--text); }
.tl-name span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.tl-track { position: relative; height: 58px; }
.tl-grid { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line-2); }
.tl-grid.minor { border-left: 1px dashed rgba(255, 255, 255, .06); }
.tl-bar { position: absolute; border-radius: 7px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .18);
  display: flex; align-items: center; background: color-mix(in srgb, var(--c) 28%, transparent); }
.tl-bar i { position: absolute; inset: 0 auto 0 0; background: var(--c); }
.tl-bar em { position: relative; font-style: normal; font-size: 12px; font-weight: 600; padding: 0 8px; white-space: nowrap;
  color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); font-feature-settings: "tnum"; }
.tl-bar.burned { background: var(--bad-bg); border-color: var(--bad); }
.tl-bar.burned i { background: rgba(248, 113, 113, .55); }
.tl-end { position: absolute; top: 10px; width: 2px; height: 38px; background: #fff; border-radius: 2px; }
.tl-end span { position: absolute; left: 6px; top: -2px; font-size: 11.5px; white-space: nowrap; font-weight: 600; }
.tl-min { position: absolute; top: 24px; width: 10px; height: 10px; transform: translateX(-5px) rotate(45deg);
  background: var(--warn); border: 2px solid var(--bg); z-index: 1; }
.tl-op { position: absolute; z-index: 2; width: 12px; height: 10px; margin-left: -6px; background: var(--c); cursor: help;
  clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: 50% 100%; transition: transform .15s; }
.tl-op:hover { transform: scale(1.4); }
.tl-min-d {position: absolute; top: 38px; transform: translateX(-50%); font-size: 11px; color: var(--warn); white-space: nowrap; opacity: .9; }
.tl-free { position: absolute; top: 17px; height: 24px; border-radius: 7px; border: 1px dashed rgba(52, 211, 153, .6);
  background: rgba(16, 185, 129, .1); color: var(--cta-2); font-size: 12px; font-weight: 600;
  display: flex; align-items: center; padding: 0 8px; white-space: nowrap; overflow: hidden; }
.tl-note { position: absolute; top: 19px; left: 8px; font-size: 12.5px; color: var(--muted); }
.tl-today { position: absolute; top: -22px; bottom: 0; width: 2px; background: var(--primary-2); box-shadow: 0 0 12px var(--primary);
  z-index: 2; pointer-events: none; }
.tl-today span { position: absolute; bottom: -22px; left: 0; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700;
  color: #0B1120; background: var(--primary-2); border-radius: 5px; padding: 1px 7px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-min { width: 9px; height: 9px; background: var(--warn); transform: rotate(45deg); display: inline-block; }
.lg-op { width: 12px; height: 10px; display: inline-block; background: #60A5FA; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.lg-end { width: 2px; height: 12px; background: #fff; display: inline-block; }
.lg-bar { width: 18px; height: 10px; border-radius: 3px; display: inline-block; background: linear-gradient(90deg, #60A5FA 50%, rgba(96, 165, 250, .3) 50%); }
.lg-free { width: 18px; height: 10px; border-radius: 3px; display: inline-block; border: 1px dashed var(--cta-2); }

/* ---------- план платежей: спокойные строки, одна главная мысль на строку ---------- */
.month { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 26px 4px 6px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 600; }
.month:first-child { padding-top: 4px; }
.month b { color: var(--dim); font-family: var(--mono); letter-spacing: 0; font-weight: 500; }
.pay { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 88px; gap: 20px; align-items: center;
  padding: 16px 8px; border-top: 1px solid var(--line); border-radius: 0; transition: background-color .2s; }
.month + .pay { border-top-color: transparent; }
.pay:hover { background: rgba(255, 255, 255, .025); }
.pay.st-overdue { background: var(--bad-bg); border-radius: 12px; }
.pay.st-info { opacity: .7; }
.pay-date { text-align: center; line-height: 1; cursor: default; }
.pay-date b { display: block; font-size: 24px; font-weight: 600; font-feature-settings: "tnum"; color: var(--text); }
.pay-date span { display: block; margin-top: 5px; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.pay-t { font-weight: 600; font-size: 15.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pay-s { font-size: 13px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.pay-card { color: color-mix(in srgb, var(--c) 80%, #fff); font-weight: 500; }
.pay-card:hover { color: #fff; }
.pay-amt { text-align: right; white-space: nowrap; font-feature-settings: "tnum"; letter-spacing: -.01em; }
.amt-main { font-size: 18px; font-weight: 600; color: var(--text); }
.amt-kop, .amt-cur { font-size: 14px; color: var(--dim); font-weight: 500; }
.approx { color: var(--primary-2); margin-right: 3px; cursor: help; }
.k-spend .amt-main, .k-annual .amt-main { color: var(--muted); font-weight: 500; }
.pay-act { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.pay-act .from { font-size: 12.5px; color: var(--dim); white-space: nowrap; cursor: help; min-width: 40px; text-align: center; }
.pay .ovr { opacity: 0; width: 32px; height: 32px; }
.pay:hover .ovr, .pay .ovr:focus-visible { opacity: 1; }
@media (hover: none) { .pay .ovr { opacity: .6; } }

/* ---------- где взять ---------- */
.take { display: grid; gap: 10px; }
.take-i { padding: 14px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line); display: grid; gap: 4px; color: var(--text); }
a.take-i:hover { border-color: var(--line-2); color: var(--text); }
.take-i.best { border-color: rgba(52, 211, 153, .45); background: rgba(16, 185, 129, .08); }
.take-i.bad { border-color: rgba(248, 113, 113, .45); background: var(--bad-bg); }
.take-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.take-amt { font-family: var(--mono); font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.take-title { font-weight: 700; font-size: 18px; }
.take-days { font-family: var(--mono); font-weight: 700; color: var(--cta-2); }

/* ---------- страница карты ---------- */
.card-head { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; align-items: stretch; }
.plastic { aspect-ratio: 1.586; border-radius: 18px; padding: 22px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden; border: 1px solid rgba(255, 255, 255, .22); color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 88%, transparent), rgba(30, 64, 175, .92));
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.plastic::before { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -90px; top: -110px; background: rgba(255, 255, 255, .14); }
.plastic > * { position: relative; }
.plastic .bank { font-weight: 700; font-size: 15px; opacity: .92; }
.plastic .nm { font-size: 22px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.plastic .prod { font-size: 13px; opacity: .85; }
.plastic .num { font-family: var(--mono); font-size: 17px; letter-spacing: .12em; opacity: .92; }
.plastic .emv { width: 42px; height: 32px; border-radius: 7px; background: linear-gradient(135deg, #FDE68A, #D4A017); opacity: .85; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stat { padding: 16px 18px; display: grid; gap: 4px; align-content: start; }
.stat .v { font-family: var(--mono); font-size: 22px; font-weight: 700; white-space: nowrap; letter-spacing: -.03em; }
.stat .v.txt { font-family: inherit; letter-spacing: -.01em; }
.stat small { font-size: 12.5px; color: var(--muted); }
.stat.bad-st { border-color: rgba(248, 113, 113, .5); background: var(--bad-bg); }
.gp { padding: 18px 22px; }
.gp-track { position: relative; height: 12px; border-radius: 99px; background: var(--glass-3); margin: 16px 0 8px; }
.gp-track > span { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), #7C3AED); }
.gp-track .now { position: absolute; top: -6px; width: 3px; height: 24px; border-radius: 2px; background: #fff; transform: translateX(-1px); }
.gp-scale { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.gp.burned .gp-track > span { background: var(--bad); }
.list-row { display: flex; gap: 8px 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 11px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.ops { width: 100%; border-collapse: collapse; font-size: 14px; }
.ops th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); font-weight: 600; padding: 0 8px 10px; }
.ops td { padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.ops td.d { font-family: var(--mono); color: var(--muted); white-space: nowrap; width: 1%; }
.ops td.amt { text-align: right; font-family: var(--mono); font-weight: 600; white-space: nowrap; width: 1%; }
.ops td.x { width: 1%; }
.ops .in { color: var(--cta-2); }
.kind { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.kind i { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.kind.k-out i { background: var(--primary-bg); color: var(--primary-2); }
.kind.k-in i { background: var(--cta-bg); color: var(--cta-2); }
.ops .del { opacity: 0; }
.ops tr:hover .del, .ops .del:focus-visible { opacity: 1; }
@media (hover: none) { .ops .del { opacity: .7; } }
.adv-opt { padding: 12px 14px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line); display: grid; gap: 2px; font-size: 14px; }
.adv-opt.first { border-color: rgba(52, 211, 153, .45); background: rgba(16, 185, 129, .08); }
.box-rows { display: grid; gap: 8px; align-content: start; justify-items: start; }
.terms summary { font-weight: 600; }
.terms p { white-space: pre-wrap; margin: 12px 0 0; color: var(--muted); }
.terms ul { margin: 10px 0 0; padding-left: 20px; }

/* ---------- формы ---------- */
input, select, textarea { font: inherit; color: var(--text); background: rgba(8, 13, 26, .7); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 0 12px; height: 42px; width: 100%; outline: none; transition: border-color .2s, box-shadow .2s; }
select option { background: var(--glass-solid); }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input[type=color] { padding: 4px; width: 64px; }
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, .26); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
input::placeholder { color: var(--dim); }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.fld > small { font-size: 12.5px; }
.fld-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.form-page { max-width: 1000px; }
.wide-page { max-width: 1240px; }
.fs { border: 1px solid var(--line); border-radius: var(--r); padding: 18px 22px 20px; margin: 0 0 16px;
  background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.fs legend { float: left; width: 100%; font-weight: 700; font-size: 15px; padding: 0; margin: 0 0 10px; }
.fs legend + * { clear: both; }
.fs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 20px; margin-top: 6px; }
.fs-grid .wide { grid-column: 1 / -1; }
.fs-opt { padding-top: 16px; padding-bottom: 16px; }
.fs-opt summary { cursor: pointer; font-size: 15px; list-style-position: outside; margin-left: 16px; }
.fs-opt summary::marker { color: var(--muted); }
.fs-opt[open] summary { margin-bottom: 10px; }
.form-actions { display: flex; gap: 10px; }
.danger-zone { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-err { color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.fld.need input, .fld.need select { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.need-mark { color: var(--warn); font-weight: 650; }
.presets { margin-bottom: 18px; }

/* ---------- каталог ---------- */
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.bank-tile { display: grid; gap: 4px; padding: 18px 20px; color: var(--text); transition: border-color .2s; }
.bank-tile:hover { border-color: var(--primary); color: var(--text); }
.bank-name { font-size: 17px; font-weight: 650; }
.prod-list { display: grid; gap: 10px; }
.prod { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 20px; color: var(--text); transition: border-color .2s; }
.prod:hover { border-color: var(--primary); color: var(--text); }
.prod-name { font-weight: 650; font-size: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prod-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 380px; }
.prod-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-banner { padding: 18px 22px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 12px; border-left: 3px solid var(--primary); }
.tpl-h { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.tpl-name { font-size: 19px; font-weight: 700; margin: 2px 0; }
.tpl-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-needs { background: var(--warn-bg); border-radius: var(--r-sm); padding: 10px 14px; }
.tpl-needs ul, .tpl-caveats, .tpl-src ul { margin: 6px 0 0; padding-left: 20px; }
.tpl-caveats { color: var(--muted); font-size: 14px; }
.tpl-src summary { color: var(--primary-2); font-size: 14px; }
.tpl-src li { font-size: 13.5px; word-break: break-word; }

/* ---------- диалоги ---------- */
.dlg { border: 1px solid var(--line-2); border-radius: 18px; padding: 0; width: min(480px, calc(100vw - 32px));
  background: var(--glass-solid); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
.dlg::backdrop { background: rgba(2, 6, 23, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dlg form { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.dlg p { margin: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dlg.confirm { width: min(560px, calc(100vw - 32px)); }
.confirm-in { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.confirm-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--r-sm);
  background: var(--glass-2); border: 1px solid var(--line); }
.confirm-amount { font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.confirm-amount.good { color: var(--cta-2); }
.confirm-title { font-weight: 650; }
.confirm-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.confirm-lines li { padding: 8px 12px 8px 34px; border-radius: 8px; position: relative; font-size: 14.5px; }
.confirm-lines li::before { position: absolute; left: 12px; top: 8px; font-weight: 700; }
.lv-info { background: var(--glass-2); } .lv-info::before { content: "•"; color: var(--muted); }
.lv-ok { background: var(--cta-bg); } .lv-ok::before { content: "✓"; color: var(--cta-2); }
.lv-warn { background: var(--warn-bg); } .lv-warn::before { content: "!"; color: var(--warn); }
.lv-bad { background: var(--bad-bg); font-weight: 600; } .lv-bad::before { content: "✕"; color: var(--bad); }

/* ---------- уведомление с отменой ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 18px; border-radius: 14px; max-width: calc(100vw - 32px); transition: opacity .6s;
  background: rgba(22, 30, 48, .92); border: 1px solid rgba(52, 211, 153, .4); box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.toast .ok { color: var(--cta-2); display: inline-flex; }
.toast.fade { opacity: 0; pointer-events: none; }

.onboard { max-width: 520px; margin: 12vh auto; text-align: center; padding: 36px; display: grid; gap: 12px; justify-items: center; }

/* ---------- нижнее меню (телефон) ---------- */
.tabbar, .cards-scroll { display: none; }

/* ---------- адаптив ---------- */
@media (min-width: 1900px) { body { font-size: 16px; } .app { grid-template-columns: 300px minmax(0, 1fr); } }
@media (max-width: 1240px) {
  .row-1, .row-2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-head { grid-template-columns: minmax(0, 1fr); }
  .plastic { max-width: 380px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding: 18px 16px 110px; }
  h1 { font-size: 22px; }
  .top .actions.hide-m { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 20px; gap: 12px; }
  .hero .ring { display: none; }
  .hero-amt { font-size: 34px; }
  .hero-amt small { font-size: 20px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis .kpi:first-child { grid-column: 1 / -1; }
  .kpi .v { font-size: 18px; }
  .kpis .kpi:first-child .v { font-size: 22px; }
  .cards-scroll { display: flex; gap: 10px; overflow-x: auto; margin: 14px -16px 0; padding: 2px 16px 4px; scroll-snap-type: x mandatory; }
  .cards-scroll .mini { flex: 0 0 72%; scroll-snap-align: start; background: var(--glass); border-color: var(--line); }
  .panel { padding: 18px 16px; }
  .tl-head, .tl-row { grid-template-columns: 124px minmax(0, 1fr); }
  .tl-name { position: sticky; left: 0; z-index: 3; background: var(--glass-solid); align-self: stretch; }
  .tl-name small { display: none; }
  .pay { grid-template-columns: 38px minmax(0, 1fr) auto; grid-template-areas: "d t act" "d a act"; gap: 6px 14px; padding: 14px 2px; }
  .pay .pay-date { grid-area: d; } .pay .pay-main { grid-area: t; } .pay .pay-act { grid-area: act; }
  .pay .pay-amt { grid-area: a; text-align: left; }
  .opt { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid .stat:last-child { grid-column: 1 / -1; }
  .stat .v { font-size: 18px; }
  .ops-sec { order: 2; }
  .fld-row { grid-template-columns: 1fr; }
  .icon-btn { width: 44px; height: 44px; }
  .btn { height: 44px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(11, 17, 32, .85);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 3px; font-size: 11px; color: var(--muted); min-height: 48px;
    align-content: center; background: none; border: 0; padding: 0; }
  .tabbar .on { color: var(--text); }
  .tabbar .fab { width: 52px; height: 52px; border-radius: 16px; background: var(--primary); color: #fff; display: grid; place-items: center;
    margin: -22px auto 0; box-shadow: 0 8px 24px rgba(59, 130, 246, .5); }
  .toast { bottom: 88px; flex-wrap: wrap; font-size: 14px; }
}
.tl-body { --tl-name: 180px; }
@media (max-width: 900px) { .tl-body { --tl-name: 124px; } }
.mini-st { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.mini-st:empty { display: none; }
.mini-chk { font-size: 12px; font-weight: 500; }
.mini-prod { margin-top: -4px; }
.stack, .row-1 > *, .row-2 > * { min-width: 0; }
@media (max-width: 900px) {
  .m-hide { display: none; }
  .ops thead { display: none; }
  .ops td { padding: 9px 4px; }
  .ops .kind i { display: none; }
  .ops td.d { font-size: 12.5px; }
}

/* =====================================================================
   Разгрузка (29.09): иерархия, группы, меньше повторов
   ===================================================================== */
.main { max-width: 2400px; }
.top { margin-bottom: 20px; }
.panel-lead { margin: -8px 0 14px; }

/* ближайший платёж — один блок, без кольца */
.hero { display: block; padding: 24px 26px; }
.hero-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-amt { font-size: 40px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 0; line-height: 1.1; }
.hero-when { text-align: right; display: grid; gap: 2px; margin: 0; }
.hero-when b { font-size: 22px; font-weight: 650; color: var(--text); }
.hero-when span { color: var(--muted); font-size: 14px; }
.hero-parts { display: grid; gap: 0; border-top: 1px solid var(--line); }
.hero-part { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 150px; align-items: center; gap: 14px;
  padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
.hero-part:last-child { border-bottom: 0; padding-bottom: 0; }
.hp-what { min-width: 0; }
.hp-what b { font-weight: 600; }
.hp-amt { font-weight: 650; font-size: 17px; white-space: nowrap; }
.hero-part .btn, .hero-part .later { justify-self: end; }
.hero-part .later { font-size: 13px; color: var(--dim); }

/* итоги — одной строкой, без карточек */
.totals { display: grid; grid-template-columns: auto auto minmax(220px, 1fr); gap: 12px 40px; align-items: end;
  padding: 18px 4px 4px; }
.tot { display: grid; gap: 2px; }
.tot > span { font-size: 12.5px; color: var(--muted); }
.tot > b { font-size: 20px; font-weight: 650; white-space: nowrap; }
.tot-bar { gap: 8px; align-self: center; }

/* шкала — чуть тише */
.tl { margin-top: 22px; }
.tl-row { min-height: 52px; }
.tl-track { height: 52px; }

/* план: каждый месяц — отдельная группа */
.plan { display: grid; gap: 14px; }
.m-group { border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .02); overflow: hidden; }
.m-group .month { padding: 12px 16px; margin: 0; background: rgba(255, 255, 255, .035); border-bottom: 1px solid var(--line);
  font-size: 13px; letter-spacing: .02em; text-transform: none; color: var(--text); font-weight: 650; }
.m-group .month:first-child { padding-top: 12px; }
.m-group .month span::first-letter { text-transform: uppercase; }
.m-group .month b { color: var(--muted); font-weight: 600; font-size: 13px; }
.m-group .pay { padding: 14px 16px; border-top: 1px solid var(--line); }
.m-group .month + .pay { border-top: 0; }

/* где взять — простые строки */
.take { gap: 0; }
.take-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 4px;
  border-top: 1px solid var(--line); color: var(--text); }
.take-row:first-child { border-top: 0; padding-top: 0; }
.take-row:hover { color: var(--text); }
.take-row:hover .take-name { color: #fff; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.take-name { font-weight: 600; }
.take-right { text-align: right; }
.take-amt { font-size: 16px; font-weight: 650; font-family: inherit; }
.take-days { font-size: 12.5px; color: var(--cta-2); font-weight: 600; font-family: inherit; }

/* боковая панель */
.mini { gap: 7px; padding: 10px; }
.mini-sub { font-size: 13px; }
.mini-sub b { font-family: inherit; }
.mini-alert { font-size: 12px; color: var(--bad); font-weight: 600; }
.side-note { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--dim); cursor: help; }
.side-user { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 4px 0 10px; border-top: 1px solid var(--line); }
.side-note + .side-user { margin-top: 12px; }
.side-login { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }

/* страница карты */
.title-row { display: flex; align-items: center; gap: 14px; }
.chip-dot.lg { width: 44px; height: 30px; border-radius: 7px; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 45%, #1E3A8A)); }
.summary { display: grid; grid-template-columns: 1fr 1fr 1.5fr; }
.sm-cell { padding: 18px 22px; display: grid; gap: 4px; align-content: start; border-left: 1px solid var(--line); min-width: 0; }
.sm-cell:first-child { border-left: 0; }
.sm-v { font-size: 22px; font-weight: 700; white-space: nowrap; letter-spacing: -.01em; }
.sm-left { font-size: 15px; font-weight: 500; }
.sm-cell small { font-size: 12.5px; color: var(--muted); }
.sm-grace .gp-track { margin: 8px 0 4px; height: 6px; }
.more { position: relative; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; padding: 6px; display: grid;
  background: var(--glass-solid); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.more-menu a, .more-menu button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--text); background: none; border: 0; text-align: left; font-size: 14px; }
.more-menu a:hover, .more-menu button:hover { background: var(--glass-3); color: var(--text); }
.card-page-grid { margin-top: 18px; }

@media (max-width: 1240px) {
  .hero-part { grid-template-columns: auto minmax(0, 1fr) auto; }
  .hero-part > :last-child { grid-column: 2 / -1; justify-self: start; }
}
@media (max-width: 900px) {
  .hero { padding: 20px 18px; }
  .hero-amt { font-size: 32px; }
  .hero-when { text-align: left; }
  .hero-when b { font-size: 18px; }
  .hero-part > :last-child { grid-column: 1 / -1; justify-self: stretch; }
  .totals { grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px 2px 0; }
  .tot-bar { grid-column: 1 / -1; }
  .tot > b { font-size: 17px; }
  .summary { grid-template-columns: 1fr 1fr; }
  .sm-grace { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .sm-v { font-size: 18px; }
  .m-group .pay { padding: 12px; }
  .more-menu { right: auto; left: 0; }
}
.ops td { padding: 11px 8px; }
.ops td.d { color: var(--dim); }
.ops td.amt { font-weight: 600; }
.nt-d { display: none; }
@media (max-width: 900px) {
  .ops td.d { display: none; }
  .nt-d { display: block; font-size: 12px; color: var(--dim); margin-top: 2px; }
  .ops td.nt { padding-left: 0; }
  .ops td.x { padding-right: 0; }
}

/* ---------- широкие экраны ---------- */
@media (min-width: 1700px) {
  .ov-top { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: stretch; }
  .ov-top .totals { grid-template-columns: 1fr; align-content: center; gap: 22px; padding: 22px 26px;
    border: 1px solid var(--line); border-radius: var(--r); background: var(--glass);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
  .ov-top .tot > b { font-size: 24px; }
  .row-2 { grid-template-columns: minmax(0, 2fr) minmax(360px, 1fr); }
  .plan { grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); align-items: start; }
  .card-page-grid, .row-2 { gap: 22px; }
}
@media (min-width: 2200px) {
  body { font-size: 16.5px; }
  .app { grid-template-columns: 320px minmax(0, 1fr); }
  .hero-amt { font-size: 48px; }
  .row-2 { grid-template-columns: minmax(0, 1.6fr) minmax(420px, 1fr); }
}

/* ---------- вход ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(380px, 100%); padding: 28px; display: grid; gap: 16px; }
.login .brand { padding: 0; margin-bottom: 6px; }
.login-h { font-size: 20px; }
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; width: 100%; }
.acc-block { width: 100%; border-top: 1px solid var(--line); padding-top: 10px; }
.acc-block summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.acc-block[open] summary { margin-bottom: 10px; }
.danger-t { color: var(--bad); }
.tg-code-inline { user-select: all; }
.login-alt { margin: 0; text-align: center; }
.tg-code { font-size: 26px; font-weight: 700; letter-spacing: .06em; padding: 10px 16px; border-radius: 10px;
  background: var(--glass-2); border: 1px dashed var(--line-2); user-select: all; }
code { font-size: .92em; background: var(--glass-3); padding: 1px 6px; border-radius: 5px; }
