/* Plata — сдержанное серебро: платиновые нейтрали, тонкие линии, много воздуха */
:root {
  --bg:#eceef1; --bg-glow:#f8f9fb;
  --surface:#fbfbfc; --field:#f3f4f6;
  --text:#1d2127; --muted:#7b818b; --faint:#a3a8b0;
  --line:#dde0e4; --line-strong:#c4c8ce;
  --rim-1:#ffffff; --rim-2:#b9bec6; --rim-3:#eef0f2; --rim-4:#a8aeb7;
  --btn-bg:#262a31; --btn-bg-hover:#1b1e23; --btn-text:#f1f2f4;
  --focus:rgba(120,128,140,.35);
  --error:#9b2c2c; --error-bg:#f7eaea;
  --shadow:0 30px 60px -30px rgba(30,38,50,.28), 0 2px 6px rgba(30,38,50,.05);
  --serif:"Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans:"Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
    color-scheme:dark;
    --bg:#111317; --bg-glow:#1d2026;
    --surface:#181b20; --field:#1f2228;
    --text:#e9ebee; --muted:#8e949d; --faint:#646a73;
    --line:#2a2e35; --line-strong:#3a3f47;
    --rim-1:#5a6069; --rim-2:#2a2e35; --rim-3:#8c929b; --rim-4:#2f333a;
    --btn-bg:#e3e6ea; --btn-bg-hover:#f3f4f6; --btn-text:#15171b;
    --focus:rgba(200,205,212,.28);
    --error:#f2b8b5; --error-bg:#3a2224;
    --shadow:0 30px 60px -30px rgba(0,0,0,.7), 0 2px 6px rgba(0,0,0,.3);
  } }
:root[data-theme="dark"] {
    color-scheme:dark;
    --bg:#111317; --bg-glow:#1d2026;
    --surface:#181b20; --field:#1f2228;
    --text:#e9ebee; --muted:#8e949d; --faint:#646a73;
    --line:#2a2e35; --line-strong:#3a3f47;
    --rim-1:#5a6069; --rim-2:#2a2e35; --rim-3:#8c929b; --rim-4:#2f333a;
    --btn-bg:#e3e6ea; --btn-bg-hover:#f3f4f6; --btn-text:#15171b;
    --focus:rgba(200,205,212,.28);
    --error:#f2b8b5; --error-bg:#3a2224;
    --shadow:0 30px 60px -30px rgba(0,0,0,.7), 0 2px 6px rgba(0,0,0,.3);
  }

:root[data-theme="light"] { color-scheme:light; }   /* светлая тема выбрана вручную */

* { box-sizing:border-box; }
[hidden] { display:none !important; }
html { -webkit-text-size-adjust:100%; }
html, body { height:100%; }
body {
  margin:0; min-height:100vh; color:var(--text);
  font-family:var(--sans); font-size:15px; line-height:1.5;
  background:radial-gradient(1200px 700px at 50% -10%, var(--bg-glow), var(--bg) 70%) fixed, var(--bg);
  -webkit-font-smoothing:antialiased;
  overflow-x:clip;
}
body.center { display:grid; place-items:center; padding:32px 16px; padding-bottom:max(32px, env(safe-area-inset-bottom)); }
button, .tab, a.btn, a.chat-open, .filter-btn { touch-action:manipulation; }

/* ---------- Карточка с серебряным ободком ---------- */
.card {
  position:relative; background:var(--surface); border-radius:18px;
  padding:48px 44px 40px; box-shadow:var(--shadow);
}
.card::before {                         /* тонкий металлический кант 1px */
  content:""; position:absolute; inset:0; border-radius:inherit; padding:1px; pointer-events:none;
  background:linear-gradient(140deg, var(--rim-1), var(--rim-2) 30%, var(--rim-3) 55%, var(--rim-4) 100%);
  -webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite:xor; mask-composite:exclude;
}
.login { width:100%; max-width:400px; }
@media (max-width:440px) { .card { padding:36px 24px 28px; } }

body.intro .login {
  background:transparent; box-shadow:none;
  transition:background .8s ease, box-shadow .8s ease;
}
body.intro .login::before { opacity:0; transition:opacity .8s ease; }
body.intro .login .brand { position:relative; z-index:2; }
body.intro .brand-name i { font-style:normal; display:inline-block; opacity:0; }
body.intro .login-body { opacity:0; transform:translateY(10px); transition:opacity .7s ease, transform .7s ease; }
body.intro.is-reveal .brand-marks { animation:intro-mark 1s cubic-bezier(.22,1,.36,1) both; }
body.intro.is-reveal .brand-name i { animation:intro-letter .65s cubic-bezier(.22,1,.36,1) both; }
body.intro.is-reveal .brand-name i:nth-child(1) { animation-delay:.45s; }
body.intro.is-reveal .brand-name i:nth-child(2) { animation-delay:.54s; }
body.intro.is-reveal .brand-name i:nth-child(3) { animation-delay:.63s; }
body.intro.is-reveal .brand-name i:nth-child(4) { animation-delay:.72s; }
body.intro.is-reveal .brand-name i:nth-child(5) { animation-delay:.81s; }
body.intro.is-settle .login { background:var(--surface); box-shadow:var(--shadow); }
body.intro.is-settle .login::before { opacity:1; }
body.intro.is-settle .login-body { opacity:1; transform:none; }
body.intro.is-settle .brand-name i { opacity:1; }
@keyframes intro-mark { from { opacity:0; transform:scale(.92); } to { opacity:1; transform:none; } }
@keyframes intro-letter { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@media (prefers-reduced-motion: reduce) {
  body.intro .login { background:var(--surface); box-shadow:var(--shadow); }
  body.intro .login::before, body.intro .login-body, body.intro .brand-name i { opacity:1; transform:none; }
}

/* ---------- Типографика ---------- */
.brand {
  display:flex; align-items:center; gap:10px;
  font-family:var(--serif); font-weight:500; font-size:15px;
  letter-spacing:.42em; text-transform:uppercase; color:var(--muted);
}
.brand-marks { position:relative; display:block; width:28px; height:28px; flex:none; }
.brand-mark { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; }
.brand-mark-on-dark { opacity:0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark-on-dark { opacity:1; }
  :root:not([data-theme="light"]) .brand-mark-on-light { opacity:0; }
}
:root[data-theme="dark"] .brand-mark-on-dark { opacity:1; }
:root[data-theme="dark"] .brand-mark-on-light { opacity:0; }
:root[data-theme="light"] .brand-mark-on-dark { opacity:0; }
:root[data-theme="light"] .brand-mark-on-light { opacity:1; }
.login .brand { flex-direction:column; justify-content:center; gap:14px; text-align:center; }
.login .brand-marks { width:72px; height:72px; }
h1 {
  font-family:var(--serif); font-weight:500; font-size:40px; line-height:1.1;
  margin:18px 0 0; letter-spacing:.01em; text-wrap:balance;
}
.login h1 { text-align:center; }
.rule {                                 /* серебряная черта под заголовком */
  width:48px; height:1px; margin:18px auto 0; border:0;
  background:linear-gradient(90deg, transparent, var(--line-strong), transparent);
}
.muted { color:var(--muted); margin:0; }

/* ---------- Форма ---------- */
form { display:flex; flex-direction:column; gap:18px; margin-top:32px; }
.field { display:flex; flex-direction:column; gap:8px; }
label {
  font-size:11px; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--muted);
}
input[type="email"], input[type="password"], input[type="text"], input[type="url"], .amt-row input[type="number"], .grp-timers input[type="number"], textarea {
  width:100%; height:48px; padding:0 16px; border-radius:10px;
  border:1px solid var(--line); background:var(--field); color:var(--text);
  font:inherit; font-size:15px; transition:border-color .2s, box-shadow .2s, background .2s;
}
textarea { height:auto; padding:12px 16px; resize:vertical; }
input::placeholder, textarea::placeholder { color:var(--faint); }
input:hover, textarea:hover { border-color:var(--line-strong); }
input:focus, textarea:focus { outline:none; border-color:var(--line-strong); background:var(--surface); box-shadow:0 0 0 4px var(--focus); }

.password { position:relative; }
.password input { padding-right:88px; }
.reveal {
  position:absolute; right:6px; top:50%; transform:translateY(-50%);
  height:36px; padding:0 12px; border:0; border-radius:8px; background:transparent;
  color:var(--muted); font:inherit; font-size:12px; font-weight:600; letter-spacing:.06em; cursor:pointer;
}
.reveal:hover { color:var(--text); }

.check { display:flex; align-items:center; gap:10px; cursor:pointer; user-select:none;
         font-size:14px; font-weight:500; letter-spacing:0; text-transform:none; color:var(--muted); }
.check input {
  appearance:none; -webkit-appearance:none; width:18px; height:18px; margin:0; flex:none;
  border:1px solid var(--line-strong); border-radius:5px; background:var(--field);
  display:grid; place-items:center; cursor:pointer; transition:background .15s, border-color .15s;
}
.check input::after {
  content:""; width:9px; height:5px; border:solid var(--btn-text); border-width:0 0 1.6px 1.6px;
  transform:rotate(-45deg) translate(1px,-1px); opacity:0;
}
.check input:checked { background:var(--btn-bg); border-color:var(--btn-bg); }
.check input:checked::after { opacity:1; }
.check input:focus-visible { box-shadow:0 0 0 4px var(--focus); outline:none; }

/* ---------- Кнопки ---------- */
button {
  height:48px; padding:0 22px; border:0; border-radius:10px; cursor:pointer;
  background:var(--btn-bg); color:var(--btn-text);
  font:inherit; font-size:14px; font-weight:600; letter-spacing:.08em;
  transition:background .2s, transform .1s;
}
button:hover { background:var(--btn-bg-hover); }
button:active { transform:translateY(1px); }
button:focus-visible { outline:none; box-shadow:0 0 0 4px var(--focus); }
button:disabled { opacity:.55; cursor:wait; }
a.btn {
  display:inline-flex; align-items:center; height:40px; padding:0 18px; border-radius:10px; text-decoration:none;
  background:var(--btn-bg); color:var(--btn-text); font-size:13px; font-weight:600; letter-spacing:.06em;
}
a.btn:hover { background:var(--btn-bg-hover); }
.view-only-bar { margin:0 0 20px; padding:12px 16px; border-radius:10px; background:var(--field); color:var(--muted); font-size:14px; }
.view-only-locked { opacity:.45; cursor:not-allowed !important; }
button[type="submit"] { margin-top:6px; }
button.ghost {
  height:36px; padding:0 14px; background:transparent; color:var(--text);
  border:1px solid var(--line-strong); font-weight:500; letter-spacing:.04em; font-size:13px;
}
button.ghost:hover { background:var(--field); }

.error { margin:0; padding:10px 14px; border-radius:10px; background:var(--error-bg); color:var(--error); font-size:14px; }

/* ---------- Кабинет ---------- */
.topbar {
  display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap;
  padding:18px 32px; border-bottom:1px solid var(--line); background:color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter:blur(8px);
}
@media (max-width:560px) { .topbar { padding:14px 16px; } }
.user { display:flex; align-items:center; gap:14px; font-size:14px; color:var(--muted); flex-wrap:wrap; }
.badge {
  font-size:10px; font-weight:700; letter-spacing:.16em; text-transform:uppercase;
  padding:4px 10px; border-radius:999px; color:var(--text); border:1px solid var(--line-strong);
}
.page { max-width:760px; margin:48px auto; padding:0 16px; }
.page h1 { font-size:34px; margin-top:0; }
.page .muted { margin-top:8px; }
pre {
  margin:20px 0 0; background:var(--field); border:1px solid var(--line); border-radius:10px;
  padding:16px; overflow:auto; font-size:13px;
}
#status { margin-top:16px; font-size:14px; }

@media (prefers-reduced-motion: reduce) { * { transition:none !important; } }

/* ================= Админ-панель ================= */
.shell { display:grid; grid-template-columns:260px minmax(0,1fr); min-height:100vh; }

.sidebar {
  position:sticky; top:0; height:100vh; display:flex; flex-direction:column; gap:6px;
  padding:32px 20px 24px; border-right:1px solid var(--line);
  background:color-mix(in srgb, var(--surface) 70%, transparent);
}
.sidebar .brand { padding:0 12px; }
.sidebar .brand-marks { width:32px; height:32px; }
.sidebar-caption { padding:0 12px; margin:6px 0 28px; font-size:12px; color:var(--faint); letter-spacing:.04em; }
.tabs { display:flex; flex-direction:column; gap:2px; }
.tab {
  position:relative; display:block; padding:11px 12px 11px 16px; border-radius:10px;
  color:var(--muted); text-decoration:none; font-size:14px; font-weight:500;
  transition:background .15s, color .15s;
}
.tab:hover { background:var(--field); color:var(--text); }
.tab.active { background:var(--field); color:var(--text); font-weight:600; }
.tab.active::before {                   /* серебряная метка активной вкладки */
  content:""; position:absolute; left:0; top:10px; bottom:10px; width:2px; border-radius:2px;
  background:linear-gradient(180deg, var(--rim-2), var(--line-strong), var(--rim-4));
}
.tab:focus-visible { outline:none; box-shadow:0 0 0 3px var(--focus); }
.sidebar-foot { margin-top:auto; padding:16px 12px 0; border-top:1px solid var(--line); display:flex; flex-direction:column; gap:12px; }
.me { font-size:13px; color:var(--muted); overflow-wrap:anywhere; }
.sidebar-foot .ghost { align-self:flex-start; }

.content { padding:48px 56px; width:100%; max-width:none; }   /* админка — на всю ширину справа от меню */
.content-head { margin-bottom:32px; }
.content-head h1 { font-size:36px; margin:0; }
.content-head .muted { margin-top:6px; }
.content-head.row { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; }

/* Обзор: показатели */
.stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px,1fr)); gap:16px; }
.stat { background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:22px 22px 18px; }
.stat-value { font-family:var(--serif); font-size:44px; line-height:1; font-variant-numeric:tabular-nums; }
.stat-label { margin-top:10px; font-size:11px; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); }

/* Таблица сотрудников */
.table-wrap { overflow-x:auto; background:var(--surface); border:1px solid var(--line); border-radius:14px; }
.table { width:100%; border-collapse:collapse; font-size:14px; }
.table th {
  text-align:left; padding:14px 18px; font-size:11px; font-weight:600; letter-spacing:.14em;
  text-transform:uppercase; color:var(--muted); border-bottom:1px solid var(--line);
}
.table td { padding:14px 18px; border-bottom:1px solid var(--line); vertical-align:middle; }
.table tr:last-child td { border-bottom:0; }
.table tbody tr:hover td { background:color-mix(in srgb, var(--field) 60%, transparent); }
.strong { font-weight:600; }
.nowrap { white-space:nowrap; }
.you { margin-left:6px; font-size:11px; color:var(--faint); font-weight:500; }
.badge-soft { color:var(--muted); border-color:var(--line); }
.dot { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:8px; background:var(--line-strong); vertical-align:middle; }
.dot.on { background:#3f9b6b; box-shadow:0 0 0 3px color-mix(in srgb, #3f9b6b 20%, transparent); }
.actions { text-align:right; white-space:nowrap; }
button.link {
  height:auto; padding:4px 8px; background:transparent; color:var(--muted);
  font-size:13px; font-weight:500; letter-spacing:.02em; border-radius:6px;
}
button.link:hover { color:var(--text); background:var(--field); }
button.danger-link:hover { color:var(--error); background:var(--error-bg); }
button.danger { background:var(--error); color:#fff; }
button.danger:hover { background:var(--error); filter:brightness(.92); }

/* Модальные окна */
.modal {
  width:min(440px, calc(100vw - 32px)); padding:36px 32px 28px; border:1px solid var(--line-strong);
  border-radius:18px; background:var(--surface); color:var(--text); box-shadow:var(--shadow);
}
.modal::backdrop { background:rgba(20,24,30,.35); backdrop-filter:blur(3px); }
.modal h2 { font-family:var(--serif); font-weight:500; font-size:28px; margin:0; }
.modal form { margin-top:0; }
.modal .muted { margin-top:-8px; }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:8px; }
.modal-actions button { height:42px; }
.small { font-size:13px; }
select {
  width:100%; height:48px; padding:0 14px; border-radius:10px; border:1px solid var(--line);
  background:var(--field); color:var(--text); font:inherit; font-size:15px;
}
select:focus { outline:none; border-color:var(--line-strong); box-shadow:0 0 0 4px var(--focus); }

.nav-toggle { display:none; }
.nav-drawer { display:flex; flex-direction:column; flex:1 1 auto; min-height:0; }

/* Уточнения */
.reveal:hover, .reveal:active { background:var(--field); transform:translateY(-50%); }
.modal-actions { align-items:center; }
.modal-actions button { margin-top:0; }
.table td:first-child, .table td:nth-child(4) { white-space:nowrap; }

/* Иконки вкладок */
.tab { display:flex; align-items:center; gap:12px; }
.ico { width:18px; height:18px; flex:none; fill:none; stroke:currentColor; stroke-width:1.4; stroke-linecap:round; stroke-linejoin:round; opacity:.85; }
.tab.active .ico { opacity:1; }

/* Раздел-заготовка */
.empty {
  display:flex; gap:24px; align-items:flex-start; padding:32px;
  background:var(--surface); border:1px dashed var(--line-strong); border-radius:14px;
}
.empty-mark {
  width:56px; height:56px; flex:none; display:grid; place-items:center; border-radius:14px;
  border:1px solid var(--line); background:var(--field); color:var(--muted);
}
.empty-mark .ico { width:26px; height:26px; stroke-width:1.2; }
.empty-title { font-family:var(--serif); font-size:24px; line-height:1.2; margin-bottom:6px; }
.empty-list { margin:10px 0 0; padding-left:18px; color:var(--text); display:flex; flex-direction:column; gap:6px; }
.empty-list li::marker { color:var(--faint); }
@media (max-width:560px) { .empty { flex-direction:column; padding:24px; } }

.num { font-variant-numeric:tabular-nums; }
.dot.warn { background:#c0862f; }

/* Пользователи: роль, данные для входа */
.hint { margin:-4px 0 0; font-size:13px; color:var(--muted); }
.role-select {
  width:auto; height:34px; padding:0 30px 0 12px; font-size:13px; font-weight:500; border-radius:8px;
  background-color:transparent; border:1px solid var(--line);
  appearance:none; -webkit-appearance:none; cursor:pointer;
  background-image:linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size:5px 5px; background-repeat:no-repeat;
  transition:border-color .2s, box-shadow .2s;
}
.role-select:hover { border-color:var(--line-strong); }
.role-select:disabled { cursor:default; opacity:.7; }
.role-select.saved { border-color:#3f9b6b; box-shadow:0 0 0 3px color-mix(in srgb, #3f9b6b 18%, transparent); }
.cred { border:1px solid var(--line); border-radius:12px; background:var(--field); overflow:hidden; }
.cred-row { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:14px 16px; }
.cred-row + .cred-row { border-top:1px solid var(--line); }
.cred-label { font-size:11px; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); }
.cred-value { font-weight:600; overflow-wrap:anywhere; text-align:right; user-select:all; }
.mono { font-family:ui-monospace, "SF Mono", Consolas, monospace; font-size:16px; letter-spacing:.06em; }

/* Разделы, панели, география */
.section { margin-top:44px; }
.section-head { display:flex; align-items:baseline; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.section-head h2 { font-family:var(--serif); font-weight:500; font-size:26px; margin:0; }
.section-head .muted { font-size:13px; }
.geo-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(280px,1fr)); gap:16px; }
.panel { background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:20px 22px; }
.panel-title { font-size:11px; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); margin-bottom:14px; }
.bars { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:12px; }
.bar-row { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(60px,1fr) 40px; align-items:center; gap:12px; font-size:14px; }
.bar-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bar-track { height:6px; border-radius:3px; background:var(--field); overflow:hidden; }
.bar-fill { height:100%; border-radius:3px; background:linear-gradient(90deg, var(--rim-4), var(--line-strong)); }
:root .bar-fill { background:linear-gradient(90deg, #8d949e, #5f6772); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar-fill { background:linear-gradient(90deg, #7e858f, #c9ced4); } }
:root[data-theme="dark"] .bar-fill { background:linear-gradient(90deg, #7e858f, #c9ced4); }
.bar-value { text-align:right; color:var(--muted); font-size:13px; }
.cc {
  display:inline-block; min-width:26px; margin-right:8px; padding:1px 5px; border-radius:4px;
  border:1px solid var(--line-strong); font-size:10px; font-weight:700; letter-spacing:.06em; text-align:center; color:var(--muted);
  vertical-align:1px;
}

/* Карточка пользователя */
.back { display:inline-block; margin-bottom:18px; font-size:13px; color:var(--muted); text-decoration:none; }
.back:hover { color:var(--text); }
.break { overflow-wrap:anywhere; }
.last { margin-top:14px; }
.warn-text { color:#b5782a; }
.device { display:flex; align-items:center; gap:10px; }
.device .ico { width:20px; height:20px; color:var(--muted); }
a.link { display:inline-block; padding:4px 8px; border-radius:6px; font-size:13px; font-weight:500; color:var(--muted); text-decoration:none; }
a.link:hover { color:var(--text); background:var(--field); }
.device .small { white-space:nowrap; }
.table td .cc + * { white-space:nowrap; }
.dot.ok { background:#3f9b6b; }
.stats-5 { grid-template-columns:repeat(auto-fit, minmax(150px,1fr)); }
.stat-value.text { font-size:30px; line-height:44px; white-space:nowrap; }
.table td.actions { padding-left:8px; padding-right:12px; }
.actions .link { padding:4px 6px; }
.table th, .table td { padding-left:16px; padding-right:16px; }
.table td.actions { padding-left:6px; padding-right:10px; }
.stats-5 .stat { padding:20px 18px 16px; }
.stat-value.text { font-size:24px; }

/* Сотрудники: доступы */
.chips { display:flex; flex-wrap:wrap; gap:6px; }
.chip {
  display:inline-block; padding:3px 9px; border-radius:999px; font-size:12px; font-weight:500;
  border:1px solid var(--line); color:var(--muted); background:var(--field); white-space:nowrap;
}
.chip-edit { color:var(--text); border-color:var(--line-strong); background:transparent; }
.modal-wide { width:min(600px, calc(100vw - 32px)); }
.perm-table { border:1px solid var(--line); border-radius:12px; overflow:hidden; }
.perm-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:10px 10px 10px 16px; flex-wrap:wrap; }
.perm-row + .perm-row { border-top:1px solid var(--line); }
.perm-name { font-size:14px; font-weight:500; }
.segmented { display:inline-flex; padding:3px; gap:2px; border-radius:9px; background:var(--field); border:1px solid var(--line); }
.seg { position:relative; margin:0; cursor:pointer; letter-spacing:0; text-transform:none; font-size:13px; font-weight:500; color:var(--muted); }
.seg input { position:absolute; opacity:0; pointer-events:none; }
.seg span { display:block; padding:6px 12px; border-radius:7px; transition:background .15s, color .15s; white-space:nowrap; }
.seg:hover span { color:var(--text); }
.seg input:checked + span { background:var(--surface); color:var(--text); box-shadow:0 1px 3px rgba(20,24,30,.12), 0 0 0 1px var(--line); }
.seg input[value="none"]:checked + span { color:var(--muted); }
.seg input:focus-visible + span { box-shadow:0 0 0 3px var(--focus); }
.legend { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:14px; font-size:13px; color:var(--muted); }
.legend .chip + .chip { margin-left:10px; }

/* Инвойсы */
.toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.filter { display:inline-flex; flex-wrap:wrap; gap:4px; padding:3px; border-radius:10px; background:var(--field); border:1px solid var(--line); }
.filter-btn {
  height:34px; padding:0 12px; border-radius:8px; background:transparent; color:var(--muted);
  font-size:13px; font-weight:500; letter-spacing:0; display:inline-flex; align-items:center; gap:8px;
}
.filter-btn:hover { background:transparent; color:var(--text); }
.filter-btn.active { background:var(--surface); color:var(--text); box-shadow:0 1px 3px rgba(20,24,30,.12), 0 0 0 1px var(--line); }
.filter-btn .num { font-size:12px; color:var(--faint); }
.search { width:min(300px, 100%) !important; height:42px !important; font-size:14px !important; }
.right { text-align:right !important; }

.uuids { display:flex; flex-direction:column; gap:4px; }
.uuid {
  display:inline-flex; align-items:center; gap:8px; height:auto; padding:2px 6px; margin-left:-6px; border-radius:6px;
  background:transparent; color:var(--text); font-weight:400; letter-spacing:0; text-align:left; width:max-content;
}
.uuid:hover { background:var(--field); }
.uuid.copied { background:color-mix(in srgb, #3f9b6b 14%, transparent); }
.uuid.is-empty { cursor:default; }
.uuid-label { width:44px; font-size:10px; font-weight:600; letter-spacing:.1em; text-transform:uppercase; color:var(--faint); }
.mono-s { font-family:ui-monospace, "SF Mono", Consolas, monospace; font-size:13px; }
.uuid.wide { margin:0; padding:4px 8px; max-width:100%; }
.uuid.wide .mono-s { overflow-wrap:anywhere; white-space:normal; }

.pill { display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:600; white-space:nowrap; border:1px solid transparent; }
.pill::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.pill-open { color:#3b6fb6; background:color-mix(in srgb, #3b6fb6 10%, transparent); }
.pill-in_progress { color:#b5782a; background:color-mix(in srgb, #c0862f 12%, transparent); }
.pill-paid { color:#6a55b0; background:color-mix(in srgb, #7a63c4 11%, transparent); }
.pill-success { color:#2f8a5c; background:color-mix(in srgb, #3f9b6b 12%, transparent); }
.pill-expired { color:#b54a3c; background:color-mix(in srgb, #c0503f 9%, transparent); border-color:color-mix(in srgb, #c0503f 18%, transparent); }
.pill-cancelled { color:var(--muted); background:var(--field); border-color:var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill-open { color:#8fb4ea; } :root:not([data-theme="light"]) .pill-in_progress { color:#e2b36b; } :root:not([data-theme="light"]) .pill-paid { color:#b3a2ec; } :root:not([data-theme="light"]) .pill-success { color:#79c9a0; } :root:not([data-theme="light"]) .pill-expired { color:#ee9a8e; } }
:root[data-theme="dark"] .pill-open { color:#8fb4ea; } :root[data-theme="dark"] .pill-in_progress { color:#e2b36b; } :root[data-theme="dark"] .pill-paid { color:#b3a2ec; } :root[data-theme="dark"] .pill-success { color:#79c9a0; } :root[data-theme="dark"] .pill-expired { color:#ee9a8e; }

.kv { background:var(--surface); border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.kv-row { display:grid; grid-template-columns:200px minmax(0,1fr); gap:16px; padding:14px 20px; align-items:center; }
.kv-row + .kv-row { border-top:1px solid var(--line); }
.kv-key { font-size:11px; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); }
@media (max-width:560px) { .kv-row { grid-template-columns:1fr; gap:4px; } }

.timeline { list-style:none; margin:0; padding:0 0 0 4px; display:flex; flex-direction:column; gap:18px; }
.timeline li { position:relative; display:flex; gap:14px; }
.timeline li:not(:last-child)::after { content:""; position:absolute; left:4px; top:16px; bottom:-18px; width:1px; background:var(--line); }
.tl-dot { flex:none; width:9px; height:9px; margin-top:6px; border-radius:50%; background:var(--line-strong); }
input[type="search"] {
  width:100%; padding:0 16px; border-radius:10px; border:1px solid var(--line); background:var(--field);
  color:var(--text); font:inherit; transition:border-color .2s, box-shadow .2s, background .2s;
}
input[type="search"]::placeholder { color:var(--faint); }
input[type="search"]:hover { border-color:var(--line-strong); }
input[type="search"]:focus { outline:none; border-color:var(--line-strong); background:var(--surface); box-shadow:0 0 0 4px var(--focus); }
.uuid.wide { margin-left:-8px; }

/* Диспуты */
.pill-dispute, .pill-d-open { color:#b54a3c; background:color-mix(in srgb, #c0503f 11%, transparent); }
.pill-d-in_review { color:#b5782a; background:color-mix(in srgb, #c0862f 12%, transparent); }
.pill-d-closed { color:var(--muted); background:var(--field); border-color:var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill-dispute, :root:not([data-theme="light"]) .pill-d-open { color:#ee9a8e; } :root:not([data-theme="light"]) .pill-d-in_review { color:#e2b36b; } }
:root[data-theme="dark"] .pill-dispute, :root[data-theme="dark"] .pill-d-open { color:#ee9a8e; } :root[data-theme="dark"] .pill-d-in_review { color:#e2b36b; }
.side { display:inline-block; margin-left:4px; padding:1px 7px; border-radius:5px; font-size:11px; font-weight:600; letter-spacing:.04em;
        border:1px solid var(--line-strong); color:var(--muted); vertical-align:1px; }
.kpi-closed { display:grid; grid-template-columns:28px minmax(60px,1fr); align-items:center; gap:10px; min-width:120px; }
.ex-form { display:flex; flex-direction:row; flex-wrap:wrap; align-items:flex-end; gap:12px; }
.ex-form .field { margin:0; flex:1 1 140px; max-width:220px; }
.ex-form .field.grow { flex:2 1 200px; max-width:none; }
.ex-form .form-actions { margin:0; }
.ex-form button[type="submit"] { margin-top:0; height:44px; }
.ex-form .error { flex:1 1 100%; }
.inv-act { display:flex; flex-direction:column; gap:16px; }
.inv-act-btns { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.inv-act-btns button { margin:0; height:36px; padding:0 14px; font-size:13px; font-weight:500; letter-spacing:.04em; box-sizing:border-box; }
.dsp-form { display:flex; flex-direction:column; gap:18px; }
.dsp-form form { margin:0; }
.form-actions { display:flex; justify-content:flex-end; gap:10px; flex-wrap:wrap; }
.pre { white-space:pre-wrap; }
.inline-link { color:inherit; text-decoration:underline; text-decoration-color:var(--line-strong); text-underline-offset:3px; }
.inline-link:hover { color:var(--text); }
.row-between { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.section-head .filter { margin-left:auto; }
.kpi th { white-space:nowrap; }
.kpi .kpi-closed { min-width:100px; }
.field .segmented { align-self:flex-start; max-width:100%; flex-wrap:wrap; }
.against { margin-top:4px; font-size:13px; }
#dsp-body td:nth-child(3) .muted { font-size:12px; }
#dsp-body td { padding-left:12px; padding-right:12px; }

/* Фильтры инвойсов */
.filters {
  display:grid; grid-template-columns:repeat(auto-fit, minmax(130px, 1fr)); gap:12px; align-items:end;
  margin:0 0 12px; padding:16px; background:var(--surface); border:1px solid var(--line); border-radius:14px;
}
.f-field { display:flex; flex-direction:column; gap:6px; min-width:0; }
.f-field label { margin:0; font-size:10px; }
.f-field select, .f-field input { height:40px; font-size:14px; padding:0 10px; }
.f-field input[type="date"] { padding:0 8px; }
.f-field input[type="number"], .f-field input[type="date"] {
  width:100%; border-radius:10px; border:1px solid var(--line); background:var(--field); color:var(--text); font:inherit; font-size:14px;
}
.f-field input:focus { outline:none; border-color:var(--line-strong); background:var(--surface); box-shadow:0 0 0 4px var(--focus); }
.f-actions { display:flex; align-items:end; }
.f-actions .ghost { height:40px; width:100%; }
.found { margin:0 0 12px; min-height:18px; }
.filters { grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); }
.found { display:flex; align-items:center; gap:8px; }

/* Технический путь инвойса */
.trace { list-style:none; margin:0; padding:0; background:var(--surface); border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.trace-step { display:grid; grid-template-columns:44px minmax(0,1fr); }
.trace-step + .trace-step { border-top:1px solid var(--line); }
.trace-num { padding:16px 0; text-align:center; font-size:12px; color:var(--faint); border-right:1px solid var(--line); background:var(--field); }
.trace-body { padding:14px 18px; display:flex; flex-direction:column; gap:6px; min-width:0; }
.trace-head { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.trace-time { margin-left:auto; }
.trace-code { font-family:ui-monospace, "SF Mono", Consolas, monospace; font-size:12.5px; padding:2px 7px; border-radius:6px; background:var(--field); border:1px solid var(--line); }
.trace-side { font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; padding:2px 8px; border-radius:5px; color:var(--muted); border:1px solid var(--line-strong); }
.trace-plata { color:var(--text); background:var(--field); }
.trace-comment { font-size:14px; line-height:1.55; }
.trace-data summary { cursor:pointer; font-size:12px; color:var(--muted); width:max-content; }
.trace-data summary:hover { color:var(--text); }
.trace-data pre { margin:8px 0 0; font-size:12px; }

/* Мерчанты и магазины */
.merch-list { display:flex; flex-direction:column; gap:20px; }
.merch-card { background:var(--surface); border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.merch-head { display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; padding:18px 20px; }
.merch-name { font-family:var(--serif); font-size:24px; line-height:1.2; }
.merch-stats { display:flex; gap:20px; font-size:14px; }
.merch-empty { padding:0 20px 18px; margin:0; }
.table-wrap.flat { border:0; border-top:1px solid var(--line); border-radius:0; }
.pill-st-active, .pill-k-active { color:#2f8a5c; background:color-mix(in srgb, #3f9b6b 12%, transparent); }
.pill-st-paused { color:var(--muted); background:var(--field); }
.pill-st-blocked { color:#b54a3c; background:color-mix(in srgb, #c0503f 11%, transparent); }
.row-acts { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.row-acts button { margin:0; }
.pill-k-revoked { color:var(--muted); background:var(--field); border-color:var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill-st-active, :root:not([data-theme="light"]) .pill-k-active { color:#79c9a0; } :root:not([data-theme="light"]) .pill-st-blocked { color:#ee9a8e; } }
:root[data-theme="dark"] .pill-st-active, :root[data-theme="dark"] .pill-k-active { color:#79c9a0; } :root[data-theme="dark"] .pill-st-blocked { color:#ee9a8e; }
.keys .mono-s { font-size:12px; }
.keys tr.is-current td { background:color-mix(in srgb, var(--field) 55%, transparent); }
.secret { display:flex; align-items:center; gap:4px; flex-wrap:wrap; }
.secret-value { overflow-wrap:anywhere; }
.note-line { margin-top:12px; }
.stores-table { table-layout:fixed; }
.stores-table td:first-child { overflow:hidden; text-overflow:ellipsis; }
.stores-table td:first-child div { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.key-cell { min-width:0; }
.key-line { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.key-line + .key-line { margin-top:6px; }
.key-line .uuid-label { width:48px; flex:none; }
.key-line .uuid { margin-left:0; }
.secret-value { padding:2px 0; }
.key-line .secret-value { padding:2px 6px; }
.stores-table th { white-space:nowrap; }
.head-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.key-state { margin-top:8px; }
.kv .key-cell .key-line + .key-line { margin-top:6px; }

/* Комиссия магазина */
.commission { display:grid; grid-template-columns:minmax(160px, 220px) minmax(0,1fr); gap:28px; align-items:start; margin:0; padding:22px 24px; }
@media (max-width:640px) { .commission { grid-template-columns:1fr; gap:16px; } }
.com-value { font-family:var(--serif); font-size:52px; line-height:1; }
.com-now .muted { margin-top:8px; }
.com-edit { display:flex; flex-direction:column; gap:8px; }
.com-edit label { margin:0; }
.com-row { display:flex; gap:10px; flex-wrap:wrap; }
.com-row button { height:48px; }
.pct-input { position:relative; width:160px; }
.pct-input input { width:100%; height:48px; padding:0 34px 0 14px; border-radius:10px; border:1px solid var(--line); background:var(--field);
  color:var(--text); font:inherit; font-size:16px; font-variant-numeric:tabular-nums; }
.pct-input input:focus { outline:none; border-color:var(--line-strong); background:var(--surface); box-shadow:0 0 0 4px var(--focus); }
.pct-input span { position:absolute; right:14px; top:50%; transform:translateY(-50%); color:var(--muted); }
.com-edit .muted { margin:0; }
.com-history { list-style:none; margin:12px 0 0; padding:0; display:flex; flex-direction:column; gap:8px; }
.com-history li { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:10px 16px; font-size:14px;
  background:var(--surface); border:1px solid var(--line); border-radius:10px; }
.merch-stats { gap:28px; flex-wrap:wrap; }
.turn { display:flex; flex-direction:column; gap:2px; text-align:right; }
.turn-label { font-size:10px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); white-space:nowrap; }
.turn-value { font-size:17px; }
@media (max-width:640px) { .turn { text-align:left; } }
.dispute-note { color:#b54a3c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dispute-note { color:#ee9a8e; } }
:root[data-theme="dark"] .dispute-note { color:#ee9a8e; }
.blocked-note { margin:-12px 0 20px; padding:12px 16px; border-radius:10px; font-size:14px;
  color:#b54a3c; background:color-mix(in srgb, #c0503f 9%, transparent); border:1px solid color-mix(in srgb, #c0503f 25%, transparent); }
/* Много вкладок: меню прокручивается, низ панели всегда виден */
.sidebar { overflow:hidden; }
.sidebar .tabs { flex:1 1 auto; min-height:0; overflow-y:auto; margin-right:-8px; padding-right:8px; }
.tab { padding-top:9px; padding-bottom:9px; }
.sidebar-caption { margin-bottom:20px; }
@media (max-width:820px) { .sidebar .tabs { margin-right:0; padding-right:0; } }

/* Курсы */
.rate-group + .rate-group { margin-top:36px; }
.rate-sign { font-family:var(--sans); font-size:18px; }
.rate-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:12px; }
.rate-card { background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:14px 16px; min-width:0; }
.rate-card.has-error { opacity:.78; }
.rate-card-head { display:flex; justify-content:space-between; align-items:baseline; gap:10px; margin-bottom:6px; }
.pair { font-size:15px; }
.src { font-size:12px; color:var(--muted); text-decoration:none; }
.src:hover { color:var(--text); text-decoration:underline; }
.rate-card-val { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.rate-value { font-size:18px; font-weight:600; }
.chg { font-size:12px; font-weight:600; white-space:nowrap; }
.chg-up { color:#2f8a5c; } .chg-down { color:#b54a3c; } .chg-flat { color:var(--muted); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chg-up { color:#79c9a0; } :root:not([data-theme="light"]) .chg-down { color:#ee9a8e; } }
:root[data-theme="dark"] .chg-up { color:#79c9a0; } :root[data-theme="dark"] .chg-down { color:#ee9a8e; }
.rate-chart { flex:none; width:108px; height:28px; }
.spark { display:block; color:var(--muted); }
.rate-card-foot { display:flex; flex-wrap:wrap; align-items:center; gap:6px 8px; margin-top:8px; }
.rate-card-time { margin-left:auto; }
.rate-card.has-error .rate-value { color:var(--muted); }
.content-head.row .grow { flex:1 1 320px; min-width:0; }

/* Группы */
.grp-list { display:flex; flex-direction:column; gap:16px; }
.grp-card { display:block; color:inherit; text-decoration:none; background:var(--surface); border:1px solid var(--line); border-radius:14px;
  transition:border-color .15s, box-shadow .15s; }
.grp-card:hover { border-color:var(--line-strong); box-shadow:0 8px 24px -16px rgba(30,38,50,.35); }
.grp-card:focus-visible { outline:none; box-shadow:0 0 0 4px var(--focus); }
.grp-head { display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; padding:18px 20px; border-bottom:1px solid var(--line); }
.grp-members { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px,1fr)); gap:18px; padding:16px 20px 18px; }
.grp-members .panel-title { margin-bottom:10px; }
.grp-sections { display:grid; grid-template-columns:repeat(auto-fit, minmax(270px,1fr)); gap:16px; margin-top:24px; align-items:start; }
.grp-section { display:flex; flex-direction:column; gap:12px; }
.grp-section .panel-title { margin:0; }
.member-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.member-list li { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:9px 0; border-bottom:1px solid var(--line); font-size:14px; }
.member-list li:last-child { border-bottom:0; }
.member-list li .grow { flex:1; min-width:0; }
.member-pos { flex:none; width:24px; height:24px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700; background:var(--field); border:1px solid var(--line-strong); }
.member-move { display:inline-flex; gap:2px; }
.member-move button { padding:0 6px; font-size:15px; }
.member-move button:disabled { opacity:.3; cursor:default; }
.grp-order-hint { margin:-4px 0 0; }
.grp-flow { margin-top:24px; display:flex; flex-direction:column; gap:10px; }
.grp-flow .panel-title { margin:0; }
.grp-flow p { margin:0; line-height:1.5; }
.grp-timers { display:flex !important; flex-direction:row !important; flex-wrap:wrap; align-items:flex-end !important; justify-content:flex-start; gap:12px; margin:4px 0 0; }
.grp-timers .field { flex:1 1 180px; max-width:240px; margin:0; }
.grp-timers input[type="number"] { height:44px; }
.grp-timers button { flex:none; margin-top:0; height:44px; }
.member-add { display:flex; gap:8px; margin:0; }
.member-add select { height:40px; font-size:14px; flex:1; min-width:0; }
.member-add button { height:40px; }
button.danger-ghost { color:var(--error); border-color:color-mix(in srgb, var(--error) 35%, var(--line)); }
button.danger-ghost:hover { background:var(--error-bg); }
.member-add { flex-direction:row; align-items:center; gap:8px; margin:0; }
.member-add select { height:40px !important; padding:0 12px; }
.member-add button { flex:none; height:40px; }
.member-add button[type="submit"] { margin-top:0; }
.member-add .sal-pct { flex:none; width:108px; }
.agent-pct { margin:0; }
.agent-pct .sal-pct { width:96px; }
#agent-root { display:flex; flex-direction:column; gap:16px; }
.agent-card .merch-head { align-items:flex-start; }
.agent-rate-box { display:flex; flex-direction:column; align-items:flex-end; gap:6px; }
.agent-rate { margin:0; }
.agent-rate .sal-pct { width:128px; }
.agent-rate .sal-pct input { height:44px; font-variant-numeric:tabular-nums; font-size:16px; }
.agent-people { display:flex; flex-direction:column; gap:18px; padding:4px 20px 18px; }
.agent-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:12px; }
.agent-person { display:flex; flex-direction:column; gap:12px; padding:14px; border:1px solid var(--line); border-radius:12px; background:var(--field); }
.agent-person-top { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
.agent-person-name { font-size:16px; font-weight:700; line-height:1.2; }
.agent-person-stats { display:grid; grid-template-columns:1fr 1fr; gap:10px 12px; }
.agent-person-stats .wide { grid-column:1 / -1; padding-top:8px; border-top:1px solid var(--line); }
.agent-stat-label { font-size:10px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); }
.agent-stat-value { margin-top:2px; font-size:15px; }
.agent-person-stats .wide .agent-stat-value { font-size:18px; }
.agent-add { display:flex; flex-direction:column; gap:10px; margin:0; padding:14px 20px 18px; border-top:1px solid var(--line); }
.agent-add .panel-title { margin:0; }
.agent-add-row { display:flex; gap:8px; align-items:center; }
.agent-add-row select { height:40px; flex:1; min-width:0; font-size:14px; }
.agent-add-row .sal-pct { flex:none; width:108px; }
.agent-add-row .sal-pct input { height:40px; }
.agent-add-row button { flex:none; height:40px; margin:0; }
.agent-link-pct { margin:0; }
.agent-link-pct .sal-pct { width:120px; }
.agent-link-pct .sal-pct input { height:40px; }
.agent-note { margin:0; }
.agent-empty { margin:0; padding:0 20px 16px; }
.dir { display:inline-block; margin-top:4px; padding:2px 9px; border-radius:6px; font-size:12px; font-weight:600; letter-spacing:.02em; border:1px solid var(--line-strong); color:var(--text); background:var(--field); }
.chip-link { text-decoration:none; color:var(--text); }
.chip-link:hover { border-color:var(--line-strong); background:var(--surface); }
.stores-table td:nth-child(2) { overflow:visible; }
.stores-table .chips { flex-wrap:wrap; }
.trd-table th { white-space:normal; line-height:1.4; }

/* Трейдеры: статус, депозиты, комиссия по направлению */
.trd-title { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.trd-toggle { margin:6px 0 0 -8px; }
.turn-sep { width:1px; align-self:stretch; background:var(--line); }
.merch-card.is-blocked .merch-name { color:var(--muted); }
.blocked-note.in-card { margin:0 20px 16px; }
.trd-streak { margin:0 20px 16px; padding-top:12px; border-top:1px solid var(--line); }
.trd-streak-hint { flex:1 1 100%; margin:0; }
.trd-streak .error { flex:1 1 100%; }
.pct-inline { display:flex; flex-direction:row; align-items:center; gap:8px; margin:0; }
.pct-input.sm { width:104px; }
.pct-input.sm input { height:36px; font-size:14px; padding:0 28px 0 10px; }
.pct-input.sm span { right:10px; font-size:13px; }
.pct-inline button { height:36px; padding:0 12px; font-size:12px; margin:0; }
.pct-inline.saved input { border-color:#3f9b6b; box-shadow:0 0 0 3px color-mix(in srgb, #3f9b6b 18%, transparent); }
.pct-inline.bad input { border-color:var(--error); }
@media (max-width:640px) { .turn-sep { display:none; } }
.pct-input input::-webkit-outer-spin-button, .pct-input input::-webkit-inner-spin-button { -webkit-appearance:none; margin:0; }
.pct-input input[type="number"] { -moz-appearance:textfield; appearance:textfield; }
.trd-table th { white-space:nowrap; }

/* Депозиты трейдера */
.cur { font-size:11px; font-weight:600; color:var(--muted); letter-spacing:.04em; }
.frozen-line { margin-top:2px; color:#3b6fb6; white-space:nowrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .frozen-line { color:#8fb4ea; } }
:root[data-theme="dark"] .frozen-line { color:#8fb4ea; }
.trd-actions { display:flex; gap:4px; margin:6px 0 0 -8px; }
.trd-actions .trd-toggle { margin:0; }
.modal-xwide { width:min(820px, calc(100vw - 32px)); }
.dep-wrap { display:flex; flex-direction:column; gap:14px; }
.dep-wrap h2 { margin:0; }
.dep-wrap > .muted { margin:-6px 0 0; }
.dep-form { display:grid; grid-template-columns:130px auto 130px minmax(160px,1fr) auto; gap:12px; align-items:end; margin:0;
  padding:16px; border:1px solid var(--line); border-radius:12px; background:var(--field); }
.dep-form .field { gap:6px; min-width:0; }
.dep-form label { margin:0; }
.dep-form select, .dep-form input[type="text"], .dep-form input[type="number"] { height:40px; font-size:14px; background:var(--surface); }
.dep-form input[type="number"] { width:100%; padding:0 12px; border-radius:10px; border:1px solid var(--line); color:var(--text); font:inherit; font-size:14px; }
.dep-form input[type="number"]:focus { outline:none; border-color:var(--line-strong); box-shadow:0 0 0 4px var(--focus); }
.dep-form .segmented { background:var(--surface); }
.dep-submit-wrap button { height:40px; margin:0; }
@media (max-width:760px) { .dep-form { grid-template-columns:1fr 1fr; } .dep-form .grow2, .dep-submit-wrap { grid-column:1 / -1; } }
.dep-table { max-height:340px; overflow:auto; }
.op-credit, .op-unfreeze { color:#2f8a5c; } .op-debit, .op-settle { color:#b54a3c; } .op-freeze { color:#3b6fb6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .op-credit, :root:not([data-theme="light"]) .op-unfreeze { color:#79c9a0; } :root:not([data-theme="light"]) .op-debit, :root:not([data-theme="light"]) .op-settle { color:#ee9a8e; } :root:not([data-theme="light"]) .op-freeze { color:#8fb4ea; } }
:root[data-theme="dark"] .op-credit, :root[data-theme="dark"] .op-unfreeze { color:#79c9a0; } :root[data-theme="dark"] .op-debit, :root[data-theme="dark"] .op-settle { color:#ee9a8e; } :root[data-theme="dark"] .op-freeze { color:#8fb4ea; }
.trd-card .merch-head { display:grid; grid-template-columns:minmax(180px, 1fr) auto; align-items:start; }
.trd-card .merch-stats { justify-content:flex-end; gap:22px; }
.trd-card .turn-value { font-size:16px; }
@media (max-width:980px) { .trd-card .merch-head { grid-template-columns:1fr; } .trd-card .merch-stats { justify-content:flex-start; } .trd-card .turn { text-align:left; } }
.dep-form { grid-template-columns:130px max-content 130px minmax(140px,1fr) auto; }
.dep-form .segmented { flex-direction:row; flex-wrap:nowrap; }
@media (max-width:760px) { .dep-form { grid-template-columns:1fr 1fr; } }
.dep-form { grid-template-columns:118px max-content 108px minmax(90px,1fr) auto; }
@media (max-width:760px) { .dep-form { grid-template-columns:1fr 1fr; } }
.dep-form > * { min-width:0; }
.grp-tags { display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin:0; }
.dir-cur { background:transparent; }
.h-cur { font-family:var(--sans); font-size:18px; color:var(--muted); font-weight:600; letter-spacing:.04em; }
.income { color:#2f8a5c; } .income.neg { color:#b54a3c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .income { color:#79c9a0; } :root:not([data-theme="light"]) .income.neg { color:#ee9a8e; } }
:root[data-theme="dark"] .income { color:#79c9a0; } :root[data-theme="dark"] .income.neg { color:#ee9a8e; }
.econ td:first-child { width:44%; }
.econ tr.econ-total td { border-top:1px solid var(--line-strong); background:color-mix(in srgb, var(--field) 60%, transparent); font-size:15px; }
.econ tr.econ-total td.strong, .econ tr.econ-total .strong { color:#2f8a5c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .econ tr.econ-total .strong { color:#79c9a0; } }
:root[data-theme="dark"] .econ tr.econ-total .strong { color:#79c9a0; }
.inv-date { margin-top:4px; }
#inv-body td, #inv-body ~ thead th, .inv-table th { padding-left:12px; padding-right:12px; }
.inv-table th, #inv-body td { padding-left:10px; padding-right:10px; }
.inv-table .uuid-label { width:38px; }
.inv-table .mono-s { font-size:12px; }
.inv-table td.actions { padding-left:4px; padding-right:8px; }
.inv-table td.actions .link { padding:4px 4px; }
.inv-table .side { margin-left:2px; }
.inv-table .uuid-label { width:40px; font-size:9px; letter-spacing:.08em; }
.inv-table .uuid { gap:6px; }

.small-btn { padding:4px 12px; font-size:12px; }

/* Чекер чеков */
.pill-v-clean { color:#2f8a5c; background:color-mix(in srgb, #3f9b6b 12%, transparent); }
.pill-v-suspicious { color:#a8661c; background:color-mix(in srgb, #d08a2a 14%, transparent); }
.pill-v-problem { color:#b54a3c; background:color-mix(in srgb, #c0503f 11%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill-v-clean { color:#79c9a0; } :root:not([data-theme="light"]) .pill-v-suspicious { color:#e8b46a; } :root:not([data-theme="light"]) .pill-v-problem { color:#ee9a8e; } }
:root[data-theme="dark"] .pill-v-clean { color:#79c9a0; } :root[data-theme="dark"] .pill-v-suspicious { color:#e8b46a; } :root[data-theme="dark"] .pill-v-problem { color:#ee9a8e; }
.rc-wrap { border:1px solid var(--line); border-radius:14px; background:var(--surface); overflow:hidden; }
.rc { padding:16px 18px; }
.rc + .rc, .rc-hist .rc { border-top:1px solid var(--line); }
.rc-old { opacity:.8; }
.rc-head { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.rc-score { font-size:20px; font-weight:600; }
.rc-score .muted { font-size:12px; font-weight:500; }
.rc-flags { list-style:none; margin:12px 0 0; padding:0; display:grid; gap:6px; }
.rc-f { display:flex; gap:10px; align-items:baseline; font-size:13px; line-height:1.45; }
.rc-lvl { flex:0 0 96px; font-size:11px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); }
.rc-critical .rc-lvl, .rc-high .rc-lvl { color:#b54a3c; }
.rc-medium .rc-lvl { color:#a8661c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rc-critical .rc-lvl, :root:not([data-theme="light"]) .rc-high .rc-lvl { color:#ee9a8e; } :root:not([data-theme="light"]) .rc-medium .rc-lvl { color:#e8b46a; } }
:root[data-theme="dark"] .rc-critical .rc-lvl, :root[data-theme="dark"] .rc-high .rc-lvl { color:#ee9a8e; } :root[data-theme="dark"] .rc-medium .rc-lvl { color:#e8b46a; }
.rc-ok { margin:10px 0 0; }
.rc-meta { display:flex; flex-wrap:wrap; gap:6px 18px; margin-top:12px; padding-top:10px; border-top:1px dashed var(--line); }
.rc-meta b { color:var(--text); font-weight:600; }
.rc-hist { border-top:1px solid var(--line); }
.rc-hist summary { cursor:pointer; padding:10px 18px; font-size:13px; color:var(--muted); }
.rc-mark { color:#c0862f; font-size:13px; }
@media (max-width: 640px) { .rc-f { flex-direction:column; gap:2px; } .rc-lvl { flex:none; } }

/* Изменение суммы в диспуте */
.amt-panel { display:flex; gap:28px; align-items:flex-start; flex-wrap:wrap; }
.amt-now { min-width:160px; }
.amt-edit, .amt-pending { flex:1; min-width:280px; display:flex; flex-direction:column; gap:10px; }
.amt-row { display:flex; gap:12px; flex-wrap:wrap; }
.amt-row .field { margin:0; }
.amt-row .field.grow { flex:1; min-width:200px; }
.amt-row input[type=number] { width:170px; }
.amt-pend-head { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.amt-decide { display:flex; gap:8px; flex-wrap:wrap; margin-top:4px; }
.amt-decide input { flex:1; min-width:200px; }
.amt-lock { margin:6px 0 0; }
.amt-was { color:#a8661c; font-size:13px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .amt-was { color:#e8b46a; } }
:root[data-theme="dark"] .amt-was { color:#e8b46a; }
.amt-history { list-style:none; margin:14px 0 0; padding:0; display:grid; gap:10px; }
.amt-history li { padding:12px 16px; border:1px solid var(--line); border-radius:12px; background:var(--surface); display:grid; gap:4px; }
.url-form { display:flex; flex-direction:column; gap:10px; }
.url-form .field { margin:0; }
.url-form .com-row input { flex:1; min-width:220px; }
.deliveries .out-err { max-width:260px; white-space:normal; margin-top:4px; }
@media (max-width: 640px) { .amt-row input[type=number] { width:100%; } }

/* ---------- Личный кабинет сотрудника ---------- */
.cab { max-width:820px; }
.cab-card { padding:28px 30px; margin-top:22px; }
.cab-shift { display:flex; justify-content:space-between; align-items:center; gap:24px; flex-wrap:wrap; }
.cab-label { font-size:11px; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:var(--muted); }
.cab-state { margin-top:10px; }
.cab-timer { font-family:var(--serif); font-size:54px; line-height:1.1; margin-top:10px; letter-spacing:.02em; }
.cab-shift .muted.small { margin:6px 0 0; max-width:440px; }
.cab-btn { min-width:210px; height:52px; font-size:15px; }
.cab-head { display:flex; justify-content:space-between; align-items:baseline; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.cab-head h2 { margin:0; font-family:var(--serif); font-weight:500; font-size:26px; }
.cab-hint { margin-top:4px; }
.cab-access { width:100%; }
.cab-card .error { margin-top:14px; }
@media (max-width:560px) {
  .cab-card { padding:22px 16px; } .cab-btn { width:100%; } .cab-timer { font-size:42px; }
  .cab-access th, .cab-access td { padding-left:8px; padding-right:8px; }
  .cab-access th:nth-child(2), .cab-access td:nth-child(2) { display:none; }
}

/* ---------- Смены сотрудника (админка) ---------- */
.stats-3 { grid-template-columns:repeat(auto-fit, minmax(180px,1fr)); }
.shifts { display:grid; gap:10px; }
.shift { border:1px solid var(--line); border-radius:14px; background:var(--surface); }
.shift summary { list-style:none; cursor:pointer; display:grid; grid-template-columns:minmax(200px,1.4fr) 120px minmax(150px,1fr) 110px; gap:12px; align-items:center; padding:14px 18px; }
.shift summary::-webkit-details-marker { display:none; }
.shift summary:hover { background:color-mix(in srgb, var(--field) 60%, transparent); border-radius:14px; }
.shift[open] summary { border-bottom:1px solid var(--line); border-radius:14px 14px 0 0; }
.shift-cnt { text-align:right; }
.shift-body { padding:12px 18px 16px; }
.shift-log { list-style:none; margin:0; padding:0; display:grid; gap:2px; }
.shift-log li { display:grid; grid-template-columns:56px 1fr auto; gap:12px; padding:7px 0; border-bottom:1px dashed var(--line); font-size:14px; }
.shift-log li:last-child { border-bottom:0; }
.shift-outside { background:transparent; border-style:dashed; }
.act-stack { display:flex; flex-direction:column; align-items:flex-end; gap:6px; }
@media (max-width:720px) {
  .shift summary { grid-template-columns:1fr auto; }
  .shift-end, .shift-cnt { text-align:left; }
  .shift-log li { grid-template-columns:48px 1fr; } .shift-log li > :last-child { display:none; }
}

/* ---------- Вход: код двухфакторной защиты ---------- */
.code-lead { margin:0 0 18px; line-height:1.5; }
.code-hint { margin:-6px 0 16px; }
#code { font-size:22px; letter-spacing:.3em; text-align:center; }
.code-back { width:100%; margin-top:10px; }

/* ---------- Настройки ---------- */
.set-sec .panel { display:flex; flex-direction:column; gap:14px; }
.set-row { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.set-form .field, .tf-form .field { margin:0; }
.set-ok { margin:0; padding:10px 14px; border-radius:10px; font-size:14px; color:#2f8a5c; background:color-mix(in srgb, #3f9b6b 12%, transparent); }
.theme-options { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:12px; }
.theme-opt { cursor:pointer; }
.theme-opt input { position:absolute; opacity:0; pointer-events:none; }
.theme-card { display:flex; flex-direction:column; gap:10px; padding:12px; border:1px solid var(--line); border-radius:14px; transition:border-color .2s, box-shadow .2s; }
.theme-opt:hover .theme-card { border-color:var(--line-strong); }
.theme-opt input:checked + .theme-card { border-color:var(--text); box-shadow:0 0 0 3px var(--focus); }
.theme-opt input:focus-visible + .theme-card { box-shadow:0 0 0 4px var(--focus); }
.theme-prev { height:64px; border-radius:9px; display:grid; grid-template-columns:28% 1fr; grid-template-rows:1fr 1fr; gap:5px; padding:7px; border:1px solid rgba(0,0,0,.08); }
.theme-prev i { border-radius:5px; }
.theme-prev i:first-child { grid-row:span 2; }
.theme-light .theme-prev { background:#eceef1; } .theme-light .theme-prev i { background:#fbfbfc; } .theme-light .theme-prev i:last-child { background:#262a31; width:45%; }
.theme-dark .theme-prev { background:#111317; border-color:#2a2e35; } .theme-dark .theme-prev i { background:#1f2228; } .theme-dark .theme-prev i:last-child { background:#e3e6ea; width:45%; }
.theme-system .theme-prev { background:linear-gradient(135deg, #eceef1 50%, #111317 50%); } .theme-system .theme-prev i { background:color-mix(in srgb, #888 35%, transparent); } .theme-system .theme-prev i:last-child { width:45%; }
.theme-name { font-size:14px; font-weight:600; text-align:center; }
.tf-head { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; flex-wrap:wrap; }
.tf-desc { margin:10px 0 0; max-width:520px; line-height:1.5; }
.tf-actions { display:flex; gap:10px; flex-wrap:wrap; }
.tf-steps { margin:4px 0 0; padding-left:22px; display:grid; gap:18px; }
.tf-steps > li > b { display:block; }
.tf-steps > li > .muted { display:block; margin-top:2px; }
.tf-qr-row { display:flex; gap:22px; align-items:center; flex-wrap:wrap; margin-top:12px; }
.tf-qr { width:184px; height:184px; padding:8px; background:#fff; border-radius:12px; border:1px solid var(--line); }
.tf-qr svg { display:block; width:100%; height:100%; }
.prov-wallet { display:flex; gap:28px; align-items:flex-start; flex-wrap:wrap; }
.prov-wallet .mono-s { font-size:15px; overflow-wrap:anywhere; }
.tf-key { display:flex; flex-direction:column; gap:8px; max-width:320px; align-items:flex-start; }
.tf-secret { font-family:ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size:15px; letter-spacing:.06em; padding:10px 12px; border-radius:10px; background:var(--field); border:1px solid var(--line); word-break:break-all; }
.tf-code { display:flex; flex-direction:row; gap:10px; align-items:center; justify-content:flex-start; flex-wrap:wrap; margin-top:10px; }
.tf-code > * { margin:0 !important; width:auto; }
.tf-code > span { flex-basis:100%; }
.tf-code input { width:170px !important; height:48px; font-size:20px; letter-spacing:.25em; text-align:center; }
.tf-code button { height:48px; }
.tf-codes h3 { margin:6px 0 6px; font-size:16px; }
.rc-grid { list-style:none; margin:12px 0 16px; padding:0; display:grid; grid-template-columns:repeat(auto-fill, minmax(150px,1fr)); gap:8px; }
.rc-grid li { padding:9px 12px; border-radius:9px; background:var(--field); border:1px solid var(--line); text-align:center; font-size:14px; }
.tf-form { display:flex; flex-direction:column; gap:12px; }
.cab-settings { margin-top:34px; }
.cab-h2 { font-family:var(--serif); font-weight:500; font-size:30px; margin:0 0 4px; }
@media (max-width:640px) {
  .set-row { grid-template-columns:1fr; }
  .theme-options { grid-template-columns:1fr; }
  .tf-qr { width:100%; max-width:240px; height:auto; aspect-ratio:1; }
  .tf-code input { width:100%; }
}

/* ---------- Активные сессии и уведомления о входе ---------- */
.main-col { min-width:0; }
.alert-bar { padding:20px 56px 0; }
.cab .alert-bar { padding:0 0 18px; }
@media (max-width:900px) { .alert-bar { padding:16px 16px 0; } }
.la-bar { border:1px solid color-mix(in srgb, #c0862f 45%, var(--line)); background:color-mix(in srgb, #c0862f 8%, var(--surface)); border-radius:14px; padding:16px 18px; display:grid; gap:10px; }
.la-bar-head { display:flex; flex-direction:column; gap:2px; }
.la-warn { margin:0; font-size:14px; color:var(--error); }
.la-warn .link { margin-left:8px; }
.ss-panel, .la-panel { gap:12px; }
.ss-list, .la-list { display:grid; gap:0; list-style:none; margin:0; padding:0; }
.ss-item, .la-item { display:grid; grid-template-columns:40px 1fr auto; gap:14px; align-items:center; padding:12px 0; border-bottom:1px solid var(--line); }
.ss-item:last-child, .la-item:last-child { border-bottom:0; }
.ss-ico { width:40px; height:40px; border-radius:10px; background:var(--field); border:1px solid var(--line); display:grid; place-items:center; }
.ss-ico svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; color:var(--muted); }
.ss-item.is-current .ss-ico { border-color:color-mix(in srgb, #3f9b6b 45%, var(--line)); }
.ss-main { min-width:0; display:grid; gap:2px; }
.ss-main .strong { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ss-act { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.la-item.unread .strong::before { content:""; width:7px; height:7px; border-radius:50%; background:#c0862f; }
.la-toggle { align-items:flex-start; }
.la-empty { margin:0; }
button.danger-soft { background:transparent; color:var(--error); border:1px solid color-mix(in srgb, var(--error) 45%, transparent); }
button.danger-soft:hover { background:var(--error-bg); }
@media (max-width:640px) {
  .ss-item, .la-item { grid-template-columns:40px 1fr; }
  .ss-act { grid-column:2; justify-content:flex-start; }
}

/* ---------- Реквизиты ---------- */
.req-filters { grid-template-columns:repeat(2, minmax(180px, 260px)); }
.req-head-right { display:flex; align-items:center; gap:12px; flex-wrap:wrap; justify-content:flex-end; }
.req-cell { display:flex; gap:12px; align-items:center; min-width:0; }
.req-cell > div { min-width:0; }
.req-cell .muted.small { white-space:normal; }
.req-ico { width:34px; height:34px; flex:none; border-radius:9px; background:var(--field); border:1px solid var(--line); display:grid; place-items:center; }
.req-ico svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; color:var(--muted); }
.req-num { letter-spacing:.03em; white-space:nowrap; }
.req-table tr.is-off td { opacity:.6; }
.danger-link { color:var(--error) !important; }
@media (max-width:640px) { .req-filters { grid-template-columns:1fr; } }
.req-table { table-layout:fixed; }
.req-table td { vertical-align:top; }
.req-acts { display:flex; flex-wrap:wrap; gap:4px 12px; margin-top:8px; font-size:12px; }
.req-acts .link, .req-cell .link.small { font-size:12px; padding:0; }
.field-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.req-method { font-weight:600; color:var(--text); }
.req-limits { margin:2px 0; }
.req-limits-form { display:flex; gap:6px; align-items:center; margin:4px 0; flex-wrap:wrap; }
.req-limits-form input { width:90px; height:30px; padding:0 8px; font-size:13px; }
.req-cell .link.small { margin-top:4px; }
#dlg-req, #dlg-trader-req { max-height:calc(100vh - 32px); overflow:auto; }
@media (max-width:760px) {
  .req-table colgroup { display:none; }
  .req-table { table-layout:auto; min-width:640px; }
}

/* ---------- Поддержка: чат Sistem ---------- */
.tab-badge { margin-left:auto; min-width:20px; height:20px; padding:0 6px; border-radius:999px; background:#c0503f; color:#fff; font-size:11px; font-weight:700; display:inline-grid; place-items:center; line-height:1; }
.cab-tabs .tab-badge { margin-left:6px; }
.chat-shell { display:grid; grid-template-columns:280px minmax(0,1fr); height:calc(100vh - 220px); min-height:460px; border:1px solid var(--line); border-radius:16px; background:var(--surface); overflow:hidden; }
.chat-list { border-right:1px solid var(--line); padding:8px; overflow-y:auto; background:color-mix(in srgb, var(--field) 45%, var(--surface)); }
.chat-item { width:100%; display:flex; align-items:center; gap:12px; padding:10px; border:0; border-radius:12px; background:transparent; color:var(--text); text-align:left; cursor:pointer; height:auto; font:inherit; letter-spacing:0; }
.chat-item.active, .chat-item:hover { background:var(--surface); box-shadow:0 1px 0 var(--line); }
.chat-item-main { flex:1; min-width:0; display:grid; gap:2px; }
.chat-item-top { display:flex; justify-content:space-between; gap:8px; }
.chat-preview { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-count { min-width:22px; height:22px; padding:0 7px; border-radius:999px; background:#c0503f; color:#fff; font-size:12px; font-weight:700; display:grid; place-items:center; }
.chat-avatar { width:40px; height:40px; flex:none; border-radius:50%; display:grid; place-items:center; font-family:var(--serif); font-size:20px; color:var(--btn-text); background:linear-gradient(140deg, #8c929b, #3a3f47); }
.chat-main { display:grid; grid-template-rows:auto 1fr auto; min-height:0; }
.chat-head { display:flex; gap:12px; align-items:center; padding:14px 18px; border-bottom:1px solid var(--line); }
.chat-feed { overflow-y:auto; padding:18px; display:flex; flex-direction:column; gap:10px; }
.chat-foot { padding:12px 18px; border-top:1px solid var(--line); background:color-mix(in srgb, var(--field) 45%, var(--surface)); }
.chat-compose { display:flex; gap:8px; align-items:center; }
.chat-compose input { flex:1; }
.chat-day, .chat-newline { display:flex; align-items:center; gap:10px; margin:8px 0 2px; font-size:12px; color:var(--muted); }
.chat-day::before, .chat-day::after, .chat-newline::before, .chat-newline::after { content:""; flex:1; height:1px; background:var(--line); }
.chat-newline { color:#c0503f; font-weight:600; }
.chat-newline::before, .chat-newline::after { background:color-mix(in srgb, #c0503f 40%, transparent); }
.chat-more { text-align:center; }
.chat-msg { display:flex; gap:10px; align-items:flex-start; max-width:720px; }
.chat-ico { width:34px; height:34px; flex:none; border-radius:10px; display:grid; place-items:center; background:var(--field); border:1px solid var(--line); }
.chat-ico svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.tone-warn .chat-ico { color:#b5782a; } .tone-bad .chat-ico { color:#b54a3c; } .tone-ok .chat-ico { color:#2f8a5c; } .tone-info .chat-ico { color:#3b6fb6; }
.chat-bubble { flex:1; min-width:0; background:var(--field); border:1px solid var(--line); border-radius:4px 14px 14px 14px; padding:10px 14px; display:grid; gap:4px; }
.chat-msg.unread .chat-bubble { border-color:color-mix(in srgb, #c0503f 35%, var(--line)); }
.chat-title { font-weight:600; font-size:14px; display:flex; justify-content:space-between; gap:12px; }
.chat-time { font-weight:500; font-size:12px; color:var(--muted); }
.chat-text { font-size:14px; line-height:1.5; white-space:pre-line; }
.chat-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:6px; }
a.chat-open { display:inline-flex; align-items:center; padding:4px 12px; border-radius:8px; border:1px solid var(--line-strong); color:var(--text); text-decoration:none; font-weight:600; }
a.chat-open:hover { background:var(--surface); }
.chat-empty { margin:auto; text-align:center; max-width:320px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tone-warn .chat-ico { color:#e2b36b; } :root:not([data-theme="light"]) .tone-bad .chat-ico { color:#ee9a8e; } :root:not([data-theme="light"]) .tone-ok .chat-ico { color:#79c9a0; } :root:not([data-theme="light"]) .tone-info .chat-ico { color:#8fb4ea; } }
:root[data-theme="dark"] .tone-warn .chat-ico { color:#e2b36b; } :root[data-theme="dark"] .tone-bad .chat-ico { color:#ee9a8e; } :root[data-theme="dark"] .tone-ok .chat-ico { color:#79c9a0; } :root[data-theme="dark"] .tone-info .chat-ico { color:#8fb4ea; }
.chat-back { display:none; }
.chat-head { min-width:0; }
.chat-compose input { min-width:0; }
/* вкладки личного кабинета */
.cab-tabs { display:flex; gap:4px; margin:22px 0 4px; border-bottom:1px solid var(--line); overflow-x:auto; }
.cab-tabs a { padding:10px 14px; color:var(--muted); text-decoration:none; font-weight:600; font-size:14px; border-bottom:2px solid transparent; margin-bottom:-1px; white-space:nowrap; display:inline-flex; align-items:center; }
.cab-tabs a.active { color:var(--text); border-bottom-color:var(--text); }
.cab-chat { margin-top:22px; }
.cab-chat .chat-shell { height:calc(100vh - 300px); }
.cab-chat .chat-shell { grid-template-columns:230px minmax(0,1fr); }
@media (max-width:760px) { .cab-chat .chat-shell { grid-template-columns:1fr; } }

/* ---------- Sistem bot (Telegram) ---------- */
.chat-avatar.tg { background:linear-gradient(140deg, #3aa0e0, #2479b8); color:#fff; }
.chat-avatar.ex { background:linear-gradient(140deg, #3d8b6e, #1f5c48); color:#fff; }
.chat-avatar.st { background:linear-gradient(140deg, #c4a574, #8a6a3d); color:#fff; }
.bot-main { grid-template-rows:auto auto 1fr auto; }
.chat-head .grow { flex:1; min-width:0; }
.chat-head .strong .pill { margin-left:8px; vertical-align:middle; }
.bot-tabs { display:flex; gap:4px; padding:0 14px; border-bottom:1px solid var(--line); overflow-x:auto; }
.bot-tab { background:transparent; border:0; border-bottom:2px solid transparent; color:var(--muted); font-weight:600; font-size:13px; padding:10px 10px; height:auto; border-radius:0; margin-bottom:-1px; letter-spacing:0; white-space:nowrap; }
.bot-tab:hover { background:transparent; color:var(--text); }
.bot-tab.active { color:var(--text); border-bottom-color:var(--text); }
.bot-body { overflow-y:auto; min-height:0; }
.bot-body.pad { padding:16px 18px; }
.bot-h3 { margin:6px 0 4px; font-size:15px; }
.bot-body.pad .table-wrap { margin:10px 0 22px; }
.tg-msg { display:flex; }
.tg-msg.out { justify-content:flex-start; }
.tg-msg.in { justify-content:flex-end; }
.tg-bubble { max-width:560px; border:1px solid var(--line); border-radius:14px; padding:8px 12px; background:var(--field); display:grid; gap:3px; }
.tg-msg.in .tg-bubble { background:color-mix(in srgb, #3aa0e0 12%, var(--surface)); border-color:color-mix(in srgb, #3aa0e0 30%, var(--line)); border-radius:14px 4px 14px 14px; }
.tg-msg.out .tg-bubble { border-radius:4px 14px 14px 14px; }
.tg-who { font-size:12px; font-weight:700; color:var(--muted); display:flex; justify-content:space-between; gap:12px; }
.bc-preview { max-width:420px; white-space:pre-line; font-size:14px; }
.bc-fail { color:var(--error); }
.invite-out { margin-top:6px; display:flex; flex-wrap:wrap; gap:6px; align-items:center; justify-content:flex-end; }
.inv-url { font-size:12px; padding:3px 6px; border-radius:6px; background:var(--field); border:1px solid var(--line); word-break:break-all; }
.bind-sel { height:36px; font-size:13px; min-width:180px; }

/* ---------- Финансы ---------- */
.fin-bal { font-size:16px; font-weight:700; }
.fin-bal.pos { color:#2f8a5c; } .fin-bal.neg { color:#b54a3c; }
:root[data-theme="dark"] .fin-bal.pos { color:#79c9a0; } :root[data-theme="dark"] .fin-bal.neg { color:#ee9a8e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fin-bal.pos { color:#79c9a0; } :root:not([data-theme="light"]) .fin-bal.neg { color:#ee9a8e; } }
.bal-form { grid-template-columns:auto 160px 1fr auto; }
@media (max-width:760px) { .bal-form { grid-template-columns:1fr; } }

/* ---------- Финансы: кошельки провайдеров и автовыплаты ---------- */
.fin-tabs { margin:0 0 24px; }
.wal-bar { display:flex; align-items:center; gap:10px 14px; flex-wrap:wrap; margin-bottom:18px; }
.wal-actions { display:flex; gap:8px; flex-wrap:wrap; margin-left:auto; }
.wal-actions button { height:40px; padding:0 16px; margin:0; }
.wal-bar + .error { margin-bottom:16px; }
.wal-treasury { display:flex; flex-direction:row; gap:10px; align-items:center; flex-wrap:wrap; padding:14px 16px; margin:0; }
.wal-treasury input { flex:1 1 320px; height:40px; font-size:14px; font-family:ui-monospace, "SF Mono", Consolas, monospace; min-width:0; }
.wal-treasury button { height:40px; margin:0; }
.wal-table td { vertical-align:top; }
.wal-addr-box { padding:14px 16px; }
.wal-addr-box .mono-s { word-break:break-all; font-size:14px; }
#wal-secret { font-family:ui-monospace, "SF Mono", Consolas, monospace; font-size:14px; }
.po-legs { display:flex; flex-direction:column; gap:6px; }
.po-leg { font-size:13px; line-height:1.5; }
.po-leg .pill { margin-left:4px; font-size:11px; padding:1px 8px; }
.po-err { color:var(--error); }
.po-warn { padding:12px 14px; margin-top:12px; font-size:14px; border-color:color-mix(in srgb, #c0862f 40%, var(--line)); background:color-mix(in srgb, #c0862f 8%, var(--surface)); }
.po-dec-note { padding:12px 14px; font-size:14px; line-height:1.5; }
.po-dec-note .mono-s { word-break:break-all; }
.po-lead { margin:-6px 0 14px; }
.po-table td { vertical-align:top; }
.merch-stores { display:flex; flex-direction:column; gap:12px; }
.merch-store { display:flex; flex-direction:column; gap:12px; }
.merch-meta { display:flex; flex-wrap:wrap; gap:8px 18px; }
.secret-once .mono-s { display:block; margin-top:6px; word-break:break-all; font-size:13px; }
.po-form { display:flex; flex-direction:row; gap:12px; align-items:flex-end; flex-wrap:wrap; margin:0; }
.po-form .field { margin:0; gap:6px; }
.po-form .field.grow { flex:1 1 320px; min-width:0; }
.po-form input { height:42px; }
.po-form #po-addr { font-family:ui-monospace, "SF Mono", Consolas, monospace; font-size:14px; }
.po-form button { height:42px; margin:0; }
.po-hint { margin-top:10px; }
.po-addr { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.po-addr .mono-s { word-break:break-all; font-size:14px; }
.cab-payouts { margin-top:22px; }
.cab-payouts .cab-card { margin-top:18px; }
.cab-payouts .section { margin-top:28px; }
#sweep-list .table-wrap { margin:4px 0 10px; }
#dlg-sweep > div { display:flex; flex-direction:column; gap:14px; }
@media (max-width:640px) {
  .wal-actions { margin-left:0; width:100%; }
  .wal-actions button { flex:1 1 auto; }
  .po-form > * { flex:1 1 100%; }
}
.po-form input[type="number"] { width:180px; padding:0 14px; border-radius:10px; border:1px solid var(--line); background:var(--field); color:var(--text); font:inherit; font-size:15px; }
.po-form input[type="number"]:focus { outline:none; border-color:var(--line-strong); box-shadow:0 0 0 4px var(--focus); }
@media (max-width:640px) { .po-form input[type="number"] { width:100%; } }
.op-wallet_deposit { color:#2f8a5c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .op-wallet_deposit { color:#79c9a0; } }
:root[data-theme="dark"] .op-wallet_deposit { color:#79c9a0; }
.fin-sum { grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); margin:-8px 0 26px; }
.fin-sum .stat { padding:20px 20px 16px; }
.fin-sum-sub { margin-top:6px; font-size:12px; }
@media (max-width:1250px) { .fin-sum { grid-template-columns:repeat(3, minmax(0,1fr)); } }
@media (max-width:760px) { .fin-sum { grid-template-columns:repeat(2, minmax(0,1fr)); } }
@media (max-width:520px) { .fin-sum { grid-template-columns:1fr; } }

/* ---------- Дашборд ---------- */
#dash-period { align-self:flex-end; }
#dash-root { transition:opacity .15s; }
.dash-top, .dash-act { grid-template-columns:repeat(3, minmax(0,1fr)); }
.dash-act { margin-top:16px; }
.dash-act .stat-value { font-size:30px; }
.dash-sub { margin-top:8px; font-size:12px; color:var(--muted); line-height:1.45; }
.dash-delta { display:inline-block; margin-top:8px; font-size:12px; font-weight:600; }
.dash-delta.up { color:#2f8a5c; } .dash-delta.down { color:#b54a3c; }
:root[data-theme="dark"] .dash-delta.up { color:#79c9a0; } :root[data-theme="dark"] .dash-delta.down { color:#ee9a8e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dash-delta.up { color:#79c9a0; } :root:not([data-theme="light"]) .dash-delta.down { color:#ee9a8e; } }
.dash-roles { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:16px; align-items:start; }
.dash-role { padding:18px 18px 10px; min-width:0; }
.dash-role .panel-title { margin-bottom:6px; }
.dash-role-sum { font-family:var(--serif); font-size:26px; font-weight:500; line-height:1.2; }
.dash-role-head { margin-bottom:10px; }
.dash-list { font-size:13px; }
.dash-list th { font-size:10px; padding:8px 6px; }
.dash-list td { padding:8px 6px; }
.dash-list th:first-child, .dash-list td:first-child { padding-left:0; }
.dash-list th:last-child, .dash-list td:last-child { padding-right:0; }
@media (max-width:1150px) { .dash-roles { grid-template-columns:1fr; } }
@media (max-width:760px) { .dash-top, .dash-act { grid-template-columns:1fr; } #dash-period { align-self:flex-start; } }
.dash-of { font-family:var(--sans, inherit); font-size:14px; color:var(--muted); font-weight:500; letter-spacing:0; }
.dash-delta.muted { font-weight:400; }

/* ---------- Зарплата ---------- */
.sal-rows { display:flex; flex-direction:column; gap:8px; }
.sal-row { display:grid; grid-template-columns:minmax(0,1fr) 120px auto; gap:8px; align-items:center; }
.sal-row select { height:40px; font-size:14px; }
.sal-pct { position:relative; }
.sal-pct input { width:100%; height:40px; padding:0 30px 0 12px; border-radius:10px; border:1px solid var(--line); background:var(--field); color:var(--text); font:inherit; font-size:14px; }
.sal-pct input:focus { outline:none; border-color:var(--line-strong); box-shadow:0 0 0 4px var(--focus); }
.sal-pct span { position:absolute; right:12px; top:50%; transform:translateY(-50%); color:var(--muted); font-size:13px; }
.issue-sec { position:relative; display:inline-flex; width:84px; margin-left:12px; vertical-align:middle; }
.issue-sec input { width:100%; height:32px; padding:0 28px 0 8px; border-radius:8px; border:1px solid var(--line); background:var(--field); color:var(--text); font:inherit; font-size:13px; }
.issue-sec input:focus { outline:none; border-color:var(--line-strong); }
.issue-sec span { position:absolute; right:8px; top:50%; transform:translateY(-50%); color:var(--muted); font-size:12px; pointer-events:none; }
.sal-add { align-self:flex-start; margin-top:8px; }
.sal-month { display:flex; align-items:center; gap:8px; }
.sal-month input { height:38px; padding:0 10px; border-radius:10px; border:1px solid var(--line); background:var(--field); color:var(--text); font:inherit; font-size:14px; }
.sal-lead { margin:-6px 0 14px; }
.sal-table td { vertical-align:top; }
.sal-total td { border-top:1px dashed var(--line); }
.cab-sal-total { font-family:var(--serif); font-size:34px; font-weight:500; margin-bottom:14px; }
.cab-sal-total .muted { font-family:var(--sans); font-size:13px; margin-top:2px; }

/* ---------- Сайт обменника ---------- */
.ex-page {
  min-height:100%; display:block;
  padding:32px 16px 48px;
}
.ex-wrap { width:min(880px, 100%); margin:0 auto; }
.ex-top {
  display:grid; grid-template-columns:1fr auto 1fr;
  align-items:center; gap:12px; margin-bottom:22px;
}
.ex-top .brand { justify-self:start; }
.ex-top .brand-name { letter-spacing:.28em; }
.ex-gate { max-width:440px; }
.ex-ticker {
  position:fixed; z-index:40;
  top:0; left:0; right:0;
  display:flex; align-items:center; justify-content:center; gap:8px;
  min-height:56px;
  padding:8px 16px;
  padding-top:max(8px, env(safe-area-inset-top));
  background:color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter:saturate(1.15) blur(16px);
  -webkit-backdrop-filter:saturate(1.15) blur(16px);
  border-bottom:1px solid var(--line);
  opacity:0; pointer-events:none;
  transition:opacity .45s ease;
}
body.ex-site.is-settle .ex-ticker,
body.ex-page .ex-ticker { opacity:1; pointer-events:auto; }
.ex-ticker-label {
  flex:none;
  font-size:11px; letter-spacing:.14em; text-transform:uppercase;
  color:var(--muted); font-weight:600;
}
.ex-ticker-track {
  display:flex; align-items:stretch; justify-content:center;
  gap:0; min-width:0; overflow-x:auto; scrollbar-width:none;
}
.ex-ticker-track::-webkit-scrollbar { display:none; }
.ex-ticker-empty { margin:0; color:var(--muted); font-size:13px; padding:8px 0; }
.ex-tick {
  display:flex; flex-direction:column; justify-content:center; gap:1px;
  padding:2px 18px; min-width:118px;
  border-left:1px solid var(--line);
}
.ex-tick:first-child { border-left:0; }
.ex-tick-coin {
  font-size:11px; letter-spacing:.12em; text-transform:uppercase;
  color:var(--muted); font-weight:600;
}
.ex-tick-pair {
  display:flex; align-items:baseline; gap:8px;
  font-variant-numeric:tabular-nums; white-space:nowrap;
}
.ex-tick-pair b { font-family:var(--serif); font-weight:500; font-size:20px; line-height:1.1; }
.ex-tick-sell { color:var(--muted); font-size:13px; }
body.ex-site.center { padding-top:calc(72px + env(safe-area-inset-top)); }
body.ex-page { padding-top:calc(88px + env(safe-area-inset-top)); }
.ex-switch {
  margin-top:4px; background:transparent; color:var(--muted); border:0; height:auto; padding:0;
  letter-spacing:0; font-weight:500; font-size:13px;
}
.ex-switch:hover { background:transparent; color:var(--text); }
#reg-code {
  letter-spacing:.32em; font-size:22px; text-align:center;
  font-variant-numeric:tabular-nums;
}
.ex-session { display:flex; align-items:center; gap:10px; justify-self:end; }
.ex-session .ghost { height:32px; }
#ex-clients .panel-title { margin:22px 0 10px; }
#ex-clients .panel-title:first-child { margin-top:0; }
.ex-nav {
  display:flex; gap:4px; justify-self:center;
  padding:4px; border-radius:999px;
  background:var(--surface); border:1px solid var(--line);
}
.ex-nav button {
  height:38px; padding:0 18px; border-radius:999px; border:0;
  background:transparent; color:var(--text);
  letter-spacing:.04em; font-weight:600;
}
.ex-nav button:hover { background:var(--field); }
.ex-nav button.is-on { background:var(--btn-bg); color:var(--btn-text); }
.ex-card { padding:36px 36px 32px; }
.ex-card h1 { font-size:34px; margin:0 0 8px; }
.ex-lead { margin:10px 0 0; color:var(--muted); }
.ex-card form, .ex-card .ex-stack { display:flex; flex-direction:column; gap:16px; margin-top:22px; }
.ex-deal { margin-top:18px; }
.ex-calc {
  display:grid; grid-template-columns:1fr auto 1fr;
  gap:16px; align-items:start;
}
.ex-leg { display:flex; flex-direction:column; gap:8px; }
.ex-leg-label {
  font-size:11px; letter-spacing:.12em; text-transform:uppercase;
  color:var(--muted); font-weight:600;
}
.ex-leg select, .ex-deal-grid select {
  width:100%; height:48px; padding:0 14px; border-radius:10px;
  border:1px solid var(--line); background:var(--field); color:var(--text);
  font:inherit; font-size:15px;
}
.ex-swap {
  width:44px; height:44px; margin-top:34px; padding:0;
  border-radius:50%; border:1px solid var(--line-strong);
  background:var(--surface); color:var(--text);
  display:grid; place-items:center;
  font-size:18px; line-height:1; font-weight:500;
}
.ex-swap:hover { background:var(--field); }
.ex-rate-line {
  margin:4px 0 8px; text-align:center;
  color:var(--muted); font-size:12px; letter-spacing:.08em; text-transform:uppercase;
}
.ex-deal-grid { display:flex; flex-direction:column; gap:16px; }
.ex-choices { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.ex-choices button, .ex-back {
  height:48px; background:transparent; color:var(--text);
  border:1px solid var(--line-strong); letter-spacing:.04em; font-weight:500;
}
.ex-choices button:hover, .ex-back:hover { background:var(--field); }
.ex-choices button.is-on { background:var(--btn-bg); color:var(--btn-text); border-color:transparent; }
.ex-back { align-self:flex-start; height:36px; padding:0 14px; font-size:13px; }
.ex-quote { display:flex; flex-direction:column; gap:10px; padding:16px 0 4px; border-top:1px solid var(--line); }
.ex-row { display:flex; justify-content:space-between; gap:16px; align-items:baseline; }
.ex-row span { color:var(--muted); font-size:13px; }
.ex-row b { font-family:var(--serif); font-weight:500; font-size:22px; letter-spacing:.01em; }
.ex-note { margin:0; color:var(--muted); font-size:13px; }
.ex-err { margin:0; padding:12px 14px; border-radius:10px; background:var(--field); color:var(--text); font-size:14px; }
.ex-req { display:flex; flex-direction:column; gap:8px; padding:14px 0; border-top:1px solid var(--line); }
.ex-req code, .ex-mono {
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:14px; word-break:break-all; color:var(--text);
}
.ex-actions { display:flex; flex-wrap:wrap; gap:8px; }
.ex-actions button, .ex-actions label.ex-file {
  height:40px; padding:0 14px; border-radius:10px; cursor:pointer;
  background:transparent; color:var(--text); border:1px solid var(--line-strong);
  font:inherit; font-size:13px; font-weight:500; letter-spacing:.02em;
  display:inline-flex; align-items:center;
}
.ex-actions button.ex-primary { background:var(--btn-bg); color:var(--btn-text); border-color:transparent; }
.ex-list { display:flex; flex-direction:column; gap:8px; margin-top:18px; }
.ex-item {
  text-align:left; height:auto; padding:14px 16px; border-radius:12px;
  background:transparent; color:var(--text); border:1px solid var(--line);
  letter-spacing:0; font-weight:500; display:flex; flex-direction:column; gap:2px;
}
.ex-item:hover { border-color:var(--line-strong); background:var(--field); }
.ex-item small { color:var(--muted); font-weight:400; }
@media (max-width:720px) {
  .ex-ticker-label { display:none; }
  .ex-tick { min-width:108px; padding:2px 14px; }
  .ex-tick-pair b { font-size:17px; }
  .ex-top { grid-template-columns:1fr auto; }
  .ex-nav { grid-column:1 / -1; justify-self:stretch; }
  .ex-nav button { flex:1; }
  .ex-calc { grid-template-columns:1fr; }
  .ex-swap { margin:0 auto; transform:rotate(90deg); }
}
@media (max-width:560px) {
  .ex-card { padding:24px 18px 20px; }
  .ex-choices { grid-template-columns:1fr; }
  .ex-session { grid-column:2; }
}

/* ---------- Телефон и узкие планшеты ---------- */
.nav-scrim {
  display:none; position:fixed; inset:0; z-index:55;
  background:rgba(20,24,30,.35); backdrop-filter:blur(3px);
}
.nav-toggle-bars {
  display:block; width:16px; height:1.6px; border-radius:1px; background:currentColor;
  box-shadow:0 -5px 0 currentColor, 0 5px 0 currentColor;
}
body.nav-open .nav-toggle-bars {
  box-shadow:none; transform:rotate(45deg);
  height:1.6px;
}
body.nav-open .nav-toggle-bars::after {
  content:""; display:block; width:16px; height:1.6px; border-radius:1px; background:currentColor;
  transform:rotate(-90deg);
}

@media (max-width:820px) {
  body.nav-open { overflow:hidden; }
  body.nav-open .nav-scrim { display:block; }
  .nav-toggle {
    display:grid; place-items:center; flex:none; margin-left:auto;
    width:44px; height:44px; padding:0;
    background:transparent; color:var(--text);
    border:1px solid var(--line-strong); border-radius:10px;
  }
  .nav-toggle:hover { background:var(--field); }
  .shell { grid-template-columns:minmax(0,1fr); align-content:start; }
  .sidebar {
    position:sticky; top:0; z-index:60; height:auto;
    flex-direction:row; flex-wrap:nowrap; align-items:center; gap:8px;
    padding:8px 12px; padding-top:max(8px, env(safe-area-inset-top));
    border-right:0; border-bottom:1px solid var(--line);
    background:var(--surface);
    backdrop-filter:none; filter:none; transform:none;
    overflow:visible;
  }
  .sidebar .brand { padding:0; min-width:0; }
  .nav-drawer { display:none; }
  body.nav-open .nav-drawer {
    display:flex; position:fixed; z-index:70;
    top:0; left:0; bottom:0; width:min(300px, 88vw); height:100dvh;
    padding:72px 14px max(16px, env(safe-area-inset-bottom));
    background:var(--surface); border-right:1px solid var(--line);
    box-shadow:var(--shadow); overflow:hidden; overscroll-behavior:contain;
  }
  body.nav-open .nav-drawer .tabs {
    flex:1 1 auto; min-height:0;
    flex-direction:column; overflow-x:hidden; overflow-y:auto;
    margin-top:4px; -webkit-overflow-scrolling:touch;
  }
  body.nav-open .nav-drawer .tab { min-height:44px; white-space:nowrap; }
  body.nav-open .nav-drawer .sidebar-foot { margin-top:auto; flex:none; }
  .content { padding:20px 16px 28px; padding-bottom:max(28px, env(safe-area-inset-bottom)); }
  .alert-bar { padding:12px 16px 0; }
  .content-head h1, .page h1, .cab-h2 { font-size:28px; }
  .stat-value { font-size:32px; }
  .com-value { font-size:36px; }
  .table-wrap { -webkit-overflow-scrolling:touch; }
  .table th, .table td { padding:12px 10px; }
  input:not(#code), select, textarea { font-size:16px !important; }
  .tf-code input { font-size:20px !important; }
  .modal {
    width:calc(100vw - 16px); max-width:none;
    max-height:calc(100dvh - 16px); margin:auto;
    padding:24px 18px 20px; overflow:auto;
  }
  .modal h2 { font-size:24px; }
  .modal-actions { flex-wrap:wrap; }
  .modal-actions button { flex:1 1 auto; min-width:120px; }
  .field-row { grid-template-columns:1fr; }
  .filters { padding:12px; }
  .toolbar { gap:8px; }
  .search { width:100% !important; }
  .merch-head, .grp-head { padding:14px 14px; }
  .merch-name { font-size:20px; }
  .merch-stats { flex-wrap:wrap; gap:10px 16px; }
  .rate-grid { grid-template-columns:1fr; }
  .dash-list { min-width:420px; }
  .inv-act-btns { flex-wrap:wrap; }
  .inv-act-btns button { min-height:40px; }
  .form-actions button, .head-actions button { min-height:44px; }
  .cab-tabs a { padding:12px 14px; min-height:44px; }
  .page { margin:24px auto; padding:0 14px; padding-bottom:max(16px, env(safe-area-inset-bottom)); }
}

@media (max-width:760px) {
  .chat-shell {
    grid-template-columns:1fr;
    height:calc(100dvh - 150px); min-height:380px;
  }
  .cab-chat .chat-shell { height:calc(100dvh - 240px); }
  .chat-shell:not(.is-open) .chat-main { display:none !important; }
  .chat-shell.is-open .chat-list { display:none; }
  .chat-back {
    display:inline-flex; align-items:center; justify-content:center;
    height:36px; padding:0 12px; margin-right:4px; flex:none;
  }
  .chat-head { flex-wrap:nowrap; padding:12px 12px; }
  .chat-head .grow, .chat-head > div { min-width:0; }
  .chat-compose { gap:6px; }
  .chat-compose button { padding:0 14px; flex:none; }
  .chat-foot { padding:10px 12px max(12px, env(safe-area-inset-bottom)); }
  .chat-item { min-height:52px; }
}

@media (max-width:560px) {
  h1 { font-size:32px; }
  .login h1 { font-size:30px; }
  .card { padding:28px 18px 24px; }
  body.center { padding:16px 12px; padding-bottom:max(16px, env(safe-area-inset-bottom)); }
  .topbar { padding:10px 12px; padding-top:max(10px, env(safe-area-inset-top)); }
  .user { gap:8px; justify-content:flex-end; }
  #user-email { max-width:42vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .modal-actions { flex-direction:column-reverse; }
  .modal-actions button { width:100%; min-width:0; }
  .theme-options { grid-template-columns:1fr; }
  .ex-page { padding:16px 12px max(24px, env(safe-area-inset-bottom)); align-items:flex-start; }
  .ex-card h1 { font-size:28px; }
  .ex-top { flex-wrap:wrap; gap:8px; margin-bottom:14px; }
  .ex-session { width:100%; justify-content:space-between; }
  .ex-nav button { height:44px; font-size:13px; padding:0 10px; }
  .ex-actions button, .ex-actions label.ex-file { min-height:44px; flex:1 1 auto; justify-content:center; }
  .ex-row { flex-wrap:wrap; gap:4px 12px; }
  .ex-row b { font-size:20px; }
  .rate-card-val { flex-wrap:wrap; }
  .pct-input { width:100%; }
  .com-row { flex-direction:column; }
  .com-row button { width:100%; }
}
