/* ============================================================
   APSAR Exchange — дизайн-система прототипа
   Один файл на весь прототип. Порядок разделов:
   1. Токены  2. База  3. Раскладка  4. Шапка  5. Кнопки
   6. Формы   7. Карточки/таблицы  8. Статусы  9. Модули
   10. Адаптив
   Принцип: каждое правило снижает когнитивную нагрузку,
   декоративных стилей без задачи нет.
   ============================================================ */

/* ---------- 1. ТОКЕНЫ ---------- */
:root{
  /* поверхности */
  --bg:#f7f7fb; --surface:#ffffff; --surface-2:#f1f3f6; --surface-3:#e9edf2;
  --border:#e3e7ed; --border-strong:#cfd6e0;
  /* текст */
  --text:#111827; --text-2:#5b6472; --text-3:#626b7b;
  /* смысловые */
  --brand:#4f46e5; --brand-hover:#4038c7; --brand-weak:#ecebfc; --on-brand:#ffffff;
  --gold:#0f766e; --gold-weak:#e5f6f3;
  --up:#0d7a44; --up-weak:#e6f5ec; --on-up:#ffffff;
  --down:#c3363b; --down-weak:#fdecec; --on-down:#ffffff;
  --warn:#916100; --warn-weak:#fdf5e2;
  --info:#20607a; --info-weak:#e8f3f8;
  /* тени: ровно две */
  --sh-1:0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.05);
  --sh-2:0 12px 32px rgba(16,24,40,.16);
  /* геометрия */
  --r-sm:8px; --r-md:12px; --r-lg:16px; --r-pill:999px;
  --container:1280px;
  /* шрифты */
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,"Helvetica Neue",Arial,sans-serif;
  --mono:ui-monospace,SFMono-Regular,"SF Mono","JetBrains Mono",Menlo,Consolas,monospace;
}
/* Тёмная палитра объявлена дважды: по явному выбору пользователя
   (data-theme="dark") и по системной настройке, если явного выбора нет. */
[data-theme="dark"]{
  --bg:#0f1016; --surface:#161a21; --surface-2:#1d222b; --surface-3:#242b36;
  --border:#2a313c; --border-strong:#3a4351;
  --text:#e8ecf2; --text-2:#98a2b3; --text-3:#8993a1;
  --brand:#8b83f5; --brand-hover:#a49df8; --brand-weak:#211f3a; --on-brand:#0b0b14;
  --gold:#2dd4bf; --gold-weak:#0f2a27;
  --up:#31c57e; --up-weak:#122b21; --on-up:#0b1220;
  --down:#f0666b; --down-weak:#2d1a1c; --on-down:#0b1220;
  --warn:#e3b341; --warn-weak:#2b2415;
  --info:#5ab0ce; --info-weak:#152730;
  --sh-1:0 1px 2px rgba(0,0,0,.4);
  --sh-2:0 12px 32px rgba(0,0,0,.55);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0f1016; --surface:#161a21; --surface-2:#1d222b; --surface-3:#242b36;
    --border:#2a313c; --border-strong:#3a4351;
    --text:#e8ecf2; --text-2:#98a2b3; --text-3:#8993a1;
    --brand:#8b83f5; --brand-hover:#a49df8; --brand-weak:#211f3a; --on-brand:#0b0b14;
    --gold:#2dd4bf; --gold-weak:#0f2a27;
    --up:#31c57e; --up-weak:#122b21; --on-up:#0b1220;
    --down:#f0666b; --down-weak:#2d1a1c; --on-down:#0b1220;
    --warn:#e3b341; --warn-weak:#2b2415;
    --info:#5ab0ce; --info-weak:#152730;
    --sh-1:0 1px 2px rgba(0,0,0,.4);
    --sh-2:0 12px 32px rgba(0,0,0,.55);
  }
}

/* ---------- 2. БАЗА ---------- */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%; color-scheme:light dark}
:root[data-theme="light"]{color-scheme:light}
:root[data-theme="dark"]{color-scheme:dark}
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:var(--font); font-size:15px; line-height:1.47;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,p,ul,ol,figure{margin:0}
ul,ol{padding:0; list-style:none}
a{color:var(--brand); text-decoration:none}
a:hover{text-decoration:underline}
img,svg{max-width:100%}
button,input,select,textarea{font:inherit; color:inherit}
:focus-visible{outline:2px solid var(--brand); outline-offset:2px; border-radius:4px}
::selection{background:var(--brand-weak); color:var(--text)}
[hidden]{display:none !important}

/* типографическая шкала */
.display{font-size:44px; line-height:1.16; font-weight:700; letter-spacing:-.02em}
h1,.h1{font-size:28px; line-height:1.28; font-weight:650; letter-spacing:-.01em}
h2,.h2{font-size:20px; line-height:1.4; font-weight:620}
h3,.h3{font-size:16px; line-height:1.5; font-weight:620}
.small{font-size:13px; line-height:1.4}
.micro{font-size:11px; line-height:1.3; letter-spacing:.04em; text-transform:uppercase; font-weight:600}
.muted{color:var(--text-2)}
.muted-3{color:var(--text-3)}
.mono{font-family:var(--mono); font-variant-numeric:tabular-nums}

/* деньги — всегда моноширинные и табличные */
.money{font-family:var(--mono); font-variant-numeric:tabular-nums; font-weight:500; white-space:nowrap}
.money.lg{font-size:22px; font-weight:600}
.money.xl{font-size:30px; font-weight:650; letter-spacing:-.01em}
.up{color:var(--up)} .down{color:var(--down)} .gold{color:var(--gold)}
.num-cell{text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; white-space:nowrap}

/* ---------- 3. РАСКЛАДКА ---------- */
.container{max-width:var(--container); margin:0 auto; padding:0 24px}
.container.narrow{max-width:560px}
.container.mid{max-width:900px}
.section{padding:40px 0}
.stack{display:flex; flex-direction:column}
.stack-4>*+*{margin-top:4px} .stack-8>*+*{margin-top:8px}
.stack-12>*+*{margin-top:12px} .stack-16>*+*{margin-top:16px}
.stack-24>*+*{margin-top:24px} .stack-32>*+*{margin-top:32px}
.row{display:flex; align-items:center; gap:12px}
.row.between{justify-content:space-between}
.row.end{justify-content:flex-end}
.row.wrap{flex-wrap:wrap}
.grow{flex:1 1 auto; min-width:0}
.grid{display:grid; gap:16px}
.g-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.hr{height:1px; background:var(--border); border:0; margin:16px 0}

/* ---------- 4. ШАПКА ---------- */
.site-header{
  position:sticky; top:0; z-index:40;
  background:color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter:saturate(1.4) blur(10px);
  border-bottom:1px solid var(--border);
}
.header-inner{display:flex; align-items:center; gap:16px; height:60px}
.brand{display:flex; align-items:center; gap:9px; font-weight:700; font-size:16px; color:var(--text)}
.brand:hover{text-decoration:none}
.brand-mark{
  width:26px; height:26px; border-radius:7px; flex:none;
  background:linear-gradient(140deg,var(--brand),var(--gold));
  display:grid; place-items:center; color:var(--on-brand); font-size:12px; font-weight:800;
}
.brand small{font-weight:500; color:var(--text-2); font-size:11px; letter-spacing:.06em; text-transform:uppercase}
.main-nav{display:flex; gap:2px; margin-left:8px}
.main-nav a{
  padding:7px 11px; border-radius:var(--r-sm); color:var(--text-2);
  font-size:14px; font-weight:520; white-space:nowrap;
}
.main-nav a:hover{background:var(--surface-2); color:var(--text); text-decoration:none}
.main-nav a[aria-current="page"]{background:var(--brand-weak); color:var(--brand)}
.header-tools{margin-left:auto; display:flex; align-items:center; gap:8px}
.icon-btn{
  display:grid; place-items:center; width:44px; height:44px; flex:none;
  border:1px solid var(--border); background:var(--surface); border-radius:var(--r-sm);
  cursor:pointer; color:var(--text-2); transition:background .12s, color .12s;
}
.icon-btn:hover{background:var(--surface-2); color:var(--text)}
.nav-toggle{display:none}
.user-chip{
  display:flex; align-items:center; gap:8px; padding:4px 10px 4px 4px;
  border:1px solid var(--border); border-radius:var(--r-pill); background:var(--surface);
  min-height:44px; cursor:pointer;
}
.user-chip:hover{background:var(--surface-2)}
.avatar{width:26px; height:26px; border-radius:50%; background:var(--brand-weak); color:var(--brand);
  display:grid; place-items:center; font-size:11px; font-weight:700; flex:none}
.lang-switch{display:flex; border:1px solid var(--border); border-radius:var(--r-sm); overflow:hidden}
.lang-switch button{
  border:0; background:var(--surface); color:var(--text-2); cursor:pointer;
  padding:6px 11px; min-height:44px; font-size:12px; font-weight:650;
}
.lang-switch button[aria-pressed="true"]{background:var(--brand); color:var(--on-brand)}

/* ---------- 5. КНОПКИ ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 16px; min-height:44px; border-radius:var(--r-sm);
  border:1px solid transparent; background:var(--surface-2); color:var(--text);
  font-size:14px; font-weight:600; cursor:pointer; white-space:nowrap;
  transition:background .12s, border-color .12s, transform .06s, opacity .12s;
}
.btn:hover{text-decoration:none}
.btn:active{transform:translateY(1px)}
.btn-primary{background:var(--brand); color:var(--on-brand)}
.btn-primary:hover{background:var(--brand-hover)}
.btn-secondary{background:var(--surface); border-color:var(--border-strong); color:var(--text)}
.btn-secondary:hover{background:var(--surface-2)}
.btn-ghost{background:transparent; color:var(--text-2); padding:8px 10px; min-height:44px}
.btn-ghost:hover{background:var(--surface-2); color:var(--text)}
.btn-danger{background:var(--down); color:var(--on-down)}
.btn-buy{background:var(--up); color:var(--on-up)}
.btn-sell{background:var(--down); color:var(--on-down)}
.btn-lg{min-height:48px; padding:13px 22px; font-size:15px}
.btn-sm{min-height:44px; padding:6px 12px; font-size:12.5px; border-radius:6px}
.btn-block{width:100%}
/* Отключённая кнопка - основная обратная связь в Приватном профиле,
   поэтому её подпись обязана читаться. Прозрачность заменена на явную
   пару токенов: text-2 на surface-3 даёт 5,09 в светлой теме и 5,53 в тёмной. */
.btn[disabled],.btn[aria-disabled="true"]{
  opacity:1; cursor:not-allowed; transform:none; box-shadow:none;
  background:var(--surface-3); border-color:var(--border-strong); color:var(--text-2);
}
.btn[disabled]:hover,.btn[aria-disabled="true"]:hover{background:var(--surface-3); color:var(--text-2)}
.btn.is-loading{pointer-events:none; position:relative; color:transparent}
.btn.is-loading::after{
  content:""; position:absolute; width:16px; height:16px; border-radius:50%;
  border:2px solid currentColor; border-top-color:transparent; opacity:.9;
  color:var(--on-brand); animation:spin .7s linear infinite;
}
.btn-secondary.is-loading::after,.btn.is-loading::after{color:inherit}
@keyframes spin{to{transform:rotate(360deg)}}
.btn-row{display:flex; gap:8px; flex-wrap:wrap}

/* ---------- 6. ФОРМЫ ---------- */
.field{display:block}
.field>.label{display:block; font-size:13px; font-weight:600; color:var(--text-2); margin-bottom:6px}
.control{
  display:flex; align-items:center; gap:8px; background:var(--surface);
  border:1px solid var(--border-strong); border-radius:var(--r-sm); padding:0 12px;
  min-height:44px; transition:border-color .12s, box-shadow .12s;
}
.control:focus-within{border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-weak)}
.control input,.control select{
  border:0; outline:0; background:transparent; width:100%; padding:11px 0; min-width:0;
}
.control input.money-input{font-family:var(--mono); font-variant-numeric:tabular-nums; font-size:17px; font-weight:600}
.control .suffix{color:var(--text-2); font-weight:600; font-size:14px; white-space:nowrap}
.control select{cursor:pointer; padding-right:2px}
.hint{font-size:12.5px; color:var(--text-3); margin-top:6px}
.field.has-error .control{border-color:var(--down); box-shadow:0 0 0 3px var(--down-weak)}
.error-text{font-size:12.5px; color:var(--down); margin-top:6px; display:flex; gap:6px; align-items:flex-start}
.error-text::before{content:"!"; flex:none; width:15px; height:15px; border-radius:50%;
  background:var(--down); color:var(--on-down); font-size:10px; font-weight:800; display:grid; place-items:center; margin-top:1px}
/* сам квадратик мал, но нажимается вся подпись: цель - строка целиком */
.checkbox{display:flex; gap:10px; align-items:flex-start; cursor:pointer; font-size:13.5px;
  color:var(--text-2); min-height:44px; padding:4px 0}
.checkbox input{margin:2px 0 0; width:17px; height:17px; accent-color:var(--brand); flex:none}
.segmented{display:inline-flex; background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-sm); padding:3px; gap:3px}
.segmented button{
  border:0; background:transparent; color:var(--text-2); cursor:pointer;
  padding:10px 14px; min-height:44px; border-radius:6px; font-size:13.5px; font-weight:600; flex:1 1 auto;
}
.segmented button:hover{color:var(--text)}
.segmented button[aria-pressed="true"]{background:var(--surface); color:var(--text); box-shadow:var(--sh-1)}
.segmented.full{display:flex; width:100%}
.segmented.wrap{flex-wrap:wrap}
.segmented.wrap button{flex:1 1 28%; min-width:88px}
.segmented.buysell button[aria-pressed="true"][data-side="buy"]{background:var(--up); color:var(--on-up)}
.segmented.buysell button[aria-pressed="true"][data-side="sell"]{background:var(--down); color:var(--on-down)}
.pct-row{display:flex; gap:6px}
.pct-row button{
  flex:1; border:1px solid var(--border); background:var(--surface); color:var(--text-2);
  border-radius:6px; padding:5px 0; min-height:44px; font-size:12px; font-weight:600; cursor:pointer;
}
.pct-row button:hover{background:var(--surface-2); color:var(--text)}

/* ---------- 7. КАРТОЧКИ И ТАБЛИЦЫ ---------- */
.card{background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); box-shadow:var(--sh-1)}
.card-head{display:flex; align-items:center; gap:12px; padding:14px 18px; border-bottom:1px solid var(--border)}
.card-head h2,.card-head h3{margin:0}
.card-head .grow{min-width:0}
.card-body{padding:18px}
.card-body.tight{padding:12px}
.card-foot{padding:12px 18px; border-top:1px solid var(--border); background:var(--surface-2);
  border-radius:0 0 var(--r-md) var(--r-md)}
.panel{background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-sm); padding:14px}
.panel.brand{background:var(--brand-weak); border-color:transparent}
.panel.gold{background:var(--gold-weak); border-color:transparent}

.stat{display:flex; flex-direction:column; gap:4px}
.stat .k{font-size:12px; color:var(--text-2); font-weight:600}
.stat .v{font-family:var(--mono); font-variant-numeric:tabular-nums; font-size:19px; font-weight:600}

.table-wrap{overflow-x:auto; -webkit-overflow-scrolling:touch}
table.tbl{width:100%; border-collapse:collapse; font-size:13.5px}
table.tbl th{
  text-align:left; font-size:11px; letter-spacing:.04em; text-transform:uppercase;
  color:var(--text-3); font-weight:650; padding:9px 12px; background:var(--surface-2);
  position:sticky; top:0; white-space:nowrap; border-bottom:1px solid var(--border);
}
table.tbl td{padding:11px 12px; border-bottom:1px solid var(--border); vertical-align:middle}
table.tbl tbody tr:last-child td{border-bottom:0}
table.tbl tbody tr:hover{background:var(--surface-2)}
table.tbl th.num,table.tbl td.num{text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; white-space:nowrap}
.asset{display:flex; align-items:center; gap:10px; min-width:0}
.coin{
  width:28px; height:28px; border-radius:50%; flex:none; display:grid; place-items:center;
  background:var(--surface-3); color:var(--text-2); font-size:10.5px; font-weight:700; letter-spacing:-.02em;
}
.coin.apsar{background:linear-gradient(140deg,var(--brand),var(--gold)); color:var(--on-brand)}
.coin.fiat{background:var(--brand-weak); color:var(--brand)}
.asset .t{font-weight:620; font-size:14px}
.asset .s{font-size:12px; color:var(--text-3)}

/* строка счёта: три состояния денег всегда рядом */
.acct{display:grid; grid-template-columns:1.4fr repeat(3,minmax(96px,.8fr)) auto;
  gap:12px; align-items:center; padding:12px 16px; border-bottom:1px solid var(--border)}
.acct:last-child{border-bottom:0}
.acct:hover{background:var(--surface-2)}
.acct .m{display:flex; flex-direction:column; align-items:flex-end; gap:2px}
.acct .m .lbl{font-size:10.5px; color:var(--text-3); text-transform:uppercase; letter-spacing:.04em; font-weight:650}
.acct .m .val{font-family:var(--mono); font-variant-numeric:tabular-nums; font-size:14px; font-weight:550}
.acct .m .val.zero{color:var(--text-3)}
.acct-actions{display:flex; gap:6px; justify-content:flex-end}
.acct-head{display:grid; grid-template-columns:1.4fr repeat(3,minmax(96px,.8fr)) auto; gap:12px;
  padding:9px 16px; background:var(--surface-2); border-bottom:1px solid var(--border);
  font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-3); font-weight:650}
.acct-head span:not(:first-child):not(:last-child){text-align:right}

/* ---------- 8. СТАТУСЫ, УВЕДОМЛЕНИЯ ---------- */
.badge{
  display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:var(--r-pill);
  font-size:11.5px; font-weight:650; white-space:nowrap; background:var(--surface-3); color:var(--text-2);
}
.badge::before{content:""; width:6px; height:6px; border-radius:50%; background:currentColor; flex:none}
.badge.ok{background:var(--up-weak); color:var(--up)}
.badge.wait{background:var(--info-weak); color:var(--info)}
.badge.warn{background:var(--warn-weak); color:var(--warn)}
.badge.err{background:var(--down-weak); color:var(--down)}
.badge.lvl1{background:var(--surface-3); color:var(--text-2)}
.badge.lvl2{background:var(--brand-weak); color:var(--brand)}
.badge.plain::before{display:none}

.alert{display:flex; gap:12px; padding:14px 16px; border-radius:var(--r-sm); border:1px solid transparent; font-size:13.5px}
.alert .ico{flex:none; width:20px; height:20px; border-radius:50%; display:grid; place-items:center;
  font-size:12px; font-weight:800; color:var(--bg)}
.alert .at{font-weight:650; margin-bottom:3px}
.alert.info{background:var(--info-weak); border-color:color-mix(in srgb,var(--info) 25%,transparent); color:var(--text)}
.alert.info .ico{background:var(--info)}
.alert.warn{background:var(--warn-weak); border-color:color-mix(in srgb,var(--warn) 30%,transparent); color:var(--text)}
.alert.warn .ico{background:var(--warn)}
.alert.danger{background:var(--down-weak); border-color:color-mix(in srgb,var(--down) 30%,transparent); color:var(--text)}
.alert.danger .ico{background:var(--down)}
.alert.success{background:var(--up-weak); border-color:color-mix(in srgb,var(--up) 30%,transparent); color:var(--text)}
.alert.success .ico{background:var(--up)}

.empty{padding:36px 20px; text-align:center; color:var(--text-2)}
.empty .e-ico{width:44px; height:44px; border-radius:12px; background:var(--surface-2); margin:0 auto 12px;
  display:grid; place-items:center; color:var(--text-3); font-size:20px}
.empty .e-t{font-weight:620; color:var(--text); margin-bottom:4px}

.skeleton{background:linear-gradient(90deg,var(--surface-2),var(--surface-3),var(--surface-2));
  background-size:200% 100%; animation:sk 1.2s ease-in-out infinite; border-radius:6px; height:14px}
@keyframes sk{0%{background-position:200% 0}100%{background-position:-200% 0}}

#toasts{position:fixed; right:20px; bottom:20px; z-index:80; display:flex; flex-direction:column; gap:10px; max-width:340px}
.toast{background:var(--surface); border:1px solid var(--border); border-left:3px solid var(--brand);
  border-radius:var(--r-sm); box-shadow:var(--sh-2); padding:12px 14px; font-size:13.5px;
  animation:tin .22s ease-out}
.toast.ok{border-left-color:var(--up)} .toast.err{border-left-color:var(--down)}
.toast .tt{font-weight:650; margin-bottom:2px}
@keyframes tin{from{opacity:0; transform:translateY(8px)}to{opacity:1; transform:none}}

.modal-back{position:fixed; inset:0; background:rgba(9,12,18,.55); z-index:70;
  display:grid; place-items:center; padding:20px; animation:fade .15s ease-out}
@keyframes fade{from{opacity:0}to{opacity:1}}
.modal{background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md);
  box-shadow:var(--sh-2); width:100%; max-width:460px; max-height:90vh; overflow:auto}

/* шаги верификации */
.steps{display:flex; flex-direction:column}
.step{display:flex; gap:14px; padding:16px 0; border-bottom:1px solid var(--border)}
.step:last-child{border-bottom:0}
.step .n{width:30px; height:30px; flex:none; border-radius:50%; display:grid; place-items:center;
  font-size:13px; font-weight:700; background:var(--surface-2); color:var(--text-3); border:1px solid var(--border)}
.step.done .n{background:var(--up); color:var(--on-up); border-color:transparent}
.step.active .n{background:var(--brand); color:var(--on-brand); border-color:transparent}
.step.review .n{background:var(--info-weak); color:var(--info); border-color:transparent}
.progress{height:6px; background:var(--surface-3); border-radius:var(--r-pill); overflow:hidden}
.progress i{display:block; height:100%; background:var(--brand); border-radius:var(--r-pill); transition:width .3s}

/* ---------- 9. МОДУЛИ: стакан, график, терминал ---------- */
.term{display:grid; gap:12px; grid-template-columns:280px minmax(0,1fr) 320px; align-items:start}
.term-mid{display:grid; gap:12px}
.ob{font-family:var(--mono); font-variant-numeric:tabular-nums; font-size:12.5px}
.ob-head,.ob-row{display:grid; grid-template-columns:1fr 1fr 1fr; gap:4px; padding:3px 12px}
/* Строка стакана - цель нажатия. 26 px удовлетворяют минимуму WCAG 2.2 (24 px,
   уровень AA); на устройствах с неточным указателем строка раскрывается до 44 px
   (уровень AAA), потому что плотность стакана нужна мыши, а не пальцу. */
.ob-row{min-height:26px; align-items:center}
.ob-head{color:var(--text-3); font-size:10.5px; text-transform:uppercase; letter-spacing:.04em;
  font-family:var(--font); font-weight:650; padding-top:8px; padding-bottom:8px; border-bottom:1px solid var(--border)}
.ob-row{position:relative; cursor:pointer; border:0; background:transparent; width:100%; text-align:right; color:var(--text-2)}
.ob-row:hover{background:var(--surface-2)}
.ob-row .p{text-align:left; font-weight:600; position:relative; z-index:1}
.ob-row span{position:relative; z-index:1}
.ob-row .depth{position:absolute; top:1px; bottom:1px; right:0; z-index:0; border-radius:2px}
.ob-row.ask .p{color:var(--down)} .ob-row.ask .depth{background:var(--down-weak)}
.ob-row.bid .p{color:var(--up)} .ob-row.bid .depth{background:var(--up-weak)}
.ob-spread{display:flex; align-items:baseline; gap:8px; padding:9px 12px; border-top:1px solid var(--border);
  border-bottom:1px solid var(--border); background:var(--surface-2)}
.ob-spread .last{font-size:17px; font-weight:700; font-family:var(--mono)}
.chart-box{background:var(--surface); border:1px solid var(--border); border-radius:var(--r-md); overflow:hidden}
.chart-box svg{display:block; width:100%; height:auto}
.tf-row{display:flex; gap:4px}
.tf-row button{border:1px solid transparent; background:transparent; color:var(--text-2); cursor:pointer;
  padding:4px 9px; min-height:44px; border-radius:6px; font-size:12px; font-weight:600}
.tf-row button:hover{background:var(--surface-2)}
.tf-row button[aria-pressed="true"]{background:var(--surface-3); color:var(--text)}
.tape{font-family:var(--mono); font-variant-numeric:tabular-nums; font-size:12.5px; max-height:260px; overflow:auto}
.tape-row{display:grid; grid-template-columns:1fr 1fr auto; gap:6px; padding:3px 12px}
.tape-row:hover{background:var(--surface-2)}
.tape-row .t{color:var(--text-3); text-align:right}
.tabs{display:flex; gap:2px; border-bottom:1px solid var(--border); padding:0 6px; overflow-x:auto}
.tabs button{border:0; background:transparent; color:var(--text-2); cursor:pointer; padding:12px; min-height:44px;
  font-size:13.5px; font-weight:600; border-bottom:2px solid transparent; white-space:nowrap}
.tabs button:hover{color:var(--text)}
.tabs button[aria-selected="true"]{color:var(--brand); border-bottom-color:var(--brand)}
.pair-bar{display:flex; align-items:center; gap:20px; flex-wrap:wrap; padding:12px 16px}
/* выбор инструмента - цель нажатия, а не подпись */
.pair-bar select{min-height:44px}
.pair-bar .pv{display:flex; flex-direction:column}
.pair-bar .pv .k{font-size:10.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-3); font-weight:650}
.pair-bar .pv .v{font-family:var(--mono); font-variant-numeric:tabular-nums; font-size:13.5px; font-weight:600}

/* обмен: «отдаю → получаю» */
.swap{position:relative; display:flex; flex-direction:column; gap:8px}
.swap-arrow{position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); z-index:2;
  width:36px; height:36px; border-radius:50%; border:3px solid var(--surface); background:var(--surface-2);
  display:grid; place-items:center; cursor:pointer; color:var(--text-2); font-size:15px}
.swap-arrow:hover{background:var(--brand); color:var(--on-brand); border-color:var(--surface)}
.leg{background:var(--surface-2); border:1px solid var(--border); border-radius:var(--r-sm); padding:12px 14px}
.leg .lh{display:flex; justify-content:space-between; font-size:12px; color:var(--text-2); margin-bottom:6px}
.leg .li{display:flex; align-items:center; gap:10px}
.leg input{border:0; background:transparent; outline:0; width:100%; min-width:0;
  font-family:var(--mono); font-variant-numeric:tabular-nums; font-size:26px; font-weight:650; padding:2px 0}
.leg select{border:1px solid var(--border-strong); background:var(--surface); border-radius:var(--r-pill);
  padding:8px 12px; font-weight:650; font-size:14px; cursor:pointer; flex:none}
.calc{border:1px solid var(--border); border-radius:var(--r-sm); overflow:hidden}
.calc-row{display:flex; justify-content:space-between; gap:12px; padding:9px 14px; font-size:13.5px; color:var(--text-2)}
.calc-row+.calc-row{border-top:1px solid var(--border)}
.calc-row .v{font-family:var(--mono); font-variant-numeric:tabular-nums; color:var(--text); font-weight:550}
.calc-row.total{background:var(--brand-weak); color:var(--text); font-weight:650; padding:13px 14px}
.calc-row.total .v{font-size:18px; font-weight:700}
.qr{width:150px; height:150px; flex:none; border-radius:var(--r-sm); border:1px solid var(--border); background:#fff; padding:8px}
.copyline{display:flex; align-items:center; gap:8px; background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--r-sm); padding:10px 12px; font-family:var(--mono); font-size:13px; word-break:break-all}
.copyline .grow{overflow-wrap:anywhere}

/* лендинг */
.hero{padding:56px 0 40px; background:
  radial-gradient(900px 320px at 15% -10%, var(--brand-weak), transparent 70%),
  radial-gradient(700px 300px at 90% 0%, var(--gold-weak), transparent 70%)}
.hero-grid{display:grid; grid-template-columns:1.05fr .95fr; gap:40px; align-items:center}
.pill{display:inline-flex; align-items:center; gap:7px; padding:5px 12px; border-radius:var(--r-pill);
  background:var(--surface); border:1px solid var(--border); font-size:12.5px; font-weight:600; color:var(--text-2)}
.trust{display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:16px}
.trust .ti{width:34px; height:34px; border-radius:9px; background:var(--brand-weak); color:var(--brand);
  display:grid; place-items:center; font-size:16px; margin-bottom:10px}
.doclist a{display:flex; align-items:center; gap:12px; padding:13px 16px; border:1px solid var(--border);
  border-radius:var(--r-sm); background:var(--surface); color:var(--text)}
.doclist a:hover{border-color:var(--brand); background:var(--surface-2); text-decoration:none}
.site-footer{border-top:1px solid var(--border); background:var(--surface); padding:32px 0; margin-top:40px; font-size:13.5px}

/* ---------- 10. АДАПТИВ ---------- */
@media (max-width:1199px){
  .term{grid-template-columns:minmax(0,1fr) 320px}
  .term-left{order:2; grid-column:1/-1}
  .trust{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:899px){
  .container{padding:0 16px}
  .display{font-size:32px}
  h1,.h1{font-size:24px}
  .hero{padding:32px 0 24px}
  .hero-grid,.g-2,.g-3,.g-4{grid-template-columns:minmax(0,1fr)}
  .term{grid-template-columns:minmax(0,1fr)}
  .term-left,.term-right{order:0; grid-column:auto}
  .main-nav{
    display:none; position:absolute; left:0; right:0; top:60px; flex-direction:column;
    background:var(--surface); border-bottom:1px solid var(--border); padding:8px; gap:2px; box-shadow:var(--sh-2);
  }
  .main-nav.open{display:flex}
  .main-nav a{padding:12px; font-size:15px}
  .nav-toggle{display:grid}
  .acct,.acct-head{grid-template-columns:1fr 1fr 1fr; row-gap:8px}
  .acct .asset{grid-column:1/-1}
  .acct-head{display:none}
  .acct .m{align-items:flex-start}
  .acct .m .val{font-size:13.5px}
  .acct-actions{grid-column:1/-1; justify-content:stretch}
  .acct-actions .btn{flex:1}
  .section{padding:24px 0}
  #toasts{left:16px; right:16px; bottom:16px; max-width:none}
  .qr{width:130px; height:130px}
}
/* Палец крупнее курсора: там, где указатель неточен, все цели нажатия
   доводятся до 44 px, включая плотные строки стакана и ленты. */
@media (pointer:coarse){
  .ob-row{min-height:44px}
  .ob-head,.ob-row{padding:6px 12px}
  .tf-row button,.pct-row button{min-height:44px}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms !important; transition-duration:.001ms !important}
}
@media print{.site-header,.site-footer,.btn{display:none}}

/* ---------- 11. МЕНЮ ПОЛЬЗОВАТЕЛЯ И ДОБАВКИ ---------- */
.user-menu-wrap{position:relative}
.user-menu{position:absolute; right:0; top:calc(100% + 8px); min-width:210px; padding:6px;
  box-shadow:var(--sh-2); z-index:50; display:flex; flex-direction:column; gap:2px}
.user-menu a{padding:10px 12px; border-radius:6px; color:var(--text); font-size:14px; font-weight:520}
.user-menu a:hover{background:var(--surface-2); text-decoration:none}
.page-head{display:flex; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:20px}
.page-head .grow{min-width:0}
.page-head p{color:var(--text-2); margin-top:4px; font-size:14px}
.auth-wrap{min-height:calc(100vh - 60px); display:flex; align-items:flex-start; justify-content:center; padding:40px 16px 64px}
.auth-card{width:100%; max-width:460px}
.kv{display:flex; justify-content:space-between; gap:16px; padding:8px 0; font-size:13.5px; border-bottom:1px dashed var(--border)}
.kv:last-child{border-bottom:0}
.kv .k{color:var(--text-2)} .kv .v{font-weight:600; text-align:right}
.kv .v.mono{font-family:var(--mono); font-variant-numeric:tabular-nums; font-weight:550}
.pill-row{display:flex; gap:8px; flex-wrap:wrap}
.side-buy{color:var(--up); font-weight:650} .side-sell{color:var(--down); font-weight:650}
.timer{display:inline-flex; align-items:center; gap:6px; font-family:var(--mono); font-weight:650; color:var(--brand)}
.timer.low{color:var(--down)}
.doc-item{display:flex; gap:14px; align-items:flex-start; padding:16px; border:1px solid var(--border);
  border-radius:var(--r-sm); background:var(--surface)}
.doc-item .di{width:36px; height:36px; flex:none; border-radius:9px; background:var(--surface-2);
  display:grid; place-items:center; color:var(--text-2); font-size:16px}
.path{font-family:var(--mono); font-size:12px; color:var(--text-3); word-break:break-all}
.two-col{display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr); gap:20px; align-items:start}
.three-col{display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; align-items:start}
.sticky-side{position:sticky; top:76px}
@media (max-width:899px){
  .two-col,.three-col{grid-template-columns:minmax(0,1fr)}
  .sticky-side{position:static}
  .auth-wrap{padding:24px 16px 48px}
}

/* ---------- 12. ДЕМОНСТРАЦИОННЫЙ ПЕРЕКЛЮЧАТЕЛЬ ПРОФИЛЯ ---------- */
.menu-sec{padding:10px 12px; border-bottom:1px solid var(--border); display:flex; flex-direction:column; gap:8px}
.lvl-switch{display:flex; border:1px solid var(--border); border-radius:var(--r-sm); overflow:hidden}
.lvl-switch button{
  flex:1 1 0; border:0; background:var(--surface); color:var(--text-2); cursor:pointer;
  padding:8px 10px; min-height:44px; font-size:12.5px; font-weight:650; line-height:1.2;
}
.lvl-switch button+button{border-left:1px solid var(--border)}
.lvl-switch button:hover{background:var(--surface-2); color:var(--text)}
.lvl-switch button[aria-pressed="true"]{background:var(--brand); color:var(--on-brand)}
/* блок «операция недоступна на этом профиле» */
.strong{font-weight:700; color:var(--text)}
.rate-note{font-size:12.5px; color:var(--text-2)}
.tag-draft{
  display:inline-flex; align-items:center; gap:6px; padding:2px 8px; border-radius:var(--r-pill);
  background:var(--warn-weak); color:var(--warn); font-size:11px; font-weight:700;
  letter-spacing:.03em; text-transform:uppercase;
}
.doc-langs{display:flex; gap:8px; flex-wrap:wrap}
/* значок формата на кнопке открытия документа (docs.html) - файл теперь
   .docx, не сырой markdown; маленький бейдж "W" перед текстом кнопки. */
.doc-link{display:inline-flex; align-items:center; gap:6px}
.doc-ext{
  display:inline-grid; place-items:center; width:16px; height:16px;
  border-radius:4px; background:var(--info); color:#fff;
  font-size:10px; font-weight:700; line-height:1;
}
/* доступно диктору, невидимо глазом */
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}
