:root {
  --bg: #f5f6fb;
  --card: #ffffff;
  --border: #e7e9f2;
  --text: #121533;
  --muted: #7a7f9a;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --pos: #16a34a;
  --pos-soft: #e7f7ec;
  --neg: #e5484d;
  --neg-soft: #fdecec;
  --warn: #d97706;
  --warn-soft: #fdf3e2;
  --side-bg: linear-gradient(180deg, #0c1033 0%, #11165a 70%, #1a1f7a 100%);
  --side-text: #c9ccef;
  --text-2: #3f4363;
  --faint: #b7bad0;
  --surface-2: #f3f4f9;
  --hover: #fafbff;
  --row-border: #f0f1f7;
  --track: #e2e5f2;
  --grid: #eef0f6;
  --line-muted: #9aa0c0;
  --control-border: #c8cbe0;
  --border-strong: #cfd3e6;
  --highlight: #fff8e6;
  --accent-hover: #4338ca;
  --tip-bg: #121533;
  --shadow: 0 1px 2px rgba(18, 21, 51, .04);
  --radius: 10px;
  --sidebar-w: 220px;
  color-scheme: light;
}

/* ---------- Тёмная тема ---------- */
:root[data-theme="dark"] {
  --bg: #0b0e1f;
  --card: #141831;
  --border: #252a4a;
  --text: #e8eaf6;
  --text-2: #c0c4e0;
  --muted: #8a8fb3;
  --faint: #4a5078;
  --accent: #6c63ff;
  --accent-hover: #7f78ff;
  --accent-soft: rgba(108, 99, 255, .16);
  --pos: #22c55e;
  --pos-soft: rgba(34, 197, 94, .14);
  --neg: #f2555a;
  --neg-soft: rgba(242, 85, 90, .15);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, .15);
  --surface-2: #1b2040;
  --hover: #1a1f3d;
  --row-border: #1e2342;
  --track: #2a3058;
  --grid: #1f2445;
  --line-muted: #6b7199;
  --control-border: #3a4070;
  --border-strong: #353b66;
  --highlight: rgba(245, 165, 36, .12);
  --tip-bg: #262c55;
  --side-bg: linear-gradient(180deg, #070918 0%, #0c0f2e 70%, #15196a 100%);
  color-scheme: dark;
}
:root[data-theme="dark"] .chip.active span { color: rgba(255, 255, 255, .7); }
:root[data-theme="dark"] .modal { background: rgba(0, 0, 0, .6); }
:root[data-theme="dark"] .topbar { background: #10142a; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  transition: background-color .2s, color .2s;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; color: inherit; border: 0; outline: 0; background: none; }

.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.r { text-align: right; }
.spacer { flex: 1; }

/* ---------- Icons ---------- */
.ic { display: inline-flex; width: 16px; height: 16px; flex: none; }
.ic svg { width: 100%; height: 100%; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--side-bg);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .18s ease, padding .18s ease;
}
.sb-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 0 22px 10px; }
.logo { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.sb-toggle { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px; color: #aeb2df; border: 1px solid rgba(255,255,255,.14); }
.sb-toggle:hover { color: #fff; background: rgba(255,255,255,.08); }
.sb-toggle .ic { width: 14px; height: 14px; transform: rotate(180deg); transition: transform .18s; }

/* Свёрнутая панель: только иконки */
:root.sb-collapsed { --sidebar-w: 72px; }
.sb-collapsed .sidebar { padding-left: 10px; padding-right: 10px; }
.sb-collapsed .sb-top { flex-direction: column; padding-left: 0; gap: 12px; }
.sb-collapsed .logo-text, .sb-collapsed .nav-sub, .sb-collapsed .nav-caret, .sb-collapsed .nav-count,
.sb-collapsed .slogan, .sb-collapsed .bull, .sb-collapsed .version { display: none; }
.sb-collapsed .sb-toggle .ic { transform: none; }
.sb-collapsed .nav-item { font-size: 0; justify-content: center; padding: 11px 0; gap: 0; }
.sb-collapsed .nav-item .ic { width: 18px; height: 18px; }
.sb-collapsed .support-btn { font-size: 0; padding: 10px 0; gap: 0; }
.sb-collapsed .support-btn .ic { width: 18px; height: 18px; }
.sb-collapsed .sidebar-bottom { padding: 0; }
.logo-mark { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; box-shadow: 0 4px 14px rgba(79, 70, 229, .45); }
.logo-text { font-weight: 800; font-size: 17px; line-height: 1.05; letter-spacing: .5px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  font-weight: 500; font-size: 13.5px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, #4f46e5, #5b54f0); color: #fff; box-shadow: 0 6px 18px rgba(79,70,229,.35); }
.nav-caret { margin-left: auto; width: 14px; height: 14px; }
.nav-sub { display: flex; flex-direction: column; margin: 2px 0 8px 22px; border-left: 1px solid rgba(255,255,255,.12); }
.nav-sub a { padding: 7px 14px; font-size: 12.5px; color: #aeb2df; }
.nav-sub a:hover, .nav-sub a.current { color: #fff; }
.nav-sub a.current { font-weight: 600; }

.sidebar-bottom { margin-top: auto; padding: 0 6px; position: relative; }
.bull {
  width: calc(100% + 36px); margin: 0 -18px -70px; display: block; aspect-ratio: 1; object-fit: cover; object-position: center 30%;
  mix-blend-mode: lighten; opacity: .4; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 55%, transparent 85%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 55%, transparent 85%);
}
.slogan { color: #8ea0ff; font-size: 13px; line-height: 1.45; margin: 0 6px 20px; position: relative; }
.support-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid rgba(255,255,255,.18); border-radius: 8px; padding: 10px; color: #fff; font-weight: 500;
}
.support-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.version { font-size: 11px; color: #6c71a8; margin: 14px 6px 0; }

/* ---------- Topbar ---------- */
.topbar {
  height: 56px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
}

.search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 0 10px; height: 34px; width: 300px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; font-size: 12.5px; }
.search kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; background: var(--card); }
.search.small { margin-left: 0; width: 210px; height: 32px; background: var(--card); }

.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm .ic { width: 15px; height: 15px; }

.conn { display: flex; align-items: center; gap: 8px; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); }
.conn b, .user b { display: block; font-size: 12px; font-weight: 600; }
.conn small, .user small { font-size: 11px; color: var(--muted); }
.user { display: flex; align-items: center; gap: 10px; padding-left: 8px; }
.user small { color: var(--accent); font-weight: 500; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 600;
}
.user .ic { width: 14px; height: 14px; color: var(--muted); }


/* ---------- Content ---------- */
.content { padding: 18px 20px 24px; display: flex; flex-direction: column; gap: 12px; }

.page-head { display: flex; align-items: center; gap: 18px; }
.page-head h1 { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -.3px; }
.page-sub { font-size: 16px; font-weight: 600; color: var(--text-2); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px;
  border-radius: 8px; font-weight: 500; white-space: nowrap;
}
.btn .ic, .btn > svg { width: 15px; height: 15px; flex: none; }
.btn-outline { background: var(--card); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--border-strong); }
.btn-outline.accent { color: var(--accent); }
.btn-outline.square { width: 34px; padding: 0; justify-content: center; font-size: 16px; }
.btn-primary { background: var(--accent); color: #fff; justify-content: center; }
.btn-primary:hover { background: var(--accent-hover); }
.btn.block { width: 100%; height: 38px; }

.sub-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.sub-tabs a { padding: 10px 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sub-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

.chips-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 7px; font-weight: 500; font-size: 12.5px;
}
.chip span { color: var(--muted); font-size: 11px; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.active span { color: #c7c9ff; }

.filters { display: flex; align-items: flex-end; gap: 14px; }
.field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.select, .input {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 32px; padding: 0 10px; min-width: 130px;
  background: var(--card); border: 1px solid var(--border); border-radius: 7px;
}
.filters .select { width: 116px; }
.select .ic { width: 14px; height: 14px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; height: 32px; font-size: 12.5px; cursor: pointer; }
.check input { display: none; }
.check span { width: 16px; height: 16px; border: 1.5px solid var(--control-border); border-radius: 4px; display: grid; place-items: center; }
.check input:checked + span { background: var(--accent); border-color: var(--accent); }
.check input:checked + span::after { content: '✓'; color: #fff; font-size: 11px; font-weight: 700; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.card-head .ic { width: 16px; height: 16px; color: var(--muted); }

.grid-top { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; align-items: start; }
.right-col { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Main table ---------- */
.table-card { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.pairs { font-size: 12px; white-space: nowrap; }
.pairs th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 11px;
  padding: 10px 7px; border-bottom: 1px solid var(--border); vertical-align: bottom;
}
.pairs th small { display: block; font-size: 10px; }
.pairs th .sort { font-size: 9px; opacity: .6; }
.pairs td { padding: 0 7px; height: 33px; border-bottom: 1px solid var(--row-border); }
.pairs tbody tr { cursor: pointer; }
.pairs tbody tr:hover { background: var(--hover); }
.pairs tbody tr.selected { background: var(--accent-soft); }
.pairs tbody tr:last-child td { border-bottom: 0; }
.star-col { width: 28px; color: var(--faint); text-align: center; padding-left: 12px !important; }
.pairs td b { font-weight: 600; }

.dev { display: inline-block; padding: 3px 7px; border-radius: 5px; font-weight: 600; }
.dev { background: var(--surface-2); color: var(--muted); }
.dev.pos { background: var(--pos-soft); color: var(--pos); }
.dev.neg { background: var(--neg-soft); color: var(--neg); }

.liq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.liq i { width: 3px; background: var(--track); border-radius: 1px; }
.liq i.on { background: var(--accent); }

.status {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
}
.status svg { width: 11px; height: 11px; }
.status.hot { background: var(--neg-soft); color: var(--neg); }
.status.active { background: var(--pos-soft); color: var(--pos); }
.status.watch { background: var(--warn-soft); color: var(--warn); }

/* ---------- Mini tables ---------- */
.mini-tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.mini-tabs a { padding: 8px 5px; font-size: 11px; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mini-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.mini-table { font-size: 12px; white-space: nowrap; }
.mini-table th { font-size: 10.5px; font-weight: 500; color: var(--muted); text-align: left; padding: 8px 8px; }
.mini-table td:last-child, .mini-table th:last-child { padding-right: 14px; }
.mini-table td { padding: 7px 8px; border-top: 1px solid var(--row-border); }
.mini-table td:first-child, .mini-table th:first-child { padding-left: 14px; }
.mini-table.events td { font-size: 11.5px; }
.more-link { display: block; text-align: right; padding: 8px 14px 12px; color: var(--accent); font-size: 12px; font-weight: 500; }

/* ---------- Interactivity ---------- */
.select { position: relative; padding: 0; }
.select select {
  appearance: none; -webkit-appearance: none; border: 0; background: none; outline: 0;
  font: inherit; color: inherit; width: 100%; height: 100%; padding: 0 28px 0 10px; cursor: pointer;
}
.select .ic, .select > svg { position: absolute; right: 10px; pointer-events: none; }
.select > svg { width: 14px; height: 14px; color: var(--muted); }
.reset-link { height: 32px; color: var(--accent); font-weight: 500; font-size: 12.5px; padding: 0 4px; }
.reset-link:hover { text-decoration: underline; }

.pairs th[data-sort] { cursor: pointer; user-select: none; }
.pairs th[data-sort]:hover { color: var(--text); }
.pairs th.sorted { color: var(--accent); }
.pairs th.sorted .sort { opacity: 1; font-size: 11px; }
.fav { color: var(--faint); font-size: 14px; line-height: 1; padding: 2px; }
.fav:hover, .fav.on { color: #f5a524; }
.table-empty { padding: 40px; text-align: center; color: var(--muted); }
.table-foot { display: flex; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 11.5px; }

.mini-table.clickable tbody tr { cursor: pointer; }
#best-body td:nth-child(2) { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.mini-table.clickable tbody tr:hover { background: var(--hover); }
.mini-table tbody tr.selected { background: var(--accent-soft); }
.mini-table tbody tr.mine td { background: var(--card)8e6; font-weight: 600; }

.pair-logo {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  color: #fff; font-weight: 800; font-size: 14px; background: #21a038;
}

.chart-tip {
  position: absolute; pointer-events: none; display: flex; flex-direction: column; gap: 1px;
  background: var(--tip-bg); color: #fff; padding: 5px 8px; border-radius: 6px; font-size: 11px; white-space: nowrap;
}
.chart-tip .muted { color: #a9add0; font-size: 10px; }

input.input { width: 100%; font-weight: 500; }
input.input:focus { border-color: var(--accent); }
.range {
  -webkit-appearance: none; appearance: none; flex: 1; height: 4px; border-radius: 2px; outline: 0;
  background: linear-gradient(var(--accent), var(--accent)) 0 / var(--fill, 100%) 100% no-repeat, var(--track);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 3px solid var(--accent); cursor: pointer;
}
.range::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 3px solid var(--accent); cursor: pointer; }

.nav-group:not(.open) .nav-sub { display: none; }
.nav-group:not(.open) .nav-caret { transform: rotate(-90deg); }
.nav-caret { transition: transform .15s; }
.has-badge { position: relative; }
.has-badge::after { content: ''; position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--neg); border: 2px solid var(--card); }
.user { cursor: pointer; }

.modal {
  position: fixed; inset: 0; background: rgba(12, 16, 51, .45); display: grid; place-items: center; z-index: 100;
  animation: fade .15s ease-out;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--card); border-radius: 14px; padding: 28px; width: min(360px, calc(100vw - 32px)); text-align: center;
  box-shadow: 0 20px 60px rgba(12, 16, 51, .3); animation: pop .18s ease-out;
}
.soon-icon { font-size: 36px; }
.modal-card h3 { margin: 8px 0 6px; font-size: 20px; }
.modal-card p { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }
.modal-card p b { color: var(--text); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 110;
  background: var(--tip-bg); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(12, 16, 51, .25); animation: fade .15s ease-out;
}
.toast[hidden] { display: none; }

/* ---------- Segmented control, списки значений ---------- */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 7px; padding: 2px; gap: 2px; }
.seg button { padding: 4px 9px; border-radius: 5px; font-size: 11.5px; color: var(--text-2); }
.seg button.active { background: var(--accent); color: #fff; }
.calc-list { margin: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.calc-list div { display: flex; justify-content: space-between; gap: 8px; }
.calc-list dt { color: var(--text-2); }
.calc-list dd { margin: 0; font-weight: 600; }
.calc-list .strong dt { color: var(--text); font-weight: 700; }
.input.sm { height: 28px; min-width: 0; padding: 0 8px; font-size: 12px; }
.btn.sm { height: 26px; padding: 0 9px; font-size: 11.5px; }
.link { color: var(--accent); font-size: 11.5px; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ---------- All / Favorites ---------- */
.table-tabs { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.view-tab {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px;
  border-radius: 9px; border: 1px solid transparent; color: var(--muted); font-weight: 500; font-size: 13px;
}
.view-tab:hover { color: var(--text); }
.view-tab.active { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.view-tab span { color: var(--muted); font-weight: 500; }
.star-ic { width: 15px; height: 15px; fill: currentColor; }
.view-tab[data-view="fav"].active .star-ic { color: #f5a524; }
.chip.empty { opacity: .45; }

/* ---------- Плашки типа инструмента ---------- */
.tbadge {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; flex: none;
  font-size: 10px; font-weight: 700; margin-right: 5px; vertical-align: -3px;
}
.b-a { background: var(--pos-soft); color: var(--pos); }
.b-f { background: var(--neg-soft); color: var(--neg); }
.b-c { background: var(--warn-soft); color: var(--warn); }
.b-x { background: var(--accent-soft); color: var(--accent); }
.b-o { background: var(--surface-2); color: var(--text-2); }

/* ---------- Панель связки ---------- */
.pairs tbody tr.expanded { background: var(--accent-soft); }
.pairs tbody tr.expanded td { border-bottom-color: transparent; }
.pairs tbody tr.xp-row, .pairs tbody tr.xp-row:hover { background: var(--bg); cursor: default; }
.pairs td[colspan] { padding: 0; height: auto; border-bottom: 1px solid var(--border); }
.xp {
  position: sticky; left: 0; white-space: normal; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  animation: xp-in .2s ease-out;
}
@keyframes xp-in { from { opacity: 0; transform: translateY(-4px); } }
.xp-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.xp-card-head span { white-space: nowrap; }
.xp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 8px; font-size: 13px; }

.xp-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.xp-title h2 { margin: 0; font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 4px; }
.xp-title .star { color: var(--faint); font-size: 16px; }
.xp-title .star.on, .xp-title .star:hover { color: #f5a524; }
.xp-legs { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); margin-top: 2px; }
.xp-legs .tbadge { margin-right: 2px; }
.xp-spread { font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.xp-kpis { display: flex; gap: 18px; padding-left: 16px; border-left: 1px solid var(--border); }
.xp-kpis label { display: block; font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.xp-kpis b { font-size: 13.5px; }
.xp-exp { font-size: 12px; }

.xp-main { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 10px; }
.xp-chart { display: flex; flex-direction: column; min-width: 0; }
.xp-chart .chart-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tools { display: flex; gap: 2px; padding-left: 6px; border-left: 1px solid var(--border); }
.tool {
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px;
  color: var(--text-2); font-size: 12px; font-weight: 600;
}
.tool:hover { background: var(--surface-2); color: var(--text); }
.tool svg { width: 15px; height: 15px; }
.tg-link { font-size: 11.5px; color: var(--warn); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); } 100% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } }

.candles-wrap { position: relative; height: 400px; }
.candles { width: 100%; height: 100%; display: block; }
.candles .grid { stroke: var(--grid); stroke-width: 1; }
.candles .axis { font-size: 10.5px; fill: var(--muted); }
.candles .up line, .candles .up rect { stroke: var(--pos); fill: var(--pos); }
.candles .down line, .candles .down rect { stroke: var(--neg); fill: var(--neg); }
.candles .fv { stroke: var(--line-muted); stroke-dasharray: 5 4; }
.candles .fv-label { fill: var(--line-muted); font-weight: 600; }
.candles .last-line { stroke: var(--accent); stroke-dasharray: 2 3; }
.candles .last-tag, .candles .tag-bg.last { fill: var(--accent); }
.candles .ref-line { stroke-dasharray: 5 4; stroke-width: 1.2; }
.candles .ev-layer .ev-hover { cursor: help; }
.candles .ev-hit { fill: transparent; }
.candles .ev-limit path { fill: var(--warn); }
.candles .ev-limit text { font-size: 9.5px; font-weight: 700; fill: var(--warn); paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
.candles .ev-pay-line { stroke: var(--line-muted); stroke-dasharray: 2 3; opacity: .55; }
.candles .ev-pay-line.swap { stroke: var(--accent); }
.candles .ev-pay-dot { fill: var(--line-muted); } .candles .ev-pay-dot.swap { fill: var(--accent); }
.candles .ev-pay rect { fill: var(--card); stroke-width: 1; }
.candles .ev-pay text { font-size: 9.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.candles .ev-pay.pos rect { stroke: var(--pos); } .candles .ev-pay.pos text { fill: var(--pos); }
.candles .ev-pay.neg rect { stroke: var(--neg); } .candles .ev-pay.neg text { fill: var(--neg); }
.candles .ref-line.entry { stroke: var(--pos); } .candles .tag-bg.entry { fill: var(--pos); }
.candles .ref-line.exit { stroke: var(--neg); } .candles .tag-bg.exit { fill: var(--neg); }
.candles .ref-line.user { stroke: var(--warn); stroke-width: 1.6; } .candles .tag-bg.user { fill: var(--warn); }
.candles .ref-label { font-size: 10.5px; font-weight: 700; paint-order: stroke; stroke: var(--card); stroke-width: 4px; }
.candles .ref-label.entry { fill: var(--pos); } .candles .ref-label.exit { fill: var(--neg); } .candles .ref-label.user { fill: var(--warn); }
.candles .last-tag-text { fill: #fff; font-size: 10.5px; font-weight: 700; }
.candles .cursor { stroke: var(--line-muted); stroke-dasharray: 3 3; }
.candles .hit { cursor: crosshair; }
.candles.dragging .hit { cursor: grabbing; }
.candles .pan-reset { cursor: pointer; }
.candles .pan-reset rect { fill: var(--card); stroke: var(--border-strong); }
.candles .pan-reset:hover rect { stroke: var(--accent); }
.candles .pan-reset text { font-size: 11px; font-weight: 600; fill: var(--accent); }
.chart-tip {
  position: absolute; pointer-events: none; display: flex; flex-direction: column; gap: 2px; z-index: 2;
  background: var(--tip-bg); color: #fff; padding: 6px 9px; border-radius: 7px; font-size: 11px; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(12, 16, 51, .25);
}
.chart-tip .muted { color: #a9add0; font-size: 10px; }
.chart-tip .tip-up { color: #4ade80; }
.chart-tip .tip-down { color: #ff7b7f; }
.chart-tip.ev-tip { white-space: normal; width: 290px; gap: 5px; padding: 9px 11px; line-height: 1.45; font-size: 11.5px; }
.chart-tip .tip-title { font-size: 12.5px; }
.chart-tip .tip-title.warn { color: #fbbf24; }
.chart-tip .tip-text { color: #c9cbe6; font-size: 11px; }

/* Стаканы */
.xp-books { display: flex; flex-direction: column; gap: 10px; }
.ob { padding: 8px 0 6px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ob-head { display: flex; align-items: center; gap: 4px; padding: 0 10px 6px; }
.ob-head .muted { margin-left: 4px; font-size: 11px; }
.ob-row { position: relative; display: flex; justify-content: space-between; padding: 2px 10px; }
.ob-row i { position: absolute; right: 0; top: 1px; bottom: 1px; }
.ob-row span { position: relative; }
.ob-row.ask i { background: var(--neg-soft); }
.ob-row.ask .px { color: var(--neg); }
.ob-row.bid i { background: var(--pos-soft); }
.ob-row.bid .px { color: var(--pos); }
.ob-mid { text-align: center; color: var(--muted); font-size: 11px; padding: 4px 0; border-top: 1px solid var(--row-border); border-bottom: 1px solid var(--row-border); margin: 2px 0; }

/* Нижний ряд */
.xp-bottom { display: grid; grid-template-columns: 270px minmax(0, 1fr) 250px; gap: 10px; align-items: start; }
.xp-stack { display: flex; flex-direction: column; gap: 10px; }
.xp-stack .xp-card { padding-bottom: 10px; }
.xp-stack .calc-list, .xp-stack .calc-legs, .lev-row, .pf-grid { margin: 0 12px; }
.sum-input { width: 120px; text-align: right; }
.lev-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; margin-bottom: 8px; white-space: nowrap; }
.calc-legs { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--row-border); }
.cl { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1px 0; font-size: 12px; }
.cl .muted { grid-column: 1 / -1; grid-row: 2; font-size: 11px; padding-left: 21px; }
.pf-grid { display: grid; grid-template-columns: minmax(0, 1fr) 58px 68px; gap: 6px; align-items: center; font-size: 12px; margin-bottom: 10px; }
.pf-grid > .muted { font-size: 10.5px; }
.pf-leg { display: flex; align-items: center; gap: 3px; white-space: nowrap; overflow: hidden; }
.pf-leg b { overflow: hidden; text-overflow: ellipsis; }

.ev-list, .tape { max-height: 392px; overflow-y: auto; }
.ev {
  display: grid; grid-template-columns: 76px 74px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
  padding: 7px 12px; border-top: 1px solid var(--row-border); font-size: 11.5px;
}
.ev-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-leg { display: flex; align-items: center; white-space: nowrap; }
.ev-val { color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ev.near .ev-text { color: var(--warn); }
.ev.limits .ev-text { color: var(--accent); }
.ev.signal .ev-text { color: var(--neg); }
.ev.div .ev-text { color: var(--pos); font-weight: 600; }
.ev.away { opacity: .6; }
.ev-text em { font-style: normal; font-size: 10px; background: var(--pos-soft); color: var(--pos); padding: 1px 5px; border-radius: 4px; margin-left: 4px; }

.tp {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto 38px; align-items: center; gap: 6px;
  padding: 3px 10px; font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.tp.new { animation: tp-new 1.2s ease-out; }
@keyframes tp-new { from { background: var(--accent-soft); } }

/* ---------- MOEX / Crypto / Forex: биржи ---------- */
.exlogo {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: var(--c); color: var(--t); font-size: 8.5px; font-weight: 800; letter-spacing: -.2px;
  box-shadow: 0 0 0 1.5px var(--card);
}
.exlogo.has-icon { position: relative; overflow: hidden; }
.exlogo.has-icon > i { position: absolute; }
.venue { display: inline-flex; align-items: center; gap: 6px; }
.venue > span:nth-child(2) { font-weight: 600; }
.mk-tag { font-size: 10px; color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 1px 5px; }
.ex-stack { display: inline-flex; margin-right: 6px; vertical-align: middle; }
.ex-stack .exlogo + .exlogo { margin-left: -5px; }

.pairs tbody tr.group-row { background: var(--card); }
.pairs tbody tr.group-row td { border-bottom-color: var(--border); }
.pairs tbody tr.group-row:hover { background: var(--hover); }
.pairs tbody tr.group-row.open { background: var(--surface-2); }
.caret { display: inline-flex; width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.caret svg { width: 100%; height: 100%; }
.group-row.open .caret { transform: rotate(90deg); color: var(--accent); }
.count-pill { font-size: 10.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 10px; margin-left: 4px; }
.best-tag { font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: var(--pos); background: var(--pos-soft); padding: 2px 5px; border-radius: 4px; margin-right: 6px; }
.pairs tbody tr.sub td:nth-child(2) { padding-left: 18px; }
.sub-arrow { color: var(--faint); margin-right: 6px; }

.table-tabs { position: relative; }
/* В MOEX / Crypto / Forex колонка MOEX дублирует инструмент в строке группы */
.pairs.cross > thead th:nth-child(4), .pairs.cross > tbody > tr:not(.xp-row) > td:nth-child(4) { display: none; }
.ex-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px 0 8px; margin-left: 6px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--card); font-weight: 600; font-size: 13px;
}
.ex-btn[hidden] { display: none; }
.ex-btn:hover, .ex-btn.open { border-color: var(--accent); }
.ex-btn .muted { font-weight: 500; }
.ex-btn svg { width: 14px; height: 14px; color: var(--muted); }
.ex-btn .ex-stack { margin-right: 2px; }

.ex-pop {
  position: absolute; top: calc(100% + 6px); left: 12px; z-index: 20; width: min(720px, calc(100% - 24px));
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(12, 16, 51, .18); animation: pop .15s ease-out; max-height: 70vh; overflow-y: auto;
}
.ex-pop[hidden] { display: none; }
.ex-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card); z-index: 1; }
.ex-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.ex-quick button { font-size: 11.5px; padding: 4px 9px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.ex-quick button:hover { color: var(--accent); }
.ex-sec { padding: 10px 16px 4px; }
.ex-sec-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; }
.ex-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; }
.ex-item { display: grid; grid-template-columns: 22px 1fr 70px 70px; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--row-border); font-size: 12.5px; }
.ex-item .exlogo { width: 22px; height: 22px; font-size: 9.5px; border-radius: 50%; }
.ex-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-name em { font-style: normal; font-size: 9px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 3px; padding: 1px 4px; margin-left: 5px; vertical-align: 1px; }
.mk { height: 24px; border-radius: 6px; font-size: 11px; font-weight: 500; border: 1px solid var(--border); color: var(--muted); }
.mk:hover { border-color: var(--accent); }
.mk.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.mk.na { display: grid; place-items: center; border: 0; color: var(--faint); }
.ex-pop-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--card); font-size: 12px; }


/* ---------- Action ---------- */
.pairs .action-col { text-align: right; padding-right: 12px; }
.open-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card); color: var(--accent); font-size: 11.5px; font-weight: 600;
}
.open-btn svg { width: 12px; height: 12px; }
.open-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Шапка: колокольчик и меню профиля ---------- */
.topbar { position: relative; z-index: 30; }
.bell-btn { position: relative; }
.bell-badge {
  position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--neg); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--card);
}
.bell-badge[hidden] { display: none; }
.pop {
  position: absolute; top: calc(100% - 4px); z-index: 40; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 18px 50px rgba(12, 16, 51, .18); animation: pop .15s ease-out;
}
.pop[hidden] { display: none; }
.bell-pop { right: 170px; width: 340px; }
.user-pop { right: 14px; width: 250px; padding: 6px; }
.pop-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.pop-item { display: flex; gap: 10px; padding: 10px 14px; font-size: 12.5px; line-height: 1.45; border-bottom: 1px solid var(--row-border); }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); margin-top: 6px; flex: none; }
.pop-empty { padding: 20px 14px; text-align: center; font-size: 12.5px; }
.pop-foot { text-align: center; padding: 10px; }
.pop-foot a { color: var(--accent); font-weight: 500; font-size: 12.5px; }
.pop-user { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.pop-user b { font-size: 13px; }
.pop-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 7px; font-size: 13px; text-align: left; }
.pop-link:hover { background: var(--hover); color: var(--accent); }
.pop-link svg { width: 16px; height: 16px; color: var(--muted); }
.pop-link .acc-count { margin-left: auto; }
.pop-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ---------- Личный кабинет ---------- */
.acc-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.acc-nav { position: sticky; top: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.acc-user { display: flex; align-items: center; gap: 10px; padding: 8px 6px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.acc-user .avatar { flex: none; }
.acc-user > div { min-width: 0; flex: 1; }
.acc-user b { display: block; font-size: 14px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-user small { display: block; font-size: 11.5px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; flex: none; }
.plan-pill { display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 5px; padding: 2px 7px; }
.plan-pill.big { font-size: 12px; padding: 3px 10px; }
.acc-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; font-weight: 500; color: var(--text-2); font-size: 13px; }
.acc-link svg { width: 17px; height: 17px; color: var(--muted); }
.acc-link:hover { background: var(--hover); color: var(--text); }
.acc-link.active { background: var(--accent-soft); color: var(--accent); }
.acc-link.active svg { color: var(--accent); }
.acc-count { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 9px; padding: 1px 7px; }
.acc-link.active .acc-count { background: var(--accent); color: #fff; }
.acc-nav-foot { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

.acc-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.acc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 2px; }
.acc-head h1 { margin: 0 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.acc-head p { margin: 0; font-size: 13px; max-width: 720px; line-height: 1.5; }
.acc-card { padding: 16px 18px; }
.acc-card h3 { margin: 0 0 12px; font-size: 14px; }
.card-head.flush { padding: 0 0 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.fld .input { width: 100%; height: 36px; min-width: 0; }
.fld .select { height: 36px; min-width: 0; }
.acc-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.row-card { display: flex; align-items: center; gap: 14px; }
.grow { flex: 1; min-width: 0; }
.grow p { margin: 3px 0 0; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.stat label { font-size: 11.5px; color: var(--muted); }
.stat b { font-size: 22px; font-weight: 800; }
.stat small { font-size: 11.5px; }

.channel { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--row-border); }
.acc-card h3 + .channel, .card-head + .channel, .acc-card > .channel:first-child { border-top: 0; padding-top: 0; }
.channel-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.channel-ic svg { width: 18px; height: 18px; }
.channel-ic.tg { background: rgba(42, 171, 238, .14); color: #2aabee; }
.channel-ic.emailOn, .channel-ic.digest { background: var(--accent-soft); color: var(--accent); }
.channel-ic.push, .channel-ic.quiet { background: var(--warn-soft); color: var(--warn); }
.channel-ic.sound, .channel-ic.shield { background: var(--pos-soft); color: var(--pos); }
.time-range { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.time-range .input { width: 96px; }
.time-range.dim { opacity: .45; }

.switch {
  position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--track); flex: none; transition: background .15s;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s;
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); }

/* Подписка */
.plan-current { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plan-current h3 { margin: 8px 0 4px; font-size: 20px; }
.plan-current p { margin: 0; font-size: 12.5px; }
.plan-actions { display: flex; gap: 8px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-top { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.plan-price { font-size: 22px; font-weight: 800; }
.plan-price .muted { font-size: 12px; font-weight: 500; }
.plan ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; flex: 1; font-size: 12.5px; color: var(--text-2); }
.plan li { display: flex; gap: 8px; align-items: center; }
.plan li svg { width: 14px; height: 14px; color: var(--pos); flex: none; }
.btn[disabled] { opacity: .6; cursor: default; }
.acc-table th:first-child, .acc-table td:first-child { padding-left: 0; }

/* Отображение */
.opt-row { display: flex; gap: 12px; flex-wrap: wrap; }
.opt-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 12.5px; font-weight: 500; width: 150px; }
.opt-card:hover { border-color: var(--border-strong); }
.opt-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: var(--accent); }
.th-prev { width: 100%; height: 64px; border-radius: 7px; display: flex; gap: 6px; padding: 8px; }
.th-prev i { flex: 1; border-radius: 4px; }
.th-prev.light { background: #f5f6fb; } .th-prev.light i { background: #fff; border: 1px solid #e7e9f2; }
.th-prev.dark { background: #0b0e1f; } .th-prev.dark i { background: #141831; border: 1px solid #252a4a; }
.th-prev.sys { background: linear-gradient(90deg, #f5f6fb 50%, #0b0e1f 50%); }
.th-prev.sys i:first-child { background: #fff; } .th-prev.sys i:last-child { background: #141831; }
.dens-prev { width: 100%; height: 64px; border-radius: 7px; background: var(--surface-2); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.dens-prev i { height: 8px; border-radius: 3px; background: var(--border-strong); }
.dens-prev.compact { gap: 3px; } .dens-prev.compact i { height: 7px; }
.home-select { max-width: 320px; height: 36px; margin-top: 8px; }
body.compact .pairs td { height: 27px; }
body.compact .pairs { font-size: 11.5px; }

/* Алерты */
.acc-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.al-type { width: 190px; height: 32px; }
.acc-toolbar .search.small { width: 220px; }
.al-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 12px; align-items: start; }
.al-table-card { overflow-x: auto; }
.alerts-table { white-space: normal; }
.alerts-table td { height: 58px; padding: 6px 10px; }
.alerts-table td:nth-child(6), .alerts-table td:nth-child(4), .alerts-table td:last-child { white-space: nowrap; }
.alerts-table th { padding: 10px; }
.alerts-table tr.off td > *:not(.switch) { opacity: .5; }
.al-main { display: flex; align-items: center; gap: 10px; min-width: 230px; }
.al-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.al-ic svg { width: 15px; height: 15px; }
.al-ic.t-spread { background: var(--pos-soft); color: var(--pos); }
.al-ic.t-dev { background: var(--neg-soft); color: var(--neg); }
.al-ic.t-price { background: var(--accent-soft); color: var(--accent); }
.al-ic.t-days { background: var(--warn-soft); color: var(--warn); }
.accent-text { color: var(--accent); }
.al-legs { margin-top: 3px; color: var(--text-2); }
.al-notify { display: inline-flex; gap: 7px; color: var(--text-2); }
.al-notify svg { width: 15px; height: 15px; }
.al-actions { white-space: nowrap; }
.al-actions .tool { display: inline-grid; }
.al-recent { padding-bottom: 6px; }
.al-log { display: flex; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--row-border); font-size: 12.5px; line-height: 1.45; }

/* Окно алерта */
.modal-card.alert-card { text-align: left; padding: 0; width: min(580px, calc(100vw - 32px)); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.am-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.am-head h3 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.am-head h3 svg { width: 18px; height: 18px; color: var(--accent); }
.am-head p { margin: 0; font-size: 12.5px; }
.am-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.pick svg { width: 15px; height: 15px; }
.pick:hover { border-color: var(--border-strong); }
.pick.on { background: var(--card); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 1px var(--accent); font-weight: 600; }
.am-hint { margin: -6px 0 0; }
.input-unit { position: relative; }
.input-unit .input { padding-right: 34px; }
.input-unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; }
.am-error { margin: 0; color: var(--neg); font-size: 12.5px; }
.am-error[hidden] { display: none; }
.am-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.am-foot .btn { height: 38px; padding: 0 18px; }
.xp-head .btn.sm svg { width: 13px; height: 13px; }

/* ---------- Многоногие связки (тройные, четверные) ---------- */
.pairs.multi td { padding-top: 7px; padding-bottom: 7px; height: auto; }
.leg-line { display: flex; align-items: center; gap: 4px; line-height: 20px; }
.leg-line .tbadge { margin-right: 1px; }
.leg-line .muted { margin-left: 3px; font-variant-numeric: tabular-nums; }
.leg-op { width: 10px; color: var(--muted); text-align: center; }
.leg-days { font-size: 10px; color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.leg-k { font-size: 11px; color: var(--accent); padding-left: 14px; }
.xp-main.multi { grid-template-columns: 1fr; }
.xp-books.many { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.xp-legs .mk-tag { margin-left: 6px; }
.xp-formula { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 11px; flex-wrap: wrap; }
.xp-formula code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11px; background: var(--surface-2); border-radius: 5px; padding: 2px 6px; color: var(--text-2); }

/* Общие метки и показатели, используемые на разных страницах. */
.seg button { white-space: nowrap; }
.leg-exp { display: inline-flex; align-items: center; gap: 3px; margin-left: 2px; font-size: 11px; color: var(--text-2); background: var(--surface-2); border-radius: 5px; padding: 2px 6px; white-space: nowrap; }
.leg-exp svg { width: 11px; height: 11px; color: var(--muted); }
.side-tag { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 5px; margin-right: 4px; }
.side-tag.buy { background: var(--pos-soft); color: var(--pos); }
.side-tag.sell { background: var(--neg-soft); color: var(--neg); }
.kpi-box { background: var(--surface-2); border-radius: 9px; padding: 9px 12px; display: flex; flex-direction: column; gap: 2px; }
.kpi-box label { font-size: 11px; color: var(--muted); }
.kpi-box b { font-size: 18px; font-weight: 800; }
.kpi-box small { font-size: 10.5px; }
.dot-live.off { background: var(--faint); }
.usd { color: var(--muted); font-weight: 500; font-size: .92em; white-space: nowrap; }
.lg-limit { color: var(--warn); font-style: normal; font-size: 10px; }
.lg-pay { width: 8px; height: 8px; transform: rotate(45deg); background: var(--line-muted); display: inline-block; }
.lg-pay.swap { background: var(--accent); }
.calc-list.receipt .total, .pm-sec .calc-list .total { border-top: 1px dashed var(--border-strong); padding-top: 6px; margin-top: 2px; }

.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Шапка: хлебные крошки и статус торгов ---------- */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; min-width: 0; white-space: nowrap; }
.crumbs a { color: var(--muted); font-weight: 500; }
.crumbs a:hover { color: var(--accent); }
.crumbs svg { width: 13px; height: 13px; color: var(--faint); flex: none; }
.crumbs b { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; }


/* Заголовок блока: страница связки и окно алерта на главной. */
.pm-sec-title { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }

/* Элементы, которые показываются только гостю или только вошедшему (shared/js/session.js) */
[data-auth-user][hidden], [data-auth-guest][hidden], [data-auth-admin][hidden], .acc-nav[hidden] { display: none !important; }

/* ---------- Доступ к данным: вход / подписка ---------- */
.access-locked > :not(.access-gate) { display: none !important; }
.access-gate { display: grid; place-items: center; min-height: min(70vh, 560px); padding: 24px 16px; }
.access-gate-card { max-width: 460px; text-align: center; padding: 32px 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--card); box-shadow: 0 10px 30px rgba(15, 23, 42, .06); }
.access-gate-card h2 { margin: 10px 0 8px; font-size: 20px; }
.access-gate-card p { margin: 0 0 18px; line-height: 1.55; }
.access-gate-icon { font-size: 30px; }
.access-gate-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
