/* ═══════════ iteropay — дизайн-токены ═══════════ */
:root {
    --font: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', Consolas, monospace;
    --r-sm: 4px; --r: 6px; --r-lg: 10px;
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
    --sidebar: 248px;
    --ease: cubic-bezier(.2, .7, .3, 1);
    --z-sticky: 10; --z-drawer: 40; --z-modal: 100; --z-toast: 1000;
}

[data-theme="light"] {
    --bg: #F3F5F8; --surface: #FFFFFF; --surface-2: #F8FAFC; --surface-3: #EEF2F6;
    --border: #E2E8F0; --border-strong: #CBD5E1;
    --text: #0F172A; --text-2: #475569; --text-3: #64748B;
    --primary: #1D4ED8; --primary-hover: #1E40AF; --primary-soft: #E8EEFC; --on-primary: #FFFFFF;
    --ok: #15803D; --ok-soft: #E7F6EC; --wait: #B45309; --wait-soft: #FEF3E2; --err: #B91C1C; --err-soft: #FDECEC;
    --dispute: #6D28D9; --dispute-soft: #F1EBFD; --info: #0369A1; --info-soft: #E6F3FA; --neutral: #475569; --neutral-soft: #EEF2F6;
    --sidebar-bg: #0F172A; --sidebar-text: #CBD5E1; --sidebar-muted: #64748B; --sidebar-active: #1E293B;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .18);
    --scrim: rgba(15, 23, 42, .5);
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0B1120; --surface: #111A2E; --surface-2: #0F1729; --surface-3: #1A253B;
    --border: #22304A; --border-strong: #334155;
    --text: #E2E8F0; --text-2: #A3B1C6; --text-3: #8091A9;
    --primary: #4F80F0; --primary-hover: #6B95F5; --primary-soft: #18264A; --on-primary: #FFFFFF;
    --ok: #34C374; --ok-soft: #0F2A1E; --wait: #F0A23B; --wait-soft: #2E2210; --err: #F06A6A; --err-soft: #321618;
    --dispute: #A78BFA; --dispute-soft: #24193F; --info: #38B2E8; --info-soft: #0E2636; --neutral: #A3B1C6; --neutral-soft: #1A253B;
    --sidebar-bg: #080D19; --sidebar-text: #CBD5E1; --sidebar-muted: #64748B; --sidebar-active: #16213A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
p { margin: 0 0 var(--s2); }
code, .mono { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ok-text { color: var(--ok); } .err-text { color: var(--err); } .wait-text { color: var(--wait); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::selection { background: var(--primary-soft); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.ic { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ═══════════ загрузка ═══════════ */
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 20px; align-items: center; justify-content: center; background: var(--bg); z-index: 5000; }
.boot-bar { width: 180px; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; position: relative; }
.boot-bar::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--primary); animation: boot 1s infinite var(--ease); }
@keyframes boot { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.boot.hidden { display: none; }
/* логотип Itero: текст чёрный в светлой теме, белый в тёмной; на тёмных панелях всегда белый */
.wordmark { font-weight: 800; letter-spacing: -.035em; line-height: 1; }
.wordmark.themed { color: #0B0B14; }
[data-theme="dark"] .wordmark.themed { color: #fff; }
.boot-logo { display: flex; align-items: center; gap: 12px; font-size: 34px; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 16px; background: var(--err); color: #fff; z-index: 6000; }

/* ═══════════ каркас ═══════════ */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: var(--sidebar-muted); letter-spacing: 0; }
.role-chip { margin: 0 14px 10px; padding: 8px 10px; border-radius: var(--r); background: var(--sidebar-active); font-size: 12px; }
.role-chip b { display: block; color: #fff; font-weight: 600; font-size: 13px; }
.nav-group { padding: 10px 10px 4px; }
.nav-title { padding: 0 8px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--sidebar-muted); }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: var(--r); color: var(--sidebar-text); font-weight: 500; transition: background .15s var(--ease), color .15s; }
.nav-link:hover { background: var(--sidebar-active); color: #fff; text-decoration: none; }
.nav-link.active { background: #1D4ED8; color: #fff; }
.nav-link .badge-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #B91C1C; color: #fff; font-size: 11px; text-align: center; line-height: 18px; }
.sidebar-foot { margin-top: auto; padding: 12px 14px; font-size: 11px; color: var(--sidebar-muted); border-top: 1px solid #1E293B; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--s3); height: 56px; padding: 0 var(--s5); background: var(--surface); border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; padding-left: 34px; }
.search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topbar .spacer { flex: 1; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid transparent; border-radius: var(--r); background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); border: 2px solid var(--surface); }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text); font: inherit; }
.user-btn:hover { background: var(--surface-3); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 12px; }
.content { padding: var(--s5); width: 100%; }
h1:focus { outline: none; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.crumbs a { color: var(--text-3); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); flex-wrap: wrap; }
.page-head p { color: var(--text-3); margin: 4px 0 0; }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

/* ═══════════ выпадающие меню ═══════════ */
.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.dd-menu .dd-item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.dd-menu .dd-item:hover { background: var(--surface-3); text-decoration: none; }
.dd-menu .dd-sep { height: 1px; background: var(--border); margin: 6px 0; }
.dd-menu .dd-head { padding: 8px 10px; font-size: 12px; color: var(--text-3); }
.dd-item.danger { color: var(--err); }
.notif { width: 360px; }
.notif-item { padding: 10px; border-radius: var(--r); display: flex; gap: 10px; }
.notif-item:hover { background: var(--surface-3); }
.notif-item small { color: var(--text-3); display: block; }

/* ═══════════ карточки и сетки ═══════════ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 14px var(--s4); border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: var(--s4); }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: var(--s4); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mb { margin-bottom: var(--s4); } .mt { margin-top: var(--s4); } .mb2 { margin-bottom: var(--s2); }
.row { display: flex; gap: var(--s2); align-items: center; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
@media (max-width: 1280px) { .g6 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(2, 1fr); } .g-2-1, .g-1-2 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .shell.nav-open .sidebar { display: flex; position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 200; }
    .g2, .g3, .g4, .g6 { grid-template-columns: 1fr; }
    .content { padding: var(--s3); }
    .topbar { padding: 0 var(--s3); }
}
.mobile-only { display: none; }
@media (max-width: 900px) { .mobile-only { display: inline-flex; } }

/* KPI */
.kpi { padding: 14px var(--s4); }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); font-weight: 500; }
.kpi-value { margin-top: 6px; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.kpi-sub { margin-top: 2px; font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.delta { font-weight: 600; font-size: 12px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--err); }

/* ═══════════ кнопки и формы ═══════════ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s var(--ease), border-color .15s, color .15s; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--err); border-color: var(--err); background: var(--surface); }
.btn.danger:hover { background: var(--err-soft); }
.btn.danger-solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.btn-group .btn.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); position: relative; z-index: 1; }

input, select, textarea { font: 13px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r); min-height: 36px; padding: 0 10px; transition: border-color .15s, box-shadow .15s; }
textarea { padding: 8px 10px; min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label, .label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .error { font-size: 12px; color: var(--err); }
.req::after { content: ' *'; color: var(--err); }
.form-grid { display: grid; gap: var(--s3) var(--s4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch { position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--border-strong); border: 0; cursor: pointer; transition: background .15s; flex: none; padding: 0; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(16px); }

/* ═══════════ фильтры ═══════════ */
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: flex-end; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.filters .field { min-width: 140px; }
.filters input, .filters select { min-height: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px var(--s4); border-bottom: 1px solid var(--border); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 500; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; display: inline-flex; padding: 2px; border-radius: 50%; }
.chip button:hover { background: rgba(0,0,0,.08); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 var(--s4); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-2); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { padding: 0 6px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); font-size: 11px; line-height: 18px; }
.tabs.page-tabs { padding: 0; margin-bottom: var(--s4); }

/* ═══════════ таблицы ═══════════ */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.t th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12px; color: var(--text-2); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.t th.sortable { cursor: pointer; }
.t th.sortable:hover { color: var(--text); }
.t th .ic { width: 12px; height: 12px; vertical-align: -1px; }
.t td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tbody tr { transition: background .1s; }
.t tbody tr:hover { background: var(--surface-2); }
.t tbody tr.clickable { cursor: pointer; }
.t tbody tr.selected { background: var(--primary-soft); }
.t tfoot td { font-weight: 600; background: var(--surface-2); }
.t .sub { display: block; font-size: 11.5px; color: var(--text-3); }
.t.compact td { padding: 6px 10px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px var(--s4); font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.pager select { min-height: 30px; }
.bulk { display: flex; align-items: center; gap: var(--s2); padding: 8px var(--s4); background: var(--primary-soft); color: var(--primary); font-weight: 500; border-bottom: 1px solid var(--border); }

/* ═══════════ бейджи ═══════════ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 18px; }
.badge .ic { width: 13px; height: 13px; vertical-align: 0; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.wait { background: var(--wait-soft); color: var(--wait); }
.badge.dispute { background: var(--dispute-soft); color: var(--dispute); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--neutral-soft); color: var(--neutral); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }
.dir { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; font-size: 12px; }
.dir.in { color: var(--ok); } .dir.out { color: var(--info); }
.cur { display: inline-block; min-width: 34px; padding: 0 4px; border-radius: 3px; background: var(--surface-3); color: var(--text-2); font: 500 11px var(--mono); text-align: center; }
.pulse { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pulse.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.pulse.wait { background: var(--wait); box-shadow: 0 0 0 3px var(--wait-soft); }
.pulse.err { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.pulse.neutral { background: var(--text-3); box-shadow: 0 0 0 3px var(--neutral-soft); }

.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.bar.ok > span { background: var(--ok); } .bar.wait > span { background: var(--wait); } .bar.err > span { background: var(--err); }

/* описание ключ-значение */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.copy { display: inline-flex; align-items: center; gap: 6px; }
.copy button { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 2px; border-radius: 4px; display: inline-flex; }
.copy button:hover { color: var(--primary); background: var(--surface-3); }

/* таймлайн */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 24px; }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li .mk { position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); background: var(--text-3); box-shadow: 0 0 0 1px var(--border-strong); }
.timeline li.ok .mk { background: var(--ok); } .timeline li.err .mk { background: var(--err); } .timeline li.warn .mk, .timeline li.wait .mk { background: var(--wait); } .timeline li.info .mk { background: var(--primary); } .timeline li.dispute .mk { background: var(--dispute); }
.timeline .tt { font-weight: 500; }
.timeline .td { color: var(--text-3); font-size: 12px; }

/* ═══════════ выезжающая панель и модалки ═══════════ */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-drawer); animation: fade .15s var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--surface); z-index: calc(var(--z-drawer) + 1); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s var(--ease); }
.drawer-head { display: flex; align-items: center; gap: var(--s3); padding: 14px var(--s5); border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s4) var(--s5); }
.drawer-foot { padding: 12px var(--s5); border-top: 1px solid var(--border); display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; background: var(--surface-2); }
.modal-wrap { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; padding: var(--s4); background: var(--scrim); animation: fade .15s var(--ease); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: pop .18s var(--ease); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px var(--s5); border-bottom: 1px solid var(--border); }
.modal-body { padding: var(--s5); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s2); padding: 12px var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 300px; max-width: 440px; padding: 12px 14px; border-radius: var(--r); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); animation: pop .18s var(--ease); font-weight: 500; }
.toast.ok .ic { color: #4ADE80; } .toast.err .ic { color: #F87171; } .toast.info .ic { color: #60A5FA; }

/* алерты */
.alert { display: flex; gap: 10px; padding: 10px 14px; border-radius: var(--r); font-size: 13px; border: 1px solid; }
.alert.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.alert.wait, .alert.warning { background: var(--wait-soft); color: var(--wait); border-color: transparent; }
.alert.err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.alert b { color: inherit; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 16px; text-align: center; color: var(--text-3); }
.empty .ic { width: 32px; height: 32px; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 320px; }

/* код */
pre.code { margin: 0; padding: 12px 14px; border-radius: var(--r); background: #0B1120; color: #D6E2F5; font: 12.5px/1.55 var(--mono); overflow-x: auto; white-space: pre; }
pre.code .k { color: #7DD3FC; } pre.code .s { color: #A7F3D0; }
.method { display: inline-block; padding: 1px 6px; border-radius: 3px; font: 600 11px var(--mono); color: #fff; }
.method.post { background: #15803D; } .method.get { background: #1D4ED8; } .method.del { background: #B91C1C; }

/* схема маршрутизации */
.flow { display: grid; grid-template-columns: 1fr 40px 1fr 40px 1.3fr; align-items: center; gap: 0; }
.flow .node { border: 1px solid var(--border-strong); border-radius: var(--r); padding: 10px 12px; background: var(--surface-2); }
.flow .node b { display: block; font-size: 13px; }
.flow .node small { color: var(--text-3); }
.flow .arrow { height: 2px; background: var(--border-strong); position: relative; }
.flow .arrow::after { content: ''; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left-color: var(--border-strong); }
.flow .targets { display: flex; flex-direction: column; gap: 6px; }
.flow .target { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: var(--r); padding: 6px 10px; background: var(--surface); font-size: 12.5px; }
.flow .target .w { margin-left: auto; font: 500 12px var(--mono); color: var(--text-2); }

/* ═══════════ логин ═══════════ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: #0F172A; color: #CBD5E1; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(148,163,184,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,.07) 1px, transparent 1px); background-size: 32px 32px; }
.auth-side > * { position: relative; }
.auth-side h2 { color: #fff; font-size: 30px; font-weight: 600; letter-spacing: -.02em; max-width: 460px; }
.auth-side ul { padding: 0; list-style: none; display: grid; gap: 12px; margin: 24px 0 0; }
.auth-side li { display: flex; gap: 10px; align-items: flex-start; }
.auth-side li .ic { color: #60A5FA; margin-top: 2px; }
.auth-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.auth-stats b { display: block; color: #fff; font-size: 22px; font-variant-numeric: tabular-nums; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--surface); }
.auth-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.auth-form input { min-height: 42px; }
.auth-form .btn { min-height: 42px; }
.demo-roles { display: grid; gap: 8px; }
.demo-role { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; text-align: left; font: inherit; color: var(--text); transition: border-color .15s, background .15s; }
.demo-role:hover { border-color: var(--primary); background: var(--primary-soft); }
.demo-role .ic { width: 20px; height: 20px; color: var(--primary); }
.demo-role small { display: block; color: var(--text-3); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.otp { display: flex; gap: 8px; }
.otp input { width: 48px; height: 52px; text-align: center; font: 600 20px var(--mono); }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ═══════════ платёжная страница ═══════════ */
.pay-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 32px 16px; background: var(--bg); }
.pay-card { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.pay-top { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.pay-amount { font-size: 34px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pay-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.steps { display: flex; gap: 6px; }
.steps .st { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.steps .st.on { background: var(--primary); }
.steps .st.done { background: var(--ok); }
.req-box { border: 1px solid var(--border); border-radius: var(--r); }
.req-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.req-row:last-child { border-bottom: 0; }
.req-row small { display: block; color: var(--text-3); font-size: 11.5px; }
.req-row b { font: 500 15px var(--mono); }
.qr { width: 184px; height: 184px; margin: 0 auto; padding: 10px; background: #fff; border-radius: 8px; border: 1px solid var(--border); }
.timer { font: 600 18px var(--mono); }
.drop { border: 2px dashed var(--border-strong); border-radius: var(--r); padding: 18px; text-align: center; color: var(--text-3); cursor: pointer; }
.drop:hover { border-color: var(--primary); color: var(--primary); }
.result-ic { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 8px auto; }
.result-ic .ic { width: 32px; height: 32px; }
.result-ic.ok { background: var(--ok-soft); color: var(--ok); } .result-ic.err { background: var(--err-soft); color: var(--err); } .result-ic.wait { background: var(--wait-soft); color: var(--wait); }
.demo-bar { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 20; flex-wrap: wrap; justify-content: center; }

.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); }
@keyframes sk { to { background-position: -200% 0; } }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 10px var(--s4); border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }
.msg { padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.msg.mine { background: var(--primary-soft); border-color: transparent; }
.msg-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.msg-head b { color: var(--text); }
@media (max-width: 1100px) { .hide-sm { display: none !important; } }
.t th.num { text-align: right; }
.tabs { overflow-y: hidden; scrollbar-width: thin; align-items: center; }
.drawer .tabs { flex: none; }
.list-plain li.selected { background: var(--primary-soft); }
@media print { .sidebar, .topbar, .actions, .demo-bar { display: none !important; } .shell { display: block; } }
/* статистика */
.stat-kpi { position: relative; overflow: hidden; }
.stat-kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.kpi-ic { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.delta.flat { color: var(--text-3); }
.geo-sum { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.geo-sum b { font-size: 18px; font-variant-numeric: tabular-nums; }
.geo-tile { border: 1px solid var(--border); border-radius: var(--r); padding: 12px; background: var(--surface-2); }
