/* Палитра в стиле Bybit (тёмная по умолчанию), макет — по референсам. */
:root {
  --bg: #0b0e11; --bg2: #101216; --panel: #16181d; --panel2: #1c1f25; --line: #262a32; --line2: #30353e;
  --text: #eaecef; --muted: #848e9c; --faint: #5e6673;
  --accent: #f7a600; --accent-ink: #121212; --accent-soft: rgba(247,166,0,.12);
  --green: #20b26c; --red: #ef454a; --green-soft: rgba(32,178,108,.12); --red-soft: rgba(239,69,74,.12);
  --blue: #3d7eff; --radius: 10px; --radius-sm: 6px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --font: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
:root[data-theme="light"] {
  --bg: #f5f6f8; --bg2: #eef0f3; --panel: #ffffff; --panel2: #f7f8fa; --line: #e6e8eb; --line2: #d9dce1;
  --text: #121214; --muted: #6b7280; --faint: #9aa1ab; --accent-ink: #121212;
  --shadow: 0 8px 30px rgba(15,20,30,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); letter-spacing: -.01em; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.up { color: var(--green); } .down { color: var(--red); } .acc { color: var(--accent); }
.hidden { display: none !important; }

/* ---------- верхняя панель ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 22px; height: 60px;
  padding: 0 20px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; color: var(--text); white-space: nowrap; }
.logo i { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-style: normal; font-size: 15px; }
.tabs { display: flex; gap: 4px; }
.tab { padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: var(--panel2); border-color: var(--line2); }
.tab.tab-hub.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; cursor: pointer;
  color: var(--muted); background: transparent; border: 0; position: relative; }
.icon-btn:hover { color: var(--text); background: var(--panel2); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px;
  background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.pill.acc { color: var(--accent); border-color: rgba(247,166,0,.35); background: var(--accent-soft); }
.pill.green { color: var(--green); border-color: rgba(32,178,108,.35); background: var(--green-soft); }
.pill.red { color: var(--red); border-color: rgba(239,69,74,.35); background: var(--red-soft); }
.banner { padding: 8px 20px; text-align: center; font-weight: 600; }
.banner.red { background: var(--red-soft); color: var(--red); border-bottom: 1px solid rgba(239,69,74,.3); }
.banner.acc { background: var(--accent-soft); color: var(--accent); border-bottom: 1px solid rgba(247,166,0,.3); }

/* ---------- кнопки и формы ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font-weight: 600;
  cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; }
label.fld, div.fld { display: block; margin: 0 0 12px; }
label.fld > span, div.fld > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.inp, select.inp, textarea.inp { width: 100%; height: 40px; padding: 0 12px; line-height: 1.3; border-radius: 8px; background: var(--bg2);
  border: 1px solid var(--line2); outline: none; }
textarea.inp { height: auto; min-height: 120px; padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; resize: vertical; }
.inp:focus { border-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: 0 0 0 1px var(--line2); }
.seg.buy-sell button.on.buy { background: var(--green); color: #fff; box-shadow: none; }
.seg.buy-sell button.on.sell { background: var(--red); color: #fff; box-shadow: none; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; color: var(--muted); font-size: 13px; }
.check input { accent-color: var(--accent); margin-top: 3px; }

/* ---------- каркас страниц ---------- */
.page { padding: 16px 20px 40px; max-width: 1400px; margin: 0 auto; }
.hub { display: grid; grid-template-columns: 300px 1fr; gap: 16px; min-height: calc(100vh - 60px); padding: 0; max-width: none; }
.side { background: var(--bg2); border-right: 1px solid var(--line); padding: 16px 12px; }
.side a.item { display: flex; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 9px; color: var(--text); font-weight: 500; }
.side a.item:hover { background: var(--panel2); }
.side a.item.active { background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line2); }
.side .promo { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--accent-soft); border: 1px solid rgba(247,166,0,.3); font-size: 13px; }
.main { padding: 22px 28px 40px; max-width: 1100px; }
h1.title { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; }
.lead { color: var(--muted); margin: 0 0 22px; max-width: 720px; }
h2.sub { font-size: 16px; margin: 26px 0 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.pad0 { padding: 0; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.stat .k { font-size: 11.5px; color: var(--muted); } .stat .v { font-size: 18px; font-weight: 700; margin-top: 2px; }

/* карточка стратегии */
.scard { cursor: pointer; transition: border-color .15s, transform .15s; }
.scard:hover { border-color: var(--line2); transform: translateY(-1px); }
.scard .head { display: flex; gap: 12px; align-items: flex-start; }
.ava { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none;
  background: radial-gradient(circle at 30% 30%, #2d333d, #15181d); border: 1px solid var(--line2); color: var(--accent); }
.scard .name { font-weight: 600; font-size: 15.5px; } .scard .sub { color: var(--muted); font-size: 12.5px; }
.scard .apr { margin-left: auto; text-align: right; } .scard .apr b { font-size: 15px; } .scard .apr small { display: block; color: var(--muted); font-size: 11.5px; }
.scard .foot { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)) 96px; gap: 8px; margin-top: 16px; align-items: end; }
.scard .foot .k { font-size: 11px; color: var(--muted); } .scard .foot .v { font-weight: 600; font-size: 13.5px; }
.spark { width: 96px; height: 36px; }
.lock { color: var(--accent); }

/* таблицы */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--panel2); }
table.t td.r, table.t th.r { text-align: right; }
.scroll-x { overflow-x: auto; }
.empty { padding: 40px 10px; text-align: center; color: var(--faint); }

/* ---------- терминал ---------- */
.term { display: grid; grid-template-columns: minmax(0, 1fr) 250px 310px; grid-template-rows: auto minmax(0,1fr) auto; gap: 6px;
  padding: 6px; height: calc(100vh - 60px); }
.term > .card { padding: 0; overflow: hidden; }
.chart-box { grid-column: 1; grid-row: 1 / 3; display: flex; flex-direction: column; min-height: 420px; }
.chart-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sym-btn { display: flex; gap: 10px; align-items: center; padding: 6px 12px; border-radius: 9px; background: var(--panel2);
  border: 1px solid var(--line2); cursor: pointer; }
.coin { font-size: 9.5px; letter-spacing: -.02em; flex: none; }
.coin, .sym-btn .coin { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.tfs { display: flex; gap: 2px; } .tfs button { background: transparent; border: 0; color: var(--muted); padding: 5px 8px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.tfs button.on { color: var(--text); background: var(--panel2); }
.chart-wrap { position: relative; flex: 1; min-height: 300px; }
.chart-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.chart-legend { position: absolute; left: 10px; top: 8px; font-size: 12px; pointer-events: none; z-index: 2; }
.chart-legend div { margin-bottom: 2px; }
.ob { grid-column: 2; grid-row: 1 / 3; display: flex; flex-direction: column; font-size: 12px; }
.ob-head { display: flex; justify-content: space-between; padding: 10px 10px 6px; color: var(--muted); font-size: 11.5px; }
.ob-rows { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.ob-row { position: relative; display: flex; justify-content: space-between; padding: 2px 10px; font-family: var(--mono); font-size: 12px; }
.ob-row .bar { position: absolute; right: 0; top: 0; bottom: 0; opacity: .16; }
.ob-row.ask .p { color: var(--red); } .ob-row.ask .bar { background: var(--red); }
.ob-row.bid .p { color: var(--green); } .ob-row.bid .bar { background: var(--green); }
.ob-mid { padding: 8px 10px; font-size: 16px; font-weight: 700; font-family: var(--mono); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.order-col { grid-column: 3; grid-row: 1 / 4; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.order-col .card { padding: 14px; }
.acct .big { font-size: 20px; font-weight: 700; }
.kv { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; }
.kv span:first-child { color: var(--muted); }
.lev { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.lev button { flex: 1; min-width: 44px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 0;
  color: var(--muted); cursor: pointer; font-size: 12px; }
.lev button.on { border-color: var(--accent); color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
.bottom { grid-column: 1 / 3; grid-row: 3; min-height: 210px; max-height: 300px; display: flex; flex-direction: column; }
.bottom-tabs { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); align-items: center; }
.bottom-tabs button { background: transparent; border: 0; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; cursor: pointer; }
.bottom-tabs button.on { background: var(--panel2); color: var(--text); }
.bottom-body { overflow: auto; flex: 1; }

/* ---------- модалки, тосты ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal-bg { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal-bg > .modal { min-width: 0; }
.row > .inp { min-width: 0; }
.modal { width: min(100%, calc(100vw - 32px)); max-width: 460px; background: var(--panel); border: 1px solid var(--line2); border-radius: 14px;
  padding: 20px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal.wide { max-width: 760px; }
.modal h3 { margin: 0 0 14px; font-size: 18px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--accent); padding: 10px 14px;
  border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; white-space: pre-line; }
.toast.err { border-left-color: var(--red); } .toast.ok { border-left-color: var(--green); }
.drop { position: absolute; right: 0; top: 44px; width: 360px; max-height: 70vh; overflow: auto; background: var(--panel);
  border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); z-index: 50; }
.drop .n { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; white-space: pre-line; }
.drop .n small { display: block; color: var(--faint); margin-top: 3px; }

/* авторизация */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(247,166,0,.10), transparent), var(--bg); }
.auth .box { width: 100%; max-width: 420px; }
.auth .logo { justify-content: center; font-size: 22px; margin-bottom: 20px; }
.qr { background: #fff; padding: 12px; border-radius: 10px; width: 200px; height: 200px; margin: 10px auto; }
.qr svg, .qr img { width: 100%; height: 100%; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: var(--mono); background: var(--bg2); padding: 12px; border-radius: 8px; }

/* пакеты индикаторов (в стиле менеджера пакетов роутера) */
.pkg-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.pkg-tools .inp { max-width: 320px; }
.meter { height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; width: 160px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.guide { white-space: pre-line; line-height: 1.6; }
.info-box { background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 14px; font-size: 13px; }
.info-box ul { margin: 6px 0 10px; padding-left: 18px; } .info-box li { margin: 3px 0; }
.info-box .never { color: var(--red); }
.kpi-strip { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kpi .k { font-size: 11px; color: var(--muted); } .kpi .v { font-size: 16px; font-weight: 700; margin-top: 3px; }
.kpi .s { font-size: 11.5px; color: var(--muted); }
.gauge { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--red), var(--accent), var(--green)); position: relative; margin-top: 8px; }
.gauge i { position: absolute; top: -4px; width: 3px; height: 14px; background: var(--text); border-radius: 2px; }

/* ---------- адаптив ---------- */
.mobile-nav { display: none; }
@media (max-width: 1100px) {
  .term { grid-template-columns: minmax(0,1fr) 300px; grid-template-rows: auto auto auto; height: auto; }
  .chart-box { grid-column: 1; grid-row: 1; min-height: 460px; }
  .ob { grid-column: 1; grid-row: 2; max-height: 360px; }
  .order-col { grid-column: 2; grid-row: 1 / 3; }
  .bottom { grid-column: 1 / 3; grid-row: 3; }
  .kpi-strip { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar .tabs { display: none; }
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--bg2);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted); gap: 2px; padding: 4px 8px; }
  .mobile-nav a.active { color: var(--accent); }
  body { padding-bottom: 64px; }
  .hub { grid-template-columns: minmax(0, 1fr); }
  .top-right .pill, .top-right .lbl, .top-right .icon-btn[title="Тема"] { display: none; }
  .logo { font-size: 16px; }
  .chart-head { gap: 8px; }
  .side { display: none; }
  .main { padding: 16px; }
  .cards, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .term { grid-template-columns: 1fr; padding: 4px; }
  .chart-box, .ob, .order-col, .bottom { grid-column: 1; grid-row: auto; }
  .chart-box { min-height: 380px; }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .page { padding: 12px; }
  .drop { position: fixed; left: 8px; right: 8px; width: auto; top: 64px; }
}
