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

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 0.875rem;
  line-height: 1.45;
  background: linear-gradient(135deg, #0a0f1e 0%, #0c1222 100%);
  color: #eef2ff;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #1e2438; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #3b4259; border-radius: 10px; }

.container { max-width: 720px; margin: 0 auto; padding: 14px 12px 24px; }

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 10px;
}

.header .logo {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.header-gear {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(51, 65, 85, 0.7);
  background: rgba(17, 24, 39, 0.9);
  color: #94a3b8;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-gear:active {
  transform: scale(0.96);
}

.logo h1 {
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo p { font-size: 0.7rem; color: #6c7289; margin-top: 4px; }
.logo .header-subhint {
  font-size: 0.62rem;
  color: #8b92a8;
  margin-top: 6px;
  line-height: 1.35;
  max-width: 22rem;
}

.user-info {
  background: #111827;
  padding: 7px 12px;
  border-radius: 40px;
  font-size: 0.75rem;
  border: 1px solid #1f2937;
  color: #c7d2fe;
}

.tab-loading-card {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab-loading-line {
  margin: 0;
  text-align: center;
  color: #94a3b8;
}
.tab-loading-line .fa-spin {
  margin-right: 8px;
  opacity: 0.85;
}

.tab-loading-card--compact {
  min-height: 56px;
  padding: 10px 16px;
}

.card {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  border: 1px solid rgba(51, 65, 85, 0.5);
  padding: 15px 16px;
  margin-bottom: 12px;
}

.control-card .control-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.control-card h3 { font-size: 0.94rem; margin-bottom: 4px; }

.hint { color: #8b92b0; font-size: 0.72rem; line-height: 1.38; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 520px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: linear-gradient(135deg, #0f172a 0%, #111827 100%);
  border-radius: 16px;
  padding: 14px;
  border: 1px solid #1e293b;
}

.stat-card .stat-icon { font-size: 1.28rem; margin-bottom: 6px; opacity: 0.9; }
.stat-card .stat-value { font-size: 1.12rem; font-weight: 700; }
.stat-card .stat-label { color: #8b92b0; font-size: 0.66rem; margin-top: 3px; }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tabs-rail {
  padding: 6px 8px;
  border-radius: 16px;
  background: rgba(11, 18, 36, 0.72);
  border: 1px solid rgba(51, 65, 85, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tab {
  padding: 7px 11px;
  border-radius: 40px;
  cursor: pointer;
  transition: background 0.2s, transform 0.12s, border-color 0.2s;
  background: transparent;
  color: #9ca3af;
  border: 1px solid transparent;
  font-size: 0.73rem;
  font-weight: 600;
  font-family: inherit;
}

.tab.tab-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(51, 65, 85, 0.55);
  background: rgba(15, 23, 42, 0.65);
}

.tab.tab-pill i {
  font-size: 0.76rem;
  opacity: 0.92;
}

.tab.tab-pill span {
  white-space: nowrap;
}

.tab.active {
  background: linear-gradient(135deg, #2563eb, #6366f1);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.35);
}

.tab.tab-pill.active {
  background: linear-gradient(135deg, #2563eb, #6366f1);
}

.tab.tab-pill[data-tab="spotfunding"] {
  border-color: rgba(52, 211, 153, 0.35);
}

.tab.tab-pill[data-tab="spotfunding"].active {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.35);
}

.tab:hover:not(.active) {
  background: #1e293b;
  color: #eef2ff;
}

.tab.tab-pill:hover:not(.active) {
  border-color: rgba(96, 165, 250, 0.45);
  color: #e2e8f0;
}

.tab:active:not(:disabled) {
  transform: scale(0.98);
}

/* ===== Spot↔Futures: "Мои хеджи" ===== */
.my-hedges-list { display: flex; flex-direction: column; gap: 12px; }
.hedges-switch { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.hedge-switch-pill { flex: 1; min-width: 120px; }

.hedge-card { padding: 14px 14px; }
.hedge-card--closed .hedge-status { opacity: 0.85; }
.hedge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.hedge-symbol { font-weight: 800; letter-spacing: 0.2px; }
.hedge-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(51, 65, 85, 0.6);
  background: rgba(15, 23, 42, 0.6);
  color: #c7d2fe;
}
.hedge-status.open { border-color: rgba(34, 197, 94, 0.4); color: #86efac; }

.hedge-route {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.route-leg {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(51, 65, 85, 0.55);
  background: rgba(15, 23, 42, 0.5);
}
.route-arrow { opacity: 0.75; color: #94a3b8; font-weight: 800; }
.leg-type { grid-column: 1 / -1; font-size: 0.72rem; color: #94a3b8; font-weight: 700; }
.leg-exchange { font-weight: 800; }
.leg-price { text-align: right; color: #e2e8f0; }

.hedge-basis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.basis-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(51, 65, 85, 0.55);
  background: rgba(2, 6, 23, 0.35);
}
.basis-kv span { font-size: 0.72rem; color: #94a3b8; font-weight: 600; }
.basis-kv strong { font-size: 0.92rem; }

.hedge-details summary { cursor: pointer; color: #e2e8f0; font-weight: 700; }
.hedge-chart-wrap { height: 170px; margin-top: 10px; }
.spot-futures-feed-chart-wrap .spot-futures-feed-chart-canvas { display: block; width: 100%; height: 140px; }
.hedge-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.hedge-filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
@media (min-width: 520px) {
  .hedge-filters-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
}
.hedge-filters-grid input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(51, 65, 85, 0.55);
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  font-size: 0.78rem;
  outline: none;
}
.hedge-filters-grid select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(51, 65, 85, 0.55);
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  font-size: 0.78rem;
  outline: none;
  appearance: none;
}
.hedge-filters-grid input::placeholder { color: rgba(148, 163, 184, 0.75); }
.hedge-filters-grid input:focus-visible { border-color: rgba(96, 165, 250, 0.55); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }
.hedge-filters-grid select:focus-visible { border-color: rgba(96, 165, 250, 0.55); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }

/* Spot↔Futures: grouped cards */
.spot-futures-alts { margin-top: 10px; }
.spot-futures-alts summary { cursor: pointer; color: #e2e8f0; font-weight: 700; }
.spot-futures-alt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(51, 65, 85, 0.45);
  background: rgba(15, 23, 42, 0.45);
  margin-top: 8px;
}
.spot-futures-alt-row .alt-legs { color: #c7d2fe; font-weight: 700; }
.spot-futures-alt-row .alt-basis { color: #e2e8f0; font-weight: 800; }
.btn-xs { padding: 6px 10px; font-size: 0.72rem; border-radius: 10px; min-height: 34px; }

.status-line { font-size: 0.66rem; color: #6b7280; margin-bottom: 8px; min-height: 1em; }

.btn {
  padding: 9px 14px;
  min-height: 42px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  border: none;
  font-size: 0.76rem;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}

.btn-sm {
  padding: 7px 11px;
  min-height: 38px;
  font-size: 0.71rem;
}

.btn-lg {
  min-height: 44px;
  padding: 11px 16px;
  font-size: 0.82rem;
  border-radius: 14px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
}

.btn-icon.btn-sm {
  width: 40px;
  min-width: 40px;
  height: 40px;
}

.btn-primary { background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: #fff; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-outline { background: rgba(15, 23, 42, 0.5); border: 1px solid #334155; color: #eef2ff; }
.btn-danger { background: linear-gradient(180deg, #f87171, #dc2626); color: #fff; }
.btn-success { background: linear-gradient(180deg, #4ade80, #16a34a); color: #fff; }

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:focus-visible,
.tab:focus-visible,
.header-gear:focus-visible,
.settings-subtab:focus-visible,
.ex-chip:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn[aria-busy='true'] {
  opacity: 0.72;
  cursor: wait;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #334155;
  transition: 0.25s;
  border-radius: 34px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  transition: 0.25s;
  border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider { background: #22c55e; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); }

.toggles-grid { display: flex; flex-direction: column; gap: 4px; }
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #1f2937;
  font-size: 0.8rem;
}
.toggle-row:last-child { border-bottom: none; }

.signal-card {
  border-radius: 18px;
  margin-bottom: 12px;
  border: 1px solid rgba(51, 65, 85, 0.6);
  overflow: hidden;
  background: #0b1222;
}

/* Длинная лента (≥24 карточек): отрисовка вне экрана откладывается; узлы остаются в DOM — WS/обработчики не снимаются. */
.signal-list-inner--virtual .signal-card.signal-card--enhanced {
  content-visibility: auto;
  contain-intrinsic-size: auto 132px;
}

.signal-card.signal-ws-below-threshold {
  border-color: rgba(234, 179, 8, 0.45);
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.2);
}

.signal-liq-warn {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  padding: 9px 12px;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #fcd34d;
  background: rgba(113, 63, 18, 0.22);
  border-bottom: 1px solid rgba(234, 179, 8, 0.35);
}
.signal-liq-warn i {
  margin-top: 2px;
  flex-shrink: 0;
  opacity: 0.95;
}
.signal-liq-warn span {
  flex: 1;
  min-width: 0;
}

/* Ликвидность: развёрнутый блок (по умолчанию open — сразу видно предупреждение) */
.signal-liq-details {
  margin: 0;
  padding: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #fcd34d;
  background: rgba(113, 63, 18, 0.22);
  border-bottom: 1px solid rgba(234, 179, 8, 0.35);
}
.signal-liq-details > summary.signal-liq-summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  padding: 9px 12px;
  font-weight: 600;
  color: #fde68a;
}
.signal-liq-details > summary.signal-liq-summary::-webkit-details-marker {
  display: none;
}
.signal-liq-details > summary.signal-liq-summary::marker {
  content: '';
}
.signal-liq-details > summary .fa-triangle-exclamation {
  margin-top: 2px;
  flex-shrink: 0;
  opacity: 0.95;
}
.signal-liq-details-body {
  padding: 0 12px 10px 36px;
  color: #fcd34d;
  font-weight: 400;
  border-top: 1px solid rgba(234, 179, 8, 0.2);
}

/* Отказ стакана: свёртка с заголовком; тело развёрнуто по умолчанию */
.liq-reject-details.card {
  padding: 0;
}
.liq-reject-details {
  margin: 8px 0;
  border-color: #b45309 !important;
  padding: 0;
  overflow: hidden;
}
.liq-reject-details > summary.liq-reject-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 12px;
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  color: #fcd34d;
  font-size: 0.88rem;
  font-weight: 600;
  background: rgba(113, 63, 18, 0.2);
  border-bottom: 1px solid rgba(180, 83, 9, 0.45);
}
.liq-reject-details > summary.liq-reject-summary::-webkit-details-marker {
  display: none;
}
.liq-reject-details > summary.liq-reject-summary::marker {
  content: '';
}
.liq-reject-summary__title .fa-water {
  margin-right: 6px;
  opacity: 0.95;
}
.liq-reject-summary__meta {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
}
.liq-reject-details-body {
  padding: 10px 12px 12px;
}
.liq-reject-details-body .liq-reject-line {
  margin: 0 0 8px;
}
.liq-reject-details-body .liq-reject-reason {
  margin: 2px 0 8px;
  font-size: 11px;
}
.liq-reject-details-body .liq-reject-hint-foot {
  margin: 8px 0 0;
}

/* Легаси-вёрстка только для карточек «Фандинг» (.signal-card--funding) */
/* Компактная строка ленты «Фандинг»: нетто + нетто+кросс */
.signal-card--funding .funding-compact-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #e2e8f0;
}
.signal-card--funding .funding-compact-net {
  color: #93c5fd;
}
.signal-card--funding .funding-compact-combo {
  color: #4ade80;
}
.signal-card--funding .funding-expanded-headbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px 0;
}
.signal-card--funding .funding-expanded-headbar .btn-signal-collapse {
  font-size: 0.78rem;
  padding: 6px 12px;
}

.signal-card--funding .signal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid #1e293b;
}

.signal-card--funding .signal-head h4 {
  font-size: 0.88rem;
  font-weight: 700;
}
.signal-card--funding .signal-meta {
  font-size: 0.66rem;
  color: #8b92b0;
}

.signal-card--funding .signal-zones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 520px) {
  .signal-card--funding .signal-zones {
    grid-template-columns: 1fr;
  }
}

.signal-card--funding .zone {
  padding: 10px 12px;
  font-size: 0.71rem;
}
.signal-card--funding .zone-long {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.12), rgba(15, 23, 42, 0.3));
  border-right: 1px solid #1e293b;
}
.signal-card--funding .zone-short {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.12), rgba(15, 23, 42, 0.3));
}
@media (max-width: 520px) {
  .signal-card--funding .zone-long {
    border-right: none;
    border-bottom: 1px solid #1e293b;
  }
}

.signal-card--funding .zone-title {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.signal-card--funding .zone-long .zone-title {
  color: #4ade80;
}
.signal-card--funding .zone-short .zone-title {
  color: #f87171;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0;
  color: #cbd5e1;
}
.kv span:first-child {
  color: #64748b;
}

.signal-card--funding .signal-foot {
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: rgba(17, 24, 39, 0.6);
}

.signal-card--funding .spread-pill {
  font-size: 1.05rem;
  font-weight: 800;
  color: #4ade80;
}

.spread-lines {
  font-size: 0.75rem;
  line-height: 1.35;
}
.fund-strip {
  margin-top: 8px;
  font-size: 0.73rem;
  color: #a5b4fc;
  padding-top: 6px;
  border-top: 1px solid rgba(51, 65, 85, 0.45);
}
.profit-pill { font-size: 0.9rem; font-weight: 700; color: #86efac; }

.ex-keys-list { display: flex; flex-direction: column; gap: 14px; }
.ex-key-block.card { margin-bottom: 0; }
.api-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 520px) {
  .api-grid { grid-template-columns: 1fr 1fr; }
}
.api-grid label {
  display: block;
  font-size: 0.72rem;
  color: #9ca3af;
  margin-bottom: 4px;
}
.api-grid input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #eef2ff;
  font-size: 0.82rem;
}
.ex-key-done { margin-top: 10px; font-size: 0.8rem; color: #86efac; }

.signal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  justify-content: flex-end;
  flex: 1 1 220px;
  min-width: 0;
}

.signal-actions .btn {
  flex: 1 1 auto;
  min-width: min(100%, 104px);
}

@media (max-width: 520px) {
  .signal-card--funding .signal-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .signal-card--funding .signal-foot > div:first-child {
    align-self: flex-start;
    width: 100%;
  }

  .signal-actions {
    justify-content: stretch;
    flex: none;
    width: 100%;
  }

  .signal-actions .btn {
    min-width: 0;
    flex: 1 1 calc(50% - 4px);
  }

  .signal-actions .btn-open,
  .signal-actions .btn-open-fund {
    flex: 1 1 100%;
  }
}

.positions-list-inner .btn-close-pos.btn-block {
  margin-top: 10px;
}

.ex-save-keys.btn-block {
  margin-top: 10px;
}

.chart-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}
.fund-schedule-block {
  padding: 8px 14px 4px;
  border-top: 1px solid rgba(30, 41, 59, 0.85);
  background: rgba(15, 23, 42, 0.35);
}
.fund-schedule-title {
  font-size: 0.72rem;
  margin-bottom: 4px;
  color: #94a3b8;
}
.fund-countdown-live { line-height: 1.4; font-size: 0.76rem; }

.live-spread-badge { margin-top: 6px; color: #93c5fd; font-size: 0.72rem; }
.btn-live-on { border-color: #38bdf8 !important; color: #38bdf8 !important; }

.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid #1f2937; }
table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid #1f2937; }
th { color: #9ca3af; font-weight: 600; text-transform: uppercase; font-size: 0.65rem; }
tr:hover { background: rgba(59, 66, 89, 0.2); }

.empty { text-align: center; color: #6c7289; padding: 28px 12px; font-size: 0.85rem; }
.err { color: #f87171; font-size: 0.8rem; padding: 12px; }

.form-grid label { display: block; font-size: 0.75rem; color: #9ca3af; margin-bottom: 4px; }
.form-grid input, .form-grid select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #eef2ff;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  margin: 0;
  border-radius: 20px 20px 0 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.modal-head-settings {
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.55);
}

.modal-panel-chart .modal-head {
  margin-bottom: 10px;
}

.settings-sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 14px;
  padding: 14px 0 6px;
  background: linear-gradient(to top, rgba(17, 24, 39, 0.98) 55%, rgba(17, 24, 39, 0));
  border-top: 1px solid rgba(51, 65, 85, 0.45);
}

.settings-sticky-actions--split {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#chartContainer {
  height: 280px;
  width: 100%;
  margin-top: 10px;
}

.ex-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #1f2937;
  font-size: 0.82rem;
}
.ex-row:last-child { border-bottom: none; }

.lim-grid { display: grid; grid-template-columns: 1fr 100px; gap: 10px; align-items: end; margin-bottom: 10px; }
.lim-grid label { font-size: 0.75rem; color: #9ca3af; }
.lim-grid select {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.9rem;
}

.lim-grid input {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #fff;
  width: 100%;
}

.chart-wrap-pos { height: 200px; margin-top: 10px; }

/* История исполняемого спреда — отдельный canvas в каждой карточке (сделка). */
.pos-session-mini {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}
.pos-session-mini-hdr {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 6px;
  line-height: 1.35;
}
.chart-wrap-pos-session {
  height: 140px;
  margin-top: 0;
}

.positions-session-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.positions-toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 10px;
  font-size: 0.75rem;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(51, 65, 85, 0.45);
  border-radius: 12px;
}
.positions-meta--stale {
  color: #fbbf24 !important;
}
.pos-leg-mismatch {
  color: #fb923c !important;
  margin: 6px 0 0 !important;
}

.settings-panel {
  max-height: 92vh;
  margin: 12px 12px 0;
  width: calc(100% - 24px);
}

.settings-scroll {
  overflow-y: auto;
  max-height: calc(92vh - 64px);
  padding-right: 4px;
}

.settings-intro {
  margin-bottom: 12px;
}

.settings-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

/* Шесть вкладок: две строки по три — читаемее, чем одна длинная строка */
.settings-subtabs--split {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

@media (min-width: 560px) {
  .settings-subtabs--split {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.settings-subtab {
  flex: 1;
  min-width: 72px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.settings-subtab:active:not(:disabled) {
  transform: scale(0.98);
}

.settings-subtab.active {
  border-color: #818cf8;
  color: #e0e7ff;
  background: rgba(79, 70, 229, 0.28);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.2);
}

.settings-tab-panel {
  margin-bottom: 8px;
}

.liq-warn-banner {
  border-color: rgba(234, 179, 8, 0.5) !important;
  background: rgba(113, 63, 18, 0.25) !important;
  margin-bottom: 12px !important;
}

.liq-warn-title {
  color: #fcd34d;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
}

#futuresLiqHint:not([hidden]) {
  color: #fcd34d !important;
  margin-top: 8px;
}

.settings-section {
  margin-bottom: 12px !important;
}

.settings-section:last-child {
  margin-bottom: 0 !important;
}

.settings-h {
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: #cbd5e1;
}

.modal-actions {
  display: flex;
  gap: 6px;
}

.settings-section .lim-grid {
  grid-template-columns: 1fr minmax(130px, 1fr);
}

@media (max-width: 480px) {
  .settings-section .lim-grid {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.form-grid input:focus-visible,
.form-grid select:focus-visible,
.lim-grid input:focus-visible,
.lim-grid select:focus-visible,
.api-grid input:focus-visible {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

.ex-block .ex-row {
  border-bottom: none;
  padding-bottom: 6px;
}

.ex-block {
  border-bottom: 1px solid #1f2937;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.ex-block:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.ex-cap-grid {
  margin-top: 8px;
  margin-bottom: 0 !important;
}

.fund-pill {
  background: linear-gradient(135deg, #7c3aed, #4f46e5) !important;
}

.signal-card--funding .signal-head-funding-pills {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.signal-card--funding .fund-pill--combo {
  background: linear-gradient(135deg, #0d9488, #2563eb) !important;
  font-size: 0.78rem;
}

.signal-card--funding .fund-pill--live {
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.55);
}

.settings-auto-trade {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(51, 65, 85, 0.55);
}

.toggle-row-compact {
  margin: 0;
  align-items: center;
}

.quick-auto-hint {
  margin-top: 8px;
  margin-bottom: 0;
}

.signal-feed-aux {
  margin-bottom: 12px;
}

.signal-scan-mode-bar {
  margin-bottom: 10px;
  padding: 12px 14px !important;
}

.scan-mode-head {
  margin-bottom: 12px;
}

.scan-mode-head h4 {
  font-size: 0.84rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 4px;
}

.scan-mode-head .hint {
  font-size: 0.68rem;
  line-height: 1.38;
}

.scan-mode-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.scan-mode-pill {
  flex: 1;
  min-width: 112px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.65);
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.scan-mode-pill:active {
  transform: scale(0.98);
}

.scan-mode-pill--active {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 116, 144, 0.25);
  color: #e0f2fe;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2);
}

.filter-ex-card {
  padding: 14px 16px !important;
}

.filter-ex-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.filter-ex-head h4 {
  font-size: 0.88rem;
  color: #e2e8f0;
  font-weight: 600;
}

.ex-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ex-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.6);
  font-size: 0.75rem;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
}

.ex-chip input {
  accent-color: #22c55e;
}

.chart-toolbar {
  margin-bottom: 8px;
}

.chart-tf-row,
.chart-range-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.chart-range-label {
  width: 100%;
  font-size: 0.7rem;
  color: #94a3b8;
  margin: 0 0 2px 0;
}

.tf-pill {
  padding: 6px 12px !important;
  min-height: 36px !important;
  font-size: 0.75rem !important;
  border-radius: 999px !important;
}

.tf-pill-active {
  background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
  border-color: transparent !important;
  color: #fff !important;
}

.chart-hint-zero {
  margin: 0;
  font-size: 0.72rem;
}

.ex-row-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.ex-ico {
  font-size: 1.15rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.ex-ico-ok {
  color: #22c55e;
}

.ex-ico-warn {
  color: #fbbf24;
}

.ex-ico-off {
  color: #64748b;
}

.api-legend {
  margin-bottom: 12px;
  font-size: 0.72rem;
}

.ex-legend-ok {
  color: #22c55e;
}

.ex-legend-warn {
  color: #fbbf24;
}

.ex-legend-off {
  color: #64748b;
}

.auto-sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-top: 10px;
}

.signal-disclaimer {
  font-size: 0.72rem;
  line-height: 1.45;
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.signal-disclaimer i {
  color: #60a5fa;
  margin-right: 6px;
}

.fund-val {
  color: #86efac;
  font-weight: 600;
}

.mono {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 0.85em;
}

.chart-wrap-analytics {
  position: relative;
  height: 220px;
  width: 100%;
}

.chart-wrap-pie {
  height: 260px;
}

.quick-auto-sub--dimmed {
  opacity: 0.55;
}

.live-ws-strip {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(51, 65, 85, 0.6);
  font-size: 0.72rem;
}

.live-ws-title {
  color: #94a3b8;
  margin-bottom: 8px;
  font-weight: 600;
}

.live-ws-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}

.live-ws-grid .live-ws-span2 {
  grid-column: 1 / -1;
}

.live-ws-grid .lw-l {
  display: block;
  color: #64748b;
  font-size: 0.68rem;
}

.live-ws-grid .lw-v {
  display: block;
  font-family: ui-monospace, monospace;
  color: #e2e8f0;
  font-size: 0.78rem;
}

.price-cross-block {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(71, 85, 105, 0.55);
  background: rgba(30, 41, 59, 0.5);
}

.price-cross-title {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 4px;
  color: #cbd5e1;
}

.price-cross-val {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

.price-cross-ok .price-cross-val {
  color: #86efac;
}

.price-cross-bad .price-cross-val {
  color: #fca5a5;
}

.tier-margins-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tier-margin-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tier-margin-row label {
  font-size: 0.78rem;
  color: #94a3b8;
}

.tier-margin-row input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 0.95rem;
}

.balance-strip {
  padding: 10px 12px !important;
  margin-bottom: 10px !important;
}

.balance-dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.balance-dashboard-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.balance-dashboard-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: #cbd5e1;
  margin: 0;
}

.balance-dashboard-title i {
  margin-right: 6px;
  color: #60a5fa;
}

.balance-cards-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.balance-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(51, 65, 85, 0.35);
}

.balance-row-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.7rem;
  color: #cbd5e1;
  letter-spacing: 0.02em;
}

.balance-row-amt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: ui-monospace, monospace;
  white-space: nowrap;
}

.balance-row-amt .bal-chip {
  font-size: 0.68rem;
  font-weight: 700;
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  padding: 1px 6px;
}

.balance-row-amt .bal-chip b {
  color: #94a3b8;
  font-weight: 600;
  margin-right: 4px;
}

.balance-cap-mark {
  font-size: 0.62rem;
  color: #64748b;
  cursor: help;
  flex-shrink: 0;
}

.balance-cap-mark:hover {
  color: #94a3b8;
}

.balance-status {
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.balance-status--on {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.balance-status--off {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
}

.total-balance-row {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: #94a3b8;
}

.total-balance-row strong {
  font-size: 0.88rem;
  font-weight: 700;
  color: #86efac;
  font-family: ui-monospace, monospace;
}

.balance-strip.balance-strip--collapsed .balance-cards,
.balance-strip.balance-strip--collapsed .balance-strip-hint,
.balance-strip.balance-strip--collapsed .total-balance-row {
  display: none;
}

.balance-strip.balance-strip--collapsed {
  padding-bottom: 8px !important;
}

.balance-strip-hint {
  margin: 6px 0 0 !important;
  font-size: 0.64rem !important;
}

/* Пресеты и скрытые поля в настройках */
.preset-group {
  margin-bottom: 16px;
}

.preset-group label {
  display: block;
  font-size: 0.72rem;
  color: #9ca3af;
  margin-bottom: 6px;
}

.signal-risk-legend-card {
  padding: 12px 14px !important;
  margin-bottom: 12px !important;
  border: 1px solid rgba(51, 65, 85, 0.65);
  background: rgba(15, 23, 42, 0.45);
}

.signal-risk-legend {
  font-size: 0.68rem !important;
  line-height: 1.45 !important;
  margin: 0 !important;
  color: #a5b4fc !important;
}

.signal-risk-legend .sr-scale {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  margin-top: 6px;
}

.signal-risk-legend .sr-step {
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid #334155;
  font-size: 0.64rem;
  font-weight: 600;
  color: #cbd5e1;
}

.preset-risk-hint,
.lim-grid .hint.field-risk-hint {
  font-size: 0.64rem !important;
  color: #818cf8 !important;
  margin-top: 6px !important;
  line-height: 1.4 !important;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-buttons button {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.preset-buttons button:hover {
  border-color: #60a5fa;
  color: #e2e8f0;
}

.preset-buttons button.active {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-color: transparent;
  color: #fff;
}

.advanced-section {
  margin-top: 12px;
}

.advanced-section summary {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
}

.advanced-section[open] summary {
  margin-bottom: 12px;
}

.settings-nested-details {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-nested-details summary {
  color: #94a3b8;
}

.hidden {
  display: none !important;
}

.settings-field-hint-ico {
  margin-left: 6px;
  opacity: 0.75;
  cursor: help;
  font-size: 0.75rem;
  color: #60a5fa;
  vertical-align: middle;
}

/* ===== Раздел «Обучение» в настройках ===== */
.tutorial-section {
  margin-bottom: 20px !important;
}

.tutorial-content {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.tutorial-content p {
  margin-bottom: 12px;
}

.tutorial-content ul {
  margin: 8px 0 12px 20px;
}

.tutorial-content li {
  margin-bottom: 4px;
}

.tutorial-diagram {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 16px;
}

.diagram-node {
  background: #0f172a;
  padding: 12px 16px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid #334155;
  font-size: 0.8rem;
}

.diagram-node .price-high {
  color: #f87171;
  font-weight: 700;
}

.diagram-node .price-low {
  color: #4ade80;
  font-weight: 700;
}

.diagram-node.profit {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border-color: #4ade80;
  color: #4ade80;
}

.diagram-arrow {
  font-size: 1.2rem;
  color: #60a5fa;
}

.tutorial-card-example {
  background: #0b1222;
  border-radius: 16px;
  border: 1px solid #334155;
  overflow: hidden;
  margin: 12px 0;
}

.example-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid #1e293b;
}

.example-coin {
  font-weight: 700;
  font-size: 0.9rem;
}

.example-spread {
  font-size: 1rem;
  font-weight: 800;
}

.example-spread.positive {
  color: #4ade80;
}

.example-exchanges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 8px;
}

.example-ex {
  flex: 1;
  text-align: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  font-size: 0.7rem;
  color: #94a3b8;
}

.example-price {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-top: 4px;
}

.example-arrow {
  color: #3b82f6;
  font-size: 1rem;
}

.example-hint {
  padding: 8px 14px 12px;
  font-size: 0.7rem;
  color: #8b92b0;
  border-top: 1px solid #1e293b;
}

.hint-icon {
  display: inline-block;
  margin-right: 6px;
}

.warning-box {
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid #f59e0b;
  padding: 12px;
  margin: 12px 0;
  border-radius: 8px;
  font-size: 0.8rem;
}

.mode-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 12px 0;
}

@media (max-width: 560px) {
  .mode-comparison {
    grid-template-columns: 1fr;
  }
}

.mode {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 12px;
}

.mode-title {
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #334155;
}

.mode ul {
  margin: 0;
  padding-left: 16px;
}

.param-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0;
}

.scale-safe,
.scale-mid,
.scale-risk {
  flex: 1;
  min-width: 120px;
  padding: 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
}

.scale-safe {
  border-left: 3px solid #22c55e;
}

.scale-mid {
  border-left: 3px solid #f59e0b;
}

.scale-risk {
  border-left: 3px solid #ef4444;
}

.positive-text {
  color: #4ade80;
  font-weight: 600;
}

.negative-text {
  color: #f87171;
  font-weight: 600;
}

.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-num {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-content ul {
  margin: 6px 0 0 18px;
}

.faq details {
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: #e2e8f0;
  padding: 4px 0;
}

.faq summary:hover {
  color: #60a5fa;
}

.faq details p {
  margin: 8px 0 4px;
  font-size: 0.8rem;
  color: #94a3b8;
}

.faq details ul {
  margin: 6px 0 4px 18px;
  font-size: 0.78rem;
}

.tutorial-param {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #1e293b;
}

.tutorial-param:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.param-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #e2e8f0;
  margin-bottom: 8px;
}

.param-desc {
  font-size: 0.8rem;
  color: #94a3b8;
}

.leverage-example {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 12px 0;
}

.leverage-option {
  flex: 1;
  min-width: 100px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  text-align: center;
}

.leverage-value {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  color: #60a5fa;
}

.leverage-desc {
  font-size: 0.7rem;
  color: #8b92b0;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 0.8rem;
}

.checklist-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #22c55e;
  flex-shrink: 0;
}

.checklist-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.checklist-progress-track {
  flex: 1;
  height: 6px;
  background: #334155;
  border-radius: 3px;
  overflow: hidden;
}

.checklist-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #3b82f6);
  border-radius: 3px;
  transition: width 0.25s ease;
}

.video-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 0.8rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.video-link:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.video-link .fa-youtube {
  font-size: 1.1rem;
  color: #ff0033;
}

/* --- Улучшенная карточка фьюч. сигнала --- */
.signal-card.signal-card--enhanced {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.95));
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 18px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.signal-card.signal-card--enhanced:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.45);
}

.signal-card--enhanced .signal-card-inner {
  position: relative;
}

.signal-card--enhanced.signal-card--collapsed .signal-card-expanded-panel {
  display: none;
}

.signal-card--enhanced:not(.signal-card--collapsed) .signal-card-expanded-panel {
  display: block;
}

.signal-card--enhanced:not(.signal-card--collapsed) .signal-card-compact-panel {
  display: none;
}

.signal-card-compact-panel {
  padding: 10px 14px 12px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.signal-card-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.signal-card-compact-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.signal-card-compact-actions .btn-open-compact,
.signal-card-compact-actions .btn-open-fund-compact,
.signal-card-compact-actions .btn-open-spot-futures-compact {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.btn-open.btn-open--live-waiting,
.btn-open-fund.btn-open--live-waiting,
.btn-open-spot-futures.btn-open--live-waiting {
  background: #475569 !important;
  border-color: #475569 !important;
  color: #cbd5e1 !important;
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: auto;
}
.btn-open.btn-open--live-waiting:hover,
.btn-open-fund.btn-open--live-waiting:hover,
.btn-open-spot-futures.btn-open--live-waiting:hover {
  background: #475569 !important;
}

.signal-card-compact-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.signal-compact-symbol {
  font-weight: 700;
  font-size: 0.95rem;
  color: #f1f5f9;
  white-space: nowrap;
}

.signal-compact-spread-block {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  min-width: 0;
}

.signal-compact-spread-scan-ref {
  font-size: 0.58rem;
  font-weight: 600;
  color: #94a3b8;
  line-height: 1.15;
  max-width: 9.5rem;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signal-compact-spread {
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.signal-compact-spread--pos {
  color: #4ade80;
}

.signal-compact-spread--neg {
  color: #f87171;
}

/* Значение со скана (живого стакана ещё не было) — блёкло и курсивом, чтобы не путать с live. */
.signal-compact-spread--scan {
  opacity: 0.62;
  font-style: italic;
  font-weight: 700;
}
.signal-compact-spread--scan::after {
  content: ' *';
  font-size: 0.72em;
  vertical-align: super;
  opacity: 0.75;
}

/* Оптимистичный клик (скан свежий, live ещё не пришёл) — подсвечиваем, что кнопка рабочая, но с оговоркой. */
.btn-open.btn-open--optimistic,
.btn-open-fund.btn-open--optimistic,
.btn-open-spot-futures.btn-open--optimistic {
  background: linear-gradient(180deg, #16a34a 0%, #15803d 100%) !important;
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.55) inset;
}

/* Тонкая плашка «задержка» сверху ленты вместо стирания всех карточек при таймауте. */
.feed-soft-error {
  margin: 0 0 8px 0;
  padding: 8px 12px;
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.28);
  border-radius: 10px;
  color: #facc15;
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
  letter-spacing: 0.01em;
  animation: feedSoftErrorPulse 1.4s ease-in-out infinite alternate;
}
@keyframes feedSoftErrorPulse {
  from { opacity: 0.78; }
  to { opacity: 1; }
}

.signal-card-compact-sub {
  margin-top: 8px;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.4;
}

.signal-compact-profit--pos {
  color: #4ade80;
}

.signal-compact-profit--neg {
  color: #f87171;
}

.btn-signal-expand,
.btn-signal-collapse {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-signal-expand:active,
.btn-signal-collapse:active {
  opacity: 0.9;
}

.signal-card--enhanced .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.signal-card--enhanced .card-header-right {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
}

.signal-card--enhanced .symbol-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.signal-card--enhanced .coin-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.signal-card--enhanced .signal-symbol-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: #f1f5f9;
}

.signal-card--enhanced .signal-meta--card {
  margin-top: 3px;
  font-size: 0.62rem;
  color: #8b92b0;
  line-height: 1.35;
}

.signal-card--enhanced .live-spread-badge {
  margin-top: 6px;
}

.signal-card--enhanced .hdr-spread-pill {
  text-align: right;
  padding: 8px 11px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  flex-shrink: 0;
}

.signal-card--enhanced .hdr-spread-value {
  font-size: 1.05rem;
  font-weight: 800;
  display: block;
  line-height: 1.1;
}

.signal-card--enhanced .hdr-spread-pill--pos .hdr-spread-value {
  color: #4ade80;
}

.signal-card--enhanced .hdr-spread-pill--neg .hdr-spread-value {
  color: #f87171;
}

.signal-card--enhanced .hdr-spread-pill--below-min {
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.4);
}

.signal-card--enhanced .hdr-spread-pill--below-min .hdr-spread-label {
  color: #fbbf24;
}

.signal-card--enhanced .hdr-spread-label {
  font-size: 0.55rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.signal-card--enhanced .hdr-spread-scan-ref {
  display: block;
  font-size: 0.58rem;
  color: #94a3b8;
  line-height: 1.25;
  margin-top: 4px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.01em;
}

.signal-card--enhanced .spread-bar-container {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.12);
}

.signal-card--enhanced .spread-bar-label {
  font-size: 0.6rem;
  color: #8b92b0;
  margin-bottom: 5px;
}

.signal-card--enhanced .spread-bar-bg {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.signal-card--enhanced .spread-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #3b82f6);
  border-radius: 3px;
  transition: width 0.45s ease;
}

.signal-card--enhanced .spread-bar-fill--neg {
  background: linear-gradient(90deg, #f87171, #b91c1c);
}

.signal-card--enhanced .exchanges-flow {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: 12px 12px;
  gap: 8px;
}

.signal-card--enhanced .exchange-node {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  min-width: 0;
}

.signal-card--enhanced .exchange-node--sell {
  border-left: 3px solid #ef4444;
}

.signal-card--enhanced .exchange-node--buy {
  border-right: 3px solid #22c55e;
}

.signal-card--enhanced .ex-flow-badge {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

.signal-card--enhanced .ex-flow-badge-txt {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(51, 65, 85, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #e2e8f0;
}

.signal-card--enhanced .ex-flow-name {
  display: block;
  font-weight: 700;
  font-size: 0.68rem;
  margin-bottom: 2px;
  color: #e2e8f0;
}

.signal-card--enhanced .ex-flow-role {
  display: block;
  font-size: 0.55rem;
  color: #64748b;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.signal-card--enhanced .ex-flow-price {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
}

.signal-card--enhanced .ex-flow-unit {
  font-size: 0.58rem;
  color: #64748b;
  font-weight: 500;
}

.signal-card--enhanced .ex-flow-fund {
  font-size: 0.6rem;
  margin-top: 4px;
  color: #a5b4fc;
}

.signal-card--enhanced .ex-flow-fund.positive {
  color: #4ade80;
  font-weight: 600;
}

.signal-card--enhanced .flow-arrow {
  display: flex;
  align-items: center;
  color: #3b82f6;
  font-size: 0.95rem;
  flex-shrink: 0;
  align-self: center;
  animation: flow-arrow-pulse 1.6s ease-in-out infinite;
}

@keyframes flow-arrow-pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.signal-card--enhanced .signal-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 520px) {
  .signal-card--enhanced .signal-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.signal-card--enhanced .signal-metric {
  text-align: center;
  min-width: 0;
}

.signal-card--enhanced .signal-metric-label {
  font-size: 0.55rem;
  color: #8b92b0;
  margin-bottom: 3px;
}

.signal-card--enhanced .signal-metric-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: #e2e8f0;
}

.signal-card--enhanced .signal-metric-value.positive {
  color: #4ade80;
}

.signal-card--enhanced .signal-metric-value.negative {
  color: #f87171;
}

.signal-card--enhanced .signal-metric-sublabel {
  font-size: 0.52rem;
  color: #6b7280;
  margin-top: 3px;
  line-height: 1.25;
}

.signal-card--enhanced .signal-metric--stale-profit .signal-metric-value {
  opacity: 0.5;
}

.signal-card--enhanced .signal-metric--stale-profit .signal-metric-sublabel {
  color: #fbbf24;
}

.signal-card--enhanced .coin-class-row {
  padding: 6px 14px 0;
}

.signal-card--enhanced .coin-class-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.signal-card--enhanced .coin-class-tag--major {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.signal-card--enhanced .coin-class-tag--alt {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.signal-card--enhanced .coin-class-tag--meme {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
}

.signal-card--enhanced .signal-card-actions-wrap {
  padding: 0 12px 10px;
  background: rgba(17, 24, 39, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.signal-card--enhanced .signal-card-actions-wrap .signal-actions {
  justify-content: stretch;
  width: 100%;
  flex-wrap: wrap;
}

.signal-card--enhanced .signal-card-actions-wrap .signal-actions .btn {
  flex: 1 1 auto;
  min-width: min(100%, 96px);
}

.signal-card--enhanced .signal-card-hints {
  padding: 8px 14px 12px;
  background: rgba(17, 24, 39, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.signal-card--enhanced .signal-card-hints:empty {
  display: none;
}

.signal-card--enhanced .signal-card-hints > p.hint {
  margin: 0 !important;
  padding: 0 !important;
}

@keyframes signal-card-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hdr-spread-pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
    color: #4ade80;
  }
  100% {
    transform: scale(1);
  }
}

.signal-card.signal-card--new {
  animation: signal-card-enter 0.32s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.signal-card.signal-card--new .hdr-spread-value {
  animation: hdr-spread-pop 0.55s ease;
}

.fund-strip--combo {
  border-left: 3px solid #6366f1;
  padding-left: 8px;
  margin-top: 6px;
}

.funding-profit-row {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(71, 85, 105, 0.45);
}

.funding-profit-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: #a5b4fc;
  margin-bottom: 6px;
}

.funding-profit-detail {
  font-size: 0.8rem;
  color: #e2e8f0;
  line-height: 1.45;
}

.spot-futures-signal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.spot-futures-signal-card {
  margin: 0;
}

.spot-futures-monitor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.spot-futures-monitor-row {
  display: grid;
  grid-template-columns: 120px 90px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 6px 8px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.18);
}

.spot-futures-monitor-row .m-sym {
  font-weight: 700;
  color: #e2e8f0;
}

.spot-futures-monitor-row .m-basis {
  font-weight: 800;
  color: #e2e8f0;
}

.spot-futures-monitor-row .m-basis.positive {
  color: #86efac;
}

.spot-futures-monitor-row .m-basis.negative {
  color: #fca5a5;
}

.spot-futures-monitor-row .m-legs {
  color: #cbd5e1;
  font-weight: 600;
}

.spot-futures-monitor-row .spot-futures-monitor-reason {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.spot-basis-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
}

.spot-basis-intro {
  margin-bottom: 8px;
}

.spot-basis-h4 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 600;
}

.spot-basis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.spot-basis-table th,
.spot-basis-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.spot-basis-table th {
  font-weight: 600;
  color: #94a3b8;
}

/* Полноэкранный экран до завершения регистрации в боте (403 registration_incomplete) */
.registration-gate {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 15, 30, 0.96);
  backdrop-filter: blur(6px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.registration-gate-inner {
  max-width: 420px;
  width: 100%;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 24px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

@media (max-width: 768px) {
  .registration-gate {
    align-items: flex-start;
    justify-content: center;
    padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  }
  .registration-gate-inner {
    margin-top: max(8px, env(safe-area-inset-top));
    max-height: calc(100dvh - 20px);
  }
}

.registration-gate-icon {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 8px;
}

.registration-gate-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 12px;
  color: #f1f5f9;
}

.registration-gate-text {
  color: #cbd5e1;
  margin: 0 0 14px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.registration-gate-steps {
  margin: 0 0 18px;
  padding-left: 1.25rem;
  color: #94a3b8;
  font-size: 0.84rem;
  line-height: 1.55;
}

.registration-gate-steps code {
  font-size: 0.92em;
  background: rgba(30, 41, 59, 0.9);
  padding: 1px 6px;
  border-radius: 4px;
}

.registration-gate-retry {
  width: 100%;
  justify-content: center;
}

.registration-gate-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.registration-gate-label {
  font-size: 0.8rem;
  color: #cbd5e1;
  margin-top: 2px;
}

.registration-gate-input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.64);
  color: #eef2ff;
  padding: 10px 12px;
  font-size: 0.86rem;
}

.registration-gate-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.7);
}

.registration-gate-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.registration-gate-hint {
  min-height: 1.2em;
  font-size: 0.8rem;
  line-height: 1.35;
}

.registration-gate-offer {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
  padding: 10px;
}

.registration-gate-offer-title {
  font-size: 0.79rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.registration-gate-offer-body {
  font-size: 0.77rem;
  line-height: 1.45;
  color: #94a3b8;
}

.registration-gate-offer-details {
  margin-top: 8px;
}

.registration-gate-offer-details > summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: #93c5fd;
  user-select: none;
  outline: none;
}

.registration-gate-offer-details[open] > summary {
  margin-bottom: 6px;
}

.registration-gate-offer-link {
  font-size: 0.8rem;
  color: #93c5fd;
  text-decoration: none;
}

.registration-gate-offer-link:hover {
  text-decoration: underline;
}
