/* HYPE ROC — OKX-style dark trading UI. Mobile-first, compact, high-density. */
:root {
  color-scheme: dark;

  /* Поверхности: чистый чёрный как на OKX */
  --bg: #000000;
  --bg-1: #0a0b0d;
  --bg-2: #101215;
  --bg-3: #16191d;
  --bg-4: #1c2026;
  --line: #1f2429;
  --line-2: #2b3138;

  /* Текст */
  --text: #ffffff;
  --text-2: #cfd4dc;
  --muted: #7a828d;
  --muted-2: #737b87;

  /* Акценты */
  --lime: #c2ff3d;
  --lime-2: #a5e81a;
  --lime-dim: rgb(194 255 61 / 12%);
  --lime-line: rgb(194 255 61 / 32%);
  --red: #ff4d4f;
  --red-dim: rgb(255 77 79 / 12%);
  --red-line: rgb(255 77 79 / 32%);
  --amber: #ffb020;
  --amber-dim: rgb(255 176 32 / 12%);
  --amber-line: rgb(255 176 32 / 30%);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;

  --font: "OKX Sans", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --num: "SF Mono", "OKX Sans", ui-monospace, "Segoe UI", Inter, system-ui, sans-serif;

  font-family: var(--font);
  --pad: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { min-height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 46% at 50% -6%, rgb(194 255 61 / 7%) 0, transparent 62%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
button, input, select, textarea { font: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; border-radius: 4px; }
.btn:focus-visible, .icon-btn:focus-visible, .seg-btn:focus-visible { outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.pos { color: var(--lime); }
.neg { color: var(--red); }
.hide { display: none !important; }
/* Атрибут hidden должен побеждать display:flex/grid у .alert, .panel-body, .kv и др. */
[hidden] { display: none !important; }

/* ─────────── Шапка ─────────── */
.top {
  position: sticky; top: 0; z-index: 40;
  background: rgb(0 0 0 / 78%);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-inner {
  height: 52px; display: flex; align-items: center; gap: 10px;
  padding: 0 max(var(--pad), env(safe-area-inset-left));
  width: min(1360px, 100%); margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 9px; color: #000; background: linear-gradient(140deg, var(--lime), var(--lime-2));
  font-size: 15px; font-weight: 900; letter-spacing: -0.06em;
  box-shadow: 0 4px 18px rgb(194 255 61 / 26%);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-name { font-size: 15px; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap; }
.brand-sub { font-size: 9px; font-weight: 600; color: var(--muted); letter-spacing: 0.14em; white-space: nowrap; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); flex: none; }
.dot.on { background: var(--lime); box-shadow: 0 0 0 3px rgb(194 255 61 / 16%); }
.dot.off { background: var(--red); box-shadow: 0 0 0 3px rgb(255 77 79 / 16%); }

.icon-btn {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--bg-2); color: var(--text-2); font-size: 15px; line-height: 1;
  transition: border-color .15s, color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); border-color: #3a424c; background: var(--bg-3); }
.top-right form { margin: 0; display: flex; }

/* ─────────── Лента системных чипов ─────────── */
.statbar {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 8px max(var(--pad), env(safe-area-inset-left));
  width: min(1360px, 100%); margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.statbar::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg-1); font-size: 10px; white-space: nowrap;
}
.chip-k { color: var(--muted-2); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.chip-v { color: var(--text-2); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ─────────── Каркас ─────────── */
.wrap {
  width: min(1360px, 100%); margin: 0 auto;
  padding: 12px max(var(--pad), env(safe-area-inset-left)) calc(28px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
}

/* Строка режима */
.mode-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
}
.mode-row .pair { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.pair-symbol { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.pair-market { white-space: nowrap; font-size: 9px; font-weight: 700; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.mode-row .spacer { margin-left: auto; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--bg-3); color: var(--text-2);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.pill.running { color: var(--lime); border-color: var(--lime-line); background: var(--lime-dim); }
.pill.waiting { color: var(--amber); border-color: var(--amber-line); background: var(--amber-dim); }
.pill.faulted { color: var(--red); border-color: var(--red-line); background: var(--red-dim); }

.alert {
  display: flex; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--red-line); border-radius: var(--r);
  background: var(--red-dim); color: #ffb3b4; font-size: 12px; line-height: 1.45;
}
.alert::before { content: "!"; flex: none; width: 16px; height: 16px; margin-top: 1px; display: grid; place-items: center; border-radius: 50%; background: var(--red); color: #000; font-size: 11px; font-weight: 900; }

/* ─────────── Мелкие плитки статистики (2 колонки на телефоне) ─────────── */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tiles.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile {
  min-width: 0; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  display: flex; flex-direction: column; gap: 3px;
}
.tile-k { font-size: 9.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-v { font-size: 16px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-s { font-size: 10px; line-height: 1.35; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile.accent { border-color: var(--lime-line); background: linear-gradient(180deg, rgb(194 255 61 / 8%), var(--bg-1)); }

/* ─────────── Панели ─────────── */
.panel {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 10px; border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 13px; font-weight: 800; letter-spacing: -0.01em; display: flex; align-items: center; gap: 7px; }
.panel-title::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--lime); }
.panel-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.panel-head .spacer { margin-left: auto; }
.panel-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.panel-body.tight { padding: 8px; }
.panel-body.flush { padding: 0; }

/* ─────────── Формы и кнопки ─────────── */
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) 76px; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
input, select {
  width: 100%; min-height: 44px; padding: 0 12px;
  color: var(--text); background: var(--bg-3);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); outline: 0;
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 20px, calc(100% - 10px) 20px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
input:focus, select:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgb(194 255 61 / 14%); }
input:disabled, select:disabled { opacity: .5; }
input::placeholder { color: var(--muted-2); font-weight: 600; }

.hint {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--bg-3); border: 1px solid var(--line);
  font-size: 11px; color: var(--muted);
}
.hint b { color: var(--text); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }

.btn {
  min-height: 44px; padding: 0 14px; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 800; letter-spacing: -0.01em;
  transition: filter .15s, opacity .15s, transform .1s, background .15s, border-color .15s;
}
.btn:active:not(:disabled) { transform: scale(.985); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn-primary { background: linear-gradient(140deg, var(--lime), var(--lime-2)); color: #000; box-shadow: 0 6px 22px rgb(194 255 61 / 20%); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost { background: var(--bg-3); color: var(--text-2); border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-4); color: var(--text); }
.btn-warn { background: var(--amber-dim); color: var(--amber); border-color: var(--amber-line); }
.btn-warn:hover:not(:disabled) { background: rgb(255 176 32 / 18%); }
.btn-danger { background: var(--red-dim); color: var(--red); border-color: var(--red-line); }
.btn-danger:hover:not(:disabled) { background: rgb(255 77 79 / 18%); }
.btn-sm { min-height: 34px; font-size: 12px; padding: 0 12px; width: auto; }
.btn-stack { display: grid; gap: 8px; align-content: start; }
.control-body { gap: 8px; }
#start-form { display: flex; flex-direction: column; gap: 8px; }

/* ─────────── Сегментированный переключатель ─────────── */
.seg {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 3px; gap: 2px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg-1);
}
.seg-btn {
  min-height: 32px; padding: 5px 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted);
  font-size: 11px; font-weight: 700; white-space: nowrap;
  transition: background .15s, color .15s;
}
.seg-btn[aria-selected="true"] { background: var(--bg-4); color: var(--text); }
.seg.lime .seg-btn[aria-selected="true"] { background: var(--lime); color: #000; }
.head-tools { display: flex; align-items: center; gap: 8px; }

/* ─────────── Пары ключ-значение ─────────── */
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.kv > div {
  min-width: 0; padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--bg-1); border: 1px solid var(--line);
}
.kv dt, .kv .k { font-size: 9.5px; color: var(--muted); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv dd, .kv .v { margin: 3px 0 0; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─────────── Таблицы ─────────── */
.tbl-wrap {
  width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(to right, var(--bg-2), rgb(0 0 0 / 0)) left center,
    linear-gradient(to left, var(--bg-2), rgb(0 0 0 / 0)) right center,
    radial-gradient(farthest-side at 0 50%, rgb(0 0 0 / 40%), rgb(0 0 0 / 0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / 40%), rgb(0 0 0 / 0)) right center;
  background-repeat: no-repeat;
  background-size: 24px 100%, 24px 100%, 12px 100%, 12px 100%;
  background-attachment: local, local, scroll, scroll;
}
.tbl { width: 100%; border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  padding: 8px 8px; text-align: left; white-space: nowrap;
  color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.tbl td { padding: 9px 8px; white-space: nowrap; border-bottom: 1px solid rgb(31 36 41 / 70%); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.n { text-align: right; }
.tbl th.n { text-align: right; }
.empty { padding: 26px 12px; text-align: center; color: var(--muted-2); font-size: 12px; }

.tag {
  display: inline-block; padding: 2px 6px; border-radius: 5px;
  background: var(--bg-4); color: var(--text-2);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap;
}
.tag.lime { background: var(--lime-dim); color: var(--lime); }
.tag.red { background: var(--red-dim); color: var(--red); }
.tag.amber { background: var(--amber-dim); color: var(--amber); }

.lvl-bar { position: relative; width: 54px; height: 4px; border-radius: 3px; background: var(--bg-4); overflow: hidden; }
.lvl-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--lime); }

/* ─────────── История сделок ─────────── */
.hlist { display: flex; flex-direction: column; }
.hitem { border-bottom: 1px solid var(--line); }
.hitem:last-child { border-bottom: 0; }
.hitem > summary { list-style: none; cursor: pointer; padding: 10px 12px; display: flex; gap: 9px; align-items: flex-start; transition: background .15s; }
.hitem > summary::-webkit-details-marker { display: none; }
.hitem > summary:hover { background: var(--bg-2); }
.hitem[open] > summary { background: var(--bg-2); }
.hbar { flex: none; width: 3px; align-self: stretch; min-height: 32px; border-radius: 2px; background: var(--muted-2); }
.hbar.pos { background: var(--lime); }
.hbar.neg { background: var(--red); }
.hmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hline { display: flex; align-items: baseline; gap: 8px; }
.htime { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hpnl { margin-left: auto; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hmeta b { color: var(--text-2); font-weight: 700; }
.hchevron { flex: none; align-self: center; color: var(--muted-2); font-size: 10px; transition: transform .18s; }
.hitem[open] .hchevron { transform: rotate(90deg); }
.hdet { padding: 0 12px 12px 24px; }
.hdet .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ─────────── Дневная статистика ─────────── */
.dlist { display: flex; flex-direction: column; }
.ditem { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.ditem:last-child { border-bottom: 0; }
.dtop { display: flex; align-items: baseline; gap: 8px; }
.ddate { font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dweek { font-size: 10px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.06em; }
.dpnl { margin-left: auto; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dmeta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dmeta b { color: var(--text-2); font-weight: 700; }
.wr { display: flex; width: 100%; max-width: 148px; height: 3px; border-radius: 2px; overflow: hidden; background: var(--bg-4); }
.wr > i { display: block; height: 100%; }
.wr > i.w { background: var(--lime); }
.wr > i.l { background: var(--red); }

/* ─────────── График ─────────── */
.chart-box { position: relative; }
.chart-box canvas { display: block; width: 100%; height: 180px; touch-action: pan-y; }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: none; transform: translate(-50%, -110%);
  padding: 5px 8px; border-radius: 7px; border: 1px solid var(--line-2);
  background: rgb(16 18 21 / 96%); box-shadow: 0 8px 24px #000a;
  font-size: 10.5px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chart-tip b { display: block; font-size: 12px; font-weight: 800; }
.chart-tip small { color: var(--muted); }

/* ─────────── Модалки ─────────── */
.modal {
  width: min(440px, calc(100% - 24px)); padding: 0; margin: auto;
  color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  background: var(--bg-2); box-shadow: 0 30px 90px #000c;
}
.modal::backdrop { background: rgb(0 0 0 / 76%); backdrop-filter: blur(4px); }
.modal-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 14px 0; }
.modal-head h2 { font-size: 15px; font-weight: 800; }
.modal-head p { margin-top: 3px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.modal-foot { padding: 0 14px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.note { font-size: 10.5px; color: var(--muted); line-height: 1.55; }
.state-line { padding: 9px 11px; border-radius: var(--r-sm); background: var(--bg-1); border: 1px solid var(--line); font-size: 11px; color: var(--muted); word-break: break-all; }

/* Мобильный лист-подтверждение снизу */
@media (max-width: 560px) {
  .modal.sheet {
    width: 100%; max-width: 100%; margin: auto auto 0;
    border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-foot .btn { font-size: 13px; padding: 0 10px; }
  .top-inner { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; row-gap: 8px; }
  .nav { order: 3; width: 100%; }
  .nav-link { flex: 1; min-height: 36px; display: grid; place-items: center; text-align: center; }
  .top-right { order: 2; }
  /* На узких экранах на свою строку уходит только сегментный переключатель. */
  .panel-head:has(.seg) { flex-wrap: wrap; }
  .panel-head .seg { width: 100%; }
  .head-tools { width: 100%; }
  .head-tools .seg { flex: 1; min-width: 0; }
  .head-tools .btn-sm { flex: none; }
  .panel-head .seg { display: grid; }
  .panel-head .seg .seg-btn { text-align: center; }
}

/* ─────────── Тост ─────────── */
.toast {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 24px));
  padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: rgb(22 25 29 / 97%); box-shadow: 0 14px 40px #000b;
  font-size: 12px; line-height: 1.45;
}
.toast.ok { border-color: var(--lime-line); }
.toast.error { border-color: var(--red-line); color: #ffb3b4; }

/* ─────────── Логин / ошибка ─────────── */
.auth-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth-card {
  width: min(380px, 100%); padding: 26px 20px;
  border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  box-shadow: 0 30px 90px #000a; text-align: center;
}
.auth-card .brand-mark { width: 44px; height: 44px; margin: 0 auto 14px; font-size: 20px; border-radius: 13px; }
.auth-card h1 { font-size: 20px; font-weight: 800; letter-spacing: 0.02em; }
.auth-card > p { margin: 6px 0 20px; font-size: 11px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.auth-card label { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.field-error, .form-error { color: var(--red); font-size: 11px; }
.form-error { padding: 9px 11px; border: 1px solid var(--red-line); border-radius: var(--r-sm); background: var(--red-dim); }
.error-page { width: min(420px, calc(100% - 24px)); margin: 18vh auto 0; padding: 26px 20px; text-align: center; }
.error-page .brand-mark { width: 44px; height: 44px; margin: 0 auto 14px; background: var(--red); color: #fff; font-size: 22px; }
.error-page h1 { font-size: 18px; font-weight: 800; }
.error-page p, .error-page small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.error-page .btn { margin-top: 18px; }

/* ─────────── Навигация между экранами ─────────── */
.nav { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-1); }
.nav-link {
  padding: 6px 12px; border-radius: 7px; color: var(--muted);
  font-size: 12px; font-weight: 700; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { background: var(--bg-4); color: var(--text); }

.stack { display: flex; flex-direction: column; gap: 10px; }
.split { display: grid; gap: 10px; }
.warn { color: var(--amber); }

/* ─────────── Прогноз входа ─────────── */
.signal-head { display: flex; flex-direction: column; gap: 3px; }
.signal-verdict { font-size: 17px; font-weight: 800; letter-spacing: -0.03em; }
.signal-verdict.pos { color: var(--lime); }
.signal-verdict.amber { color: var(--amber); }
.signal-note { font-size: 11px; color: var(--muted); line-height: 1.45; }

.gauge { display: flex; flex-direction: column; gap: 5px; }
.gauge-top { display: flex; align-items: baseline; gap: 8px; }
.gauge-name { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.gauge-value { margin-left: auto; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gauge-track { position: relative; height: 6px; border-radius: 4px; background: var(--bg-4); overflow: hidden; }
.gauge-fill {
  display: block; height: 100%; width: 0; border-radius: 4px;
  background: linear-gradient(90deg, #4d5665, #7a828d);
  transition: width .35s ease;
}
.gauge-fill.met { background: linear-gradient(90deg, var(--lime-2), var(--lime)); box-shadow: 0 0 12px rgb(194 255 61 / 45%); }
.gauge-fill.neg { background: var(--red); }
.gauge-target { font-size: 10px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.cooldown {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--amber-line); border-radius: var(--r-sm);
  background: var(--amber-dim); color: var(--amber); font-size: 11px; font-weight: 700;
}
.cooldown b { font-size: 15px; font-variant-numeric: tabular-nums; }
.kv.compact > div { padding: 7px 9px; }
.kv.compact dd { font-size: 12px; }

/* ─────────── График TradingView ─────────── */
.tv-box { position: relative; width: 100%; }
#tv-chart { width: 100%; height: 260px; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted-2); font-size: 12px; pointer-events: none;
}
.legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  padding: 9px 12px; border-top: 1px solid var(--line);
  font-size: 10px; color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend .dash { width: 14px; height: 0; border-top: 2px dashed currentColor; }
.legend .dash.entry { color: #fff; border-top-style: solid; }
.legend .dash.tp { color: var(--lime); }
.legend .dash.stop { color: var(--red); }
.legend .mark { width: 8px; height: 8px; border-radius: 50%; }
.legend .mark.entry { background: var(--lime); }
.legend .mark.exit { background: var(--red); box-shadow: -11px 0 0 -1px var(--lime); margin-left: 10px; }
.legend .dot-mark {
  width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-bottom: 7px solid var(--lime);
}

/* ─────────── Риск позиции ─────────── */
.risk-box { display: flex; flex-direction: column; gap: 10px; }
.tp-bar {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-1);
}
.tp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.tp-top b { font-size: 14px; color: var(--lime); font-variant-numeric: tabular-nums; }
.tp-track { height: 6px; border-radius: 4px; background: var(--bg-4); overflow: hidden; }
.tp-fill { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--lime-2), var(--lime)); transition: width .35s ease; }
.tp-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ─────────── Распределения ─────────── */
.dist { display: flex; flex-direction: column; gap: 6px; }
.dist-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 22px 88px; align-items: center; gap: 7px; }
.dist-label { font-size: 10.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.dist-label.wide { font-size: 10px; }
.dist-track { height: 14px; border-radius: 4px; background: var(--bg-1); border: 1px solid var(--line); overflow: hidden; }
.dist-fill { display: block; height: 100%; min-width: 2px; border-radius: 3px; background: var(--lime); transition: width .35s ease; }
.dist-fill.neg { background: var(--red); }
.dist-fill.zero { background: var(--bg-4); min-width: 0; }
.dist-count { font-size: 11px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.dist-extra { font-size: 10px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.insight {
  margin-top: 4px; padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--bg-1); border: 1px solid var(--line);
  font-size: 11px; color: var(--text-2); line-height: 1.5;
}

/* ─────────── Настройки: вкладки и переключатели ─────────── */
.settings-pane { display: flex; flex-direction: column; gap: 10px; }
#settings-dialog .seg { display: grid; width: 100%; }
.modal-foot.inline { padding: 4px 0 0; }
.switches { display: flex; flex-direction: column; gap: 2px; }
.switch {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer;
  transition: background .15s;
}
.switch:hover { background: var(--bg-1); }
.switch-text { display: flex; flex-direction: column; gap: 2px; font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.switch-text b { font-size: 12.5px; font-weight: 700; color: var(--text); }
.switch input[type="checkbox"] {
  appearance: none; flex: none; position: relative; order: 2; margin-left: auto;
  width: 40px; min-width: 40px; height: 23px; min-height: 23px; padding: 0;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--bg-4);
  transition: background .18s, border-color .18s;
}
.switch input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--muted); transition: transform .18s, background .18s;
}
.switch input[type="checkbox"]:checked { background: var(--lime-dim); border-color: var(--lime-line); }
.switch input[type="checkbox"]:checked::after { transform: translateX(17px); background: var(--lime); }
.state-line.ok { color: var(--lime); border-color: var(--lime-line); background: var(--lime-dim); }

/* ─────────── Формула доходности: velocity x utilization x time-in-market ─────────── */
.formula { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.formula-cell {
  min-width: 0; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg-1);
  display: flex; flex-direction: column; gap: 3px;
}
.formula-cell.result { border-color: var(--lime-line); background: linear-gradient(180deg, rgb(194 255 61 / 8%), var(--bg-1)); }
.formula-k { font-size: 9.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.07em; text-transform: uppercase; }
.formula-v { font-size: 17px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.formula-s { font-size: 10px; line-height: 1.35; color: var(--muted); overflow-wrap: anywhere; }
.formula-op {
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: var(--muted-2);
  font-variant-numeric: tabular-nums; user-select: none;
}

/* ─────────── ДНК сделок: архетипы ─────────── */
.arch-list { display: flex; flex-direction: column; }
.arch { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.arch:last-child { border-bottom: 0; }
.arch-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.arch-name { font-size: 12.5px; font-weight: 800; letter-spacing: -0.01em; }
.arch-pnl { margin-left: auto; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.arch-bar { display: flex; width: 100%; height: 4px; border-radius: 3px; overflow: hidden; background: var(--bg-4); }
.arch-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--lime); transition: width .35s ease; }
.arch-bar > i.slow { background: var(--amber); }

/* ─────────── Матрица часов UTC ─────────── */
.hm { display: flex; flex-direction: column; gap: 6px; }
.hm-grid { display: grid; grid-template-columns: 24px repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; }
.hm-corner { min-width: 0; }
.hm-hour { font-size: 8px; color: var(--muted-2); text-align: center; font-variant-numeric: tabular-nums; overflow: hidden; }
.hm-day { font-size: 9px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hm-cell {
  aspect-ratio: 1; min-width: 0; border-radius: 2px;
  background: var(--bg-1); border: 1px solid transparent;
  transition: transform .12s;
}
.hm-cell.has { cursor: pointer; }
.hm-cell.on { border-color: var(--text); transform: scale(1.18); }
.hm-legend { display: flex; align-items: center; gap: 7px; font-size: 9.5px; color: var(--muted); flex-wrap: wrap; }
.hm-legend .spacer { margin-left: auto; }
.hm-scale { width: 84px; height: 7px; border-radius: 4px; background: linear-gradient(90deg, #c2ff3d, #ffb020); }
.hm-readout {
  padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--bg-1); border: 1px solid var(--line);
  font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; line-height: 1.45;
}

/* ─────────── Адаптив ─────────── */
@media (min-width: 480px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hdet .kv { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 700px) {
  :root { --pad: 18px; }
  .top-inner { height: 60px; }
  .brand-mark { width: 34px; height: 34px; font-size: 17px; }
  .icon-btn { width: 36px; height: 36px; }
  .brand-name { font-size: 17px; }
  .wrap { padding-top: 16px; gap: 12px; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tiles.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile { padding: 12px 13px; }
  .tile-v { font-size: 19px; }
  .kv { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hdet .kv { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chart-box canvas { height: 240px; }
  #tv-chart { height: 340px; }
  .dist-row { grid-template-columns: 52px minmax(0, 1fr) 30px 96px; }
  /* Формула в строку: множитель × множитель × множитель = результат */
  .formula {
    grid-template-columns: minmax(0, 1fr) 16px minmax(0, 1fr) 16px minmax(0, 1fr) 16px minmax(0, 1.1fr);
    gap: 8px; align-items: stretch;
  }
  .formula-v { font-size: 19px; }
  .hm-grid { grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 3px; }
  .hm-hour { font-size: 9px; }
  .hm-day { font-size: 10px; }
  /* Планшет: форма слева, команды справа — иначе кнопки растягиваются на всю ширину. */
  .control-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
  .tbl { font-size: 12.5px; }
  .tbl td { padding: 10px; }
}
@media (min-width: 1060px) {
  .cols { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; align-items: start; }
  .cols > .col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .cols > .col:first-child { position: sticky; top: 72px; }
  .control-body { display: flex; align-items: stretch; gap: 8px; }
  .tiles { gap: 10px; }
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
}

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