* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0e0e11;
  --bg2: #16161a;
  --bg3: #1c1c22;
  --bg4: #222229;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.13);
  --text: #e8e8ec;
  --text2: #8b8b9a;
  --text3: #50505c;
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.1);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.1);
  --accent: #7c6af7;
  --accent-bg: rgba(124,106,247,0.12);
  --ex-binance: #f0b90b;
  --ex-binance-bg: rgba(240,185,11,0.14);
  --ex-bybit: #f7a600;
  --ex-bybit-bg: rgba(247,166,0,0.14);
  --up-wick: #22c55e;
  --dn-wick: #ef4444;
  --grid-line: rgba(255,255,255,0.05);
  --vline-h: rgba(255,255,255,0.07);
  --vline-30: rgba(255,255,255,0.035);
}

/* ── Светлая тема (переопределение тех же переменных) ── */
[data-theme="light"] {
  --bg: #f4f5f7;
  --bg2: #ffffff;
  --bg3: #eceef1;
  --bg4: #e1e4e9;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.14);
  --text: #1b1b24;
  --text2: #5b5b69;
  --text3: #8c8c99;
  --green: #16a34a;
  --green-bg: rgba(22,163,74,0.10);
  --red: #dc2626;
  --red-bg: rgba(220,38,38,0.10);
  --accent: #6d5cf0;
  --accent-bg: rgba(109,92,240,0.12);
  --grid-line: rgba(0,0,0,0.07);
  --vline-h: rgba(0,0,0,0.09);
  --vline-30: rgba(0,0,0,0.045);
}
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; font-size: 12px; -webkit-font-smoothing: antialiased; overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100vh; }

/* ── HEADER ── */
#header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg2); flex-shrink: 0; gap: 12px;
}
.logo { font-size: 14px; font-weight: 700; letter-spacing: -0.5px; white-space: nowrap; font-family: 'Inter', sans-serif; display: inline-flex; align-items: center; gap: 6px; }
.logo-icon { width: 18px; height: 18px; display: block; }
.logo span { color: var(--accent); }
#ticker-bar {
  display: flex; gap: 0; overflow: hidden; flex: 1;
  align-items: stretch; height: 26px;
}
.tk { display: flex; gap: 5px; align-items: center; padding: 0 10px; border-left: 1px solid var(--border); font-size: 11px; white-space: nowrap; cursor: pointer; }
.tk:hover { background: var(--bg3); }
.tk.active { background: var(--accent-bg); }
.tk-sym { color: var(--text); font-weight: 700; }
.tk-val { font-weight: 700; font-size: 11.5px; letter-spacing: -0.2px; }
.pos { color: var(--green) !important; }
.neg { color: var(--red)   !important; }
#header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#status {
  display: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.5);
  transition: background 0.2s, box-shadow 0.2s;
}
#status.err { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
#btn-ref {
  font-size: 11px; padding: 3px 10px; border-radius: 5px;
  border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text2); cursor: pointer; font-family: inherit; white-space: nowrap;
}
#btn-ref:hover { background: var(--border2); color: var(--text); }
#btn-ref:disabled { opacity: 0.4; cursor: default; }

/* ── BODY SPLIT ── */
#body { display: flex; flex: 1; overflow: hidden; }

/* ── TOOL SIDEBAR ── */
#tool-sidebar {
  width: 36px; flex-shrink: 0; background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 0; gap: 2px; z-index: 10;
}
.tool-btn {
  width: 28px; height: 28px; border-radius: 5px; border: none;
  background: transparent; color: var(--text3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; position: relative; transition: background 0.1s, color 0.1s;
}
.tool-btn:hover { background: var(--bg3); color: var(--text2); }
.tool-btn.on { background: var(--accent-bg); color: var(--accent); }
.tool-btn[title]:hover::after {
  content: attr(title); position: absolute; left: 38px; top: 50%;
  transform: translateY(-50%); background: var(--bg3); color: var(--text);
  font-size: 11px; font-family: 'Inter', sans-serif; white-space: nowrap;
  padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border2);
  pointer-events: none; z-index: 100;
}
.tool-sep { width: 20px; height: 1px; background: var(--border); margin: 3px 0; flex-shrink: 0; }
#drawing-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
#interact-canvas { position: absolute; inset: 0; z-index: 4; }
#resizer {
  width: 5px; flex-shrink: 0; background: var(--border);
  cursor: col-resize; position: relative; z-index: 20;
  transition: background 0.15s;
}
#resizer:hover, #resizer.dragging { background: var(--accent); }
#resizer::after {
  content: ''; position: absolute; inset: 0 -4px;
}

/* ── LEFT: CHART PANEL ── */
#chart-panel {
  display: flex; flex-direction: column; width: var(--chart-w, 80%);
  border-right: none; flex-shrink: 0; min-width: 200px;
}
#chart-toolbar {
  display: flex; align-items: center; gap: 0;
  border-bottom: 1px solid var(--border); background: var(--bg2);
  padding: 0; flex-shrink: 0; height: 34px;
}
#chart-symbol {
  padding: 0 14px; font-size: 13px; font-weight: 700; letter-spacing: -0.3px;
  color: var(--text); border-right: 1px solid var(--border);
  height: 100%; display: flex; align-items: center; min-width: 110px; gap: 6px;
}
#chart-chg { font-size: 11px; font-weight: 600; }
#tf-btns { display: flex; }
.tf-btn {
  padding: 0 10px; height: 34px; font-size: 11px; font-family: inherit;
  border: none; border-right: 1px solid var(--border);
  background: transparent; color: var(--text3); cursor: pointer;
}
.tf-btn:hover { background: var(--bg3); color: var(--text2); }
.tf-btn.on { background: var(--accent-bg); color: var(--accent); }


#chart-wrap { flex: 1; position: relative; overflow: hidden; }
#chart-canvas { position: absolute; inset: 0; }
#chart-loading {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; background: var(--bg); font-size: 13px; color: var(--text3);
}
.spinner { width: 24px; height: 24px; border: 2px solid var(--border2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

#chart-crosshair {
  position: absolute; inset: 0; pointer-events: none;
}

/* ── RIGHT: SCREENER ── */
#screener { display: flex; flex-direction: column; width: var(--scr-w, 20%); overflow: hidden; min-width: 160px; max-width: 600px; }
#scr-controls {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-bottom: 1px solid var(--border); background: var(--bg2); flex-shrink: 0; flex-wrap: wrap;
}
#search {
  font-family: inherit; font-size: 11px; padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--border2); background: var(--bg3); color: var(--text); flex: 1; outline: none; min-width: 80px;
}
#search:focus { border-color: var(--accent); }
#search::placeholder { color: var(--text3); }
#sort-sel {
  font-family: inherit; font-size: 10px; padding: 3px 6px; border-radius: 4px;
  border: 1px solid var(--border2); background: var(--bg3); color: var(--text2); outline: none; cursor: pointer;
}
#btn-fav-filter {
  font-family: inherit; font-size: 12px; padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--border2); background: var(--bg3); color: var(--text3);
  cursor: pointer; line-height: 1; transition: all 0.1s;
}
#btn-fav-filter:hover { color: #f59e0b; border-color: #f59e0b; }
#btn-fav-filter.on { background: rgba(245,158,11,0.12); color: #f59e0b; border-color: #f59e0b; }
#scr-count { font-size: 10px; color: var(--text3); white-space: nowrap; }
#col-toggles {
  display: flex; gap: 4px; padding: 4px 8px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); background: var(--bg); flex-shrink: 0;
}
.col-toggle {
  font-size: 10px; padding: 2px 7px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border2); background: transparent; color: var(--text3);
  font-family: inherit; transition: all 0.1s; white-space: nowrap;
}
.col-toggle.on { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.col-toggle:hover { color: var(--text2); border-color: var(--border2); }

#scr-table-wrap { flex: 1; overflow-y: auto; overflow-x: hidden; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
thead { position: sticky; top: 0; z-index: 5; }
thead th {
  background: var(--bg2); padding: 4px 6px; font-size: 9px; font-weight: 500;
  color: var(--text3); text-align: right; border-bottom: 1px solid var(--border2);
  cursor: pointer; user-select: none; white-space: nowrap;
}
thead th:first-child { text-align: left; }
thead th:hover { color: var(--text2); }
thead th.on { color: var(--accent); }
.arr { font-size: 8px; margin-left: 1px; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: rgba(255,255,255,0.025); }
tbody tr.sel td { background: var(--accent-bg) !important; }
tbody td {
  padding: 3px 6px; text-align: right; border-bottom: 1px solid var(--border);
  color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.9; font-size: 11px; font-variant-numeric: tabular-nums;
}
tbody td:first-child { text-align: left; color: var(--text); font-weight: 600; font-size: 11px; }
.fav-star {
  display: inline-block; width: 14px; margin-right: 3px;
  color: var(--text3); cursor: pointer; user-select: none;
  font-size: 12px; line-height: 1; transition: color 0.1s;
}
.fav-star:hover { color: #f59e0b; }
.fav-star.on { color: #f59e0b; }
.sym-q { font-size: 8px; color: var(--text3); }
.pill { display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 10px; font-weight: 600; }
.pp { background: var(--green-bg); color: var(--green); }
.pn { background: var(--red-bg);   color: var(--red); }
.p0 { background: var(--bg4); color: var(--text3); }
.bar-bg { display: inline-block; width: 22px; height: 2px; background: var(--border2); border-radius: 1px; vertical-align: middle; margin-left: 3px; overflow: hidden; }
.bar-fg { height: 100%; background: rgba(124,106,247,0.5); border-radius: 1px; }

#scr-loading { padding: 30px 0; text-align: center; color: var(--text3); font-size: 12px; }
#scr-err { display: none; padding: 20px 10px; color: var(--red); font-size: 11px; text-align: center; line-height: 1.6; }

/* ── FOOTER ── */
#footer {
  padding: 4px 14px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text3); flex-shrink: 0; background: var(--bg2);
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
.col-hidden { display: none !important; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }/* ── КНОПКА КЕЙСА В ШАПКЕ ── */
#btn-case {
  font-family: inherit; font-size: 11px; padding: 3px 10px; border-radius: 5px;
  border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text2); cursor: pointer; white-space: nowrap;
}
#btn-case:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
#btn-case.on { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

/* ── МОДАЛКА ── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 8px;
  width: 540px; max-width: 92vw; max-height: 80vh; display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 14px; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text2); font-size: 22px;
  cursor: pointer; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 12px 16px; overflow-y: auto; }

/* Карточка кейса */
.case-item {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  margin-bottom: 8px; cursor: pointer; transition: all 0.1s;
}
.case-item:hover { border-color: var(--accent); background: var(--accent-bg); }
.case-item-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.case-item-meta { font-size: 11px; color: var(--text3); }
.case-item-desc { font-size: 11px; color: var(--text2); margin-top: 6px; line-height: 1.4; }

/* Сетка статистики */
.summary-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.sm-card {
  background: var(--bg3); border-radius: 6px; padding: 10px 12px;
  border: 1px solid var(--border);
}
.sm-label { font-size: 10px; color: var(--text3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.sm-val { font-size: 16px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* ── REPLAY-ПАНЕЛЬ ── */
#case-bar {
  display: flex; align-items: center; gap: 16px; padding: 8px 14px;
  border-top: 1px solid var(--accent); background: var(--bg2);
  flex-shrink: 0; font-size: 11px;
}
.cb-section { display: flex; align-items: center; gap: 6px; }
.cb-info { flex: 1; justify-content: center; color: var(--text2); font-variant-numeric: tabular-nums; }
.cb-info #cb-name { font-weight: 600; color: var(--text); }
#cb-play, .cb-step, .cb-speed, #cb-exit {
  font-family: inherit; font-size: 11px; padding: 4px 10px; border-radius: 4px;
  border: 1px solid var(--border2); background: var(--bg3); color: var(--text2);
  cursor: pointer; line-height: 1;
}
#cb-play { padding: 4px 14px; font-size: 12px; }
.cb-speed.on { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.cb-speed-label, .cb-balance-label { color: var(--text3); margin-left: 4px; }
#cb-balance { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
#cb-pnl-live { font-weight: 600; font-variant-numeric: tabular-nums; }
#cb-exit { color: var(--red); border-color: var(--red); }
#cb-exit:hover { background: var(--red-bg); }

/* ── ТОРГОВАЯ ПАНЕЛЬ ── */
#trade-panel {
  display: none;                       /* видна только в кейс-режиме */
  flex-direction: column;
  width: var(--scr-w, 20%); min-width: 200px; max-width: 600px;
  overflow-y: auto;
  background: var(--bg2); border-left: 1px solid var(--border2);
  padding: 12px; font-size: 11px;
}
/* Кейс-режим: скринер прячется, торговая панель встаёт на его место справа */
body.case-mode #screener { display: none; }
body.case-mode #resizer { display: none; }
body.case-mode #trade-panel { display: flex; }
/* Убираем отвлекающую обвязку: тикер-лента, переключатель бирж, статус,
   живое изменение цены и фандинг. Остаются только инструменты рисования и ТФ. */
body.case-mode #header { display: none; }
body.case-mode #chart-symbol { display: none; }
.tp-head { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.tp-row { margin-bottom: 8px; }
.tp-label { color: var(--text3); display: block; margin-bottom: 3px; font-size: 10px; }
.tp-row input {
  width: 100%; font-family: inherit; font-size: 12px; padding: 5px 8px;
  border-radius: 4px; border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text); outline: none;
}
.tp-row input:focus { border-color: var(--accent); }
.tp-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tp-sltp { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tp-rr {
  font-size: 10px; color: var(--text3); text-align: center;
  padding: 4px; margin-bottom: 8px; background: var(--bg3); border-radius: 4px;
}
.tp-rr.good { color: var(--green); }
.tp-rr.bad { color: var(--red); }
.tp-btn {
  font-family: inherit; font-size: 12px; font-weight: 600; padding: 8px;
  border-radius: 4px; border: none; cursor: pointer; color: #fff;
}
.tp-long { background: var(--green); }
.tp-long:hover { background: #15803d; }
.tp-short { background: var(--red); }
.tp-short:hover { background: #b91c1c; }
.tp-pos-card {
  background: var(--bg3); border-radius: 4px; padding: 8px; margin-bottom: 6px;
  border-left: 3px solid var(--accent);
}
.tp-pos-side { font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.tp-pos-line { font-size: 10px; color: var(--text2); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.tp-pos-line span { color: var(--text); font-weight: 500; }
#tp-close-btn {
  width: 100%; font-family: inherit; font-size: 11px; font-weight: 600; padding: 6px;
  border-radius: 4px; border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text); cursor: pointer;
}
#tp-close-btn:hover { background: var(--border2); }
.tp-pos-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.tp-pos-actions .tp-act-close { grid-column: 1 / -1; }
.tp-pos-hint { font-size: 9px; color: var(--text3); text-align: center; margin: 2px 0 6px; }
.tp-pct-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 5px; }
.tp-pct {
  font-family: inherit; font-size: 10px; font-weight: 600; padding: 4px 0;
  border-radius: 4px; border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text2); cursor: pointer; transition: background .12s, color .12s;
}
.tp-pct:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tp-act {
  font-family: inherit; font-size: 11px; font-weight: 600; padding: 6px 4px;
  border-radius: 4px; border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text); cursor: pointer; transition: background .12s, border-color .12s;
}
.tp-act:hover { background: var(--border2); }
.tp-act-add { grid-column: 1 / -1; border-color: var(--accent); color: var(--accent); }
.tp-act-add:hover { background: var(--accent); color: #fff; }
.tp-act-close { border-color: var(--red); color: var(--red); }
.tp-act-close:hover { background: var(--red); color: #fff; }
.tp-fin-card {
  background: var(--bg3); border-radius: 6px; padding: 12px; margin-bottom: 8px;
  text-align: center; border: 1px solid var(--border2);
}
.tp-fin-title { font-size: 11px; color: var(--text3); margin-bottom: 4px; }
.tp-fin-pnl { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tp-fin-sub { font-size: 11px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tp-fin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.tp-fin-actions .tp-act-add { grid-column: 1 / -1; }
#tp-newcase { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.tp-newcase-hint { font-size: 10px; color: var(--text3); text-align: center; margin-bottom: 6px; }
#tp-trades-list { max-height: 180px; overflow-y: auto; }
.trade-row {
  font-size: 10px; padding: 4px 6px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 6px;
  font-variant-numeric: tabular-nums;
}
.trade-row.win { color: var(--green); }
.trade-row.loss { color: var(--red); }

/* ═══════════════════════════════════════════════
   ЭТАП 2 v5 — стили
   Дописать в конец css/styles.css
   (если v4-блок уже добавлен — удалить его и заменить этим)
   ═══════════════════════════════════════════════ */

/* ── Кнопка ⚙ Настройки в шапке ── */
#btn-settings {
  font-family: inherit; font-size: 14px; line-height: 1;
  padding: 3px 8px; border-radius: 4px; position: relative;
  border: 1px solid var(--border2); background: var(--bg3); color: var(--text2);
  cursor: pointer; transition: all 0.1s;
}
#btn-settings:hover { color: var(--text); border-color: var(--text3); }
#btn-settings .set-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 1;
  padding: 2px 4px; border-radius: 8px; min-width: 14px; text-align: center;
}

/* ═══════════════════════════════════════════════
   #scr-controls — добавление кнопки F справа
   ═══════════════════════════════════════════════ */
#scr-controls { position: relative; }

#funding-anchor {
  position: relative;
  display: inline-block;
  margin-left: auto;
}
#funding-btn {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text2); font-family: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  padding: 0; transition: all 0.15s;
}
#funding-btn:hover {
  color: #7c6af7; border-color: #7c6af7;
  background: rgba(124,106,247,0.08);
}

/* Поповер funding — открывается влево от кнопки чтобы не выходить за скринер */
#funding-pop {
  position: absolute; top: 30px; right: 0; width: 280px; z-index: 200;
  background: #101014; border: 1px solid #1f1f28; border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none; transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s;
}
#funding-pop.on { opacity: 1; pointer-events: auto; transform: translateY(0); }

.fpop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid #1a1a22;
  font-size: 11px; font-weight: 500; color: #e6e6ee;
}
.fpop-hint { font-size: 10px; font-weight: 400; color: #5c5c6a; font-family: 'JetBrains Mono', monospace; }
.fpop-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #1a1a22; }
.fpop-col { background: #101014; padding: 4px 0; }
.fpop-col-head {
  font-size: 9px; letter-spacing: 0.4px; text-transform: uppercase;
  text-align: center; padding: 4px 0 6px; font-weight: 600;
}
.fpop-col-pos { color: var(--green); }
.fpop-col-neg { color: var(--red); }
.fpop-list { display: flex; flex-direction: column; }
.fpop-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 10px; cursor: pointer; transition: background 0.1s;
  font-size: 11px;
}
.fpop-item:hover { background: rgba(255,255,255,0.04); }
.fpop-sym { color: #e6e6ee; font-weight: 500; }
.fpop-val { font-size: 10px; padding: 1px 5px; }
.fpop-empty {
  padding: 12px; text-align: center; font-size: 10px;
  color: #5c5c6a; font-style: italic;
}

/* ═══════════════════════════════════════════════
   #col-toggles — базовые кнопки в шапке скринера
   ═══════════════════════════════════════════════ */
/* Стили .col-toggle уже есть в основном styles.css. Здесь — только подгонка */
.ct-label {
  font-size: 10px; color: var(--text3);
  line-height: 22px; white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   МОДАЛКА НАСТРОЕК
   ═══════════════════════════════════════════════ */
.modal-settings {
  width: 560px; max-width: 95vw; max-height: 80vh;
  background: #101014;
  border: 1px solid #1f1f28;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.modal-settings .modal-head {
  padding: 14px 18px; border-bottom: 1px solid #1a1a22;
  display: flex; align-items: center;
}
.modal-settings .modal-head h3 {
  margin: 0; font-size: 13px; font-weight: 500; color: #e6e6ee;
  flex: 1;
}
.modal-settings .modal-close {
  background: transparent; border: none; color: #5c5c6a;
  font-size: 18px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.modal-settings .modal-close:hover { color: #cfcfd8; }

.settings-layout { display: flex; min-height: 320px; }

#settings-tabs {
  width: 130px; flex-shrink: 0;
  border-right: 1px solid #1a1a22; padding: 8px 0;
}
.set-tab {
  display: block; width: 100%; text-align: left;
  font-family: inherit; font-size: 11px;
  padding: 8px 16px;
  background: transparent; border: none;
  border-left: 2px solid transparent;
  color: #7c7c8a; cursor: pointer; transition: color 0.1s;
}
.set-tab:hover { color: #cfcfd8; }
.set-tab.on { color: #7c6af7; border-left-color: #7c6af7; }

#settings-content {
  flex: 1; padding: 18px 22px; overflow-y: auto;
  min-width: 0;
}

/* ── Подвкладки ── */
.set-subtabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 1px solid #1a1a22;
}
.set-subtab {
  position: relative;
  font-family: inherit; font-size: 11px;
  padding: 6px 14px; margin-bottom: -1px;
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  color: #7c7c8a; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.set-subtab:hover { color: #cfcfd8; }
.set-subtab.on { color: #e6e6ee; border-bottom-color: #7c6af7; }
.subtab-badge {
  background: #7c6af7; color: #fff;
  font-size: 9px; font-weight: 600; line-height: 1;
  padding: 2px 5px; border-radius: 7px; min-width: 14px;
  display: none; text-align: center;
}

/* ── Секции ── */
.set-section { margin-bottom: 4px; }
.set-section + .set-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid #1a1a22; }
.set-section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 12px; gap: 12px;
}
.set-section-title {
  font-size: 12px; font-weight: 500; color: #e6e6ee;
  margin-bottom: 3px;
}
.set-section-hint {
  font-size: 10px; color: #5c5c6a;
  margin-bottom: 12px;
}
.set-section-head .set-section-hint { margin-bottom: 0; }
.set-clear {
  font-family: inherit; font-size: 10px;
  padding: 4px 10px; border-radius: 4px;
  border: 1px solid #1f1f28; background: transparent; color: #7c7c8a;
  cursor: pointer; flex-shrink: 0; white-space: nowrap;
  transition: all 0.1s;
}
.set-clear:hover { color: #e85151; border-color: rgba(232,81,81,0.35); }

/* ═══════════════════════════════════════════════
   ТУМБЛЕРЫ С РАСКРЫВАЮЩИМСЯ МИНИ-ФИЛЬТРОМ
   ═══════════════════════════════════════════════ */
.set-toggles { display: flex; flex-direction: column; gap: 4px; }

.toggle-block {
  border: 1px solid transparent; border-radius: 5px;
  transition: background 0.1s, border-color 0.1s;
}
.toggle-block.open {
  background: rgba(124,106,247,0.05);
  border-color: rgba(124,106,247,0.2);
}

.set-toggle {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; cursor: pointer; user-select: none;
}
.toggle-block:not(.open) .set-toggle:hover {
  background: rgba(255,255,255,0.02); border-radius: 5px;
}

.tgl {
  width: 30px; height: 17px; flex-shrink: 0;
  background: #25252e; border-radius: 9px;
  position: relative; transition: background 0.15s;
}
.tgl.on { background: #7c6af7; }
.tgl-knob {
  position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #8a8a96; transition: transform 0.15s, background 0.15s;
}
.tgl.on .tgl-knob { transform: translateX(13px); background: #fff; }
.tgl-text { display: flex; flex-direction: column; gap: 1px; }
.tgl-label { font-size: 12px; color: #cfcfd8; }
.set-toggle.on .tgl-label { color: #e6e6ee; }
.tgl-hint { font-size: 10px; color: #5c5c6a; }

/* Мини-фильтр под тумблером */
.toggle-filter {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px 10px 52px;  /* отступ слева = 12 padding-блока + 30 тумблер + 10 gap */
}
.tf-prefix {
  font-size: 10px; color: #7c7c8a; white-space: nowrap;
}
.tf-op {
  font-family: inherit; font-size: 10px;
  padding: 2px 4px; border-radius: 3px;
  border: 1px solid #1f1f28; background: #15151a; color: #9c9caa;
  cursor: pointer; outline: none; width: 64px;
}
.tf-val {
  flex: 1; min-width: 0;
  font-family: inherit; font-size: 11px;
  padding: 2px 7px; border-radius: 3px;
  border: 1px solid #1f1f28; background: #15151a; color: #cfcfd8;
  outline: none; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.tf-val::-webkit-outer-spin-button,
.tf-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tf-val:focus { border-color: #7c6af7; }
.tf-unit {
  font-size: 9px; color: #5c5c6a;
  min-width: 16px; text-align: left;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════
   ПОДВКЛАДКА «ФИЛЬТРЫ» — базовые
   ═══════════════════════════════════════════════ */
.fset-list { display: flex; flex-direction: column; gap: 2px; }
.fset-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
}
.fset-label {
  width: 110px; font-size: 11px; color: #9c9caa;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fset-row.on .fset-label { color: #e6e6ee; }
.fset-op {
  font-family: inherit; font-size: 10px;
  padding: 3px 4px; border-radius: 3px;
  border: 1px solid #1f1f28; background: #15151a; color: #9c9caa;
  cursor: pointer; outline: none; width: 78px;
}
.fset-val {
  flex: 1; min-width: 0;
  font-family: inherit; font-size: 11px;
  padding: 3px 7px; border-radius: 3px;
  border: 1px solid #1f1f28; background: #15151a; color: #cfcfd8;
  outline: none; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.fset-val::-webkit-outer-spin-button,
.fset-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fset-val:focus { border-color: #7c6af7; }
.fset-row.on .fset-val { border-color: #7c6af7; }
.fset-unit {
  font-size: 10px; color: #5c5c6a;
  min-width: 18px; text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ── Выбор таймфрейма ── */
.set-tf-row { display: flex; gap: 4px; flex-wrap: wrap; }
.set-tf {
  font-family: inherit; font-size: 11px;
  padding: 5px 12px; border-radius: 4px;
  border: 1px solid #1f1f28; background: transparent; color: #7c7c8a;
  cursor: pointer; min-width: 36px;
  transition: all 0.1s;
}
.set-tf:hover { color: #cfcfd8; border-color: #2a2a35; }
.set-tf.on {
  background: rgba(124,106,247,0.1);
  color: #7c6af7; border-color: #7c6af7;
}
.set-soon { margin-top: 12px; font-size: 10px; font-style: italic; color: #5c5c6a; }

/* ═══════════════════════════════════════════════
   FUNDING В ШАПКЕ ГРАФИКА — капсула
   ═══════════════════════════════════════════════ */
.cf-cap {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: 8px;
  padding: 2px 8px; border-radius: 5px;
  background: var(--bg3); border: none;
  font-variant-numeric: tabular-nums;
  cursor: default;
}
.cf-label {
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text2);
}
.cf-val {
  font-size: 10px; font-weight: 500;
  color: var(--text);
}
.cf-cap.pp .cf-val { color: var(--green); }
.cf-cap.pn .cf-val { color: var(--red); }
.cf-cap.p0 .cf-val { color: var(--accent); }

/* ── Текст-плейсхолдер в ячейке ── */
.muted { color: var(--text3); }

/* ═══════════════════════════════════════════════
   МЕТКИ БИРЖ (Binance / Bybit)
   ═══════════════════════════════════════════════ */
.ex-tag {
  display: inline-block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
  line-height: 1.3;
}
.ex-tag.ex-binance { color: var(--ex-binance); background: var(--ex-binance-bg); }
.ex-tag.ex-bybit   { color: var(--ex-bybit);   background: var(--ex-bybit-bg); }

/* Метка биржи-лидера у пары в скринере: «BIN/BYB» (первой — активная) */
.ex-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 6px;
  vertical-align: middle;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.3;
}
.ex-badge.switch { cursor: pointer; }
.ex-badge.switch:hover .ex-sec { opacity: 1; }
.ex-badge .ex-lead {
  padding: 1px 4px;
  border-radius: 3px;
}
.ex-badge .ex-lead.ex-binance { color: var(--ex-binance); background: var(--ex-binance-bg); }
.ex-badge .ex-lead.ex-bybit   { color: var(--ex-bybit);   background: var(--ex-bybit-bg); }
.ex-badge .ex-slash { color: var(--muted); opacity: 0.5; font-weight: 400; }
.ex-badge .ex-sec {
  color: var(--muted);
  opacity: 0.55;
  transition: opacity 0.15s;
}
.ex-badge .ex-sec.ex-binance { color: var(--ex-binance); }
.ex-badge .ex-sec.ex-bybit   { color: var(--ex-bybit); }

/* Метка биржи в тикер-баре (компактнее) */
.tk-ex {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 0 3px;
  border-radius: 2px;
  line-height: 1.4;
}
.tk-ex.tk-ex-binance { color: var(--ex-binance); background: var(--ex-binance-bg); }
.tk-ex.tk-ex-bybit   { color: var(--ex-bybit);   background: var(--ex-bybit-bg); }

/* Метка биржи в шапке графика */
.cs-exchange {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.cs-exchange.ex-binance { color: var(--ex-binance); background: var(--ex-binance-bg); }
.cs-exchange.ex-bybit   { color: var(--ex-bybit);   background: var(--ex-bybit-bg); }

/* Тумблеры бирж в настройках наследуют общий вид .toggle-block */
.ex-toggle-block .tgl-label { display: flex; align-items: center; gap: 4px; }

/* ── Глобальный тумблер ведущей биржи (BIN│BYB) рядом с «Кейс» ── */
#lead-ex-switch {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  height: 28px;
}
.lead-ex-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lead-ex-btn:first-child { border-right: 1px solid var(--border); }
.lead-ex-btn:hover { color: var(--text); }
.lead-ex-btn.on[data-ex="binance"] { background: var(--ex-binance-bg); color: var(--ex-binance); }
.lead-ex-btn.on[data-ex="bybit"]   { background: var(--ex-bybit-bg);   color: var(--ex-bybit); }
.lead-ex-btn.disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Кликабельная метка биржи в шапке графика ── */
.cs-exchange.switch { cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.cs-exchange.switch:hover .cse-sec { opacity: 1; }
.cs-exchange .cse-lead { font-weight: 700; }
.cs-exchange .cse-slash { color: var(--muted); opacity: 0.5; font-weight: 400; margin: 0 1px; }
.cs-exchange .cse-sec { opacity: 0.5; transition: opacity 0.15s; }
.cs-exchange .cse-sec.ex-binance { color: var(--ex-binance); }
.cs-exchange .cse-sec.ex-bybit   { color: var(--ex-bybit); }

/* ═══════════════════════════════════════════════════════════════
   ЭТАП 3 — каталог кейсов (бейджи) + экран разбора
   Дописывается в конец styles-additions.css
   ═══════════════════════════════════════════════════════════════ */

/* ── Бейджи в каталоге ── */
.case-badge {
  display: inline-block; font-size: 9px; font-weight: 600; padding: 1px 6px;
  border-radius: 999px; margin-left: 6px; vertical-align: middle; letter-spacing: .02em;
}
.case-badge-learn   { background: var(--accent-bg); color: var(--accent); }
.case-badge-control { background: var(--red-bg);    color: var(--red); }
.case-badge-prem    { background: rgba(234,179,8,0.14); color: #eab308; }
.case-pat  { color: var(--accent); }
.case-diff { color: var(--text2); letter-spacing: 1px; }

/* ── Модалка разбора шире обычной ── */
.modal.modal-wide { width: 640px; }

/* ── Шапка: итоговый P&L ── */
.rv-pnl     { text-align: center; font-size: 32px; font-weight: 700; margin-bottom: 2px; }
.rv-pnl-sub { text-align: center; font-size: 12px; font-weight: 500; margin-bottom: 14px; }

/* ── Раскрытие паттерна/исхода ── */
.rv-reveal {
  text-align: center; font-size: 13px; color: var(--text2);
  background: var(--accent-bg); border: 1px solid var(--border2);
  border-radius: 6px; padding: 8px 12px; margin-bottom: 14px;
}
.rv-reveal b { color: var(--text); }

/* ── Твоя сделка vs эталон ── */
.rv-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.rv-card {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 6px; padding: 10px 12px;
}
.rv-card-you    { border-color: var(--border2); }
.rv-card-expert { border-color: rgba(124,106,247,0.45); background: var(--accent-bg); }
.rv-card-muted  { color: var(--text3); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 11px; }
.rv-card-title  { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); margin-bottom: 6px; }
.rv-side        { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.rv-line        { font-size: 12px; color: var(--text2); margin-top: 2px; }
.rv-trade-row   { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text2); margin-top: 4px; font-variant-numeric: tabular-nums; }
.rv-line b      { color: var(--text); font-family: 'JetBrains Mono', Consolas, monospace; }

.rv-noentry { text-align: center; color: var(--text3); padding: 14px; font-size: 13px; }

/* ── Структурированный разбор ── */
.rv-sections { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.rv-sec    { background: var(--bg2); border-left: 2px solid var(--accent); border-radius: 4px; padding: 8px 12px; }
.rv-sec-h  { font-size: 11px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.rv-sec-b  { font-size: 12px; color: var(--text2); line-height: 1.45; }

.rv-stat {
  text-align: center; font-size: 12px; color: var(--text2);
  border-top: 1px solid var(--border); padding-top: 10px; margin-bottom: 4px;
}

/* ── Кнопки ── */
.rv-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.rv-btn {
  padding: 8px 22px; font-family: inherit; font-size: 12px; cursor: pointer;
  border: 1px solid var(--border2); background: var(--bg3); color: var(--text); border-radius: 5px;
}
.rv-btn:hover { background: var(--border2); }
.rv-btn-retry { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.rv-btn-retry:hover { background: rgba(124,106,247,0.2); }
.rv-btn-primary { border-color: var(--green); background: var(--green); color: #fff; }
.rv-btn-primary:hover { background: #15803d; }

/* ── Кнопки выбора паттерна в модалке кейса ── */
.case-pat-btn {
  padding: 14px 12px; font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; color: var(--text);
  border: 1px solid var(--border2); background: var(--bg3); border-radius: 8px;
  transition: background .12s, border-color .12s, color .12s;
}
.case-pat-btn:hover {
  background: var(--accent-bg); border-color: var(--accent); color: var(--accent);
}

/* ── Запертая витрина разбора (Pro) ── */
.rv-locked {
  text-align: center; padding: 18px 16px; margin-bottom: 12px;
  background: var(--accent-bg); border: 1px solid rgba(124,106,247,0.45);
  border-radius: 8px;
}
.rv-locked-icon  { font-size: 26px; margin-bottom: 8px; }
.rv-locked-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.rv-locked-text  { font-size: 12px; color: var(--text2); line-height: 1.5; max-width: 360px; margin: 0 auto; }

/* ── Витрина выбора кейса (карточки паттернов) ── */
.case-pick-head {
  font-size: 12px; color: var(--text2); padding: 14px 14px 2px; line-height: 1.4;
}
.case-pick-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 14px 16px;
}
@media (max-width: 440px) { .case-pick-grid { grid-template-columns: repeat(2, 1fr); } }

.case-pat-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  padding: 14px 8px 12px; cursor: pointer; font-family: inherit;
  background: var(--bg3); border: 1px solid var(--border2); border-radius: 10px;
  transition: background .12s, border-color .12s, transform .08s;
}
.case-pat-card:hover  { background: var(--bg2); border-color: var(--accent); transform: translateY(-2px); }
.case-pat-card:active { transform: translateY(0); }

.cpc-ico { width: 60px; height: 36px; display: flex; align-items: center; justify-content: center; }
.cpc-ico svg { width: 100%; height: 100%; }
.cpc-lvl   { stroke: var(--text3); }
.cpc-path  { stroke: var(--accent); fill: none; }
.cpc-label { font-size: 13px; font-weight: 600; color: var(--text); }

/* «Любой» — выделенная акцентом карточка */
.cpc-any         { background: var(--accent-bg); border-color: rgba(124,106,247,0.4); }
.cpc-any:hover   { background: rgba(124,106,247,0.18); border-color: var(--accent); }
.cpc-any .cpc-ico { width: 28px; height: 28px; }

/* ── Сок: вспышка на закрытии, HUD статистики, пульс баланса ── */
#case-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 9; border-radius: inherit; }
#case-flash.win  { animation: flashWin  .5s ease-out; }
#case-flash.loss { animation: flashLoss .5s ease-out; }
@keyframes flashWin {
  0%   { opacity: 0; box-shadow: inset 0 0 0 rgba(34,197,94,0); }
  25%  { opacity: 1; box-shadow: inset 0 0 110px rgba(34,197,94,0.35); }
  100% { opacity: 0; box-shadow: inset 0 0 110px rgba(34,197,94,0); }
}
@keyframes flashLoss {
  0%   { opacity: 0; box-shadow: inset 0 0 0 rgba(239,68,68,0); }
  25%  { opacity: 1; box-shadow: inset 0 0 110px rgba(239,68,68,0.32); }
  100% { opacity: 0; box-shadow: inset 0 0 110px rgba(239,68,68,0); }
}
#tp-stats { font-size: 10px; font-weight: 600; color: var(--text3); margin-left: 4px; font-variant-numeric: tabular-nums; }
#tp-stats .st-win { color: var(--green); }
#tp-stats .st-loss { color: var(--red); }
#cb-balance.bump { animation: balBump .35s ease-out; display: inline-block; }
@keyframes balBump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.trade-row .tr-r { color: var(--text3); font-weight: 600; }

#tp-sound { float: right; cursor: pointer; font-size: 12px; opacity: .8; user-select: none; }
#tp-sound:hover { opacity: 1; }

/* ── Плечо ── */
.tp-lev-row { margin-top: 6px; }
.tp-lev-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 4px; }
.tp-lev {
  font-family: inherit; font-size: 11px; font-weight: 700; padding: 5px 0;
  border-radius: 4px; border: 1px solid var(--border2); background: var(--bg3);
  color: var(--text2); cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.tp-lev:hover { border-color: var(--accent); color: #fff; }
.tp-lev.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tp-lev:disabled { opacity: .45; cursor: default; }
.tp-lev:disabled:hover { border-color: var(--border2); color: var(--text2); }
.tp-pos-liq-line span { color: #f59e0b; font-weight: 600; }

.tp-expo { font-size: 11px; font-weight: 600; color: var(--accent); text-align: right; margin-top: 5px; font-variant-numeric: tabular-nums; }

/* ── Кабинет «Дневник трейдера» ── */
.cab-modal { width: 640px; }
.cab-acct { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cab-acct-info b { font-size: 14px; }
.cab-acct-info span { display: block; font-size: 12px; color: var(--text2); margin-top: 2px; }
.cab-unverif { color: var(--red); font-style: normal; }
.cab-acct-btns { display: flex; gap: 6px; }
.cab-mini { font-family: inherit; font-size: 11px; padding: 6px 11px; border-radius: 5px; border: 1px solid var(--border2); background: var(--bg3); color: var(--text2); cursor: pointer; }
.cab-mini:hover { color: var(--text); border-color: var(--accent); }
.cab-mini-danger:hover { color: var(--red); border-color: var(--red); }

.cab-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cab-hero-lbl { font-size: 12px; color: var(--text2); }
.cab-hero-val { font-size: 28px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.cab-hero-sub { font-size: 12px; margin-top: 2px; }
.cab-hero-reset { text-align: right; }
.cab-reset-btn { font-family: inherit; font-size: 12px; font-weight: 600; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--border2); background: var(--bg2); color: var(--red); cursor: pointer; }
.cab-reset-btn:hover:not(:disabled) { border-color: var(--red); }
.cab-reset-btn:disabled { opacity: .45; cursor: not-allowed; }
.cab-reset-hint { font-size: 10px; color: var(--text3); margin-top: 4px; }

.cab-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.cab-kpi { background: var(--bg3); border-radius: 8px; padding: 10px 12px; }
.cab-kpi-l { font-size: 11px; color: var(--text2); }
.cab-kpi-v { font-size: 20px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }

.cab-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.cab-card-h { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.cab-svg { width: 100%; height: 80px; display: block; }
.cab-empty { font-size: 12px; color: var(--text3); padding: 6px 0; }

.cab-setup { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.cab-setup-n { width: 120px; font-size: 12px; }
.cab-setup-bar { flex: 1; height: 7px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.cab-setup-bar > div { height: 100%; }
.cab-setup-wr { width: 38px; text-align: right; font-size: 12px; color: var(--text2); }
.cab-setup-avg { width: 60px; text-align: right; font-size: 12px; font-weight: 600; }
.cab-setup-c { width: 48px; text-align: right; font-size: 11px; color: var(--text3); }

.cab-tr { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--border); }
.cab-tr:first-child { border-top: none; }
.cab-tr-l { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cab-side { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.cab-side.pos { color: var(--green); background: var(--green-bg); }
.cab-side.neg { color: var(--red); background: var(--red-bg); }
.cab-tr-p { font-size: 12px; }
.cab-tr-px { font-size: 11px; color: var(--text3); }
.cab-tr-r { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 600; }
.cab-tr-t { font-size: 11px; color: var(--text3); font-weight: 400; width: 86px; text-align: right; }

/* ── Календарь дневника (кабинет) ── */
.cab-cal-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cab-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.cab-seg button { padding: 5px 12px; background: none; border: none; color: var(--text2); font-size: 12px; cursor: pointer; }
.cab-seg button.on { background: var(--bg3); color: var(--text); }
.cab-cal-nav { display: flex; align-items: center; gap: 8px; }
.cab-cal-nav button { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg3); color: var(--text2); font-size: 15px; line-height: 1; cursor: pointer; }
.cab-cal-nav button:hover { color: var(--text); border-color: var(--text3); }
.cab-cal-title { font-size: 13px; font-weight: 600; min-width: 110px; text-align: center; }
.cab-cal-tot { font-size: 12px; color: var(--text2); }
.cab-grid { display: grid; grid-template-columns: repeat(7, 1fr) 0.85fr; gap: 6px; }
.cab-dow { font-size: 11px; color: var(--text3); text-align: center; padding: 2px 0; }
.cab-cell { min-height: 54px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg3); padding: 5px 6px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.cab-cell .cd { font-size: 10px; color: var(--text3); }
.cab-cell .cp { font-size: 12px; font-weight: 600; margin-top: auto; }
.cab-cell .cn { font-size: 10px; color: var(--text3); }
.cab-cell.pos { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); }
.cab-cell.pos .cp { color: var(--green, #22c55e); }
.cab-cell.neg { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); }
.cab-cell.neg .cp { color: var(--red, #ef4444); }
.cab-cell.empty { background: none; border-color: transparent; cursor: default; }
.cab-cell.sel { outline: 2px solid var(--accent, #7c6af7); outline-offset: -1px; }
.cab-wk { border-radius: 9px; background: var(--bg2); display: flex; align-items: center; justify-content: flex-end; padding: 5px 8px; font-size: 12px; font-weight: 600; }
.cab-cal-day { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
@media (max-width: 560px) {
  .cab-grid { gap: 4px; }
  .cab-cell { min-height: 46px; padding: 4px; }
  .cab-cell .cp { font-size: 11px; }
  .cab-cell .cn { display: none; }
}

/* ── Кейс в процессе (на доске вместо витрины паттернов) ── */
.case-resume { max-width: 460px; }
.case-resume-t { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.case-resume-sub { font-size: 13px; color: var(--text2); margin-bottom: 14px; }
.case-resume-btns { display: flex; gap: 10px; }
.case-resume-go, .case-resume-end { padding: 9px 18px; border-radius: 9px; font-size: 13px; font-family: inherit; cursor: pointer; border: 1px solid var(--border); }
.case-resume-go { background: var(--accent, #7c6af7); border-color: transparent; color: #fff; }
.case-resume-go:hover { filter: brightness(1.08); }
.case-resume-end { background: var(--bg2); color: var(--text2); }
.case-resume-end:hover { color: var(--text); border-color: var(--text3); }

/* Кабинет: комфортная ширина, чтобы не растягивался на всю широкую колонку */
#board-cabinet { max-width: 560px; }

/* ── Cookie-баннер ── */
#cookie-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 2000;
  max-width: 760px; margin: 0 auto;
  background: var(--bg2, #16161e); border: 1px solid var(--border, #2a2a36);
  border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  font-size: 13px; color: var(--text2, #c7c7d2);
}
.cc-text { line-height: 1.5; margin-bottom: 12px; }
.cc-text a { color: var(--accent, #7c6af7); }
.cc-custom { margin: 8px 0 12px; display: flex; flex-direction: column; gap: 8px; }
.cc-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cc-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.cc-btn { padding: 9px 16px; border-radius: 9px; font-size: 13px; font-family: inherit; cursor: pointer; border: 1px solid var(--border, #2a2a36); }
.cc-primary { background: var(--accent, #7c6af7); border-color: transparent; color: #fff; }
.cc-primary:hover { filter: brightness(1.08); }
.cc-secondary { background: var(--bg, #0e0e14); color: var(--text2, #c7c7d2); }
.cc-secondary:hover { color: var(--text, #fff); }
.cc-ghost { background: transparent; color: var(--text3, #8b8b9a); }
.cc-ghost:hover { color: var(--text2, #c7c7d2); }
@media (max-width: 560px) { .cc-btns { justify-content: stretch; } .cc-btn { flex: 1; } }

/* ── Карточка подписки (настройки → Подписка) ── */
.sub-card { font-size: 14px; }
.sub-muted { color: var(--text2, #8b8b9a); padding: 6px 0; }
.sub-block { background: var(--bg2, #16161a); border: 1px solid var(--border, rgba(255,255,255,.07)); border-radius: 12px; padding: 14px 16px; }
.sub-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
.sub-row + .sub-row { border-top: 1px solid var(--border, rgba(255,255,255,.06)); }
.sub-row span { color: var(--text2, #8b8b9a); }
.sub-row b { color: var(--text, #e8e8ec); font-weight: 600; }
.sub-ok { color: var(--green, #22c55e) !important; }
.sub-warn { color: #f59e0b !important; }
.sub-actions { margin-top: 12px; }
.sub-note { margin-top: 12px; font-size: 12.5px; line-height: 1.5; color: var(--text2, #8b8b9a); }
.sub-btn { border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--accent, #7c6af7); color: #fff; transition: opacity .15s; }
.sub-btn:hover { opacity: .9; }
.sub-btn-ghost { background: transparent; border: 1px solid var(--border2, rgba(255,255,255,.13)); color: var(--text2, #8b8b9a); }
.sub-btn-ghost:hover { color: var(--text, #e8e8ec); border-color: var(--text2, #8b8b9a); opacity: 1; }
.sub-plans { display: flex; gap: 12px; margin: 14px 0; }
.sub-plan { flex: 1; background: var(--bg2, #16161a); border: 1px solid var(--border, rgba(255,255,255,.07)); border-radius: 12px; padding: 16px; text-align: center; }
.sub-plan-best { border-color: var(--accent, #7c6af7); }
.sub-plan-name { color: var(--text2, #8b8b9a); font-size: 13px; margin-bottom: 8px; }
.sub-plan-price { color: var(--text, #e8e8ec); font-size: 22px; font-weight: 700; margin-bottom: 14px; }
.sub-plan-price span { font-size: 13px; font-weight: 400; color: var(--text2, #8b8b9a); }
.sub-consent { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; color: var(--text2, #8b8b9a); cursor: pointer; }
.sub-consent input { margin-top: 2px; flex-shrink: 0; }

/* ── Слайдер размера позиции (% баланса) в кейсе ── */
.tp-size-slider-row { display: flex; align-items: center; gap: 10px; }
.tp-size-slider-row .tp-label { flex-shrink: 0; }
#tp-size-slider { flex: 1; -webkit-appearance: none; appearance: none; height: 15px; border-radius: 3px;
  background: transparent; outline: none; cursor: pointer; }
#tp-size-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 3px; background: var(--bg3, #1c1c22); }
#tp-size-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px;
  border-radius: 50%; background: var(--accent, #7c6af7); cursor: pointer; border: 2px solid var(--bg, #0e0e14);
  margin-top: -5.5px; }
#tp-size-slider::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--accent, #7c6af7);
  cursor: pointer; border: 2px solid var(--bg, #0e0e14); }
#tp-size-slider::-moz-range-track { height: 4px; border-radius: 3px; background: var(--bg3, #1c1c22); }
.tp-size-pct { flex-shrink: 0; min-width: 40px; text-align: right; font-weight: 600; font-size: 13px;
  color: var(--accent, #7c6af7); font-variant-numeric: tabular-nums; }
