:root {
  --bg: #02050b;
  --panel: rgba(6, 12, 24, 0.78);
  --line: rgba(98, 212, 255, 0.32);
  --cyan: #58dbff;
  --lime: #8cff8c;
  --amber: #ffd36e;
  --red: #ff6f91;
  --text: #dff5ff;
  --muted: #7da8bd;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: radial-gradient(1000px 600px at 15% 0%, #0f2f49 0%, transparent 55%),
              radial-gradient(1000px 800px at 100% 100%, #1e1133 0%, transparent 50%),
              var(--bg);
  color: var(--text);
  font-family: "Rajdhani", sans-serif;
}

.scanline {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02) 0,
    rgba(255, 255, 255, 0.02) 1px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0) 4px
  );
  animation: scan 8s linear infinite;
  opacity: 0.5;
}

.glow-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(90px);
  opacity: 0.24;
}
.orb-a { width: 420px; height: 420px; left: -120px; top: -90px; background: #00d8ff; }
.orb-b { width: 380px; height: 380px; right: -130px; bottom: -120px; background: #7b61ff; }

.dash {
  position: relative;
  z-index: 2;
  min-height: 100%;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(12, 23, 42, 0.78), rgba(5, 10, 18, 0.88));
  box-shadow: inset 0 0 40px rgba(88, 219, 255, 0.06), 0 10px 24px rgba(0, 0, 0, 0.45);
}

.topbar {
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--muted);
}
h1 {
  margin: 0.25rem 0;
  font-family: "Orbitron", sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
}
.sub { color: var(--muted); font-size: 0.9rem; }
.sub a { color: var(--amber); text-decoration: none; }
.top-metrics { display: flex; gap: 0.6rem; }
.chip {
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  background: rgba(8, 21, 33, 0.76);
  border: 1px solid rgba(117, 222, 255, 0.25);
  display: flex;
  flex-direction: column;
  min-width: 110px;
}
.chip span { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; }
.chip b { font-family: "Orbitron", sans-serif; font-size: 13px; }

/* Layout is now stacked vertically - no hero-grid needed */

@media (max-width: 1200px) {
  .bottom-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .top-metrics { width: 100%; flex-wrap: wrap; }
  .chart-toolbar { grid-template-columns: 1fr; }
  .chart-stats-bar { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
  .stats-row { flex-wrap: wrap; }
}

@media (max-width: 768px) {
  body { overflow: auto; }
  .dash { padding: 0.6rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .chart-panel { min-height: auto; }
  .chart-wrap { min-height: 200px; }
  .trades-panel { min-height: auto; }
  .bottom-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .table-card .tr { grid-template-columns: 1.4fr repeat(3, 1fr); }
  .source-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .control-btn {
    min-width: 0;
    width: 100%;
    padding: 0.3rem 0.5rem;
  }
  .control-btn span:last-child { font-size: 13px; }
  .chart-tabs { flex-wrap: wrap; }
  .tv-types { margin-left: 0; }
  .chart-stats-bar { gap: 0.45rem; }
  .stats-row { flex-wrap: wrap; gap: 0.4rem; }
  .price { font-size: 1.6rem; }
  .indicators-charts { display: none; }
  .indicators-overlay { font-size: 10px; }
  .indicator-legend-row { padding: 2px 6px; gap: 4px; }
}

@media (max-width: 520px) {
  h1 { font-size: 1.05rem; }
  .panel-title { font-size: 0.62rem; }
  .control-btn { font-size: 12px; }
  .picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .indicator-card h3 { font-size: 10px; }
  .indicator-canvas { height: 90px; }
  .trade-row { grid-template-columns: 52px 1fr auto; }
}
.chart-panel {
  position: relative;
  min-height: 0;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.panel-title {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  color: #9ccce0;
  text-transform: uppercase;
}
.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.source-controls {
  padding: 0.2rem 0;
}
.control-btn {
  background: #1a1d2e;
  border: 1px solid #2d3748;
  color: #e6e6e6;
  padding: 0.38rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  min-width: 115px;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  font-family: "Rajdhani", sans-serif;
}
.control-btn .control-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7da8bd;
}
.control-btn span:last-child {
  font-weight: 700;
  font-size: 14px;
}
.control-btn:hover {
  border-color: #58dbff;
}
.control-btn-muted {
  opacity: 0.8;
}
.chart-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.tv-types { display: flex; gap: 0.35rem; margin-left: 0.5rem; }
.tab-btn {
  background: rgba(7, 16, 28, 0.8);
  border: 1px solid rgba(117, 222, 255, 0.22);
  color: var(--muted);
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.65rem;
  cursor: pointer;
}
.tab-btn.active {
  color: var(--lime);
  border-color: rgba(140, 255, 140, 0.6);
  box-shadow: 0 0 10px rgba(140, 255, 140, 0.2);
}
.tv-overlay-toggle { margin-left: auto; font-size: 0.6rem; padding: 0.2rem 0.5rem; }
.tv-overlay-toggle.active { color: #58dbff; border-color: rgba(88,219,255,0.5); box-shadow: 0 0 8px rgba(88,219,255,0.2); }
.tv-overlay-toggle:not(.active) { color: #555; border-color: rgba(80,80,80,0.3); }
.chart-wrap {
  position: relative;
  flex: 1;
  min-height: 260px;
  background: rgba(2, 5, 11, 0.95);
  border-radius: 12px;
  border: 1px solid rgba(120, 208, 243, 0.2);
  overflow: hidden;
}
.indicators-overlay {
  position: absolute;
  top: 26px;
  left: 8px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: auto;
}
.indicator-legend-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  font-size: 12px;
  white-space: nowrap;
  background: rgba(15, 20, 25, 0.85);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  width: fit-content;
}
.ind-legend-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
}
.ind-legend-btn:hover { color: #fff; }
.ind-close-btn { font-size: 16px; font-weight: bold; }
.ind-close-btn:hover { color: #ff4757; }
.ind-settings-btn:hover { color: #58dbff; }

/* Indicator Settings Popup */
.ind-settings-popup {
  position: fixed;
  z-index: 9999;
  background: rgba(10, 18, 30, 0.96);
  border: 1px solid rgba(88, 219, 255, 0.25);
  border-radius: 8px;
  backdrop-filter: blur(12px);
  width: 210px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  font-size: 12px;
  color: #e6e6e6;
}
.ind-set-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(88, 219, 255, 0.12);
  font-weight: 700;
  font-size: 13px;
  color: #58dbff;
}
.ind-set-close {
  background: none; border: none; color: #888; cursor: pointer; font-size: 18px; line-height: 1;
}
.ind-set-close:hover { color: #ff4757; }
.ind-set-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ind-set-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #aaa;
}
.ind-set-input {
  width: 60px;
  background: rgba(20, 30, 50, 0.8);
  border: 1px solid rgba(88, 219, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  padding: 3px 6px;
  font-size: 12px;
  text-align: center;
}
.ind-set-input:focus {
  outline: none;
  border-color: #58dbff;
}
.ind-set-color {
  width: 32px;
  height: 24px;
  border: 1px solid rgba(88, 219, 255, 0.2);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.ind-set-range {
  width: 80px;
  accent-color: #58dbff;
}
.ind-set-range-val {
  font-size: 11px;
  color: #58dbff;
  min-width: 20px;
  text-align: center;
}
.ind-set-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid rgba(88, 219, 255, 0.12);
}
.ind-set-reset, .ind-set-apply {
  padding: 4px 12px;
  border: 1px solid rgba(88, 219, 255, 0.25);
  border-radius: 4px;
  background: rgba(20, 30, 50, 0.6);
  color: #aaa;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s;
}
.ind-set-reset:hover { border-color: #ff6f91; color: #ff6f91; }
.ind-set-apply {
  background: rgba(88, 219, 255, 0.15);
  color: #58dbff;
  border-color: #58dbff;
}
.ind-set-apply:hover { background: rgba(88, 219, 255, 0.3); }
.ind-legend-symbol { font-size: 13px; color: #e6e6e6; display: inline-flex; align-items: center; gap: 6px; }
.indicator-badge {
  background: rgba(6, 14, 24, 0.85);
  border: 1px solid;
  border-radius: 6px;
  padding: 0.18rem 0.4rem;
  font-size: 11px;
  font-family: "Orbitron", sans-serif;
}
.indicators-charts {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.45rem;
}
.indicator-card {
  border: 1px solid rgba(120, 208, 243, 0.22);
  border-radius: 10px;
  background: rgba(5, 12, 20, 0.8);
  padding: 0.55rem;
}
.indicator-card h3 {
  margin: 0 0 0.45rem;
  color: #9ccce0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: "Orbitron", sans-serif;
}
.indicator-canvas {
  width: 100%;
  height: 110px;
  display: block;
}
.tv-full {
  width: 100%;
  height: 100%;
  min-height: 260px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(120, 208, 243, 0.2);
  position: relative;
}
/* Watermark - text via ::after (matches footprint) */
.tv-full::after {
  content: 'Formion AI';
  position: absolute;
  top: var(--watermark-top, auto);
  bottom: var(--watermark-bottom, 35px);
  left: var(--watermark-left, auto);
  right: var(--watermark-right, 95px);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.15);
  pointer-events: none;
  z-index: 100;
  transform: var(--watermark-transform, none);
  white-space: nowrap;
}
.tv-full.hide-watermark::after {
  display: none;
}
/* Logo via ::before (matches footprint) */
.tv-full::before {
  content: '';
  position: absolute;
  top: var(--logo-top, auto);
  bottom: var(--logo-bottom, 35px);
  left: var(--logo-left, 10px);
  right: var(--logo-right, auto);
  width: clamp(40px, 8%, 60px);
  height: clamp(40px, 8%, 60px);
  background-image: url(/logo/logo.png);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.1;
  pointer-events: none;
  z-index: 99;
  transform: var(--logo-transform, none);
}
.tv-full.hide-logo::before {
  display: none;
}
/* Legacy watermark elements (hidden, replaced by ::after/::before) */
.chart-watermark-left {
  display: none;
}
.chart-watermark-right {
  display: none;
}
/* Maximize mode */
.chart-panel.maximized {
  position: fixed !important;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  border-radius: 0;
  margin: 0;
  max-width: none;
  width: 100vw !important;
  height: 100vh !important;
  overflow: auto;
  background: var(--bg);
}
.chart-panel.maximized .tv-full {
  flex: 1;
  min-height: 0;
  height: calc(100vh - 200px);
  border-radius: 0;
}
.chart-panel.maximized .rsi-sub-chart {
  height: 120px;
}
/* Loading toast */
.loading-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(88, 219, 255, 0.85);
  color: #0a1929;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 10000;
  font-family: 'Rajdhani', sans-serif;
}
/* Settings toggle row */
.settings-item { padding: 0.4rem 0; }
.toggle-row {
  display: flex; align-items: center; gap: 0.6rem; cursor: pointer;
  font-size: 0.9rem; color: #e0e6ed;
}
.toggle-row input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: #58dbff; cursor: pointer;
}
.tf-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.tf-btn {
  background: rgba(7, 16, 28, 0.8);
  border: 1px solid rgba(117, 222, 255, 0.22);
  color: var(--muted);
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.65rem;
  cursor: pointer;
}
.tf-btn.active {
  color: var(--lime);
  border-color: rgba(140, 255, 140, 0.6);
  box-shadow: 0 0 10px rgba(140, 255, 140, 0.2);
}
.hidden {
  display: none !important;
}
#priceCanvas {
  width: 100%;
  height: 280px;
  display: block;
}
.chart-stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  flex-shrink: 0;
}
.price-block .label { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; }
.price {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.6rem);
  color: #e9faff;
  text-shadow: 0 0 16px rgba(89, 220, 255, 0.75);
}
.stats-row { display: flex; gap: 0.45rem; }
.mini {
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(120, 208, 243, 0.2);
  background: rgba(6, 14, 24, 0.75);
  display: flex;
  flex-direction: column;
}
.mini span { font-size: 10px; color: var(--muted); }
.mini b { font-size: 14px; font-family: "Orbitron", sans-serif; }

/* old trades-panel rule moved above */
.trades {
  margin-top: 0.5rem;
  flex: 1;
  overflow: hidden;
  display: grid;
  gap: 0.3rem;
  align-content: start;
}
.trade-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(125, 190, 214, 0.2);
  background: rgba(3, 9, 17, 0.85);
  border-radius: 10px;
  padding: 0.34rem 0.45rem;
  transform: translateX(16px);
  opacity: 0;
  animation: rowin 320ms ease forwards;
}
.trade-side { font-family: "Orbitron", sans-serif; font-size: 11px; }
.trade-row.buy .trade-side { color: var(--lime); }
.trade-row.sell .trade-side { color: var(--red); }
.trade-price { font-size: 14px; }
.trade-qty { color: var(--muted); font-size: 12px; }

.bottom-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}
.mini-panel {
  min-height: 175px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.big-number {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.4rem, 2vw, 2rem);
  color: #effcff;
}
.small-text { color: var(--muted); font-size: 0.9rem; }

.meter {
  height: 10px;
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(144, 210, 232, 0.35);
  background: rgba(8, 21, 34, 0.8);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0.1);
  background: linear-gradient(90deg, #34f0d1, #9eff5d);
  box-shadow: 0 0 16px rgba(90, 255, 191, 0.55);
}

.prob-wrap { position: relative; height: 105px; }
.gauge {
  width: 100%;
  height: 105px;
  display: block;
}
.prob-number {
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-family: "Orbitron", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 10px rgba(88, 219, 255, 0.8), 0 1px 3px rgba(0,0,0,0.6);
  pointer-events: none;
}
.prob-label {
  position: absolute;
  bottom: 2px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  pointer-events: none;
}
.prob-bear { left: 8px; color: #ff6f91; text-shadow: 0 0 8px rgba(255,60,80,0.7); }
.prob-bull { right: 8px; color: #8cff8c; text-shadow: 0 0 8px rgba(0,230,118,0.7); }
.prob-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 0 2px;
}
.prob-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,111,145,0.25);
  overflow: hidden;
  position: relative;
}
.prob-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #ff6f91, #ffd36e, #8cff8c);
  transition: width 0.6s ease;
  box-shadow: 0 0 8px rgba(140,255,140,0.4);
}
.prob-pct {
  font-family: "Orbitron", sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  min-width: 36px;
}
.prob-pct-bear { color: #ff6f91; text-align: left; }
.prob-pct-bull { color: #8cff8c; text-align: right; }

.arb-rows {
  display: grid;
  gap: 0.55rem;
}
.arb-row {
  display: grid;
  gap: 0.3rem;
}
.arb-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}
.arb-track {
  height: 8px;
  border-radius: 999px;
  border: 1px solid rgba(176, 235, 255, 0.35);
  overflow: hidden;
}
.arb-fill {
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #ffd36e, #ff8e6f);
}

.neural-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#neuralLabel {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}
.wave {
  width: 100%;
  height: 82px;
  display: block;
  border: 1px solid rgba(112, 197, 226, 0.28);
  border-radius: 10px;
  background: rgba(3, 9, 17, 0.75);
}
.rsi-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.45rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.rsi-row span { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }
.rsi-row b { font-family: "Orbitron", sans-serif; font-size: 0.8rem; min-width: 32px; text-align: right; }
.rsi-bar {
  height: 10px;
  background: rgba(90, 188, 223, 0.10);
  border-radius: 999px;
  border: 1px solid rgba(176, 235, 255, 0.20);
  overflow: hidden;
  position: relative;
}
.rsi-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transform-origin: left;
  transition: width 0.5s ease, background 0.5s ease;
  background: linear-gradient(90deg, #ff6f91, #ffd36e);
}
/* RSI color zones via JS-applied classes */
.rsi-fill.rsi-oversold { background: linear-gradient(90deg, #ff3355, #ff6f91); }
.rsi-fill.rsi-low { background: linear-gradient(90deg, #ff6f91, #ffa64d); }
.rsi-fill.rsi-neutral { background: linear-gradient(90deg, #ffa64d, #ffd36e); }
.rsi-fill.rsi-high { background: linear-gradient(90deg, #8cff8c, #58dbff); }
.rsi-fill.rsi-overbought { background: linear-gradient(90deg, #00e676, #8cff8c); }

@keyframes rowin {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scan {
  from { transform: translateY(-25%); }
  to { transform: translateY(25%); }
}

@media (max-width: 1200px) {
  .hero-grid { grid-template-columns: 1fr; }
  .trades-panel { max-height: 300px; }
  .bottom-grid { grid-template-columns: repeat(2, 1fr); }
  body { overflow: auto; }
  .dash { min-height: 100%; }
}

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
  .top-metrics { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
  .bottom-grid { grid-template-columns: 1fr; }
    .source-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .control-btn {
    min-width: 0;
    width: 100%;
  }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  width: min(540px, 94vw);
  max-height: 82vh;
  border-radius: 12px;
  border: 1px solid rgba(120, 208, 243, 0.25);
  background: #131b2a;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-content-sm {
  width: min(360px, 94vw);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid rgba(120, 208, 243, 0.2);
}
.modal-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-family: "Orbitron", sans-serif;
  color: #dff5ff;
}
.close-btn {
  border: none;
  background: transparent;
  color: #dff5ff;
  font-size: 1.2rem;
  cursor: pointer;
}
.modal-body {
  padding: 0.95rem;
  overflow: auto;
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}
.picker-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.picker-option {
  border: 1px solid rgba(120, 208, 243, 0.25);
  background: rgba(7, 16, 28, 0.8);
  color: #dff5ff;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  text-align: left;
  font-family: "Rajdhani", sans-serif;
  font-size: 0.95rem;
}
.picker-option:hover,
.picker-option.active {
  border-color: rgba(140, 255, 140, 0.6);
  color: #8cff8c;
}
.indicator-search {
  width: 100%;
  background: #0f1419;
  color: #e6e6e6;
  border: 1px solid #2d3748;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}
.indicator-list-item {
  padding: 0.65rem;
  border: 1px solid rgba(120, 208, 243, 0.15);
  border-radius: 8px;
  margin-bottom: 0.45rem;
  cursor: pointer;
}
.indicator-list-item:hover {
  border-color: rgba(120, 208, 243, 0.5);
}
.indicator-list-item.active {
  border-color: rgba(140, 255, 140, 0.6);
  background: rgba(140, 255, 140, 0.08);
}
.indicator-name {
  font-family: "Orbitron", sans-serif;
  font-size: 0.72rem;
  color: #dff5ff;
  margin-bottom: 0.2rem;
}
.indicator-desc {
  font-size: 0.78rem;
  color: #7da8bd;
}

/* shared tables & pages */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}
.stat-card {
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.stat-big {
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.2rem, 2vw, 2rem);
  color: #e9faff;
}
.stat-sub { color: var(--muted); font-size: 0.85rem; }
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}
.chart-card { padding: 0.8rem; }
.table-card { padding: 0.8rem; }
.table { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tr { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(120, 208, 243, 0.18); background: rgba(5, 12, 20, 0.75); }
.tr .th { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.tr .td { font-size: 0.82rem; color: var(--text); }

/* history table overrides */
.table-card .tr { grid-template-columns: 2fr repeat(4, 1fr); }

/* settings */
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
.settings-card { padding: 0.8rem; display: flex; flex-direction: column; gap: 0.8rem; }
.field { display: flex; flex-direction: column; gap: 0.25rem; color: var(--muted); font-size: 0.85rem; }
.field input, .field select {
  background: rgba(5, 12, 20, 0.9);
  border: 1px solid rgba(120, 208, 243, 0.25);
  border-radius: 10px;
  color: var(--text);
  padding: 0.45rem 0.6rem;
  font-family: "Rajdhani", sans-serif;
}
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.action-btn {
  background: rgba(15, 32, 48, 0.9);
  border: 1px solid rgba(140, 255, 140, 0.4);
  color: var(--text);
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  font-family: "Orbitron", sans-serif;
  cursor: pointer;
}

/* Trading Panel - Bybit style */
.trading-panel { padding: 0; overflow: hidden; }
.tp-header {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid rgba(98,212,255,0.12);
  background: rgba(8,16,28,0.6);
}
.tp-bot-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tp-label {
  font-family: "Orbitron", sans-serif;
  font-size: 10px;
  color: #7da8bd;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tp-status {
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  margin-right: 0.3rem;
}
.tp-sep { width: 1px; height: 18px; background: rgba(98,212,255,0.2); margin: 0 0.3rem; }
.tp-select {
  background: rgba(5,12,20,0.9);
  border: 1px solid rgba(120,208,243,0.25);
  border-radius: 6px;
  color: var(--text);
  padding: 0.25rem 0.4rem;
  font-family: "Rajdhani", sans-serif;
  font-size: 12px;
}
.tp-btn {
  background: rgba(15,32,48,0.9);
  border: 1px solid rgba(120,208,243,0.3);
  color: var(--text);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.15s;
}
.tp-btn:hover { border-color: #58dbff; background: rgba(88,219,255,0.08); }
.tp-btn-sm { padding: 0.25rem 0.55rem; font-size: 10px; }
.tp-btn-buy {
  flex: 1;
  background: rgba(20,60,30,0.7);
  border-color: rgba(140,255,140,0.5);
  color: #8cff8c;
  padding: 0.55rem;
  font-size: 13px;
  font-weight: 700;
}
.tp-btn-buy:hover { background: rgba(140,255,140,0.15); }
.tp-btn-sell {
  flex: 1;
  background: rgba(60,20,30,0.7);
  border-color: rgba(255,111,145,0.5);
  color: #ff6f91;
  padding: 0.55rem;
  font-size: 13px;
  font-weight: 700;
}
.tp-btn-sell:hover { background: rgba(255,111,145,0.15); }
.tp-btn-close {
  border-color: rgba(255,211,110,0.5);
  color: #ffd36e;
}
.tp-btn-close:hover { background: rgba(255,211,110,0.1); }
.tp-btn-cancel {
  border-color: rgba(125,168,189,0.4);
  color: #7da8bd;
}
.tp-btn-tp { border-color: rgba(140,255,140,0.4); color: #8cff8c; }
.tp-btn-sl { border-color: rgba(255,111,145,0.4); color: #ff6f91; }

.tp-body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}
.tp-account {
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-right: 1px solid rgba(98,212,255,0.1);
}
.tp-account-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tp-val {
  font-family: "Orbitron", sans-serif;
  font-size: 13px;
  color: #e9faff;
}

.tp-position {
  padding: 0.65rem 0.8rem;
  border-right: 1px solid rgba(98,212,255,0.1);
}
.tp-section-title {
  font-family: "Orbitron", sans-serif;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #9ccce0;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.tp-pos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}
.tp-pos-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.tp-pos-item .tp-label { font-size: 9px; }
.tp-pos-item .tp-val { font-size: 12px; }
.tp-pos-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.tp-order {
  padding: 0.65rem 0.8rem;
}
.tp-order-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.tp-field { display: flex; flex-direction: column; gap: 0.15rem; }
.tp-field label {
  font-family: "Orbitron", sans-serif;
  font-size: 9px;
  color: #7da8bd;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tp-input {
  background: rgba(5,12,20,0.9);
  border: 1px solid rgba(120,208,243,0.25);
  border-radius: 6px;
  color: var(--text);
  padding: 0.35rem 0.45rem;
  font-family: "Rajdhani", sans-serif;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}
.tp-input-sm { width: auto; min-width: 80px; }
.order-type-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 0.6rem;
  border: 1px solid rgba(88,219,255,0.25);
  border-radius: 6px;
  overflow: hidden;
}
.order-type-btn {
  flex: 1;
  padding: 0.4rem 0;
  border: none;
  background: transparent;
  color: #7da8bd;
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s ease;
}
.order-type-btn:not(:last-child) {
  border-right: 1px solid rgba(88,219,255,0.25);
}
.order-type-btn.active {
  background: rgba(88,219,255,0.12);
  color: #58dbff;
}
.order-type-btn:hover:not(.active) {
  background: rgba(88,219,255,0.06);
}
.tp-order-btns {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.tp-sltp-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(98,212,255,0.1);
}

/* Logs panel */
.logs-panel { padding: 0; }
.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  user-select: none;
}
.logs-header:hover { background: rgba(88,219,255,0.04); }
.logs-toggle-icon {
  font-size: 10px;
  color: #7da8bd;
  transition: transform 0.2s;
}
.logs-wrap {
  max-height: 220px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.logs-wrap.collapsed { max-height: 0; }
.logs {
  overflow-y: auto;
  max-height: 220px;
  padding: 0 0.8rem 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  color: #b8d4e3;
}
.log-entry {
  padding: 0.15rem 0;
  border-bottom: 1px solid rgba(120,208,243,0.06);
}

/* Cyber Confirm / Alert Modal */
.cyber-modal {
  animation: cyberSlideIn 0.2s ease-out;
}
@keyframes cyberSlideIn {
  from { transform: scale(0.92) translateY(-12px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.cyber-modal-body {
  text-align: center;
  padding: 1.2rem 1.4rem 1rem !important;
}
.cyber-modal-body p {
  margin: 0 0 1.2rem;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #e9faff;
  line-height: 1.5;
}
.cyber-modal-btns {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
}
.cyber-btn {
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 0.55rem 1.6rem;
  border-radius: 6px;
  border: 1px solid;
  cursor: pointer;
  background: transparent;
  transition: all 0.15s ease;
}
.cyber-btn-cancel {
  border-color: rgba(125,168,189,0.4);
  color: #7da8bd;
}
.cyber-btn-cancel:hover {
  background: rgba(125,168,189,0.1);
  border-color: rgba(125,168,189,0.7);
}
.cyber-btn-ok {
  border-color: rgba(88,219,255,0.5);
  color: #58dbff;
}
.cyber-btn-ok:hover {
  background: rgba(88,219,255,0.12);
  border-color: rgba(88,219,255,0.8);
  box-shadow: 0 0 12px rgba(88,219,255,0.2);
}
.cyber-btn-ok.danger {
  border-color: rgba(255,111,145,0.5);
  color: #ff6f91;
}
.cyber-btn-ok.danger:hover {
  background: rgba(255,111,145,0.12);
  border-color: rgba(255,111,145,0.8);
  box-shadow: 0 0 12px rgba(255,111,145,0.2);
}
.cyber-btn-ok.success {
  border-color: rgba(140,255,140,0.5);
  color: #8cff8c;
}
.cyber-btn-ok.success:hover {
  background: rgba(140,255,140,0.1);
  border-color: rgba(140,255,140,0.8);
  box-shadow: 0 0 12px rgba(140,255,140,0.2);
}
.cyber-btn-ok.warning {
  border-color: rgba(255,211,110,0.5);
  color: #ffd36e;
}
.cyber-btn-ok.warning:hover {
  background: rgba(255,211,110,0.1);
  border-color: rgba(255,211,110,0.8);
  box-shadow: 0 0 12px rgba(255,211,110,0.2);
}

@media (max-width: 900px) {
  .tp-body { grid-template-columns: 1fr; }
  .tp-account, .tp-position { border-right: none; border-bottom: 1px solid rgba(98,212,255,0.1); }
  .tp-order-grid { grid-template-columns: 1fr; }
}

/* Quick Drawing Toolbar */
.quick-drawing-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px 0;
  align-items: center;
}
.quick-tool-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #8b949e;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
  line-height: 1;
}
.quick-tool-btn:hover {
  border-color: rgba(88, 219, 255, 0.4);
  color: #58dbff;
  background: rgba(88, 219, 255, 0.08);
}
.quick-tool-btn.active {
  border-color: rgba(140, 255, 140, 0.6);
  color: #8cff8c;
  background: rgba(140, 255, 140, 0.1);
}
.quick-tool-btn.quick-sys {
  color: #ff6f91;
  border-color: rgba(255, 111, 145, 0.2);
}
.quick-tool-btn.quick-sys:hover {
  border-color: rgba(255, 111, 145, 0.5);
  background: rgba(255, 111, 145, 0.08);
}
.quick-tool-btn.quick-sys[data-tool="pointer"] {
  color: #ffd36e;
  border-color: rgba(255, 211, 110, 0.2);
}
.quick-tool-btn.quick-sys[data-tool="pointer"]:hover {
  border-color: rgba(255, 211, 110, 0.5);
  background: rgba(255, 211, 110, 0.08);
}
.quick-tool-sep {
  width: 1px;
  height: 22px;
  background: rgba(98, 212, 255, 0.2);
  margin: 0 4px;
}

/* Chart Tools Modal */
.tool-section {
  margin-bottom: 12px;
}
.tool-section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #9ccce0;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.tool-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tool-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(120, 208, 243, 0.12);
  border-radius: 8px;
  background: rgba(7, 16, 28, 0.6);
  color: #dff5ff;
  cursor: pointer;
  text-align: left;
  font-family: 'Rajdhani', sans-serif;
  transition: all 0.15s;
  width: 100%;
}
.tool-btn:hover {
  border-color: rgba(88, 219, 255, 0.4);
  background: rgba(88, 219, 255, 0.06);
}
.tool-btn.active {
  border-color: rgba(140, 255, 140, 0.5);
  background: rgba(140, 255, 140, 0.06);
}
.tool-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.tool-info {
  flex: 1;
  min-width: 0;
}
.tool-name {
  font-size: 13px;
  font-weight: 600;
  color: #e6e6e6;
}
.tool-desc {
  font-size: 11px;
  color: #7da8bd;
}

/* Favorites grid */
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
}
.favorites-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #bfe8ff;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
}
.favorites-grid label:hover {
  background: rgba(88, 219, 255, 0.05);
}
.favorites-grid input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #58dbff;
}

/* Drawing Settings sections */
.ds-section {
  margin-bottom: 12px;
}
.ds-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #9ccce0;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ds-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #bfe8ff;
}
.ds-row span:first-child {
  min-width: 80px;
  color: #7da8bd;
  font-size: 12px;
}
.ds-row input[type="color"] {
  width: 32px;
  height: 24px;
  border: 1px solid #2d3748;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.ds-row input[type="range"] {
  flex: 1;
  accent-color: #58dbff;
  height: 4px;
}
.ds-row select {
  flex: 1;
  background: #0f1419;
  color: #e6e6e6;
  border: 1px solid #2d3748;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 12px;
}

/* Indicator category headers */
.ind-category {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #9ccce0;
  text-transform: uppercase;
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(98, 212, 255, 0.12);
}
.ind-category:first-child {
  margin-top: 0;
}
.ind-tag {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
  margin-left: 6px;
  font-family: 'Rajdhani', sans-serif;
}
.ind-tag.ind-coming {
  background: rgba(125, 168, 189, 0.15);
  color: #7da8bd;
}

/* Trades panel full-width stacked */
.trades-panel {
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.trades-panel .trades {
  max-height: 180px;
  overflow-y: auto;
}
.trades-panel.trades-collapsed .trades {
  display: none;
}

/* OHLC Display */
.ohlc-display {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 10;
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  color: #bfe8ff;
  pointer-events: none;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: calc(100% - 16px);
}
.ohlc-display .ohlc-item {
  display: inline-flex;
  gap: 3px;
}
.ohlc-display .ohlc-label {
  color: #7da8bd;
}
.ohlc-display .ohlc-val {
  font-weight: 600;
}
.ohlc-display .ohlc-val.up { color: #8cff8c; }
.ohlc-display .ohlc-val.down { color: #ff6f91; }
.ohlc-display .indicator-val {
  font-weight: 600;
}

/* Drawing Toolbar */
.drawing-toolbar {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(6, 12, 24, 0.92);
  border: 1px solid rgba(98, 212, 255, 0.2);
  border-radius: 8px;
  padding: 4px;
}
.drawing-toolbar .draw-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #7da8bd;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}
.drawing-toolbar .draw-btn:hover {
  border-color: rgba(88, 219, 255, 0.4);
  color: #58dbff;
  background: rgba(88, 219, 255, 0.08);
}
.drawing-toolbar .draw-btn.active {
  border-color: rgba(140, 255, 140, 0.6);
  color: #8cff8c;
  background: rgba(140, 255, 140, 0.1);
}
.drawing-toolbar .draw-sep {
  height: 1px;
  background: rgba(98, 212, 255, 0.15);
  margin: 2px 0;
}

/* Drawing Canvas */
.drawing-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  pointer-events: none;
}
.drawing-canvas.active {
  pointer-events: auto;
  cursor: crosshair;
}
.drawing-canvas.pan-mode {
  cursor: grab;
}

/* Live Trades toggle */
.trades-panel.trades-hidden .trades {
  display: none;
}
.trades-panel.trades-hidden {
  padding: 0.4rem 0.8rem;
}

/* RSI Sub Chart */
.rsi-sub-chart {
  width: 100%;
  height: 100px;
  border: 1px solid rgba(120, 208, 243, 0.2);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  margin-top: 4px;
}
.rsi-sub-chart .rsi-label {
  position: absolute;
  top: 4px;
  left: 8px;
  z-index: 5;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  color: rgba(140, 255, 140, 0.6);
  pointer-events: none;
}

/* Indicator Overlay Labels with values */
.indicator-badge {
  background: rgba(6, 14, 24, 0.85);
  border: 1px solid;
  border-radius: 6px;
  padding: 0.18rem 0.4rem;
  font-size: 11px;
  font-family: "Orbitron", sans-serif;
  display: flex;
  gap: 6px;
  align-items: center;
}
.indicator-badge .ind-value {
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 700;
}

/* Layout Management Modal */
.layout-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.layout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(120, 208, 243, 0.15);
  border-radius: 8px;
  cursor: pointer;
}
.layout-item:hover {
  border-color: rgba(120, 208, 243, 0.4);
}
.layout-item .layout-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  color: #dff5ff;
}
.layout-item .layout-del {
  background: none;
  border: 1px solid rgba(255, 111, 145, 0.3);
  color: #ff6f91;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.layout-item .layout-del:hover {
  background: rgba(255, 111, 145, 0.12);
}
.layout-save-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.layout-save-row input {
  flex: 1;
  background: #0f1419;
  color: #e6e6e6;
  border: 1px solid #2d3748;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  font-family: 'Rajdhani', sans-serif;
}
.layout-save-row button {
  background: rgba(15, 32, 48, 0.9);
  border: 1px solid rgba(140, 255, 140, 0.4);
  color: #8cff8c;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  cursor: pointer;
}

/* Text input modal for drawing text tool */
.text-input-overlay {
  position: absolute;
  z-index: 25;
  background: rgba(6, 12, 24, 0.95);
  border: 1px solid rgba(88, 219, 255, 0.4);
  border-radius: 6px;
  padding: 6px;
}
.text-input-overlay input {
  background: #0f1419;
  color: #e6e6e6;
  border: 1px solid #2d3748;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  width: 160px;
}

/* Save button in header */
.save-btn {
  cursor: pointer;
  border: 1px solid rgba(140, 255, 140, 0.3) !important;
  transition: all 0.15s;
}
.save-btn:hover {
  border-color: rgba(140, 255, 140, 0.6) !important;
  background: rgba(140, 255, 140, 0.08) !important;
}
.save-btn b {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #8cff8c;
}
.save-btn b svg {
  color: #8cff8c;
}

/* Control button SVG icons */
.control-btn .control-label svg {
  vertical-align: middle;
  margin-right: 2px;
  opacity: 0.7;
}

/* Volume Stats Bar */
.volume-stats-bar {
  display: flex;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem;
  background: rgba(6, 14, 24, 0.6);
  border: 1px solid rgba(98, 212, 255, 0.12);
  border-radius: 8px;
  flex-wrap: wrap;
}
.vol-stat {
  display: flex;
  flex-direction: column;
  min-width: 70px;
}
.vol-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  color: #7da8bd;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.vol-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  color: #e9faff;
}
.vol-buy { color: #8cff8c; }
.vol-sell { color: #ff6f91; }

/* Formion Logo Watermark */
.chart-watermark-logo {
  position: absolute;
  bottom: 28px;
  left: 10px;
  pointer-events: none;
  z-index: 2;
  color: rgba(255, 255, 255, 0.15);
}

/* Chart Resize Handle */
.chart-resize-handle {
  height: 6px;
  background: transparent;
  cursor: ns-resize;
  position: relative;
  transition: background 0.2s, height 0.2s;
  border-radius: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chart-resize-handle:hover {
  background: rgba(88, 219, 255, 0.12);
  height: 10px;
}
.chart-resize-handle:active {
  background: rgba(88, 219, 255, 0.2);
}
.chart-resize-handle::after {
  content: '';
  width: 50px;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}
.chart-resize-handle:hover::after {
  background: rgba(88, 219, 255, 0.5);
}

/* Width Resize Handle (right side) */
.chart-resize-handle-right {
  width: 6px;
  background: transparent;
  cursor: ew-resize;
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 20;
  transition: background 0.2s, width 0.2s;
}
.chart-resize-handle-right:hover {
  background: rgba(88, 219, 255, 0.12);
  width: 10px;
}
.chart-resize-handle-right:active {
  background: rgba(88, 219, 255, 0.2);
}
.chart-resize-handle-right::after {
  content: '';
  width: 3px;
  height: 50px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
}
.chart-resize-handle-right:hover::after {
  background: rgba(88, 219, 255, 0.5);
}

/* LIVE Status Indicator */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 255, 136, 0.15);
  border-color: rgba(0, 255, 136, 0.4);
  color: #00ff88;
  font-size: 10px;
  font-weight: bold;
  padding: 0.25rem 0.5rem;
}
.status-chip.disconnected {
  background: rgba(255, 71, 87, 0.15);
  border-color: rgba(255, 71, 87, 0.4);
  color: #ff4757;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ff88;
  display: inline-block;
  animation: statusPulse 2s ease-in-out infinite;
}
.status-chip.disconnected .status-dot {
  background: #ff4757;
  animation: none;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(0, 255, 136, 0); }
}

/* Market Type Badge (PERPETUAL/SPOT) */
.market-type-badge {
  color: #888;
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
  align-items: center;
}

/* Symbol Picker Icons */
.symbol-icon-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}
.symbol-icon-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}
.symbol-full-name {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 1px;
}
.symbol-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.symbol-meta .symbol-name {
  font-weight: 600;
  color: #e6e6e6;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Big Trades Panel */
.big-trades-panel {
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.big-trades-list {
  max-height: 220px;
  overflow-y: auto;
  margin-top: 0.4rem;
}
.big-trades-list::-webkit-scrollbar {
  width: 6px;
}
.big-trades-list::-webkit-scrollbar-track {
  background: transparent;
}
.big-trades-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
.big-trade-item {
  display: grid;
  grid-template-columns: 60px 1fr 80px 80px;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid rgba(120, 208, 243, 0.1);
  border-radius: 6px;
  margin-bottom: 3px;
  font-size: 12px;
  transition: all 0.2s;
}
.big-trade-item.flash {
  animation: bigTradeFlash 0.6s ease-out;
}
@keyframes bigTradeFlash {
  0% { background: rgba(255, 215, 0, 0.25); border-color: rgba(255, 215, 0, 0.5); }
  100% { background: transparent; border-color: rgba(120, 208, 243, 0.1); }
}
.big-trade-side {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 700;
}
.big-trade-price {
  font-size: 12px;
  color: #e6e6e6;
}
.big-trade-qty {
  color: #7da8bd;
  font-size: 11px;
}
.big-trade-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}
.big-trade-value.big {
  color: #ffd36e;
}
.big-trades-panel.trades-hidden .big-trades-list {
  display: none;
}
.big-trades-panel.trades-hidden {
  padding: 0.4rem 0.8rem;
}

/* ═══ Footprint-Style Cards (Trades, Liquidations) ═══ */
.fp-card {
  background: #1a1f2e;
  border: 1px solid #2d3748;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  margin-bottom: 8px;
}
.fp-card h2 {
  font-size: 11px;
  margin-bottom: 8px;
  color: #00d4ff;
  font-weight: 600;
  text-transform: uppercase;
}
.fp-settings-btn {
  background: none;
  border: none;
  color: #8b949e;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.fp-settings-btn:hover { color: #e6e6e6; }
.fp-list {
  max-height: 180px;
  overflow-y: auto;
  font-size: 9px;
  scrollbar-width: thin;
  scrollbar-color: rgba(88,219,255,0.3) rgba(0,0,0,0.2);
}
.fp-list::-webkit-scrollbar { width: 6px; }
.fp-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
.fp-list::-webkit-scrollbar-thumb { background: rgba(88,219,255,0.3); border-radius: 3px; }
.fp-list::-webkit-scrollbar-thumb:hover { background: rgba(88,219,255,0.5); }

/* Trade item (footprint layout) */
.fp-trade-item {
  padding: 4px;
  border-bottom: 1px solid #0f1419;
  display: flex;
  justify-content: space-between;
  gap: 5px;
  transition: all 0.3s;
}
.fp-trade-item span { flex: 1; }
.fp-trade-item.flash-new {
  animation: fpTradeFlash 0.6s ease-out;
}
@keyframes fpTradeFlash {
  0% { opacity: 0.5; transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}

/* Big Trades scroll container */
.big-trades-scroll {
  max-height: 180px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 4px;
  background: rgba(255, 215, 0, 0.03);
  margin-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 215, 0, 0.5) rgba(0,0,0,0.2);
}
.big-trades-scroll::-webkit-scrollbar { width: 6px; }
.big-trades-scroll::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
.big-trades-scroll::-webkit-scrollbar-thumb { background: rgba(255, 215, 0, 0.5); border-radius: 3px; }
.big-trades-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 215, 0, 0.7); }

.big-trades-header {
  background: rgba(255, 215, 0, 0.15);
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 600;
  color: #ffa500;
  border-bottom: 2px solid #ffa500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Liquidation item */
.fp-liq-item {
  padding: 6px;
  border-radius: 4px;
  border-left: 3px solid;
  margin: 3px 0;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  gap: 6px;
}
.fp-liq-item.long {
  background: rgba(255, 71, 87, 0.1);
  border-left-color: #ff4757;
}
.fp-liq-item.short {
  background: rgba(0, 255, 136, 0.1);
  border-left-color: #00ff88;
}

/* Symbol Picker Enhanced */
.symbol-exchange-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.symbol-exchange-tabs .tab-btn {
  display: flex;
  align-items: center;
  gap: 3px;
}
.symbol-picker-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 380px;
  overflow-y: auto;
}
.symbol-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(120, 208, 243, 0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.symbol-picker-item:hover {
  border-color: rgba(88, 219, 255, 0.4);
  background: rgba(88, 219, 255, 0.04);
}
.symbol-picker-item.active {
  border-color: rgba(140, 255, 140, 0.5);
  background: rgba(140, 255, 140, 0.05);
}
.symbol-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}
.symbol-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.symbol-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  color: #dff5ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.symbol-exchange-label {
  font-size: 10px;
  color: #7da8bd;
  display: flex;
  align-items: center;
  gap: 4px;
}
.symbol-exchange-label img {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}
.symbol-type-tag {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(88, 219, 255, 0.15);
  color: #58dbff;
  font-family: 'Rajdhani', sans-serif;
}

/* Session List Enhanced */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(120, 208, 243, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.session-item:hover {
  border-color: rgba(88, 219, 255, 0.4);
  background: rgba(88, 219, 255, 0.04);
}
.session-item.active {
  border-color: rgba(140, 255, 140, 0.5);
  background: rgba(140, 255, 140, 0.05);
}
.session-flag {
  font-size: 22px;
  width: 30px;
  text-align: center;
}
.session-info {
  flex: 1;
}
.session-name {
  font-weight: 600;
  color: #e6e6e6;
  font-size: 14px;
}
.session-time {
  color: #7da8bd;
  font-size: 11px;
}

/* Custom Indicator Section */
.custom-indicator-section {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(98, 212, 255, 0.12);
  border-radius: 8px;
  background: rgba(6, 14, 24, 0.5);
}
.custom-indicator-editor {
  width: 100%;
  background: #0a0e14;
  color: #8cff8c;
  border: 1px solid #2d3748;
  border-radius: 6px;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
  margin-top: 8px;
  line-height: 1.5;
}
.custom-indicator-editor:focus {
  border-color: rgba(88, 219, 255, 0.4);
  outline: none;
}
.custom-tpl-btn {
  font-size: 0.6rem !important;
  padding: 0.15rem 0.4rem !important;
}

/* Text overflow fix */
.panel, .chip, .control-btn, .tp-val, .tp-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash {
  overflow-x: hidden;
}

/* Exchange Picker Enhanced */
.exchange-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(120, 208, 243, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.exchange-picker-item:hover {
  border-color: rgba(88, 219, 255, 0.4);
  background: rgba(88, 219, 255, 0.04);
}
.exchange-picker-item.active {
  border-color: rgba(140, 255, 140, 0.5);
  background: rgba(140, 255, 140, 0.05);
}
.exchange-picker-item img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}
.exchange-picker-item .exchange-name {
  font-weight: 600;
  color: #e6e6e6;
  font-size: 14px;
}
.exchange-aggregated-logos {
  position: relative;
  width: 32px;
  height: 24px;
}
.exchange-aggregated-logos img {
  position: absolute;
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.exchange-aggregated-logos img:first-child {
  left: 0;
  z-index: 2;
}
.exchange-aggregated-logos img:last-child {
  left: 12px;
  z-index: 1;
}

/* ═══ LAYOUT SYSTEM ═══ */
.layout-main {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.layout-chart-area {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-width: 0;
}
.layout-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* Sidebar layout mode */
.layout-main.layout-sidebar-mode {
  flex-direction: row;
}
.layout-main.layout-sidebar-mode .layout-chart-area {
  flex: 1;
  min-width: 0;
}
.layout-main.layout-sidebar-mode .layout-sidebar {
  width: 320px;
  min-width: 280px;
  max-width: 400px;
  border-left: 1px solid #2d3748;
  padding-left: 0.8rem;
  overflow-y: auto;
  max-height: calc(100vh - 80px);
  position: sticky;
  top: 80px;
}
/* Sidebar: trades/liq lists get taller */
.layout-main.layout-sidebar-mode .fp-list {
  max-height: 300px;
}

/* Responsive: collapse sidebar on mobile */
@media (max-width: 900px) {
  .layout-main.layout-sidebar-mode {
    flex-direction: column;
  }
  .layout-main.layout-sidebar-mode .layout-sidebar {
    width: 100%;
    max-width: 100%;
    border-left: none;
    padding-left: 0;
    position: static;
    max-height: none;
  }
}

/* Layout option buttons in Settings */
.layout-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: #0f1419;
  border: 2px solid #2d3748;
  border-radius: 8px;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}
.layout-option:hover {
  border-color: #58dbff;
  color: #ccc;
}
.layout-option.active {
  border-color: #00d4ff;
  color: #00d4ff;
  background: rgba(0, 212, 255, 0.05);
}
.layout-option span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

/* ═══ LAYOUT PRESET BUTTONS ═══ */
.layout-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #0f1419;
  border: 1.5px solid #2d3748;
  border-radius: 6px;
  color: #7da8bd;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 70px;
}
.layout-preset-btn:hover {
  border-color: #58dbff;
  color: #bfe8ff;
  background: rgba(88, 219, 255, 0.05);
}
.layout-preset-btn.active {
  border-color: #00d4ff;
  color: #00d4ff;
  background: rgba(0, 212, 255, 0.08);
}
.layout-preset-btn span {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ═══ FONT OPTION BUTTONS ═══ */
.font-option {
  flex: 1;
  padding: 8px 12px;
  background: #0f1419;
  border: 1.5px solid #2d3748;
  border-radius: 6px;
  color: #7da8bd;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  text-align: center;
}
.font-option:hover { border-color: #58dbff; color: #bfe8ff; }
.font-option.active { border-color: #00d4ff; color: #00d4ff; background: rgba(0, 212, 255, 0.08); }

/* ═══ TRADES SETTINGS MODAL ═══ */
.ts-section {
  margin-bottom: 14px;
  padding: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid #2d3748;
  border-radius: 8px;
}
.ts-title {
  font-size: 12px;
  font-weight: 700;
  color: #e6e6e6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.ts-section .setting-item {
  margin-bottom: 10px;
}
.ts-section .setting-item:last-child {
  margin-bottom: 0;
}
.setting-label {
  display: block;
  font-size: 11px;
  color: #8b949e;
  margin-bottom: 4px;
  font-weight: 600;
}
.ts-select, .ts-input {
  width: 100%;
  padding: 7px 10px;
  background: #0f1419;
  color: #e6e6e6;
  border: 1px solid #2d3748;
  border-radius: 5px;
  font-size: 12px;
  font-family: inherit;
  box-sizing: border-box;
}
.ts-select:focus, .ts-input:focus {
  border-color: #58dbff;
  outline: none;
}
.ts-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: #ccc;
}
.ts-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #00d4ff;
  cursor: pointer;
}
.ts-hint {
  font-size: 10px;
  color: #666;
  margin-top: 3px;
}
