:root {
  --bg:#0a0e13; --panel:#111823; --panel2:#161f2c; --line:#1f2a3a; --ink:#e8edf4; --muted:#8493a8;
  --accent:#2ec4a6; --accent-ink:#052a23; --ok:#3ddc97; --warn:#f5b942; --bad:#ff6b6b;
  --line2:#2d3b50; --chip:#1b2636; --track:#2a3547; --ink2:#b7c3d4; --code:#0b1119; --warn-ink:#f1cf86;
  --toast:#1d2838; --toast-err:#2a1a1f; --toast-new:#0f2a27; --info:#7fb0ff; --glow:rgba(46,196,166,.10);
  --r:16px; --side:264px; color-scheme:dark;
}
:root[data-theme="light"] {
  --bg:#f3f5f9; --panel:#ffffff; --panel2:#f2f5f9; --line:#e0e6ee; --ink:#111a27; --muted:#5b6a7f;
  --accent:#139f84; --accent-ink:#ffffff; --ok:#0f9d63; --warn:#b97c06; --bad:#dc3b3b;
  --line2:#c5cfdc; --chip:#eaeff5; --track:#cfd7e2; --ink2:#334155; --code:#f5f7fa; --warn-ink:#7a5200;
  --toast:#ffffff; --toast-err:#fff1f1; --toast-new:#ecfbf6; --info:#2563eb; --glow:rgba(19,159,132,.08);
  color-scheme:light;
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html, body { margin:0; background:var(--bg); color:var(--ink); }
body { font:15px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif; -webkit-font-smoothing:antialiased;
       background:radial-gradient(900px 420px at 60% -80px, var(--glow), transparent 70%), var(--bg); min-height:100vh; }
a { color:inherit; text-decoration:none; }
button, input, select, textarea { font:inherit; color:inherit; }
.muted { color:var(--muted); } .s { font-size:12.5px; } .g { color:var(--ok); }

/* --- общие элементы --- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:10px 16px; border-radius:12px; border:1px solid var(--line); background:var(--panel2); cursor:pointer; white-space:nowrap; }
.btn:hover { border-color:var(--line2); }
.btn.primary { background:var(--accent); border-color:var(--accent); color:var(--accent-ink); font-weight:600; }
.btn.primary:hover { filter:brightness(1.08); }
.btn.danger { color:var(--bad); border-color:rgba(255,107,107,.35); background:transparent; }
.btn.wide { width:100%; }
.btn:disabled { opacity:.55; cursor:wait; }
.icon-btn { width:38px; height:38px; display:inline-grid; place-items:center; border-radius:11px; border:1px solid var(--line);
            background:var(--panel2); cursor:pointer; padding:0; }
.icon-btn:hover { border-color:var(--line2); }
.icon-btn.ok { color:var(--ok); border-color:rgba(61,220,151,.4); background:rgba(61,220,151,.08); }
.icon-btn.warn { color:var(--warn); border-color:rgba(245,185,66,.35); background:transparent; }
.ic { display:block; }
input, select, textarea { width:100%; padding:11px 13px; background:var(--panel2); border:1px solid var(--line); border-radius:12px; outline:none; }
input:focus, select:focus, textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(46,196,166,.15); }
textarea { resize:vertical; min-height:90px; }
label.f { display:block; font-size:12.5px; color:var(--muted); margin:12px 0 5px; }
.panel { background:var(--panel); border:1px solid var(--line); border-radius:var(--r); padding:18px; margin-bottom:16px; }
.panel h3 { margin:0 0 12px; font-size:15px; }
.empty { text-align:center; color:var(--muted); padding:44px 12px; }
.empty .ic { margin:0 auto 10px; opacity:.5; }
.chip { display:inline-block; padding:2px 10px; border-radius:20px; font-size:12px; background:var(--chip); color:var(--muted); }
.chip.ok { background:rgba(61,220,151,.12); color:var(--ok); } .chip.bad { background:rgba(255,107,107,.12); color:var(--bad); }
.chip.pending { background:rgba(245,185,66,.12); color:var(--warn); } .chip.warn { background:rgba(245,185,66,.16); color:var(--warn); }

.switch { position:relative; width:46px; height:26px; flex:none; display:inline-block; }
.switch input { position:absolute; inset:0; opacity:0; cursor:pointer; z-index:1; width:100%; height:100%; margin:0; }
.switch i { position:absolute; inset:0; border-radius:20px; background:var(--track); transition:.15s; }
.switch i::after { content:""; position:absolute; top:3px; left:3px; width:20px; height:20px; border-radius:50%; background:#fff; transition:.15s; }
.switch input:checked + i { background:var(--accent); } .switch input:checked + i::after { transform:translateX(20px); }

/* --- вход --- */
.login { min-height:100vh; display:grid; place-items:center; padding:20px; }
.login-card { width:100%; max-width:380px; background:var(--panel); border:1px solid var(--line); border-radius:22px; padding:28px; }
.login-card h1 { font-size:22px; margin:18px 0 4px; }
.login-card input { margin:14px 0; }
.err { color:var(--bad); font-size:13.5px; margin:12px 0 0; }

/* --- каркас --- */
.brand { display:flex; align-items:center; gap:10px; font-weight:700; font-size:19px; letter-spacing:.01em; }
.logo { width:26px; height:26px; border-radius:8px; background:linear-gradient(135deg,var(--accent),#3b82f6); display:inline-block; }
.app { display:grid; grid-template-columns:var(--side) 1fr; min-height:100vh; }
.side { position:sticky; top:0; height:100vh; padding:20px 16px; display:flex; flex-direction:column; gap:14px;
        background:var(--panel); border-right:1px solid var(--line); }
.chips-row { display:flex; gap:8px; }
.balchip { flex:1; padding:10px 12px; border-radius:13px; background:var(--panel2); border:1px solid var(--line); font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bell { position:relative; width:44px; display:grid; place-items:center; border-radius:13px; background:var(--panel2); border:1px solid var(--line); }
.badge { position:absolute; top:-6px; right:-6px; min-width:20px; height:20px; padding:0 5px; border-radius:10px; background:var(--accent); color:var(--accent-ink);
         font-size:12px; font-weight:700; display:grid; place-items:center; }
.nav { display:flex; flex-direction:column; gap:4px; margin-top:6px; }
.nav a, .nav .soon { display:flex; align-items:center; gap:12px; padding:11px 12px; border-radius:12px; color:var(--ink2); }
.nav a:hover { background:var(--panel2); }
.nav a.on { background:rgba(46,196,166,.12); color:var(--accent); font-weight:600; }
.nav .soon { opacity:.4; cursor:default; } .nav .soon em { margin-left:auto; font-size:11px; font-style:normal; border:1px solid var(--line); padding:1px 7px; border-radius:10px; }
.nav .nb { margin-left:auto; min-width:22px; height:22px; padding:0 6px; border-radius:11px; background:var(--accent); color:var(--accent-ink); font-size:12px; font-weight:700; display:grid; place-items:center; }
.side-foot { margin-top:auto; display:flex; flex-direction:column; gap:12px; }
.row-sw { display:flex; align-items:center; justify-content:space-between; gap:10px; color:var(--muted); font-size:13px; cursor:pointer; }
.user { display:flex; align-items:center; gap:10px; padding:10px; border-radius:14px; background:var(--panel2); border:1px solid var(--line); }
.avatar { width:34px; height:34px; border-radius:10px; background:rgba(46,196,166,.15); color:var(--accent); display:grid; place-items:center; font-weight:700; }
.uname { flex:1; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.main { padding:22px 28px 60px; min-width:0; max-width:1200px; width:100%; margin:0 auto; }
.topbar { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; min-height:38px; }
.topbar h1 { margin:0; font-size:22px; }
.mtop { display:none; }

/* --- дашборд --- */
.hero { text-align:center; padding:6px 0 20px; }
.hero-name { font-size:20px; font-weight:700; }
.hero-bal { font-size:56px; font-weight:700; letter-spacing:-.02em; line-height:1.15; margin:6px 0 10px; }
.hero-bal .dec { color:var(--muted); } .hero-bal .cur { font-size:26px; color:var(--accent); margin-left:6px; }
.pill { display:inline-block; padding:7px 16px; border-radius:20px; background:var(--panel2); border:1px solid var(--line); color:var(--muted); font-size:14px; }
.pill b { color:var(--ink); }
.quick { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:16px; }
.qbtn { position:relative; display:flex; align-items:center; justify-content:center; gap:10px; padding:16px; border-radius:var(--r);
        background:var(--panel); border:1px solid var(--line); color:var(--accent); font-weight:600; }
.qbtn:hover { border-color:var(--line2); background:var(--panel2); }
.qbtn .qb { min-width:22px; height:22px; padding:0 6px; border-radius:11px; background:var(--accent); color:var(--accent-ink); font-size:12px; display:grid; place-items:center; }
.online { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.online b { display:flex; align-items:center; gap:8px; }
.dot { width:9px; height:9px; border-radius:50%; background:var(--track); display:inline-block; } .dot.on { background:var(--ok); box-shadow:0 0 0 4px rgba(61,220,151,.15); }
.online a { color:var(--accent); text-decoration:underline; }
.filters { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; align-items:end; }
.filters label { font-size:12px; color:var(--muted); display:block; margin-bottom:4px; }
.filters input { width:170px; }
.bars { display:flex; align-items:flex-end; gap:5px; height:190px; padding-top:8px; }
.bar-col { flex:1; min-width:0; height:100%; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:6px; }
.bar { width:100%; max-width:46px; border-radius:7px 7px 3px 3px; background:linear-gradient(180deg,var(--accent),#1c8d78); min-height:3px; }
.bar.zero { background:var(--chip); }
.bar-l { font-size:11px; color:var(--muted); height:14px; white-space:nowrap; }
.kpis { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:16px; }
.kpi, .tile { background:var(--panel); border:1px solid var(--line); border-radius:var(--r); padding:16px 18px; }
.kpi span, .tile span { display:block; color:var(--muted); font-size:13px; }
.kpi b, .tile b { display:block; font-size:26px; margin-top:4px; letter-spacing:-.01em; }
.tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px; margin-bottom:16px; }

/* --- списки --- */
.toolbar { display:flex; gap:10px; margin-bottom:12px; }
.chips { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.fchip { padding:8px 16px; border-radius:20px; background:var(--panel); border:1px solid var(--line); cursor:pointer; color:var(--ink2); }
.fchip.on { background:rgba(46,196,166,.14); border-color:rgba(46,196,166,.5); color:var(--accent); font-weight:600; }
.list { display:flex; flex-direction:column; gap:10px; }
.deal { display:grid; grid-template-columns:44px minmax(150px,1.1fr) minmax(150px,1fr) minmax(130px,.8fr) 92px; align-items:center; gap:14px;
        padding:14px 16px; border-radius:var(--r); background:var(--panel); border:1px solid var(--line); cursor:pointer; }
.deal:hover { border-color:var(--line2); background:var(--panel2); }
.deal.pending { border-color:rgba(245,185,66,.35); }
.deal-ic { width:40px; height:40px; border-radius:50%; display:grid; place-items:center; font-weight:700; background:var(--chip); color:var(--muted); }
.deal-ic.ok { background:rgba(61,220,151,.12); color:var(--ok); } .deal-ic.bad { background:rgba(255,107,107,.12); color:var(--bad); }
.deal-ic.pending, .deal-ic.warn { background:rgba(245,185,66,.14); color:var(--warn); }
.deal-amt { font-size:20px; font-weight:700; } .deal-amt small { color:var(--accent); font-size:15px; }
.deal-sub { font-size:12.5px; color:var(--muted); } .deal-sub i { font-style:normal; opacity:.6; margin:0 3px; }
.bank { font-weight:600; } .det { color:var(--ink2); font-size:14px; word-break:break-all; }
.deal-act { display:flex; gap:8px; justify-content:flex-end; }
.more { text-align:center; margin:16px 0; }
.card-row { display:flex; align-items:center; gap:14px; padding:16px; border-radius:var(--r); background:var(--panel); border:1px solid var(--line); }
.card-row .grow { flex:1; min-width:0; } .card-row.off { opacity:.6; }
.op { display:grid; grid-template-columns:44px 1fr auto; gap:14px; align-items:center; padding:13px 16px; border-radius:var(--r); background:var(--panel); border:1px solid var(--line); }
.op .amt { font-size:17px; font-weight:700; } .op .amt.pos { color:var(--ok); } .op .amt.neg { color:var(--bad); }
.op-flow { color:var(--muted); font-size:13px; text-align:right; }
.dsp { padding:16px; border-radius:var(--r); background:var(--panel); border:1px solid var(--line); }
.dsp-top { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:6px; }
.dsp-top b { font-size:19px; }

/* --- модальные окна и уведомления --- */
.modal { position:fixed; inset:0; background:rgba(3,6,10,.7); display:grid; place-items:center; padding:16px; z-index:50; backdrop-filter:blur(3px); }
.sheet { width:100%; max-width:480px; max-height:92vh; overflow:auto; background:var(--panel); border:1px solid var(--line); border-radius:22px; padding:22px; }
.sheet.wide { max-width:780px; }
.sheet h2 { margin:0 0 4px; font-size:19px; }
.kv { display:flex; justify-content:space-between; gap:16px; padding:8px 0; border-bottom:1px solid var(--line); font-size:14.5px; }
.kv:last-of-type { border-bottom:0; } .kv span:first-child { color:var(--muted); } .kv span:last-child { text-align:right; word-break:break-all; }
.sheet-act { display:flex; gap:10px; margin-top:18px; flex-wrap:wrap; } .sheet-act .btn { flex:1; }
.warnbox { background:rgba(245,185,66,.1); border:1px solid rgba(245,185,66,.35); border-radius:12px; padding:11px 13px; color:var(--warn-ink); font-size:13.5px; margin-top:12px; }
.copy { cursor:pointer; color:var(--accent); margin-left:8px; font-size:13px; }
.toasts { position:fixed; right:18px; bottom:18px; display:flex; flex-direction:column; gap:8px; z-index:99; max-width:min(420px, calc(100vw - 36px)); }
.toast { padding:12px 15px; border-radius:13px; background:var(--toast); border:1px solid var(--line); box-shadow:0 10px 30px rgba(0,0,0,.4); font-size:14px; }
.toast.ok { border-color:rgba(61,220,151,.5); } .toast.err { border-color:rgba(255,107,107,.55); background:var(--toast-err); }
.toast.new { border-color:rgba(46,196,166,.6); background:var(--toast-new); }

/* --- мобильная версия --- */
@media (max-width: 900px) {
  .app { display:block; }
  .side { position:fixed; top:auto; bottom:0; left:0; right:0; height:auto; z-index:20; padding:6px 8px calc(6px + env(safe-area-inset-bottom));
          flex-direction:row; border-right:0; border-top:1px solid var(--line); }
  .side .brand, .side .chips-row, .side-foot, .nav .soon { display:none; }
  .nav { flex-direction:row; width:100%; margin:0; justify-content:space-around; gap:0; }
  .nav a { flex-direction:column; gap:3px; padding:6px 4px; font-size:11px; flex:1; align-items:center; position:relative; }
  .nav .nb { position:absolute; top:0; right:calc(50% - 22px); margin:0; min-width:18px; height:18px; font-size:11px; }
  .mtop { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; position:sticky; top:0; z-index:15;
          background:color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter:blur(8px); border-bottom:1px solid var(--line); padding-top:calc(12px + env(safe-area-inset-top)); }
  .mtop-r { display:flex; gap:8px; } .mtop .balchip { padding:8px 11px; font-size:14px; flex:none; } .mtop .bell { width:40px; height:38px; }
  .main { padding:16px 14px calc(90px + env(safe-area-inset-bottom)); }
  .hero-bal { font-size:42px; } .quick { grid-template-columns:repeat(2,1fr); } .kpis { grid-template-columns:repeat(2,1fr); }
  .deal { grid-template-columns:40px 1fr auto; row-gap:6px; }
  .deal-req { grid-column:2 / 4; order:4; } .deal-meta { grid-column:2 / 3; order:5; } .deal-act { grid-column:3 / 4; order:5; }
  .filters input { width:100%; } .filters > div { flex:1; min-width:140px; }
  .tiles { grid-template-columns:repeat(2,1fr); } .tile { padding:13px 14px; } .tile b { font-size:22px; }
}

.chip.info { background:rgba(59,130,246,.14); color:var(--info); }
.btn svg { flex:none; }
.steps { margin:12px 0 0; padding-left:20px; line-height:1.6; } .steps a { color:var(--accent); }
.qr { display:flex; justify-content:center; margin:14px 0 6px; } .qr svg { width:200px; height:200px; background:#fff; border-radius:12px; padding:6px; }
.mono { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:13px; word-break:break-all; }
.quick.two { grid-template-columns:repeat(2,1fr); margin-bottom:16px; } .quick .qbtn { font:inherit; color:inherit; }
.fill { display:flex; align-items:center; gap:10px; min-width:170px; }
.fill-bg { fill:none; stroke:var(--line); stroke-width:4.5; }
.fill-fg { fill:none; stroke-width:4.5; stroke-linecap:round; } .fill-fg.ok { stroke:var(--ok); } .fill-fg.warn { stroke:var(--warn); } .fill-fg.bad { stroke:var(--bad); }
.fill-n { font-size:14px; font-variant-numeric:tabular-nums; white-space:nowrap; }
@media (max-width:640px) { .card-row { flex-wrap:wrap; } .fill { order:5; width:100%; } }
.theme-btn { display:inline-grid; place-items:center; }
:root[data-theme="light"] .toast { box-shadow:0 10px 30px rgba(15,23,42,.12); }
:root[data-theme="light"] .modal { background:rgba(15,23,42,.35); }
.topbar > .js-theme { margin-left:auto; margin-right:8px; }
.bank-badge { width:36px; height:36px; flex:none; border-radius:50%; display:grid; place-items:center; font-weight:800; font-size:15px; }
.deal-req { display:flex; align-items:center; gap:10px; min-width:0; } .deal-req > div { min-width:0; }
.deal.ok { background:linear-gradient(90deg, rgba(61,220,151,.06), transparent 40%), var(--panel); }
.deal.bad { background:linear-gradient(90deg, rgba(255,107,107,.07), transparent 40%), var(--panel); }
.deal-sub .spent { color:var(--ink); font-weight:600; }
.mchip { display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:9px; border:1px solid var(--line); background:var(--panel2); font-size:12px; font-weight:600; vertical-align:middle; white-space:nowrap; }
.mchip.m-sbp svg { color:#7c5cff; } .mchip.m-card svg { color:var(--accent); } .mchip.m-sim svg { color:var(--warn); } .mchip.m-none { color:var(--muted); }
.mcfg { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:10px; }
.mcard { background:var(--panel2); border:1px solid var(--line); border-radius:12px; padding:12px 14px; display:grid; gap:4px; font-size:14px; color:var(--muted); }
.mcard b { color:var(--ink); } .mtag { justify-self:start; padding:2px 10px; border-radius:8px; background:rgba(245,185,66,.14); color:var(--warn); font-weight:700; font-size:12.5px; margin-bottom:4px; }
.tbl-wrap { overflow-x:auto; }
.tbl { width:100%; border-collapse:collapse; font-size:14px; }
.tbl th { text-align:left; color:var(--muted); font-weight:500; font-size:12px; padding:8px 10px; border-bottom:1px solid var(--line); white-space:nowrap; }
.tbl td { padding:10px; border-bottom:1px solid var(--line); white-space:nowrap; font-variant-numeric:tabular-nums; }
.tbl tr:last-child td { border-bottom:0; } .tbl .r { text-align:right; } .tbl .sum { color:var(--warn); font-weight:700; }
.pager { display:flex; justify-content:space-between; align-items:center; margin-top:12px; gap:10px; flex-wrap:wrap; }
.pg { display:flex; gap:6px; align-items:center; } .pgdots { color:var(--muted); padding:0 4px; }
.pgb { min-width:34px; height:34px; border-radius:50%; border:1px solid var(--line); background:var(--panel2); cursor:pointer; padding:0 8px; }
.pgb.on { background:rgba(245,185,66,.18); border-color:rgba(245,185,66,.45); color:var(--warn); font-weight:700; } .pgb:disabled { opacity:.4; cursor:default; }
