/* ============================================================
   POLYTERM v2.0 — design system
   Dark, restrained, terminal-grade. No gradients / glassmorphism.
   ============================================================ */

:root {
  /* Surfaces — layered dark navy */
  --bg:            #0a0c12;
  --sidebar:       #0c0e15;
  --surface:       #12151d;
  --surface-hover: #171b25;
  --surface-2:     #1a1f2b;
  --border:        #232834;
  --border-soft:   #1a1e27;

  /* Text */
  --text:   #e7e9ee;
  --text-2: #969db0;
  --text-3: #5c6373;

  /* Accent + semantic */
  --accent:       #4f7cff;
  --accent-hover: #6e92ff;
  --accent-soft:  rgba(79, 124, 255, .13);
  --green:  #18c98b;
  --red:    #f6465d;
  --amber:  #f5a623;
  --green-soft: rgba(24, 201, 139, .13);
  --red-soft:   rgba(246, 70, 93, .13);
  --amber-soft: rgba(245, 166, 35, .14);

  /* Risk ratings A..F */
  --risk-a: #18c98b;
  --risk-b: #5fd0a6;
  --risk-c: #f5a623;
  --risk-d: #ff8a3d;
  --risk-e: #f56b5e;
  --risk-f: #f6465d;

  --r-sm: 6px;
  --r:    9px;
  --r-lg: 13px;

  --font: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Consolas", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 244px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { flex: 1; padding: 26px 32px 56px; max-width: 1560px; width: 100%; }

/* ---------- Brand ---------- */
.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 20px 22px 18px;
  font-size: 17px; font-weight: 800; letter-spacing: .4px;
}
.brand-mark {
  width: 28px; height: 28px;
  display: block; flex-shrink: 0;
}
.brand-poly { color: var(--text); }
.brand-term { color: var(--text-3); }

/* ---------- Nav ---------- */
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-group { margin-top: 16px; }
.nav-group:first-child { margin-top: 2px; }
.nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-3);
  padding: 6px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  position: relative;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item.active .ic { color: var(--accent); }
.nav-item .ic { color: var(--text-3); flex-shrink: 0; }
.nav-item:hover .ic { color: var(--text-2); }

/* ---------- User block ---------- */
.user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-top: 1px solid var(--border-soft);
}
.avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: var(--surface-2); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-3); }
.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); padding: 6px; border-radius: var(--r-sm);
  display: flex; transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

/* ---------- Topbar ---------- */
.topbar {
  height: 54px; flex-shrink: 0;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg);
  display: flex; align-items: center; gap: 14px;
  padding: 0 32px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-spacer { flex: 1; }
.crumb { color: var(--text-3); font-size: 13px; }
.crumb b { color: var(--text); font-weight: 600; }

.status-dot {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-2);
}
.status-dot .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 3px var(--green-soft);
}
.status-dot.off .dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.status-dot.stale .dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }

/* Live auto-refresh caption under the page head */
.live-line {
  display: flex; align-items: center; gap: 7px;
  margin-top: 8px; font-size: 11.5px; color: var(--text-3);
}
.live-line .live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse { 50% { opacity: .35; } }

/* Подсветка ячейки при живом обновлении цены (SSE-тик). */
.tick-flash { animation: tick-flash .9s ease-out; border-radius: 4px; }
@keyframes tick-flash {
  0%   { background: var(--accent-soft, rgba(80,160,255,.34)); }
  100% { background: transparent; }
}

/* «О рынке» — правила разрешения: абзацы + сворачивание с затуханием. */
.market-rules { font-size: 13px; line-height: 1.65; color: var(--text-2); }
.market-rules p { margin: 0 0 9px; }
.market-rules p:last-child { margin-bottom: 0; }
.market-rules.clamp {
  max-height: 118px; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent);
  mask-image: linear-gradient(180deg, #000 62%, transparent);
}

/* Live-цена базового актива в шапке графика. */
.asset-live {
  font-family: "JetBrains Mono", monospace; font-size: 13px;
  font-weight: 600; color: var(--green);
}

/* Smart Money — крупнейшие сделки по P&L (горизонтальные бары). */
.pnl-bar-row {
  display: grid; grid-template-columns: 1fr 120px 72px;
  align-items: center; gap: 10px; padding: 5px 0; font-size: 12.5px;
}
.pnl-bar-title {
  color: var(--text-2); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.pnl-bar-track {
  height: 8px; background: var(--border-soft);
  border-radius: 4px; overflow: hidden;
}
.pnl-bar-fill { display: block; height: 100%; border-radius: 4px; }
.pnl-bar-fill.up { background: var(--green); }
.pnl-bar-fill.down { background: var(--red); }
.pnl-bar-val { text-align: right; font-family: "JetBrains Mono", monospace; }

/* ── Страница «Подключения» ──────────────────────────────────────────── */
.exec-banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 16px; border-radius: 12px; margin-bottom: 16px;
  border: 1px solid var(--border);
}
.exec-banner b { font-size: 13.5px; }
.exec-banner p { margin: 3px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.exec-banner .exec-ic { flex: none; margin-top: 1px; }
.exec-paper { background: var(--surface-2); }
.exec-paper .exec-ic { color: var(--text-3); }
.exec-live { background: var(--green-soft); border-color: var(--green); }
.exec-live .exec-ic { color: var(--green); }

.conn-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 720px) { .conn-types { grid-template-columns: 1fr; } }
.conn-type {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  padding: 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); cursor: pointer; transition: border-color .12s, background .12s;
}
.conn-type:hover:not(:disabled) { border-color: var(--text-3); }
.conn-type.active { border-color: var(--accent); background: var(--accent-soft); }
.conn-type-ic { color: var(--accent); }
.conn-type-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.conn-type-sub { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.conn-type-soon { opacity: .55; cursor: not-allowed; }

.conn-card {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--surface-2);
}
.conn-card:last-child { margin-bottom: 0; }
.conn-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conn-addr { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.conn-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.conn-step {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; color: var(--text-3);
  padding: 2px 7px; border-radius: 20px; border: 1px solid var(--border-soft);
}
.conn-step.done { color: var(--green); border-color: var(--green); }
.conn-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

/* Пошаговый визард подключения (браузерный путь). */
.cw-steps { display: flex; flex-direction: column; gap: 3px; margin: 12px 0 2px; }
.cw-step {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid transparent;
}
.cw-step.current { border-color: var(--accent); background: var(--accent-soft); }
.cw-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: var(--surface); color: var(--text-3); border: 1px solid var(--border);
}
.cw-step.done .cw-num { background: var(--green-soft); color: var(--green); border-color: transparent; }
.cw-step.current .cw-num { background: var(--accent); color: #fff; border-color: transparent; }
.cw-label { font-size: 12.5px; color: var(--text-3); flex: 1; }
.cw-step.done .cw-label { color: var(--text-2); }
.cw-step.current .cw-label { color: var(--text); }
.cw-step .btn, .cw-step .btn-sm { margin-left: auto; }
.conn-hint { font-size: 11px; color: var(--text-3); margin: 6px 0 0; line-height: 1.5;
  display: flex; align-items: center; gap: 6px; }
.conn-hint.ok { color: var(--green); }

.env-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .6px;
  padding: 4px 9px; border-radius: var(--r-sm);
  background: var(--amber-soft); color: var(--amber);
  border: 1px solid rgba(245, 166, 35, .25);
}
.env-pill.env-live {
  background: var(--red-soft); color: var(--red);
  border-color: rgba(246, 70, 93, .25);
}

/* ---------- Page head ---------- */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.page-head .subtitle { color: var(--text-2); font-size: 13px; margin-top: 3px; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
}
.card-title { font-size: 14px; font-weight: 650; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
}

/* Спорт-фид: карточка матча (live-счёт/форма/рекорд из ESPN). */
.sports-card { margin-top: 14px; }
.sports-card .sports-state {
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 100px;
  background: var(--surface-2, #161a22); color: var(--text-3);
}
.sports-card .sports-state.sports-in { background: var(--green-soft); color: var(--green); }
.sports-card .sports-state.sports-post { color: var(--text-2); }
.sports-team {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 12px;
  align-items: center; padding: 8px 2px;
}
.sports-team + .sports-team { border-top: 1px solid var(--border, #232733); }
.sports-team.is-win .sports-name { color: var(--text-1); font-weight: 650; }
.sports-logo { width: 28px; height: 28px; object-fit: contain; }
.sports-name { font-size: 13.5px; }
.sports-meta { display: flex; gap: 10px; font-size: 11.5px; margin-top: 2px; }
.sports-form { display: inline-flex; gap: 2px; }
.sports-form .frm, .sports-h2h .frm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 3px; font-size: 9px; font-weight: 700;
  font-family: var(--mono); color: #fff;
}
.frm-w { background: var(--green); }
.frm-l { background: var(--red); }
.frm-d { background: var(--text-3); }
.sports-score { font-size: 22px; font-weight: 700; min-width: 32px; text-align: right; }
.sports-h2h { margin-top: 10px; border-top: 1px solid var(--border, #232733); padding-top: 8px; }
.sports-h2h-title { font-size: 11px; margin-bottom: 5px; }
.sports-h2h-row {
  display: grid; grid-template-columns: 1fr auto 18px; gap: 10px;
  align-items: center; font-size: 12px; padding: 2px 0;
}
.sports-foot { font-size: 11px; margin-top: 8px; }

/* Полоска события на странице рынка + чипы соседних ставок. */
.event-strip { margin-top: 14px; padding: 12px 16px; }
.evt-link { color: var(--text-1); font-weight: 600; text-decoration: none; }
.evt-link:hover { color: var(--accent, #4f9dff); }
.sib-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sib-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px; border: 1px solid var(--border, #232733);
  border-radius: 8px; background: var(--surface-2, #161a22);
  font-size: 12.5px; text-decoration: none; color: var(--text-2);
}
.sib-chip:hover { border-color: var(--accent, #4f9dff); color: var(--text-1); }
.sib-chip .sib-prob { color: var(--text-1); font-weight: 600; }
.evt-meta { text-decoration: none; color: var(--text-3); }
.evt-meta:hover { color: var(--accent, #4f9dff); }
.news-refresh { color: var(--text-3); }
.news-refresh:hover { color: var(--accent, #4f9dff); }

/* «На чём основан сигнал» — драйверы рекомендации под баннером тикета. */
.rec-why { margin: 8px 0 4px; padding: 8px 10px; border-radius: 8px;
  background: var(--surface-2, #161a22); border: 1px solid var(--border, #232733); }
.rec-why-h { font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.rec-why-row { display: flex; gap: 8px; font-size: 12px; padding: 2px 0; }
.rec-why-l { color: var(--text-1); font-weight: 600; flex-shrink: 0; min-width: 96px; }
.rec-why-s { color: var(--text-2); }

/* Grouped-режим: карточка мультиисходного события с под-рынками внутри. */
.evt-card .evt-title { font-weight: 650; }
.evt-chip { display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent); }
.evt-count { display: inline-flex; align-items: center; gap: 5px;
  margin: 8px 0 6px; font-size: 11px; color: var(--text-3); }
.evt-count .ic { color: var(--accent); }
.evt-sub { display: flex; flex-direction: column; gap: 1px; margin-bottom: 4px; }
.evt-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 64px 38px 42px;
  gap: 10px; align-items: center;
  padding: 6px 8px; border-radius: 6px; text-decoration: none;
  color: var(--text-2); font-size: 12.5px; transition: background .12s;
}
.evt-row:hover { background: var(--surface-hover); color: var(--text); }
.evt-row-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evt-row-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.evt-row-bar > span { display: block; height: 100%; background: var(--accent);
  border-radius: 3px; min-width: 2px; }
.evt-row-prob { color: var(--text); font-weight: 600; text-align: right;
  font-variant-numeric: tabular-nums; }
.evt-row-alpha { text-align: right; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.evt-row-alpha.up { color: var(--green); }
.evt-row-alpha.down { color: var(--red); }
.evt-more { text-decoration: none; color: var(--text-3); font-size: 12px; }
.evt-more:hover { color: var(--accent); }

/* Строки события (стиль Polymarket): метка + вероятность + изменение + Buy. */
.evrow {
  display: grid; grid-template-columns: 1fr auto auto; gap: 14px;
  align-items: center; padding: 10px 4px;
}
.evrow + .evrow { border-top: 1px solid var(--border, #232733); }
.evrow-main { text-decoration: none; min-width: 0; display: flex; gap: 10px; align-items: center; }
.evrow-icon { margin-top: 0; }
.evrow-text { min-width: 0; flex: 1; }
.evrow-label {
  display: block; font-size: 13.5px; color: var(--text-1); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.evrow-main:hover .evrow-label { color: var(--accent, #4f9dff); }
.evrow-sub { display: flex; align-items: center; gap: 5px; font-size: 11.5px; margin-top: 3px; }
.evrow-bar { display: block; margin-top: 7px; }
.evrow-prob { text-align: right; min-width: 58px; }
.evrow-pct { font-size: 17px; font-weight: 700; font-family: var(--mono); }
.evrow-chg { display: block; font-size: 11px; margin-top: 1px; color: var(--text-3); }
.evrow-chg.up { color: var(--green); }
.evrow-chg.down { color: var(--red); }
.evrow-buy { display: flex; gap: 6px; }
.buybtn {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 84px; max-width: 132px; padding: 6px 10px; border-radius: 8px;
  text-decoration: none; font-size: 11px; font-weight: 600; transition: background .12s;
}
.buybtn .bb-l { max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.buybtn .bb-p { font-family: var(--mono); font-size: 13px; }
.buybtn-yes { background: rgba(24, 201, 139, .12); color: var(--green); }
.buybtn-yes:hover { background: rgba(24, 201, 139, .22); }
.buybtn-no { background: rgba(246, 70, 93, .12); color: var(--red); }
.buybtn-no:hover { background: rgba(246, 70, 93, .22); }
.addr { text-decoration: none; color: var(--text-2); }
.addr:hover { color: var(--accent, #4f9dff); }
@media (max-width: 720px) {
  .evrow { grid-template-columns: 1fr auto; }
  .evrow-buy { grid-column: 1 / -1; }
}

/* Карточка рынка: иконка, инлайн-кнопки Buy, изменение 24ч (стиль Polymarket). */
.mkt-icon { width: 22px; height: 22px; border-radius: 5px; object-fit: cover;
  flex-shrink: 0; margin-top: 1px; }
.mkt-q { display: flex; align-items: flex-start; gap: 8px; }
.mkt-q .mkt-link { min-width: 0; }
.mkt-buy { display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  position: relative; z-index: 1; }       /* над растянутой ссылкой карточки */
.mkt-buy .buybtn { min-width: 0; max-width: none; flex-direction: row;
  align-items: baseline; justify-content: center; gap: 6px; padding: 8px 10px; }
.mkt-meta .meta-item.up { color: var(--green); }
.mkt-meta .meta-item.down { color: var(--red); }
.mkt-meta .evt-meta { position: relative; z-index: 1; }

/* Карточка живой цены актива — лёгкий акцент + пульсирующий индикатор. */
.asset-card { border-color: var(--green-soft); }
.asset-card .live-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 3px var(--green-soft);
  animation: live-pulse 2s ease-in-out infinite; vertical-align: middle;
}

/* ---------- Stat tile ---------- */
.stat { padding: 16px 18px; }
.stat-label {
  font-size: 11px; font-weight: 600; letter-spacing: .7px;
  text-transform: uppercase; color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}
.stat-value {
  font-family: var(--mono); font-size: 25px; font-weight: 600;
  margin-top: 9px; letter-spacing: -.5px;
}
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 5px; }

/* ---------- Table ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 600;
  letter-spacing: .6px; text-transform: uppercase; color: var(--text-3);
  padding: 11px 16px; border-bottom: 1px solid var(--border-soft);
}
.tbl td {
  padding: 13px 16px; border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
}
.tbl tr:last-child td, .tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-hover); }
.tbl .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl .col-q { font-weight: 550; }

/* ---------- Market card ---------- */
.market-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}
.mkt {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px 17px;
  display: flex; flex-direction: column; gap: 13px;
  transition: border-color .12s, background .12s;
}
.mkt-link { color: inherit; }
.mkt-link::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.mkt:hover .mkt-link { color: var(--accent); }
.mkt:hover { border-color: var(--border); background: var(--surface-hover); }
.mkt-top { display: flex; align-items: flex-start; gap: 10px; }
.mkt-q { font-size: 13.5px; font-weight: 600; line-height: 1.4; flex: 1; }
.mkt-prob {
  font-family: var(--mono); font-size: 19px; font-weight: 600;
  flex-shrink: 0; text-align: right;
}
.mkt-prob small { display: block; font-size: 10px; color: var(--text-3); font-weight: 500; }

/* Центр уведомлений в топбаре (Фаза 5d). */
.notif-center { position: relative; display: inline-block; }
.notif-bell { position: relative; }
.notif-bell .notif-badge {
  position: absolute; top: 1px; right: 1px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 100px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.notif-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 6px;
  width: 360px; max-height: 480px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: 0 12px 32px rgba(0,0,0,.45);
  z-index: 50; display: flex; flex-direction: column;
}
.notif-head {
  padding: 11px 14px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px;
}
.notif-list { overflow-y: auto; flex: 1; }
.notif-row {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 14px; border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px; line-height: 1.45;
  border-left: 3px solid var(--border);
  text-decoration: none; color: inherit; cursor: pointer;
  transition: background .12s;
}
.notif-row:hover { background: var(--surface-hover); }
.notif-row:last-child { border-bottom: 0; }
.notif-row.notif-info { border-left-color: var(--accent); }
.notif-row.notif-success { border-left-color: var(--green); }
.notif-row.notif-warning { border-left-color: var(--amber); }
.notif-row.notif-critical { border-left-color: var(--red); }
.notif-title { font-weight: 600; color: var(--text); }
.notif-meta { font-size: 11px; color: var(--text-2); }
.notif-empty {
  padding: 28px 14px; text-align: center; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 12.5px;
}

/* SSE-aware live-индикатор в топбаре (Фаза 5e). */
.sse-dot {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: var(--r-sm);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sse-dot.online { background: rgba(24, 201, 139, 0.13); color: var(--green); }
.sse-dot.offline { background: var(--surface-2); color: var(--text-3); }
.sse-dot .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.sse-dot.online .dot { animation: live-pulse 1.6s ease-in-out infinite; }

/* Топбар: метка деска — кому принадлежит этот рабочий стол (Фаза 5c). */
.topbar-desk {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  color: var(--text-2); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.02em;
}
.topbar-desk .ic { color: var(--text-3); }

/* Y/N inline-пилюли на карточке рынка (Фаза 5b) — как у Fireplace/Bullpen. */
.yn-pair {
  display: inline-flex; gap: 4px; flex-shrink: 0;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
}
.yn-pair > span {
  padding: 4px 8px; border-radius: var(--r-sm);
  letter-spacing: 0.02em; display: inline-flex; gap: 4px; align-items: center;
}
.yn-pair .yn-yes { background: rgba(24, 201, 139, 0.12); color: var(--green); }
.yn-pair .yn-no { background: rgba(246, 70, 93, 0.12); color: var(--red); }
.yn-pair small { font-size: 9.5px; font-weight: 500; opacity: 0.75; letter-spacing: 0.04em; }

/* Пара именованных исходов (Knicks/Cavaliers, Over/Under) — как у Polymarket. */
.oc-pair { display: inline-flex; gap: 4px; flex-shrink: 0; font-size: 11px; font-weight: 600; }
.oc-pair .oc {
  display: inline-flex; align-items: baseline; gap: 5px; padding: 4px 8px;
  border-radius: var(--r-sm); max-width: 112px;
}
.oc-pair .oc-l {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 74px;
  font-weight: 500; opacity: 0.85;
}
.oc-pair .oc-p { font-family: var(--mono); }
.oc-pair .oc-yes { background: rgba(24, 201, 139, 0.12); color: var(--green); }
.oc-pair .oc-no { background: rgba(246, 70, 93, 0.12); color: var(--red); }

.prob-bar {
  height: 5px; border-radius: 3px; background: var(--surface-2);
  overflow: hidden;
}
.prob-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.mkt-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.meta-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-2); font-family: var(--mono);
}
.meta-item .ic { color: var(--text-3); }
.mkt-foot {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border-soft); padding-top: 11px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 8px; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text-2);
}
.badge.ok  { background: var(--green-soft); color: var(--green); }
.badge.bad { background: var(--red-soft);   color: var(--red); }
.badge.warn{ background: var(--amber-soft); color: var(--amber); }

.alpha {
  font-family: var(--mono); font-weight: 600; font-size: 13px;
  padding: 3px 8px; border-radius: var(--r-sm);
}
.alpha.up   { background: var(--green-soft); color: var(--green); }
.alpha.down { background: var(--red-soft);   color: var(--red); }
.alpha.flat { background: var(--surface-2);  color: var(--text-3); }

/* Risk rating chip A..F */
.risk {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: var(--r-sm);
  font-family: var(--mono); font-weight: 700; font-size: 12px;
  color: #06090f;
}
.risk-A { background: var(--risk-a); }
.risk-B { background: var(--risk-b); }
.risk-C { background: var(--risk-c); }
.risk-D { background: var(--risk-d); }
.risk-E { background: var(--risk-e); color: #fff; }
.risk-F { background: var(--risk-f); color: #fff; }

.cat {
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
  padding: 3px 8px; border-radius: 100px;
  background: var(--surface-2); color: var(--text-2);
  text-transform: capitalize;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--r); border: none; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  background: var(--accent); color: #fff;
  transition: filter .12s, background .12s;
}
.btn:hover { filter: brightness(1.12); }
.btn-ghost {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); filter: none; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-2); margin-bottom: 6px;
}
.field input, .field select {
  width: 100%; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font-family: var(--font); font-size: 14px;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Торговые параметры (Настройки → overlay config.yaml) */
.ts-group { font-size: 11px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-3); margin: 16px 0 6px;
  cursor: pointer; user-select: none; }
.ts-group:hover { color: var(--text-2); }
.ts-grp:first-child .ts-group { margin-top: 2px; }
.ts-row { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 5px 0; }
.ts-label { font-size: 13px; color: var(--text-2); }
.ts-badge { font-size: 9px; margin-left: 6px; }
.ts-control { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ts-input { width: 150px; flex-shrink: 0; padding: 7px 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text); font-family: var(--mono); font-size: 13px; }
.ts-input:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
/* В узких числовых полях (R:R, цена) spinner-кнопки браузера накладываются
   на значение, и «3,5» / «0,30» прячутся под ними. Делаем spinner компактнее
   (только Firefox/Chrome) + добавляем правый padding под их ширину. */
.ts-input[type="number"] { padding-right: 18px; }
.ts-input[type="number"]::-webkit-inner-spin-button,
.ts-input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.55; height: 22px;
}
.ts-input[type="number"]:hover::-webkit-inner-spin-button { opacity: 1; }
.ts-reset { width: 28px; height: 30px; flex-shrink: 0; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-3); font-size: 14px; line-height: 1; }
.ts-reset:hover { color: var(--accent); border-color: var(--accent); }
.ts-help { font-size: 10.5px; color: var(--text-3); margin: 0 0 6px; line-height: 1.4; }
.ts-banner { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 12px;
  padding: 9px 12px; border-radius: var(--r-sm); font-size: 12px; line-height: 1.5;
  background: var(--accent-soft); color: var(--text-2); border: 1px solid var(--border); }
.ts-banner .ic { color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.ts-banner b { color: var(--text); }
.lab-intro-body { display: flex; flex-direction: column; gap: 5px; }
.lab-intro-h { font-size: 12px; }
.lab-intro-list { margin: 0; padding-left: 16px; display: grid; gap: 3px; }
.lab-intro-list li { margin: 0; }
.ts-banner-custom { background: var(--surface-2); }

/* Карточка «Точность прогноза» рядом с настройками */
.acc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.acc-cell { display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); }
.acc-k { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.acc-v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.acc-v.good { color: var(--green); }
.acc-v.bad { color: var(--red); }
.acc-sub { font-size: 10.5px; color: var(--text-3); }
@media (max-width: 640px) { .acc-grid { grid-template-columns: repeat(2, 1fr); } }

/* Пресеты + поиск */
.ts-presets { padding-bottom: 12px; margin-bottom: 6px;
  border-bottom: 1px solid var(--border-soft); }
.ts-presets-row { display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 8px; }
.ts-presets-row:last-child { margin-bottom: 0; }
.ts-presets-lbl { font-size: 12px; color: var(--text-3); min-width: 90px; }
.ts-chip { display: inline-flex; align-items: stretch; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--border); }
.ts-chip-apply { padding: 5px 10px; cursor: pointer; background: var(--surface-2);
  border: none; color: var(--text-1); font: inherit; font-size: 12px; }
.ts-chip-apply:hover { background: var(--accent-soft); color: var(--accent); }
.ts-chip-del { padding: 5px 9px; cursor: pointer; background: var(--surface-2);
  border: none; border-left: 1px solid var(--border); color: var(--text-3);
  font-size: 13px; line-height: 1; }
.ts-chip-del:hover { background: var(--red-soft); color: var(--red); }
.ts-chip.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ts-chip.is-active .ts-chip-apply { color: var(--accent); }
/* Профили — сегментный переключатель с подсветкой активного */
.ts-profiles { display: inline-flex; border: 1px solid var(--border);
  border-radius: 9px; overflow: hidden; }
/* v2.46.15 — сегмент-контрол работает и с <button>, и с <a> (журнал
   фильтрует причины ссылками — раньше <a> были без стилей и слипались). */
.ts-profiles button, .ts-profiles a { padding: 6px 13px; cursor: pointer;
  background: var(--surface-2); border: none;
  border-left: 1px solid var(--border); color: var(--text-2);
  font: inherit; font-size: 12.5px; text-decoration: none;
  display: inline-flex; align-items: center; white-space: nowrap; }
.ts-profiles button:first-child, .ts-profiles a:first-child { border-left: none; }
.ts-profiles button:hover, .ts-profiles a:hover { color: var(--text-1); }
.ts-profiles button.active, .ts-profiles a.active {
  background: var(--accent); color: #fff; font-weight: 600; }
.ts-active-custom { font-size: 11.5px; color: var(--amber); }
.ts-search { width: 100%; margin: 4px 0 8px; padding: 8px 11px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text); font-size: 13px; }
.ts-search:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box { position: relative; }
.search-box .ic {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none; transition: color .15s ease;
}
/* v2.46.15 — поиск рынков был нативным input (чужеродный на тёмной теме).
   Стилизуем под терминал: тёмный фон, рамка, фокус-glow, аккуратный
   placeholder, скрытый нативный «×» (свой clear по желанию). */
.search-box input {
  width: 100%; height: 38px; padding: 0 34px 0 36px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-1);
  font-family: inherit; font-size: 13px; line-height: 38px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:hover { border-color: var(--border-strong, var(--text-3)); }
.search-box input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface);
}
.search-box:focus-within .ic { color: var(--accent); }
/* Нативную лупу/крестик WebKit прячем — у нас своя иконка слева. */
.search-box input::-webkit-search-decoration,
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* ---------- Dashboard ---------- */
.dash-cols {
  display: grid; grid-template-columns: 1.62fr 1fr; gap: 14px;
  align-items: start; margin-top: 14px;
}
.dash-cols .stack > * + * { margin-top: 14px; }
@media (max-width: 1180px) { .dash-cols { grid-template-columns: 1fr; } }

.rank { color: var(--text-3); font-family: var(--mono); font-size: 12px; }
.card-note { font-size: 11.5px; color: var(--text-3); }

/* Category breakdown bars */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: flex; align-items: center; gap: 11px; font-size: 13px; }
.bar-row .bar-label { width: 78px; color: var(--text-2); flex-shrink: 0; }
.bar-track {
  flex: 1; height: 7px; background: var(--surface-2);
  border-radius: 4px; overflow: hidden;
}
.bar-track > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar-row .bar-val {
  width: 58px; text-align: right; flex-shrink: 0;
  font-family: var(--mono); color: var(--text-2); font-size: 12px;
}

/* Roadmap / feature list */
.feat { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.feat:last-child { border-bottom: none; }
.feat .feat-ic { color: var(--accent); margin-top: 1px; flex-shrink: 0; }
.feat b { font-size: 13px; }
.feat p { font-size: 12px; color: var(--text-2); margin-top: 2px; line-height: 1.5; }

/* Sidebar nav count badge */
.nav-badge {
  margin-left: auto; font-family: var(--mono); font-size: 11px; font-weight: 600;
  background: var(--accent); color: #fff;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* ---------- Analysis panel ---------- */
.fc-row { display: flex; gap: 10px; margin-bottom: 4px; }
.fc-item {
  flex: 1; background: var(--surface-2); border-radius: var(--r); padding: 13px 14px;
}
.fc-item.accent { background: var(--accent-soft); }
.fc-label {
  font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .6px;
}
.fc-value { font-family: var(--mono); font-size: 23px; font-weight: 600; margin-top: 6px; }
.fc-meta { font-size: 12px; color: var(--text-2); margin-top: 12px; }

.sig { display: flex; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.sig:last-child { border-bottom: none; }
.sig-name { width: 158px; flex-shrink: 0; font-size: 13px; font-weight: 550; }
.sig-mid { flex: 1; min-width: 0; }
.sig-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.sig-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--text-3); }
.sig-bar.up > span { background: var(--green); }
.sig-bar.down > span { background: var(--red); }
.sig-bar.flat > span { background: var(--text-2); }
.sig-bar.info > span { background: var(--accent); }
.sig-summary { font-size: 12px; color: var(--text-2); margin-top: 6px; }
.sig-wait { font-size: 12px; color: var(--text-3); }
.sig-na { width: 56px; flex-shrink: 0; text-align: right; font-family: var(--mono);
  font-size: 12px; color: var(--text-3); }

.risk-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.risk-grade {
  width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 25px; font-weight: 700; color: #06090f;
}
.risk-grade.risk-E, .risk-grade.risk-F { color: #fff; }
.risk-cap { font-size: 13px; font-weight: 600; }
.risk-cap small { display: block; font-size: 12px; font-weight: 400; color: var(--text-2); margin-top: 2px; }

/* Segmented control — поддерживает и <a>, и <button class="seg-btn"> */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.seg a, .seg .seg-btn {
  padding: 6px 13px; font-size: 12.5px; color: var(--text-2);
  background: transparent; border: 0; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 4px;
}
.seg a.active, .seg .seg-btn.active { background: var(--accent-soft); color: var(--accent); }
.seg a:hover:not(.active), .seg .seg-btn:hover:not(.active) { color: var(--text); }
.seg a + a, .seg .seg-btn + .seg-btn, .seg a + .seg-btn, .seg .seg-btn + a {
  border-left: 1px solid var(--border);
}

/* Топбар-переключатель режима ДЕМО/БОЕВОЙ. Боевой выделен красным, чтобы
   трейдер всегда видел, что терминал в реальном режиме. */
.seg-mode .seg-btn {
  padding: 5px 11px; font-size: 11.5px; font-weight: 700; letter-spacing: .4px;
}
.seg .seg-live.active { background: var(--red-soft); color: var(--red); }

/* ---------- Тикет ордера: цвет стороны, свёрнутые настройки, сводка ---------- */
.seg-outcome .seg-btn.active.is-yes { background: var(--green-soft); color: var(--green); }
.seg-outcome .seg-btn.active.is-no  { background: var(--red-soft); color: var(--red); }

.adv-toggle {
  display: flex; align-items: center; gap: 7px; width: 100%;
  background: none; border: none; cursor: pointer; padding: 9px 2px;
  color: var(--text-2); font-family: var(--font); font-size: 12.5px; font-weight: 600;
}
.adv-toggle:hover { color: var(--text-1); }
.adv-toggle .adv-sum { margin-left: auto; font-weight: 500; }
.adv-toggle .adv-caret { color: var(--text-3); margin-left: 8px; }

/* Подсказка размера позиции (рекоменд. 7–12% / потолок 15%) и live R:R в тикете */
.size-guide { font-size: 10.5px; line-height: 1.5; margin: -2px 0 10px; }
.size-guide .sg-warn { color: var(--amber); }
.sg-fit {
  margin-left: 6px; padding: 1px 7px; font-size: 10.5px; cursor: pointer;
  background: var(--amber-soft); color: var(--amber);
  border: none; border-radius: 6px;
}
.rr-line {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 10px; padding: 7px 11px; border-radius: var(--r-sm);
  background: var(--surface-2); font-size: 12px;
}
.rr-line .mono { font-weight: 600; }

.ticket-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 2px;
  padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2);
  border: 1px solid var(--border);
}
.ticket-summary .ts-cell { display: flex; flex-direction: column; gap: 2px; }
.ticket-summary .ts-l {
  font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em;
}
.ticket-summary .ts-v { font-size: 15px; font-weight: 700; }

.btn-buy-yes { background: var(--green); color: #fff; }
.btn-buy-no  { background: var(--red); color: #fff; }
.btn-sell { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-sell:hover { background: var(--surface-hover); filter: none; }
/* Боевая кнопка: цвет по стороне (btn-buy-*) + янтарное кольцо = реальные деньги. */
.btn-live { box-shadow: 0 0 0 2px var(--amber-soft, rgba(245, 158, 11, .35)); }

/* ---------- Окно редактирования условий выхода позиции ---------- */
.pe-modal {
  position: fixed; z-index: 96; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(440px, 94vw); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: 0 18px 50px rgba(0, 0, 0, .5); padding: 18px;
}
.pe-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.pe-title { font-size: 15px; font-weight: 700; }
.pe-x { background: none; border: none; color: var(--text-3); font-size: 16px; cursor: pointer; padding: 2px 6px; }
.pe-x:hover { color: var(--text-1); }
.pe-ctx, .pe-preview {
  display: grid; gap: 8px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.pe-ctx { grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; }
.pe-preview { grid-template-columns: repeat(3, 1fr); margin-top: 4px; }
.pe-ctx > div, .pe-preview > div { display: flex; flex-direction: column; gap: 2px; }
.pe-ctx-l { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.pe-preview .mono { font-size: 14px; font-weight: 700; }
.pe-field { margin-bottom: 12px; }
.pe-field label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.pe-field input {
  width: 100%; padding: 9px 11px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-family: var(--font); font-size: 14px;
}
.pe-field input:focus { outline: none; border-color: var(--accent); }
.pe-mini { background: none; border: none; color: var(--accent, #4f9dff); font-size: 11.5px; cursor: pointer; padding: 0; }
.pe-mini:hover { text-decoration: underline; }
.pe-presets { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.pe-presets button {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-2); font-size: 11.5px; padding: 4px 9px; cursor: pointer;
}
.pe-presets button:hover { color: var(--text-1); border-color: var(--accent, #4f9dff); }
.pe-close { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.pe-close-label { font-size: 12px; color: var(--text-2); font-weight: 600; }

/* Рекомендация стороны в тикете ордера. */
.rec-banner {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600;
  padding: 8px 11px; border-radius: var(--r-sm); margin-bottom: 12px;
}
.rec-yes  { background: var(--green-soft); color: var(--green); }
.rec-no   { background: var(--red-soft);   color: var(--red); }
.rec-none { background: var(--surface-2);  color: var(--text-3); font-weight: 500; }

/* Кликабельное название рынка в таблицах (портфель/журнал) → страница рынка. */
.q-link { color: inherit; text-decoration: none; }
.q-link:hover { color: var(--accent); text-decoration: underline; }

/* Срез рынков — чистая сетка: категория · бар · кол-во · к торгу. */
.slice { display: flex; flex-direction: column; gap: 2px; }
.slice-row {
  display: grid; grid-template-columns: 80px 1fr 40px 78px;
  align-items: center; gap: 11px; padding: 7px 8px;
  border-radius: var(--r-sm); text-decoration: none; transition: background .12s;
}
.slice-row:hover { background: var(--surface-2); }
.slice-name { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.slice-row:hover .slice-name { color: var(--text); }
.slice-bar { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.slice-row:hover .slice-bar { background: var(--surface); }
.slice-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.slice-n { text-align: right; font-size: 12.5px; color: var(--text); }
.slice-trade { text-align: right; font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* Чек-лист готовности боевого режима в тикете. */
.live-readiness {
  margin: 10px 0 4px; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2);
}
.lr-title { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.lr-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.lr-steps li { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 7px; }
.lr-steps li.done { color: var(--green); }
.lr-mark { display: inline-flex; width: 14px; justify-content: center; }
.lr-steps li a { margin-left: auto; font-size: 11px; color: var(--accent); }

/* ---------- Scanner filter bar ---------- */
.scanner-bar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.scanner-bar .search-box { width: 300px; }
/* Фильтр «дней до завершения» — единый pill в стиле чипов. */
.days-filter {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 100px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 12.5px; font-weight: 500;
  transition: background .12s, color .12s, border-color .12s;
}
.days-filter:hover { background: var(--surface-hover); }
.days-filter:focus-within { border-color: var(--accent); }
.days-filter.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.days-filter svg { opacity: .7; flex: none; }
.days-filter .days-lte { font-weight: 600; }
.days-filter .days-input {
  width: 34px; padding: 0; border: 0; background: transparent;
  color: var(--text); font-size: 12.5px; font-weight: 600;
  text-align: center; -moz-appearance: textfield; appearance: textfield;
}
.days-filter .days-input::-webkit-outer-spin-button,
.days-filter .days-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.days-filter .days-input:focus { outline: none; }
.days-filter .days-input::placeholder { color: var(--text-3); font-weight: 400; }
.days-filter .days-unit { color: var(--text-3); }
.days-filter.active .days-unit { color: var(--accent); }
.days-filter .days-go {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 2px; padding: 0; width: 20px; height: 20px;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--accent-soft); color: var(--accent);
  transition: background .12s, color .12s;
}
.days-filter .days-go:hover { background: var(--accent); color: #fff; }
.days-filter .days-go svg { opacity: 1; }
.days-filter .days-clear {
  margin-left: 2px; color: var(--accent); font-weight: 600;
  text-decoration: none; line-height: 1;
}
.days-filter .days-clear:hover { color: var(--text); }
.days-filter.price-filter .days-input { width: 42px; }   /* доли вида 0.55 */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-size: 12.5px; font-weight: 500;
  padding: 7px 13px; border-radius: 100px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip.active {
  background: var(--accent-soft); border-color: rgba(79,124,255,.4); color: var(--accent);
}
.list-count { font-size: 12.5px; margin-bottom: 12px; }
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ---------- Messages ---------- */
.messages { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 10px 14px; border-radius: var(--r); font-size: 13px; }
.msg-success { background: var(--green-soft); color: var(--green); }
.msg-error { background: var(--red-soft); color: var(--red); }
.msg-warning { background: var(--amber-soft); color: var(--amber); }

/* ---------- Trade proposal ---------- */
.prop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.prop-title { font-size: 14px; font-weight: 650; display: block; margin-bottom: 6px; }
a.prop-title:hover { color: var(--accent); }
.prop-rationale { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.prop-warn { font-size: 12.5px; color: var(--amber); margin-top: 7px; }
.prop-actions { display: flex; gap: 9px; margin-top: 13px; }

/* v2.34.0 — source-бейдж + bulk-выбор предложений */
.src-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 9999px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-2); color: var(--text-2);
  border: 1px solid var(--border-soft);
}
.src-badge.src-analysis     { background: rgba(59, 130, 246, .14); color: #93c5fd; border-color: rgba(59, 130, 246, .35); }
.src-badge.src-manual       { background: var(--bg-2); color: var(--text-2); }
.src-badge.src-limit_fill   { background: rgba(168, 85, 247, .14); color: #c4b5fd; border-color: rgba(168, 85, 247, .35); }
.src-badge.src-stop_loss    { background: var(--red-soft); color: var(--red); border-color: rgba(220, 38, 38, .35); }
.src-badge.src-take_profit  { background: var(--green-soft); color: var(--green); border-color: rgba(34, 197, 94, .35); }
.src-badge.src-rebalance    { background: var(--amber-soft); color: var(--amber); border-color: rgba(245, 158, 11, .35); }
.src-badge.src-manual_exit  { background: var(--bg-2); color: var(--text-2); }
.prop-pick { display: inline-flex; align-items: center; cursor: pointer; padding: 2px; }
.prop-pick input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--accent); }
.prop-card.is-picked { box-shadow: 0 0 0 1.5px var(--accent) inset; }
.lim-row.is-picked { background: rgba(99, 102, 241, .08); }

/* v2.35.0 — Метрики профиля автоматизации (карточка /automation/). */
.metrics-head {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px; font-size: 12.5px;
}
.metrics-title { font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.metrics-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.metric {
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border-soft);
}
.metric-label { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.metric-val { font-family: var(--mono); font-size: 17px; font-weight: 700; }
.metric-delta { font-size: 11px; margin-top: 3px; font-family: var(--mono); }
.seg-pill {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 9999px; font-size: 11px;
  background: var(--bg-2); color: var(--text-2); border: 1px solid var(--border-soft);
  text-decoration: none;
}
.seg-pill:hover { color: var(--text-1); }
.seg-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* v2.36.0 — R-histogram + equity-кривая под grid метрик. */
.metric-charts {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
  margin-top: 10px;
}
@media (max-width: 720px) { .metric-charts { grid-template-columns: 1fr; } }
.chart-box {
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border-soft);
}
.chart-head {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.chart-title {
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-2);
}

/* R-distribution: 6 «свечей» с подписями, высота = % от max bucket. */
.r-hist {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 4px; align-items: end; height: 84px;
}
.r-bar-cell { display: flex; flex-direction: column; align-items: center; height: 100%; }
.r-bar-wrap {
  flex: 1; width: 100%; display: flex; flex-direction: column-reverse;
  align-items: center; position: relative;
}
.r-bar {
  width: 100%; min-height: 1.5px;
  border-radius: 3px 3px 0 0;
  background: var(--bg-elev);
  transition: height .2s ease;
}
.r-bar.bar-neg-strong { background: var(--red); }
.r-bar.bar-neg        { background: var(--red); opacity: .75; }
.r-bar.bar-neg-soft   { background: var(--red); opacity: .45; }
.r-bar.bar-pos-soft   { background: var(--green); opacity: .45; }
.r-bar.bar-pos        { background: var(--green); opacity: .75; }
.r-bar.bar-pos-strong { background: var(--green); }
.r-bar-n {
  position: absolute; top: -14px; font-size: 10.5px;
  font-weight: 700; color: var(--text-2);
}
.r-bar-lbl {
  font-size: 9.5px; color: var(--text-3); margin-top: 4px;
  font-family: var(--mono); text-align: center; line-height: 1.1;
}

/* Equity sparkline */
.equity-svg {
  width: 100%; height: 60px; display: block; overflow: visible;
}
.equity-zero {
  stroke: var(--border-soft); stroke-width: 1; stroke-dasharray: 2 3;
}
.equity-line {
  fill: none; stroke: var(--text-2); stroke-width: 1.5;
  stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.equity-line.eq-up { stroke: var(--green); }
.equity-line.eq-down { stroke: var(--red); }

/* v2.44.0 — категории и справочник на /learn/. */
.learn-category { margin: 22px 0 0; }
.learn-category-title {
  font-size: 14px; font-weight: 700; letter-spacing: .3px;
  margin: 0 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}
.learn-card-preview { margin-top: 6px; font-size: 11.5px; }
.learn-card-preview summary { cursor: pointer; color: var(--text-3); }
.learn-card-preview summary:hover { color: var(--text-2); }
.learn-card-step-list {
  margin: 6px 0 0; padding-left: 18px;
  color: var(--text-2); line-height: 1.5;
}
.learn-status-new .learn-badge { background: rgba(99, 102, 241, .18); color: var(--accent); }
.learn-status-updated .learn-badge { background: var(--amber-soft); color: var(--amber); }

.learn-references { margin-top: 28px; }
.learn-ref-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 10px;
}
.learn-ref-card {
  border: 1px solid var(--border-soft); border-radius: 10px;
  background: var(--bg-2); padding: 0;
  overflow: hidden;
}
.learn-ref-card[open] { border-color: var(--accent); }
/* v2.46.8 — кратковременная подсветка карточки при переходе по якорю #ref-<key> */
.learn-ref-flash { animation: learn-ref-flash 1.8s ease-out; }
@keyframes learn-ref-flash {
  0%   { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.learn-ref-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer; user-select: none;
  font-weight: 600; font-size: 13px;
}
.learn-ref-head:hover { background: rgba(255, 255, 255, .03); }
.learn-ref-title { flex: 1; }
.learn-ref-body {
  padding: 0 14px 14px; font-size: 12.5px; line-height: 1.6;
  color: var(--text-2);
}
.learn-ref-body p { margin: 0 0 10px; }
.learn-ref-body ul { margin: 0 0 10px; padding-left: 20px; }
.learn-ref-body code {
  font-family: var(--mono); font-size: 12px;
  padding: 1px 5px; background: var(--bg-1); border-radius: 3px;
  color: var(--text-1);
}

/* v2.43.11 — Excursion-аналитика (MAE/MFE) на /performance/. */
.excursion-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
@media (max-width: 720px) { .excursion-grid { grid-template-columns: 1fr; } }
.excursion-col {
  padding: 10px 12px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--border-soft);
}
.excursion-title {
  font-size: 12.5px; font-weight: 700;
  margin: 0 0 8px;
  text-transform: uppercase; letter-spacing: .3px;
}

/* v2.43.10 — actionable insights на /performance/ (рекомендации трейдеру). */
.insights-block { margin: 0 0 22px; }
.insight {
  padding: 12px 14px; margin: 0 0 8px;
  border-radius: 10px;
  border-left: 3px solid var(--border-soft);
  background: var(--bg-2);
}
.insight-critical { border-left-color: var(--red); }
.insight-warning  { border-left-color: var(--amber); }
.insight-info     { border-left-color: var(--accent); }
.insight-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
  font-size: 13.5px; font-weight: 600;
}
.insight-icon { font-size: 16px; flex-shrink: 0; }
.insight-title { flex: 1; }
.insight-body {
  margin: 0; font-size: 12.5px; line-height: 1.55;
  color: var(--text-2);
}

/* v2.43.8 — приглушённая строка для «мало данных» в таблицах сигналов. */
.row-mute { opacity: .55; }
.row-mute:hover { opacity: .85; }

/* v2.43.4 — Серии исходов в Лаб (Risk of Ruin): спарклайн + подсветка. */
.streak-spark {
  display: inline-flex; gap: 2px; align-items: center;
  padding: 2px 4px; border-radius: 4px;
  background: var(--bg-1);
}
.streak-dot {
  width: 8px; height: 14px; border-radius: 2px;
  background: var(--border-soft);
}
.streak-dot.streak-win  { background: var(--green); }
.streak-dot.streak-stop { background: var(--red); }
.streak-dot.streak-loss { background: #d97706; }   /* amber — резолв-минус */
.streak-row-alert {
  background: rgba(220, 38, 38, .04);
}

/* v2.43.3 — заголовки секций на /performance/ (разделение «мои сделки»
   vs «качество модели»). */
.section-head {
  margin: 0 0 12px;
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.section-title {
  font-size: 16px; font-weight: 700;
  letter-spacing: .3px; margin: 0;
  display: inline-flex; align-items: center; gap: 6px;
}
.section-sub {
  font-size: 12px; line-height: 1.5;
  flex: 1; min-width: 240px;
}
.lab-link:hover { border-color: var(--accent); }

/* v2.41.0 — Экспорт CSV/JSON в карточке профиля. */
.export-row {
  margin-top: 10px; padding: 8px 12px; border-radius: 8px;
  background: var(--bg-2); border: 1px dashed var(--border-soft);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.export-row .btn { font-size: 11.5px; padding: 4px 10px; }

/* v2.40.0 — Compare-страница для нескольких профилей. */
.compare-tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); }
.compare-tbl td { vertical-align: middle; }
.compare-tbl .winner {
  background: rgba(34, 197, 94, .10);
  position: relative;
}
.compare-tbl .winner::before {
  content: "★"; color: var(--green); margin-right: 4px; font-size: 11px;
}

/* v2.39.0 — Лучшие/худшие рынки профиля за окно. */
.markets-breakdown {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px;
}
@media (max-width: 720px) { .markets-breakdown { grid-template-columns: 1fr; } }
.mb-col {
  padding: 8px 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border-soft);
}
.mb-tbl { font-size: 12px; }
.mb-tbl td { padding: 3px 6px; border-bottom: 1px solid var(--border-soft); }
.mb-tbl tr:last-child td { border-bottom: none; }
.chart-title.pos { color: var(--green); }
.chart-title.neg { color: var(--red); }

/* v2.37.0 — drawdown-настройка (свёрнуто <details>) */
.drawdown-cfg {
  margin-top: 10px; border: 1px dashed var(--border-soft);
  border-radius: 8px; padding: 8px 12px; background: var(--bg-2);
}
.drawdown-cfg summary {
  cursor: pointer; font-size: 12.5px; user-select: none;
  display: flex; align-items: center; gap: 6px;
}
.drawdown-cfg[open] summary { margin-bottom: 8px; }
.drawdown-form .field-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: end;
  font-size: 12px;
}
.drawdown-form label { display: flex; flex-direction: column; gap: 3px; }
.drawdown-form label.cbx { flex-direction: row; align-items: center; gap: 5px; }
.drawdown-form input[type="number"],
.drawdown-form select {
  padding: 4px 8px; font-size: 12.5px;
  background: var(--bg-1); border: 1px solid var(--border); color: var(--text-1);
  border-radius: 6px;
}

/* Sticky bar — групповые действия снизу страницы /trades/. */
.bulk-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 22px; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  padding: 9px 16px; border-radius: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: 0 10px 32px rgba(0,0,0,.45);
  font-size: 13px;
}
.bulk-bar .bulk-count { font-weight: 700; color: var(--accent); }
.bulk-bar form { display: inline-flex; }
.bulk-bar .btn { padding: 5px 12px; font-size: 12.5px; }

/* ---------- Signals feed ---------- */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 13px; padding: 14px 4px; border-bottom: 1px solid var(--border-soft); }
.feed-item:last-child { border-bottom: none; }
.feed-dot {
  width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0;
  background: var(--accent);
}
.sev-success .feed-dot { background: var(--green); }
.sev-warning .feed-dot { background: var(--amber); }
.sev-critical .feed-dot { background: var(--red); }
.feed-body { flex: 1; min-width: 0; }
.feed-head { display: flex; gap: 10px; margin-bottom: 3px; }
.feed-type {
  font-size: 10.5px; font-weight: 600; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-3);
}
.feed-time { font-size: 11.5px; color: var(--text-3); font-family: var(--mono); }
.feed-title { font-size: 13.5px; font-weight: 600; }
a.feed-title:hover { color: var(--accent); }
.feed-text { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }

/* Telegram link-code block */
.link-code {
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px 12px; user-select: all; word-break: break-all;
}

/* ---------- Smart Money leaderboard ---------- */
.wr { display: flex; align-items: center; gap: 9px; }
.wr-bar { position: relative; width: 88px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.wr-bar > span { display: block; height: 100%; background: var(--green); border-radius: 3px; }
/* v2.45.24 — модификаторы pos/neg + риска (для разреза A-F в /lab/) */
.wr-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; }
.wr-bar-fill.pos { background: var(--green); }
.wr-bar-fill.neg { background: var(--red); }
.wr-bar-mid { position: absolute; left: 50%; top: -1px; bottom: -1px; width: 1px;
  background: var(--text-3); opacity: .5; }

/* v2.45.25 — сравнение прогонов Optimizer-2 side-by-side. */
.tbl-compare th, .tbl-compare td { vertical-align: top; padding: 6px 10px; }
.tbl-compare .cmp-winner { background: rgba(16, 185, 129, .08); font-weight: 600; }
.tbl-compare .cmp-crown { margin-left: 4px; font-size: 13px; }
.tbl-compare .cmp-sep td { padding-top: 10px; padding-bottom: 4px; }

/* Sticky-bar выбора прогонов в архиве. */
.opt2-compare-bar {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; margin-top: 8px;
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, .35);
  font-size: 12.5px;
}
.opt2-compare-bar[hidden] { display: none; }
.opt2-compare-bar .ocb-count { color: var(--text-2); }
.opt2-compare-bar .ocb-warn { color: var(--amber, #f59e0b); font-size: 11.5px; }
.opt2-archive-check { transform: scale(1.1); cursor: pointer; }
.wr-val { font-size: 12px; color: var(--text-2); }
.wallet-cell { display: inline-flex; align-items: baseline; gap: 7px; }
.wallet-cell b { font-size: 13px; }
.wallet-cell:hover b { color: var(--accent); }
.btn-following {
  background: var(--red-soft); color: var(--red);
  border: 1px solid rgba(246, 70, 93, .3);
}
.btn-following:hover { filter: none; background: rgba(246, 70, 93, .18); }

/* ---------- News brief ---------- */
.news-loading { display: flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 13px; }
.news-state { display: flex; gap: 12px; align-items: flex-start; }
.news-state b { font-size: 13.5px; }

.news-prob {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; padding-bottom: 13px; border-bottom: 1px solid var(--border-soft);
}
.news-prob-val { font-family: var(--mono); font-size: 24px; font-weight: 600; margin-top: 5px; }
.news-conf { font-size: 11.5px; color: var(--text-3); text-align: right; line-height: 1.6; }

.news-summary { font-size: 13px; line-height: 1.65; margin: 13px 0; }

.news-factors { display: flex; flex-direction: column; gap: 7px; margin-bottom: 13px; }
.factor { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.factor-dot {
  width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0;
  background: var(--text-3);
}
.factor-bullish .factor-dot { background: var(--green); }
.factor-bearish .factor-dot { background: var(--red); }

.news-reasoning { margin-bottom: 11px; }
.news-reasoning summary { font-size: 12.5px; color: var(--accent); cursor: pointer; }
.news-reasoning p {
  font-size: 12.5px; color: var(--text-2); line-height: 1.6; margin-top: 8px;
  padding-left: 11px; border-left: 2px solid var(--border);
}
.news-foot { font-size: 11.5px; display: flex; align-items: center; gap: 5px; }
code {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface-2); padding: 1px 5px; border-radius: 4px;
}

/* ---------- Empty state ---------- */
.empty {
  border: 1px dashed var(--border); border-radius: var(--r-lg);
  padding: 44px 32px; text-align: center; color: var(--text-2);
}
.empty .ic { color: var(--text-3); margin-bottom: 10px; }
.empty h3 { font-size: 15px; font-weight: 650; color: var(--text); margin-bottom: 5px; }
.empty p { font-size: 13px; max-width: 460px; margin: 0 auto; }
.tag {
  display: inline-block; margin-top: 14px; padding: 4px 11px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: var(--r-sm); font-size: 12px; font-weight: 600;
}

/* ---------- KV rows ---------- */
.kv { display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.kv:last-child { border-bottom: none; }
.kv-k { color: var(--text-2); font-size: 13px; }

/* Settings — labelled rows with a toggle switch */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.setting-row:last-of-type { border-bottom: none; }
.setting-row .st-text b { font-size: 13px; font-weight: 600; display: block; }
.setting-row .st-text small {
  font-size: 11.5px; color: var(--text-3); display: block; margin-top: 3px;
}
.toggle {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  position: relative; width: 40px; height: 23px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; border-radius: 50%; background: var(--text-3);
  transition: transform .16s, background .16s;
}
.toggle:checked { background: var(--accent-soft); border-color: var(--accent); }
.toggle:checked::after { transform: translateX(17px); background: var(--accent); }
.kv-link { cursor: pointer; transition: color .12s; }
.kv-link:hover .kv-k { color: var(--text); }
.kv-go {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-3); transition: color .12s;
}
.kv-go b { color: var(--text); }
.kv-link:hover .kv-go, .kv-link:hover .kv-go b { color: var(--accent); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card { width: 360px; padding: 30px 30px 26px; }
.login-card .brand { padding: 0 0 6px; justify-content: center; }
.login-sub {
  text-align: center; color: var(--text-3); font-size: 12.5px; margin-bottom: 22px;
}
.form-error {
  background: var(--red-soft); color: var(--red);
  font-size: 12.5px; padding: 9px 12px; border-radius: var(--r); margin-bottom: 14px;
}

/* === Закрытая страница входа (без brand, без подписей) === */
.login-mystery {
  background: radial-gradient(ellipse at center,
    rgba(80, 100, 160, 0.06) 0%, transparent 70%), var(--bg);
  min-height: 100vh; overflow: hidden;
}
.login-mini {
  display: flex; flex-direction: column; align-items: center;
  gap: 18px; width: 280px;
}
.login-mark {
  opacity: 0.85; filter: drop-shadow(0 0 24px rgba(74, 144, 226, 0.25));
  margin-bottom: 4px;
}
.login-dots {
  display: flex; gap: 6px; margin-bottom: 8px;
}
.login-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-3); opacity: 0.4;
  animation: login-blink 2s infinite ease-in-out;
}
.login-dots span:nth-child(2) { animation-delay: 0.3s; }
.login-dots span:nth-child(3) { animation-delay: 0.6s; }
@keyframes login-blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.9; }
}
.login-row {
  width: 100%;
}
.login-row input {
  width: 100%; padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-soft); border-radius: var(--r);
  color: var(--text); font-family: 'JetBrains Mono', monospace;
  font-size: 13px; letter-spacing: 1px;
  transition: border-color .15s, background .15s;
}
.login-row input:focus {
  outline: none; border-color: rgba(74, 144, 226, 0.5);
  background: rgba(255, 255, 255, 0.04);
}
.login-row input::placeholder { color: var(--text-3); opacity: 0.5; }
.login-submit {
  width: 48px; height: 48px; border-radius: 50%;
  background: transparent; color: var(--text-3);
  border: 1px solid var(--border-soft);
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; margin-top: 4px;
}
.login-submit:hover {
  border-color: rgba(74, 144, 226, 0.5); color: var(--text);
  background: rgba(74, 144, 226, 0.08);
}

/* ---------- Misc ---------- */
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   POLISH COMPONENTS — skeleton, tooltip, toast
   ============================================================ */

/* Skeleton loaders */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--surface-2); border-radius: var(--r-sm);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--surface-hover), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-line { height: 12px; margin: 8px 0; }
.skeleton-line.sm { width: 60%; }
.skeleton-chart { height: 220px; border-radius: var(--r); }
.skeleton-row { height: 36px; margin: 7px 0; }

/* Tooltip — pure CSS; attach class="tooltip" data-tip="…" */
.tooltip { position: relative; }
.tooltip[data-tip]::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 9px);
  transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 250px;
  padding: 8px 11px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-family: var(--font);
  font-size: 11.5px; font-weight: 400; line-height: 1.55;
  text-align: left; white-space: normal; text-transform: none;
  letter-spacing: normal;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity .14s, transform .14s;
}
.tooltip[data-tip]::before {
  content: ""; position: absolute; left: 50%; bottom: calc(100% + 4px);
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent; border-top-color: var(--border);
  opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity .14s, transform .14s;
}
.tooltip[data-tip]:hover::after,
.tooltip[data-tip]:hover::before {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* Help dot — small "?" affordance next to jargon labels */
.help-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface-2); color: var(--text-3);
  font-size: 9.5px; font-weight: 700; cursor: help;
  vertical-align: middle;
}
.tooltip:hover .help-dot { background: var(--accent-soft); color: var(--accent); }

/* Toasts */
.toast-host {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  display: flex; flex-direction: column; gap: 9px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  min-width: 220px; max-width: 360px;
  padding: 11px 15px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text); font-size: 13px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  animation: toast-in .22s ease;
}
.toast-ok   { border-left-color: var(--green); }
.toast-bad  { border-left-color: var(--red); }
.toast-warn { border-left-color: var(--amber); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hide Alpine-managed elements until the component is ready */
[x-cloak] { display: none !important; }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; height: 240px; }
.chart-wrap canvas { position: absolute; inset: 0; }
.chart-wrap .skeleton-chart { position: absolute; inset: 0; height: auto; }
.chart-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px;
  color: var(--text-3); font-size: 12.5px;
}
.chart-empty .ic { color: var(--text-3); }

/* Sparkline on market cards */
.mkt-side { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.spark { width: 60px; height: 26px; display: block; }
.spark polyline {
  fill: none; stroke: var(--text-3); stroke-width: 1.6;
  stroke-linejoin: round; stroke-linecap: round;
}
.spark-up polyline   { stroke: var(--green); }
.spark-down polyline { stroke: var(--red); }

/* ---------- Orderbook ladder + live tape ---------- */
.depth-cols {
  display: grid; grid-template-columns: 320px 1fr; gap: 14px; margin-top: 14px;
  align-items: start;
}
@media (max-width: 1180px) { .depth-cols { grid-template-columns: 1fr; } }

.ladder-head, .ladder-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.ladder-head {
  padding: 0 5px 7px; font-size: 10px; font-weight: 600;
  letter-spacing: .5px; text-transform: uppercase; color: var(--text-3);
}
.ladder-head span:not(:first-child),
.ladder-row span:not(.depth-bar):not(.ld-price) { text-align: right; }
.ladder { display: flex; flex-direction: column; }
.ladder-row {
  position: relative; padding: 4px 5px;
  font-family: var(--mono); font-size: 12px;
}
.ladder-row span:not(.depth-bar) { position: relative; z-index: 1; }
.depth-bar {
  position: absolute; right: 0; top: 1px; bottom: 1px;
  border-radius: 3px; z-index: 0; min-width: 2px;
}
.depth-bar.bid { background: var(--green-soft); }
.depth-bar.ask { background: var(--red-soft); }
.ladder-row .ld-price { font-weight: 600; }
.ladder-row.ask .ld-price { color: var(--red); }
.ladder-row.bid .ld-price { color: var(--green); }
.ladder-mid {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 5px; margin: 3px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 10.5px; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .5px;
}

.tape td { padding: 9px 14px; }
.tape-whale { background: var(--amber-soft) !important; }
.tape-whale .ic { color: var(--amber); vertical-align: -1px; }
.side-pill {
  display: inline-block; font-family: var(--mono);
  font-size: 10.5px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
}
.side-pill.buy  { background: var(--green-soft); color: var(--green); }
.side-pill.sell { background: var(--red-soft);   color: var(--red); }
.tape-empty {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 26px; font-size: 13px;
}
.tape-empty .ic { color: var(--text-3); }

/* ---------- Calibration / reliability diagram ---------- */
.calib-legend {
  font-size: 11.5px; color: var(--text-3); margin-bottom: 10px;
}
.calib-legend b { font-weight: 600; }
.calib-legend b:not(.pos) { color: var(--text-2); }
.calib-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 0; border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px;
}
.calib-row:last-child { border-bottom: none; }
.calib-bucket { width: 86px; flex-shrink: 0; color: var(--text-2); font-size: 11.5px; }
.calib-track {
  flex: 1; position: relative; height: 8px;
  background: var(--surface-2); border-radius: 4px;
}
.calib-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--green); border-radius: 4px;
}
.calib-mark {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--text); border-radius: 1px;
}
.calib-meta { width: 92px; text-align: right; flex-shrink: 0; font-size: 12px; }
.calib-n { width: 48px; text-align: right; flex-shrink: 0; font-size: 11px; }

/* ---------- Portfolio — P&L bar + diversification caps ---------- */
.pnl-cell { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.pnl-bar {
  width: 72px; height: 4px; background: var(--surface-2);
  border-radius: 2px; overflow: hidden;
}
.pnl-bar > span { display: block; height: 100%; border-radius: 2px; }
.pnl-bar > span.up   { background: var(--green); }
.pnl-bar > span.down { background: var(--red); }
.warn-ic { color: var(--amber); vertical-align: -1px; }
.cap-ic { color: var(--red); vertical-align: -1px; }

.cap-track { position: relative; overflow: visible; }
.cap-track > span.over { background: var(--red); }
.cap-track > .cap-mark {
  position: absolute; top: -2px; bottom: -2px; width: 2px;
  background: var(--amber); border-radius: 1px; z-index: 2;
}

/* ---------- Favorites / watchlist ---------- */
.fav-wrap { position: relative; z-index: 1; display: inline-flex; }
.fav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  background: none; border: none; cursor: pointer;
  color: var(--text-3); border-radius: var(--r-sm);
  transition: color .12s, background .12s;
}
.fav-btn:hover { background: var(--surface-2); color: var(--amber); }
.fav-btn.active { color: var(--amber); }
.fav-btn.active .ic { fill: var(--amber); }
.chip-fav { display: inline-flex; align-items: center; gap: 5px; }
.chip-fav.active .ic { fill: currentColor; }

/* ---------- Command palette (⌘K) + keycaps ---------- */
.kbd {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  color: var(--text-3); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; line-height: 1.6;
}
.cmdk-trigger {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-3); font-family: var(--font); font-size: 12.5px;
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.cmdk-trigger:hover {
  background: var(--surface-hover); color: var(--text-2);
  border-color: var(--accent);
}
.cmdk-overlay { position: fixed; inset: 0; z-index: 95; background: rgba(6, 9, 15, .66); }
.cmdk-modal {
  position: fixed; z-index: 96;
  top: 84px; left: 50%; transform: translateX(-50%);
  width: 580px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  overflow: hidden;
}
.cmdk-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; border-bottom: 1px solid var(--border-soft);
}
.cmdk-input-wrap .ic { color: var(--text-3); flex-shrink: 0; }
.cmdk-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font); font-size: 14px;
}
.cmdk-input::placeholder { color: var(--text-3); }
.cmdk-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.cmdk-group {
  font-size: 10px; font-weight: 600; letter-spacing: .7px;
  text-transform: uppercase; color: var(--text-3); padding: 9px 9px 4px;
}
.cmdk-result {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 9px 10px; border-radius: var(--r-sm);
  font-size: 13px; cursor: pointer; color: var(--text);
}
.cmdk-result.active { background: var(--accent-soft); }
.cmdk-result-q { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-result-meta { flex-shrink: 0; font-size: 11px; color: var(--text-3); }
.cmdk-empty { padding: 22px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- Sortable table headers (клиентская сортировка по столбцам) ---------- */
.tbl th.th-s { cursor: pointer; user-select: none; white-space: nowrap; transition: color .12s; }
.tbl th.th-s:hover { color: var(--text-2); }
.tbl th.th-s::after {
  content: "⇅"; margin-left: 5px; font-size: 9px; opacity: .32;
  display: inline-block; vertical-align: middle; transition: opacity .12s, color .12s;
}
.tbl th.th-s:hover::after { opacity: .6; }
.tbl th.th-s.s-active { color: var(--text-1); }
.tbl th.th-s.s-active::after { opacity: 1; color: var(--accent); font-size: 8px; }
.tbl th.th-s.s-active[data-dir="asc"]::after  { content: "▲"; }
.tbl th.th-s.s-active[data-dir="desc"]::after { content: "▼"; }
.tbl th.th-s:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }


/* ---------- Compact density ---------- */
html[data-density="compact"] .tbl td,
html[data-density="compact"] .tbl th { padding: 8px 14px; }
html[data-density="compact"] .card-pad { padding: 13px 16px; }
html[data-density="compact"] .stat { padding: 12px 15px; }
html[data-density="compact"] .main { padding-top: 18px; }
html[data-density="compact"] .market-grid { gap: 10px; }

/* ---------- Comfortable density (просторно) ---------- */
html[data-density="comfortable"] .tbl td,
html[data-density="comfortable"] .tbl th { padding: 16px 22px; }
html[data-density="comfortable"] .card-pad { padding: 22px 24px; }
html[data-density="comfortable"] .stat { padding: 22px 24px; }
html[data-density="comfortable"] .main { padding-top: 32px; }
html[data-density="comfortable"] .market-grid { gap: 18px; }
html[data-density="comfortable"] .card { margin-bottom: 18px; }

/* ---------- Display-меню (popover) ---------- */
.display-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 800;
  width: 280px; padding: 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}
.dp-section { margin-bottom: 14px; }
.dp-section:last-of-type { margin-bottom: 10px; }
.dp-label { font-size: 11.5px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 8px; display: flex;
  align-items: center; justify-content: space-between; }
.dp-seg { display: flex; gap: 4px; border: 1px solid var(--border);
  border-radius: 8px; padding: 3px; background: var(--bg); }
.dp-seg button { flex: 1; padding: 7px 10px; border: 0; border-radius: 5px;
  background: transparent; color: var(--text-2); font-size: 12px; cursor: pointer;
  font-family: inherit; transition: background 0.15s, color 0.15s; }
.dp-seg button:hover { background: var(--surface-hover); color: var(--text); }
.dp-seg button.active { background: var(--accent); color: #fff; font-weight: 600; }
.dp-accents { display: flex; gap: 8px; padding: 4px 2px; }
.dp-accents button { width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer; padding: 0;
  transition: transform 0.12s, border-color 0.15s; }
.dp-accents button:hover { transform: scale(1.1); }
.dp-accents button.active { border-color: var(--text); }
.dp-accents button[data-accent="blue"]   { background: #4f7cff; }
.dp-accents button[data-accent="teal"]   { background: #14b8a6; }
.dp-accents button[data-accent="violet"] { background: #8b5cf6; }
.dp-accents button[data-accent="amber"]  { background: #f59e0b; }
.dp-accents button[data-accent="rose"]   { background: #f43f5e; }
.dp-reset { width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text-3); font-size: 12px; cursor: pointer;
  font-family: inherit; }
.dp-reset:hover { color: var(--text); border-color: var(--text-3); }

/* ---------- Акцентные палитры (переопределение --accent через data-attribute) ---------- */
html[data-accent="teal"]   { --accent: #14b8a6; --accent-soft: rgba(20,184,166,0.18); }
html[data-accent="violet"] { --accent: #8b5cf6; --accent-soft: rgba(139,92,246,0.18); }
html[data-accent="amber"]  { --accent: #f59e0b; --accent-soft: rgba(245,158,11,0.18); }
html[data-accent="rose"]   { --accent: #f43f5e; --accent-soft: rgba(244,63,94,0.18); }

/* ---------- Arbitrage ---------- */
.profit-pill {
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  padding: 3px 9px; border-radius: var(--r-sm);
  background: var(--green-soft); color: var(--green);
}

/* ---------- Arbitrage (Dutch-book) ---------- */
.arb-kind {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; padding: 2px 6px; border-radius: var(--r-sm);
  margin-right: 6px; vertical-align: middle;
}
.arb-kind-spread { background: var(--accent-soft); color: var(--accent); }
.arb-kind-dutch  { background: var(--amber-soft, #f5e8c8); color: var(--amber, #9a6b00); }
.arb-dir {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .3px;
  padding: 2px 6px; border-radius: var(--r-sm); margin-right: 6px; vertical-align: middle;
}
.arb-dir-buy  { background: var(--green-soft); color: var(--green); }
.arb-dir-sell { background: var(--red-soft);   color: var(--red); }
.cov-chip {
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  padding: 2px 7px; border-radius: var(--r-sm);
}
.cov-hi  { background: var(--green-soft); color: var(--green); }
.cov-mid { background: var(--amber-soft); color: var(--amber); }
.kpi-strip {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
}
.kpi-cell {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px; background: var(--surface, #11151c);
  border: 1px solid var(--border, #1e2430); border-radius: var(--r-md, 10px);
}
.kpi-val { font-size: 20px; font-weight: 700; font-family: var(--mono); }
.kpi-lbl { font-size: 11px; color: var(--text-dim, #8a93a3); }
/* Флаг качества категории на радаре (модель тут без доказанного перевеса) */
.cat-flag {
  display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: var(--r-sm);
  font-size: 9px; font-weight: 700; letter-spacing: .2px; text-transform: uppercase;
  vertical-align: middle;
}
.cat-weak     { background: var(--red-soft);   color: var(--red); }
.cat-unproven { background: var(--amber-soft); color: var(--amber); }
/* Метка «в портфеле» — событие уже есть в открытых позициях */
.pf-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: var(--r-sm);
  font-size: 10px; font-weight: 700; letter-spacing: .2px; vertical-align: middle;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
/* «Результаты» — окно последних N дней (текущая конфигурация vs весь шлейф) */
.recent-window {
  padding: 10px 12px; margin-bottom: 12px; border-radius: var(--r-md, 10px);
  background: var(--surface, #11151c); border: 1px solid var(--border, #1e2430);
}
.rw-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; }
.rw-h { font-size: 12px; font-weight: 700; }
.rw-val { font-family: var(--mono); font-weight: 700; font-size: 15px; }
.rw-sub { font-size: 12px; color: var(--text-dim, #8a93a3); }
.rw-verdict { margin-top: 6px; font-size: 12px; line-height: 1.5; }
.rw-verdict.pos { color: var(--green); }
.rw-verdict.neg { color: var(--text-dim, #8a93a3); }
.rw-alltime-label {
  font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  color: var(--text-dim, #8a93a3); margin-bottom: 6px;
}
/* Structured help block (replaces run-on disclaimer prose) */
.help-block {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 28px;
  font-size: 12px; line-height: 1.55; color: var(--text-dim, #8a93a3);
}
.help-row { display: flex; flex-direction: column; gap: 4px; }
.help-h {
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; color: var(--text, #cdd3dd);
}
.help-block ul { margin: 0; padding-left: 16px; display: grid; gap: 3px; }
.help-block li { margin: 0; }
/* Одиночный блок (напр. пояснение к демо-сделкам) — на всю ширину, не в половину */
.help-block.help-single { grid-template-columns: 1fr; }
@media (max-width: 900px) { .help-block { grid-template-columns: 1fr; } }
/* Arbitrage detail — size calculator */
.calc-bar {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border, #1e2430);
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
}
.calc-bar form { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.calc-input {
  width: 90px; padding: 5px 8px; border-radius: var(--r-sm);
  border: 1px solid var(--border, #1e2430); background: var(--surface, #11151c);
  color: var(--text, #cdd3dd); font-family: var(--mono); font-size: 13px;
}
.calc-grid { display: flex; flex-wrap: wrap; gap: 18px; }
.calc-grid > div { display: flex; flex-direction: column; gap: 2px; }
.calc-lbl { font-size: 11px; color: var(--text-dim, #8a93a3); }
.calc-val { font-size: 14px; font-weight: 600; }
.row-best { background: var(--green-soft); }
.arb-stale { opacity: .5; }
.arb-legs > summary { cursor: pointer; font-size: 12px; color: var(--accent); }
.arb-legs-list { margin-top: 6px; display: grid; gap: 3px; font-size: 12px; }
.arb-legs-list > div { display: flex; justify-content: space-between; gap: 12px; }
.arb-fresh { white-space: nowrap; }
.arb-verify-ok  { color: var(--green); font-weight: 600; font-size: 12px; }
.arb-verify-bad { color: var(--red);   font-weight: 600; font-size: 12px; }
.btn-xs {
  font-size: 11px; padding: 2px 7px; line-height: 1.4; margin-left: 6px;
}

/* ---------- Insider radar ---------- */
.insider-score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 26px; padding: 0 8px;
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  border-radius: var(--r-sm);
}
.insider-score.watch    { background: var(--surface-2);  color: var(--text-2); }
.insider-score.elevated { background: var(--amber-soft); color: var(--amber); }
.insider-score.high     { background: var(--red-soft);   color: var(--red); }
.flag-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.flag-reason {
  font-size: 11px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 100px;
}
.level-pill {
  font-size: 10.5px; font-weight: 700; letter-spacing: .4px;
  padding: 2px 8px; border-radius: var(--r-sm); text-transform: uppercase;
}
.level-pill.watch    { background: var(--surface-2);  color: var(--text-3); }
.level-pill.elevated { background: var(--amber-soft); color: var(--amber); }
.level-pill.high     { background: var(--red-soft);   color: var(--red); }

/* ============================================================
   Обучение трейдера: тема driver.js, welcome-модалка, Центр обучения
   ============================================================ */

/* --- driver.js popover под тёмный терминал --- */
.driver-popover.polyterm-tour {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55); font-family: var(--font);
  max-width: 348px; padding: 16px 16px 14px;
}
.driver-popover.polyterm-tour .driver-popover-title {
  color: var(--text); font-size: 15px; font-weight: 700; margin-bottom: 4px;
}
.driver-popover.polyterm-tour .driver-popover-description {
  color: var(--text-2); font-size: 13px; line-height: 1.55;
}
.driver-popover.polyterm-tour .driver-popover-progress-text {
  color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums;
}
.driver-popover.polyterm-tour .driver-popover-close-btn { color: var(--text-3); }
.driver-popover.polyterm-tour .driver-popover-close-btn:hover { color: var(--text); }
.driver-popover.polyterm-tour .driver-popover-footer button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--r-sm); text-shadow: none; font-size: 12.5px; padding: 5px 12px;
}
.driver-popover.polyterm-tour .driver-popover-footer button:hover {
  background: var(--surface-hover);
}
.driver-popover.polyterm-tour .driver-popover-footer button.driver-popover-next-btn {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.driver-popover.polyterm-tour .driver-popover-footer button.driver-popover-next-btn:hover {
  background: var(--accent-hover);
}
/* стрелка пузыря — в цвет фона на тёмной теме */
.driver-popover.polyterm-tour .driver-popover-arrow-side-left.driver-popover-arrow { border-left-color: var(--surface); }
.driver-popover.polyterm-tour .driver-popover-arrow-side-right.driver-popover-arrow { border-right-color: var(--surface); }
.driver-popover.polyterm-tour .driver-popover-arrow-side-top.driver-popover-arrow { border-top-color: var(--surface); }
.driver-popover.polyterm-tour .driver-popover-arrow-side-bottom.driver-popover-arrow { border-bottom-color: var(--surface); }

/* --- welcome-модалка первого входа --- */
.ob-welcome { position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center; }
.ob-welcome.ob-hidden { display: none; }
.ob-overlay { position: absolute; inset: 0; background: rgba(6, 9, 15, .68); }
.ob-card { position: relative; width: 440px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55); padding: 26px 26px 18px; text-align: center; }
.ob-card-icon { display: inline-flex; padding: 12px; margin-bottom: 6px;
  color: var(--accent); background: var(--accent-soft); border-radius: 50%; }
.ob-card-title { font-size: 20px; font-weight: 700; margin: 4px 0 8px; }
.ob-card-text { color: var(--text-2); font-size: 13.5px; line-height: 1.6; margin: 0 0 18px; }
.ob-card-actions { display: flex; gap: 10px; justify-content: center; }
.ob-card-foot { display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.ob-card-foot a { color: var(--accent); font-size: 12px; }
.ob-link { background: none; border: none; color: var(--text-3); font-size: 12px;
  cursor: pointer; }
.ob-link:hover { color: var(--text); text-decoration: underline; }

/* --- Центр обучения (/learn/) --- */
.learn-hero { display: flex; gap: 16px; align-items: center; padding: 18px 20px; margin-bottom: 16px; }
.learn-hero-icon { display: inline-flex; padding: 12px; color: var(--accent);
  background: var(--accent-soft); border-radius: var(--r); flex-shrink: 0; }
.learn-hero-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.learn-hero-text { color: var(--text-2); font-size: 13px; line-height: 1.55; margin: 0 0 12px; }
.learn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.learn-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.learn-card.is-done { border-color: var(--green-soft); }
.learn-card-icon { display: inline-flex; padding: 9px; color: var(--accent);
  background: var(--accent-soft); border-radius: var(--r-sm); flex-shrink: 0; }
.learn-card-main { flex: 1; min-width: 0; }
.learn-card-head { display: flex; align-items: center; gap: 8px; }
.learn-card-title { font-weight: 600; font-size: 14px; }
.learn-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; }
.learn-card-desc { color: var(--text-2); font-size: 12.5px; line-height: 1.5; margin: 4px 0 6px; }
.learn-card-meta { font-size: 11px; }
.learn-card-btn { flex-shrink: 0; align-self: center; }
.learn-foot { font-size: 11.5px; margin-top: 16px; }

/* Чек-лист «Первые шаги» на дашборде (Фаза 3 обучения) */
.gs-card { padding: 14px 16px; margin-bottom: 16px; }
.gs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.gs-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; }
.gs-title .ic { color: var(--accent); }
.gs-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.gs-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.gs-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.gs-items { display: flex; flex-direction: column; gap: 7px; }
.gs-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.gs-check { display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%;
  border: 1.5px solid var(--border); color: #fff; }
.gs-item.is-done .gs-check { background: var(--green); border-color: var(--green); }
.gs-item.is-done .gs-label { color: var(--text-3); text-decoration: line-through; }
.gs-label { flex: 1; color: var(--text); }
.gs-cta { flex-shrink: 0; }

/* Прогресс-бар Центра обучения (Фаза 3) */
.learn-progress { height: 6px; background: var(--surface-2); border-radius: 3px;
  overflow: hidden; margin: 10px 0 4px; max-width: 420px; }
.learn-progress > span { display: block; height: 100%; background: var(--accent);
  border-radius: 3px; transition: width .3s; }

/* --- Лаборатория стратегий: чипы лучших стримов + расходящийся бар ожидания --- */
.vt-chip { font-size: 12px; padding: 5px 11px; border-radius: 8px;
  background: var(--surface-hover); border: 1px solid var(--border-soft); }
.vt-divbar { position: relative; height: 9px; background: var(--border-soft);
  border-radius: 3px; overflow: hidden; min-width: 64px; }
.vt-divbar-mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
  background: var(--text-3); opacity: .45; }
.vt-divbar-fill { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.vt-divbar-fill.pos { left: 50%; background: var(--green); }
.vt-divbar-fill.neg { right: 50%; background: var(--red); }

/* Мини-бар распределения выходов (тейк/стоп/резолв/истёк) в строке стрима. */
.vt-mix { display: flex; height: 9px; background: var(--border-soft);
  border-radius: 3px; overflow: hidden; }
.vt-mix-take { background: var(--green); }
.vt-mix-stop { background: var(--red); }
.vt-mix-resolved { background: #6b7280; }
.vt-mix-expired { background: #b89020; opacity: .75; }

/* Сигнальные чипы в панели сделки: «за» сторону — зелёный, «против» — красный. */
.vt-sig { display: inline-flex; align-items: center; gap: 4px; font-size: 11px;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-hover);
  border: 1px solid var(--border-soft); }
.vt-sig-pos { border-color: rgba(24,201,139,.45); color: var(--green); }
.vt-sig-neg { border-color: rgba(246,70,93,.45); color: var(--red); }
.vt-sig-flat { color: var(--text-3); }

/* Подвкладки в карточке настроек: «Стратегия трейдера» / «Лаборатория стратегий». */
.ts-subtab { display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; font-size: 12.5px; color: var(--text-3);
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  text-decoration: none; transition: color .12s, background .12s, border-color .12s; }
.ts-subtab:hover { color: var(--text-2); background: var(--surface-hover); }
.ts-subtab.active { color: var(--text-1); background: var(--surface-2);
  border-color: var(--border-soft); }

/* Глобальные вкладки страницы настроек: Профиль/Уведомления/Торговля/Лаборатория/Система */
.set-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-soft);
  margin-bottom: 16px; padding-bottom: 0; flex-wrap: wrap; }
.set-tab { display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; font-size: 13px; font-weight: 500; color: var(--text-3);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .12s, border-color .12s, background .12s; border-radius: 4px 4px 0 0; }
.set-tab:hover { color: var(--text-2); background: var(--surface-hover); }
.set-tab.active { color: var(--text-1); border-bottom-color: var(--accent);
  background: var(--surface-hover); }

/* v2.45.0 — Optimizer-2: активный таб RSI/Momentum + прогресс-бар. */
.btn-active { background: var(--surface-hover); color: var(--text-1);
  border-color: var(--accent); }
.opt2-progress { font-size: 12.5px; }
.opt2-progress-pct { font-weight: 600; color: var(--text-1); }
.opt2-progress-bar { transition: width 0.3s ease; }

/* ===========================================================================
 * v2.45.23 — Усиление UX тумблера ДЕМО/БОЕВОЙ:
 * • бейдж готовности на кнопке БОЕВОЙ (✓ зелёный / 🔒 серый)
 * • sticky-полоса при live-режиме (никогда не «забыть» что на реальных деньгах)
 * • модалка подтверждения перехода ДЕМО → БОЕВОЙ
 * =========================================================================== */
.seg-badge {
  display: inline-block; margin-left: 5px; font-size: 10px; line-height: 1;
  padding: 2px 4px; border-radius: 3px;
}
.seg-badge-ok   { background: var(--green-soft, rgba(16,185,129,.18)); color: var(--green, #10b981); }
.seg-badge-lock { background: rgba(120,120,130,.18); color: var(--text-3); }

/* Sticky-полоса БОЕВОЙ-режима — заметная, пульсирующая точка. */
.live-strip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px; font-size: 12.5px; font-weight: 500;
  background: var(--red-soft, rgba(239,68,68,.14));
  color: var(--red, #ef4444);
  border-bottom: 1px solid rgba(239,68,68,.25);
  position: sticky; top: 0; z-index: 19;
}
.live-strip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red, #ef4444);
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(1.2); }
}
.live-strip-spacer { flex: 1; }
.live-strip-back {
  background: rgba(255,255,255,.06); border: 1px solid rgba(239,68,68,.35);
  color: var(--red, #ef4444); border-radius: var(--r-sm);
  padding: 3px 9px; font-size: 11.5px; cursor: pointer;
}
.live-strip-back:hover { background: rgba(239,68,68,.12); }

/* Модалка подтверждения LIVE — оверлей + карточка. */
.modal-overlay {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(6, 9, 15, .68);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  width: min(520px, 96vw); max-height: 92vh; overflow-y: auto;
  animation: modal-in .15s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.live-confirm-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 18px 8px; border-bottom: 1px solid var(--border);
}
.live-confirm-head h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--red, #ef4444); }
.modal-x {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0 4px;
}
.modal-x:hover { color: var(--text-1); }
.modal-body { padding: 14px 18px; }
.live-confirm-warn {
  background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--r-sm); padding: 10px 12px;
  font-size: 12.5px; line-height: 1.5; color: var(--text-1);
  margin-bottom: 14px;
}
.live-confirm-check { font-size: 12.5px; }
.lcc-title { font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.lcc-warn { font-size: 11.5px; margin-top: 8px; font-style: italic; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.modal-foot .btn-live {
  background: var(--red, #ef4444); color: white; border: none;
  padding: 7px 14px; border-radius: var(--r-sm); cursor: pointer;
  font-weight: 600; font-size: 12.5px;
  box-shadow: 0 0 0 2px var(--red-soft, rgba(239,68,68,.25));
}
.modal-foot .btn-live:hover { background: #dc2626; }
