﻿/* Тема: тёмная матовая. Два варианта (переключатель в шапке):
   data-theme="indigo" — фиолетовый с градиентом в тёмно-синий (по умолчанию)
   data-theme="violet" — фиолетовый без синего */
:root, :root[data-theme="indigo"] {
  --bg: #07070c;
  --bg-paint:
    radial-gradient(1100px 700px at -5% -10%, rgba(76, 52, 140, .24), transparent 62%),
    radial-gradient(1500px 1000px at 100% 100%, rgba(24, 52, 135, .42), transparent 62%),
    linear-gradient(165deg, #0b0a12 0%, #090a1b 50%, #06102a 100%);
  --card: rgba(13, 13, 21, .88);
  --card-2: #13131d;
  --field: #0b0b12;
  --line: #1c1d28;
  --line-2: #272836;
  --text: #e8e8f0;
  --muted: #8a8ba0;
  --dim: #5a5b70;
  --accent: #8e7df2;
  --accent-2: #4f6fe3;
  --accent-grad: linear-gradient(135deg, #7a66ea 0%, #5a6ce6 55%, #3f64d8 100%);
  --accent-soft: rgba(126, 110, 240, .13);
  --accent-ink: #ffffff;
}
:root[data-theme="violet"] {
  --bg-paint:
    radial-gradient(1200px 800px at 0% -10%, rgba(80, 52, 140, .20), transparent 60%),
    linear-gradient(165deg, #0b0a12 0%, #0a0911 100%);
  --card: rgba(14, 13, 20, .9);
  --accent: #9a86f4;
  --accent-2: #7a62e6;
  --accent-grad: linear-gradient(135deg, #8d76f0 0%, #6d55d9 100%);
  --accent-soft: rgba(146, 126, 242, .13);
}
:root {
  --green: #33c57a;
  --green-bg: rgba(51, 197, 122, .11);
  --red: #ef5b5b;
  --red-bg: rgba(239, 91, 91, .11);
  --orange: #f0a14d;
  --blue: #6c8cf5;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #2a2b3a transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a2b3a; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg-paint), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 13px/1.4 Onest, Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.num { font-variant-numeric: tabular-nums; }
.error-text { color: var(--red); min-height: 18px; font-size: 12px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.spacer { flex: 1; }
h2 { font-size: 15px; font-weight: 600; margin: 20px 0 10px; }
h2:first-child { margin-top: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
/* лёгкая неоновая подсветка блоков: светящаяся кромка + мягкий ореол в цветах темы */
:root, :root[data-theme="indigo"] { --neon-edge: rgba(130, 118, 245, .30); --neon-glow: rgba(105, 110, 240, .20); --neon-glow-2: rgba(70, 110, 235, .10); }
:root[data-theme="violet"] { --neon-edge: rgba(160, 130, 245, .32); --neon-glow: rgba(150, 115, 240, .20); --neon-glow-2: rgba(120, 90, 225, .10); }
.card, .kc {
  border-color: var(--neon-edge);
  box-shadow: 0 0 14px -2px var(--neon-glow), 0 0 42px -10px var(--neon-glow-2), inset 0 1px 0 rgba(255, 255, 255, .035);
  transition: box-shadow .25s, border-color .25s;
}
.card:hover, .kc:hover { box-shadow: 0 0 18px -1px var(--neon-glow), 0 0 52px -8px var(--neon-glow-2), inset 0 1px 0 rgba(255, 255, 255, .045); }
@media (prefers-reduced-motion: reduce) { .card, .kc { transition: none; } }

/* звёзды сверху — за контентом, прозрачны для кликов, растворяются книзу */
#stars {
  position: fixed; top: 0; left: 0; width: 100%; height: 380px; pointer-events: none; z-index: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
}
#app, #login { position: relative; z-index: 1; }

/* ---------- кнопки и поля ---------- */
.btn {
  border: 1px solid var(--line-2); background: var(--card-2); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; font-weight: 600; transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { border-color: #3a3b4c; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent-grad); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { opacity: .92; }
.btn.green { background: var(--green); color: #04150b; border-color: transparent; }
.btn.red { background: var(--red); color: #1c0505; border-color: transparent; }
.btn.green:hover, .btn.red:hover { opacity: .9; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; padding: 12px; font-size: 14px; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--card-2); cursor: pointer; display: inline-grid; place-items: center; color: var(--muted);
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
input, select {
  background: var(--field); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 11px;
  outline: none; min-width: 0;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--dim); }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
.check { flex-direction: row; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

.seg { display: inline-flex; background: var(--field); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 8px; cursor: pointer;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--accent-grad); color: var(--accent-ink); }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; padding: 8px 6px; }

/* ---------- вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 380px; padding: 30px; display: flex; flex-direction: column; gap: 12px; }
.login-box p { margin: 0 0 6px; }

/* ---------- шапка ---------- */
.logo { font-weight: 700; font-size: 17px; letter-spacing: -.2px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.logo span { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo .mark { width: 26px; height: 26px; }
.logo.big { font-size: 24px; }
.topbar {
  display: flex; align-items: center; gap: 22px; padding: 11px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, .05); background: rgba(8, 8, 14, .35); backdrop-filter: blur(3px);
  position: sticky; top: 0; z-index: 20;
}
.nav { display: flex; gap: 4px; margin: 0 auto; }
.nav button {
  background: none; border: 0; padding: 8px 14px; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.nav button:hover { color: var(--text); }
.nav button.active { background: var(--accent-soft); color: var(--text); }
.top-right { display: flex; align-items: center; gap: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; }
.status-dot.ok { background: var(--green); }

/* ---------- строка пары ---------- */
.pairbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.symbol-search { position: relative; display: flex; align-items: center; }
.symbol-search svg { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--dim); pointer-events: none; }
.symbol-search input { width: 230px; padding-left: 36px; font-weight: 600; height: 40px; }
.dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; width: 280px; max-height: 340px; overflow: auto;
  background: var(--card-2); border: 1px solid var(--line-2); border-radius: 12px; z-index: 30; padding: 5px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.dropdown div { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; }
.dropdown div:hover, .dropdown div.sel { background: var(--line); }
.venue-select {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.venue-select .tri { font-size: 11px; }
.venue-select.long .tri { color: var(--green); }
.venue-select.short .tri { color: var(--red); }
.venue-select select { border: 0; background: transparent; font-weight: 600; padding: 6px 4px; min-width: 110px; cursor: pointer; }
.venue-select select option { background: var(--card-2); }
.pairbar { position: relative; }
.venue-picker { position: relative; }
.vp-btn {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 12px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; font-weight: 600; min-width: 230px;
}
.vp-btn:hover { border-color: var(--line-2); }
.vp-btn.open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.vp-btn .tri { font-size: 11px; }
.vp-btn .tri.long { color: var(--green); }
.vp-btn .tri.short { color: var(--red); }
.vp-btn b { font-weight: 600; flex: 1; text-align: left; }
.vp-btn svg { width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.vp-btn.open svg { transform: rotate(180deg); }
.vicon {
  width: 20px; height: 20px; border-radius: 6px; display: inline-grid; place-items: center; flex: none;
  font-size: 10px; font-weight: 800; color: #101014; background: #8a8ba0;
}
.vicon[data-ex="binance"] { background: #f0b90b; }
.vicon[data-ex="bybit"] { background: #f7a600; color: #17181e; }
.vicon[data-ex="xt"] { background: #2ad5a0; font-size: 8px; }
.vicon[data-ex="mexc"] { background: #2d7cf6; color: #fff; }
.vicon[data-ex="gate"] { background: #2354e6; color: #fff; }
.vicon[data-ex="bitget"] { background: #1fc7d4; font-size: 8px; }
.vicon[data-ex="bingx"] { background: #2a54ff; color: #fff; font-size: 8px; }
.vicon[data-ex="hyperliquid"] { background: #97fce4; font-size: 8px; }
.vicon[data-ex="aster"] { background: #e8b27c; }
.vicon[data-ex="lbank"] { background: #f5c518; font-size: 8px; }
.vrow .tag { font-size: 10px; margin-left: 4px; vertical-align: 1px; }
.venue-panel {
  position: absolute; top: calc(100% + 8px); z-index: 40; width: min(900px, calc(100vw - 32px));
  background: #101019; border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  overflow: hidden;
}
.vpanel-search { padding: 12px; border-bottom: 1px solid var(--line); position: relative; }
.vpanel-search input { width: 100%; padding-left: 36px; height: 40px; border-color: var(--accent); }
.vpanel-search svg { position: absolute; left: 25px; top: 25px; width: 15px; height: 15px; color: var(--dim); }
.vpanel-cols { display: grid; grid-template-columns: 1.5fr 1.15fr .55fr; }
/* у каждой колонки своя высота и прокрутка: колесо и полоса справа (можно тянуть мышью) */
.vpanel-col { border-right: 1px solid var(--line); overflow-y: auto; min-width: 0; max-height: min(420px, calc(100vh - 230px));
  overscroll-behavior: contain; }
.vpanel-col, .page { scrollbar-width: auto; scrollbar-color: #4a4b63 transparent; }
.vpanel-col::-webkit-scrollbar, .page::-webkit-scrollbar { width: 10px; }
.vpanel-col::-webkit-scrollbar-thumb, .page::-webkit-scrollbar-thumb { background: #4a4b63; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.vpanel-col::-webkit-scrollbar-thumb:hover, .page::-webkit-scrollbar-thumb:hover { background: #6a6b88; background-clip: padding-box; }
.vpanel-col:last-child { border-right: 0; }
.vpanel-col h4 {
  margin: 0; padding: 12px 16px 10px; font-size: 11px; letter-spacing: .07em; color: var(--dim); font-weight: 600;
  position: sticky; top: 0; z-index: 2; background: #101019; border-bottom: 1px solid var(--line);
}
.vrow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 3px 6px; border-radius: 10px; cursor: pointer; }
.vrow:hover { background: var(--line); }
.vrow.sel { background: var(--accent-soft); }
.vrow.sel .vname, .vrow.sel .vprice { color: var(--accent); }
.vrow.off { opacity: .35; cursor: not-allowed; }
.vrow.off:hover { background: none; }
.vname { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vprice { color: var(--muted); font-size: 12.5px; }
.vfund { font-size: 12.5px; min-width: 76px; text-align: right; }
.vempty { padding: 16px; color: var(--dim); font-size: 12px; }
.mkt { font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 3px 7px; border-radius: 6px; background: var(--line); color: var(--muted); }

.multi-check { color: var(--muted); font-size: 13px; font-weight: 500; padding: 0 6px; }
.multibar { display: flex; align-items: center; gap: 14px; padding: 10px 14px; flex-wrap: wrap; }
.leg-pick { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.leg-pick input { height: 36px; }
.leg-pick label input { width: 90px; }
.ticker-search { position: relative; }
.ticker-search input { width: 210px; font-weight: 600; }
#multi-hint { font-size: 12px; flex-basis: 100%; }
.seg.tf button { padding: 6px 10px; }
.chart-note { font-size: 11px; color: var(--orange); padding: 0 14px 6px; margin-top: -4px; }
.wide-page { max-width: 1200px; }
.alert-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.alert-form label { min-width: 120px; }
.alert-form .pair-label { font-weight: 600; color: var(--text); padding-bottom: 10px; }

/* ---------- информационная таблица ---------- */
.infotable { display: grid; grid-template-columns: 150px 170px repeat(7, minmax(105px, 1fr)); overflow-x: auto; }
.infotable > div { padding: 9px 16px; border-right: 1px solid var(--line); display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.infotable .h { font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); padding-top: 11px; padding-bottom: 11px; }
.infotable .r1 { border-bottom: 1px solid var(--line); }
.infotable .last { border-right: 0; }
.infotable .span2 { grid-row: span 2; }
.coin { gap: 10px !important; font-weight: 700; font-size: 14px; }
.coin .av {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--accent-grad); color: #fff; flex: none;
}
.bigspread { flex-direction: column; align-items: flex-start !important; justify-content: center; gap: 2px !important; }
.bigspread b { font-size: 22px; font-weight: 700; color: var(--green); }
.bigspread small { color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--line); color: var(--muted); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.red { background: var(--red-bg); color: var(--red); }

/* ---------- рабочая область ---------- */
.view { padding: 16px 24px 28px; display: flex; flex-direction: column; gap: 14px; max-width: 1920px; margin: 0 auto; }
.workspace { display: grid; gap: 14px; grid-template-columns: minmax(420px, 1fr) 430px 350px; height: 720px; }
.chart-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.chart-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
.tool-group { display: flex; flex-direction: column; gap: 4px; }
.tool-group > span { font-size: 11px; color: var(--muted); }
.bucket { display: flex; align-items: center; gap: 6px; background: var(--field); border: 1px solid var(--line); border-radius: 11px; padding: 0 4px 0 10px; height: 36px; }
.bucket svg { width: 14px; height: 14px; color: var(--muted); }
.bucket select { border: 0; background: transparent; font-weight: 700; padding: 4px 2px; }
.bucket select option { background: var(--card-2); }
.legend { display: flex; gap: 14px; font-weight: 600; margin-left: auto; }
.lg::before { content: ""; display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.lg.entry::before { background: var(--green); }
.lg.exit::before { background: var(--red); }
.lg b { margin-left: 4px; }
.lg.entry b { color: var(--green); }
.lg.exit b { color: var(--red); }
.chart-hint { font-size: 11px; color: var(--dim); padding: 0 14px 8px; }
#chart { flex: 1; min-height: 300px; position: relative; }

/* стаканы */
.books { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; min-width: 0; }
.book { display: flex; flex-direction: column; min-width: 0; }
.book + .book { border-left: 1px solid var(--line); }
.book-head { padding: 12px 14px 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.book-head b { font-size: 14px; }
.book-head .role.long { color: var(--green); font-size: 11px; }
.book-head .role.short { color: var(--red); font-size: 11px; }
.book-head .spr { font-size: 12px; color: var(--muted); }
.book-head .spr b { font-size: 12px; color: var(--text); font-weight: 600; }
.book-cols { display: flex; justify-content: space-between; align-items: center; padding: 2px 14px 6px; font-size: 11px; color: var(--muted); }
.unit-toggle { display: inline-flex; background: var(--field); border: 1px solid var(--line); border-radius: 6px; margin-left: 6px; }
.unit-toggle button { border: 0; background: none; font-size: 10px; padding: 1px 6px; cursor: pointer; color: var(--dim); border-radius: 5px; font-weight: 700; }
.unit-toggle button.active { background: var(--accent-soft); color: var(--accent); }
.book-rows { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 0 6px 8px; font-size: 13px; }
.book-row { display: flex; justify-content: space-between; align-items: center; padding: 0 8px; height: 30px; }
.book-row .p { font-weight: 500; }
.book-row.ask .p { color: var(--red); }
.book-row.bid .p { color: var(--green); }
.book-row .v { position: relative; padding: 3px 7px; border-radius: 6px; font-weight: 500; z-index: 0; }
.book-row .v i { position: absolute; top: 0; bottom: 0; right: 0; border-radius: 6px; z-index: -1; }
.book-row.ask .v i { background: var(--red-bg); }
.book-row.bid .v i { background: var(--green-bg); }
.book-row.ask .v { color: var(--red); }
.book-row.bid .v { color: var(--green); }
.book-sep { height: 1px; background: var(--line); margin: 4px 8px; }

/* панель ордера */
.panel { padding: 12px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.panel label > input, .panel label > select { width: 100%; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { width: 100%; padding-right: 76px; }
.input-wrap .suffix { position: absolute; right: 9px; display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.input-wrap .suffix button { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; padding: 2px 4px; font-size: 11px; }
.label-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.label-row b { color: var(--text); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-2); background: var(--field); color: var(--muted); border-radius: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.chip:hover { color: var(--text); }
.chip.active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.chips.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); }
.chips.grid4 .chip { padding: 7px 2px; text-align: center; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiers { display: flex; flex-direction: column; gap: 6px; }
.tier-row { display: grid; grid-template-columns: 18px 1fr 1.2fr 30px; gap: 6px; align-items: center; }
.tier-row .input-wrap input { padding-right: 46px; }
.tier-n { color: var(--green); font-weight: 700; font-size: 12px; text-align: center; }
.tier-add { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.size-slider { display: flex; flex-direction: column; gap: 4px; margin-top: -4px; }
.size-slider input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; padding: 0; border: 0; cursor: pointer;
}
.size-slider input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent) 0, var(--accent-2) var(--p, 0%), var(--line-2) var(--p, 0%));
}
.size-slider input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
.size-slider input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent-grad); }
.size-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; margin-top: -6px;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 0 0 3px rgba(126, 110, 240, .18);
}
.size-slider input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
.size-slider .ticks { display: flex; justify-content: space-between; }
.size-slider .ticks button { background: none; border: 0; color: var(--dim); font-size: 11px; cursor: pointer; padding: 0 2px; }
.size-slider .ticks button:hover { color: var(--text); }
.slider-base { font-size: 11px; }
.presets-row { display: flex; gap: 6px; align-items: center; }
.presets-row .chips { flex: 1; }
.icon-btn.small { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; flex: none; }
.chip-input { width: 100%; padding: 6px 4px; font-size: 12px; text-align: center; border-radius: 8px; }
.section-title { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); margin-bottom: -4px; font-weight: 600; }
.margin-box { background: var(--card-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.margin-box .t { grid-column: 1 / -1; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.margin-box .v { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.margin-box .v span:first-child { font-weight: 600; }
.margin-box .v.long span:first-child { color: var(--green); }
.margin-box .v.short span:first-child { color: var(--red); }
.margin-box .v b { font-size: 14px; font-weight: 600; }
.summary { background: var(--card-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; display: grid; gap: 5px; font-size: 12px; }
.summary div { display: flex; justify-content: space-between; gap: 8px; }
.summary b { font-weight: 600; }
.pos-card { border: 1px solid var(--line-2); border-radius: 11px; padding: 11px 12px; display: grid; gap: 5px; font-size: 12px; background: var(--card-2); }
.pos-card .title { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; }
.pos-card div { display: flex; justify-content: space-between; gap: 8px; }
.pos-card b { font-weight: 600; }
.note { font-size: 12px; color: var(--muted); background: var(--card-2); border-radius: 11px; padding: 10px 12px; border: 1px dashed var(--line-2); }
.warn { color: var(--orange); }
.pick-target { display: flex; gap: 12px; font-size: 12px; color: var(--muted); align-items: center; }
.pick-target label { flex-direction: row; align-items: center; gap: 5px; cursor: pointer; }

/* низ: позиции/ордера */
.bottom { min-height: 240px; }
.bottom-head { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; padding: 13px 12px; cursor: pointer; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { color: var(--accent); margin-left: 2px; }
.tab-body { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
td.num, th.num { text-align: right; }
tr.current td { background: rgba(126, 110, 240, .045); }
tr:last-child td { border-bottom: 0; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: var(--line); color: var(--muted);
}
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.orange { background: rgba(240, 161, 77, .13); color: var(--orange); }
.badge.blue { background: rgba(108, 140, 245, .13); color: var(--blue); }
.progress { width: 80px; height: 4px; background: var(--line); border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; margin-left: 6px; }
.progress i { display: block; height: 100%; background: var(--accent-grad); }
.actions { display: flex; gap: 6px; }
.log-row { display: grid; grid-template-columns: 74px 110px 1fr; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.log-row .t { color: var(--dim); }
.log-row.bad { color: var(--red); }
.log-row.good { color: var(--green); }
.wrap { white-space: normal; max-width: 380px; }

/* страницы */
/* своя прокрутка колесом внутри страницы — не зависит от прокрутки окна */
.page { padding: 22px; max-width: 1000px; max-height: calc(100vh - 110px); overflow-y: auto; overscroll-behavior: contain; }
.keys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.key-card { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--card-2); }
.key-card .head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.invite-code { font-size: 16px; padding: 11px 13px; background: var(--field); border: 1px dashed var(--accent); border-radius: 10px; margin: 10px 0; user-select: all; word-break: break-all; }

/* модалка и тосты */
.modal { position: fixed; inset: 0; background: rgba(3, 3, 8, .66); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { width: 100%; max-width: 460px; padding: 22px; display: flex; flex-direction: column; gap: 12px; max-height: 90vh; overflow: auto; background: #101019; }
.modal-box h3 { margin: 0; font-size: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: #14141f; border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: 13px; }
.toast.bad { border-left-color: var(--red); }
.toast.good { border-left-color: var(--green); }

/* ---------- адаптив ---------- */
@media (max-width: 1500px) {
  .workspace { grid-template-columns: minmax(380px, 1fr) 380px 330px; }
}
@media (max-width: 1250px) {
  .workspace { grid-template-columns: 1fr 1fr; height: auto; }
  .chart-card { grid-column: 1 / -1; height: 560px; }
  .books { height: 640px; }
}
@media (max-width: 760px) {
  .view { padding: 12px 16px 22px; }
  .topbar { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; margin: 0; overflow-x: auto; }
  .symbol-search input { width: 100%; }
  .symbol-search { flex-basis: 100%; }
  .venue-select select { min-width: 80px; }
  .workspace { grid-template-columns: 1fr; }
  .books { display: none; }
  .chart-card { height: 440px; }
  .infotable { grid-template-columns: 120px 150px repeat(7, 120px); }
  .ticker-search input { width: 150px; }
}

.vicon[data-ex="binance_alpha"] { background: linear-gradient(135deg, #f0b90b, #c99400); font-size: 9px; }

/* ключи бирж: свёрнутые карточки */
.keys-list { display: flex; flex-direction: column; gap: 10px; }
.kc { border: 1px solid var(--line-2); border-radius: 14px; background: var(--card-2); overflow: hidden; }
.kc.open { border-color: #34354a; }
.kc-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: none; border: 0; cursor: pointer; text-align: left; }
.kc-head:hover { background: rgba(255, 255, 255, .02); }
.kc-ava { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none;
  background: rgba(240, 185, 11, .12); color: #f0b90b; }
.kc-ava[data-ex="bybit"] { background: rgba(247, 166, 0, .12); color: #f7a600; }
.kc-ava[data-ex="mexc"], .kc-ava[data-ex="gate"], .kc-ava[data-ex="bingx"] { background: rgba(45, 124, 246, .13); color: #6c9cf8; }
.kc-ava[data-ex="bitget"], .kc-ava[data-ex="xt"] { background: rgba(31, 199, 212, .12); color: #1fc7d4; }
.kc-ava[data-ex="hyperliquid"] { background: rgba(151, 252, 228, .1); color: #97fce4; }
.kc-ava[data-ex="aster"] { background: rgba(232, 178, 124, .12); color: #e8b27c; }
.kc-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kc-title b { font-size: 14px; }
.kc-title .muted { font-size: 12px; }
.kc-chev { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; flex: none; }
.kc-chev svg { width: 18px; height: 18px; display: block; }
.kc.open .kc-chev { transform: rotate(180deg); }
.kc-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.kc-key { background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.kc-keyrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kc-keyrow code { font: 600 12.5px ui-monospace, Consolas, monospace; }
.kc-sep { height: 1px; background: var(--line); }
.kc-check { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kc-checkbtn { display: inline-flex; align-items: center; gap: 6px; border-color: var(--accent); color: var(--accent); background: transparent; }
.kc-checkbtn svg { width: 15px; height: 15px; }
.kc-wallets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.kc-wallet { border: 1px solid rgba(51, 197, 122, .35); background: var(--green-bg); border-radius: 11px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.kc-wallet b { font-size: 12.5px; }
.kc-wallet b::first-letter { color: var(--green); }
.kc-wallet span { color: var(--green); font-size: 12.5px; }
.kc-wallet.bad { border-color: rgba(239, 91, 91, .35); background: var(--red-bg); }
.kc-wallet.bad b::first-letter, .kc-wallet.bad span { color: var(--red); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--line); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
@media (max-width: 760px) { .kc-head .pill { display: none; } }
.alpha-howto { background: rgba(240, 161, 77, .07); border: 1px solid rgba(240, 161, 77, .35); border-radius: 11px; padding: 12px 14px; font-size: 12.5px; }
.alpha-howto ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }
.alpha-howto a { color: var(--orange); }
.alpha-howto code { font-size: 11.5px; color: var(--text); }
textarea { background: var(--field); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 11px; outline: none; font: 12px ui-monospace, Consolas, monospace; color: var(--text); resize: vertical; width: 100%; }
textarea:focus { border-color: var(--accent); }
