/* RIGHT PANEL */
.right-panel {
  width: 240px;
  min-width: 0;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
  flex-shrink: 0;
}

/* Collapsed panel */
.right-panel.collapsed {
  width: 32px;
  min-width: 32px;
  overflow: hidden;
}

.right-panel.collapsed > *:not(.panel-header) {
  display: none !important;
}

.right-panel.collapsed .panel-header {
  flex-direction: column;
  padding: 6px 4px;
  gap: 4px;
}

.right-panel.collapsed .panel-exchange,
.right-panel.collapsed .panel-live {
  display: none;
}

.right-panel.collapsed .panel-header-actions {
  flex-direction: column;
}

.right-panel.collapsed #btn-panel-compact {
  display: none;
}

.right-panel.collapsed #btn-panel-collapse svg {
  transform: rotate(180deg);
}

/* Compact mode */
.right-panel.compact {
  width: 200px;
}

.right-panel.compact .calc-row,
.right-panel.compact .info-row {
  padding: 0;
  font-size: 10px;
}

.right-panel.compact .calculator,
.right-panel.compact .info-section,
.right-panel.compact .sl-tp-section {
  padding: 3px 8px;
}

.right-panel.compact .btn-long,
.right-panel.compact .btn-short {
  padding: 5px 0;
  font-size: 11px;
}

.right-panel.compact .trade-buttons,
.right-panel.compact .action-buttons {
  padding: 3px 8px;
}
n/* Scrollable controls area — watchlist stays visible below */
.panel-controls {
  flex: 0 1 auto;
  overflow-y: auto;
  min-height: 0;
}

/* Panel section toggle (hidden by checkbox) */
.panel-section.section-hidden {
  display: none !important;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.panel-exchange { color: var(--accent); }
.panel-live { color: var(--green); font-size: 10px; }

.panel-header-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
}

.panel-toggle-btn {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s;
}

.panel-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--border);
  background: var(--bg-tertiary);
}

.panel-toggle-btn.active {
  color: var(--accent);
  border-color: var(--accent);
}

/* Panel config bar */
.panel-config-bar {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  align-items: center;
}

.pcb-title {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  width: 100%;
  margin-bottom: 2px;
}

.pcb-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.pcb-item input[type="checkbox"] {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.pcb-item:hover { color: var(--text-primary); }

/* ORDER TYPE SELECTOR */
.order-type-section {
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
}

.order-type-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.ot-tab {
  flex: 1;
  padding: 4px 0;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.1s;
}

.ot-tab.active {
  background: var(--accent);
  color: white;
}

.ot-tab:hover:not(.active) {
  background: var(--bg-input);
  color: var(--text-primary);
}

/* PARTIAL CLOSE */
.partial-close-section {
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
}

.partial-close-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pc-label {
  font-size: 8px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pc-buttons {
  display: flex;
  gap: 3px;
  flex: 1;
}

.pc-btn {
  flex: 1;
  padding: 4px 2px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.1s;
  text-align: center;
}

.pc-btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* ALERTS SECTION */
.alerts-section {
  border-bottom: 1px solid var(--border);
}

.alerts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 10px;
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.alerts-add-form {
  padding: 2px 10px 4px;
}

.alerts-list {
  max-height: 80px;
  overflow-y: auto;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 10px;
  border-bottom: 1px solid var(--border);
}

.alert-symbol {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 9px;
}

.alert-condition {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
}

.alert-price {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

.alert-remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  padding: 0 2px;
}

.alert-remove:hover { color: var(--red); }

/* Price alert items (from alerts.js module) */
.pa-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 10px;
  padding: 4px 10px;
}

.pa-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 10px;
  border-bottom: 1px solid var(--border);
}

.pa-symbol {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 9px;
  min-width: 40px;
}

.pa-dir {
  font-size: 10px;
  color: var(--text-muted);
}

.pa-above .pa-price { color: var(--green); }
.pa-below .pa-price { color: var(--red); }

.pa-price {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

.pa-remove-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
}

.pa-remove-btn:hover { color: var(--red); }

.pa-icon {
  font-size: 10px;
  flex-shrink: 0;
}

.pa-triggered {
  opacity: 0.5;
}
.pa-triggered .pa-symbol,
.pa-triggered .pa-price {
  color: var(--text-muted);
}

/* ORDER BOOK SECTION */
.orderbook-section {
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ob-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 10px;
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.ob-container {
  overflow-y: auto;
  min-height: 0;
  max-height: 360px;
}

.ob-row {
  display: flex;
  align-items: center;
  padding: 1px 10px;
  font-size: 10px;
  font-family: var(--font-mono);
  position: relative;
  height: 16px;
}

.ob-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  opacity: 0.15;
  pointer-events: none;
}

.ob-ask .ob-bar { background: var(--red); }
.ob-bid .ob-bar { background: var(--green); }

.ob-price {
  flex: 1;
  z-index: 1;
}

.ob-qty {
  width: 80px;
  text-align: right;
  z-index: 1;
  color: var(--text-secondary);
  font-size: 9px;
}

.ob-ask .ob-price { color: var(--red); }
.ob-bid .ob-price { color: var(--green); }

.ob-spread {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2px 10px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* RECENT TRADES */
.rt-container {
  max-height: 120px;
  overflow-y: auto;
}

.rt-row {
  display: flex;
  align-items: center;
  padding: 1px 10px;
  font-size: 9px;
  font-family: var(--font-mono);
}

.rt-time {
  width: 50px;
  color: var(--text-muted);
}

.rt-price {
  flex: 1;
  font-weight: 600;
}

.rt-buy .rt-price { color: var(--green); }
.rt-sell .rt-price { color: var(--red); }

.rt-qty {
  width: 70px;
  text-align: right;
  color: var(--text-secondary);
}

/* SL/TP Section */
.sl-tp-section {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.input-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.sl-label {
  background: var(--red-bg, rgba(234,57,67,0.15));
  color: var(--red, #ea3943);
  border: 1px solid var(--red, #ea3943);
}
.tp-label {
  background: var(--green-bg, rgba(22,199,132,0.15));
  color: var(--green, #16c784);
  border: 1px solid var(--green, #16c784);
}

.input-row {
  display: flex;
  gap: 3px;
  margin-bottom: 4px;
}

.input-row:last-child { margin-bottom: 0; }

.price-input {
  flex: 1;
  padding: 5px 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  outline: none;
}

.price-input:focus { border-color: var(--accent); }

.btn-sl, .btn-tp {
  padding: 5px 10px;
  border: none;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.1s;
  font-family: var(--font);
}

.btn-sl { background: var(--red); color: white; }
.btn-tp { background: var(--green); color: white; }
.btn-sl:hover, .btn-tp:hover { opacity: 0.85; }

/* SL/TP chart-click actions */
.sl-tp-actions {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}

.btn-click-set {
  flex: 1;
  padding: 5px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.1s;
}

.btn-click-set:hover {
  background: var(--bg-input);
  border-color: var(--accent);
}

.btn-click-clear {
  padding: 5px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.1s;
}

.btn-click-clear:hover {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
}

/* GSL toggle row */
.gsl-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding-top: 4px;
}

.gsl-toggle {
  position: relative;
  width: 28px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.gsl-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.gsl-toggle .gs-toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-input);
  border-radius: 7px;
  transition: 0.2s;
}

.gsl-toggle .gs-toggle-slider:before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.2s;
}

.gsl-toggle input:checked + .gs-toggle-slider {
  background: var(--yellow);
}

.gsl-toggle input:checked + .gs-toggle-slider:before {
  transform: translateX(14px);
  background: white;
}

.gsl-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
}

.gsl-hint {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  font-size: 9px;
  color: var(--text-muted);
  cursor: help;
  flex-shrink: 0;
}

/* CALCULATOR */
.calculator {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.calc-title {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1px 0;
  font-size: 11px;
}

.calc-row span:first-child { color: var(--text-secondary); font-size: 10px; }

.calc-value {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
}

.risk-color { color: var(--red); }

.calc-input {
  width: 90px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  text-align: right;
  outline: none;
  transition: border-color 0.15s;
}

.calc-input:focus {
  border-color: var(--accent);
}

.calc-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.calc-volume {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.volume-color {
  color: var(--green);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* INFO SECTION */
.info-section {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1px 0;
  font-size: 11px;
}

.info-row span:first-child { color: var(--text-secondary); font-size: 10px; }

.info-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
}

/* TRADE BUTTONS */
.trade-buttons {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.btn-long, .btn-short {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s;
  font-family: var(--font);
  letter-spacing: 0.5px;
}

.btn-long { background: var(--green); color: white; }
.btn-short { background: var(--red); color: white; }
.btn-long:hover { filter: brightness(1.1); }
.btn-short:hover { filter: brightness(1.1); }

/* ACTION BUTTONS */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
}

.btn-action {
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s;
  font-family: var(--font);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.btn-action:hover { background: var(--bg-input); color: var(--text-primary); }
.btn-action.btn-danger { border-color: var(--red); color: var(--red); }
.btn-action.btn-danger:hover { background: var(--red-bg); }
.btn-action.btn-breakeven { border-color: var(--accent); color: var(--accent); }
.btn-action.btn-breakeven:hover { background: rgba(46, 134, 222, 0.15); }
.btn-action.btn-lock-lines { border-color: #ff6b35; color: #ff6b35; font-size: 11px; }
.btn-action.btn-lock-lines:hover { background: rgba(255,107,53,0.15); }
.btn-action.btn-lock-lines.active { background: rgba(255,107,53,0.1); }

/* WATCHLIST */
.watchlist {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.watchlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 10px;
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.watchlist-table-header {
  display: flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.wth-symbol { flex: 1; }
.wth-price { width: 70px; text-align: right; }
.wth-change { width: 55px; text-align: right; }

.watchlist-body {
  flex: 1;
  overflow-y: auto;
}

.wl-section-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 10px;
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-tertiary);
  font-weight: 600;
}

.wl-section-label {
  cursor: default;
  flex: 1;
}

.wl-section-actions {
  display: none;
  gap: 4px;
}
.wl-section-name:hover .wl-section-actions {
  display: flex;
}

.wl-sec-btn {
  cursor: pointer;
  font-size: 11px;
  opacity: 0.5;
  padding: 0 2px;
}
.wl-sec-btn:hover { opacity: 1; }
.wl-sec-delete:hover { color: var(--red); }

.wl-section-rename-input {
  background: var(--bg-primary);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.wl-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 10px;
  opacity: 0;
  padding: 0 1px;
  flex-shrink: 0;
  user-select: none;
}
.wl-item:hover .wl-drag-handle { opacity: 0.5; }
.wl-drag-handle:hover { opacity: 1 !important; }

.wl-item.wl-dragging {
  opacity: 0.3;
}

.wl-item.wl-drop-above {
  border-top: 2px solid var(--accent);
}
.wl-item.wl-drop-below {
  border-bottom: 2px solid var(--accent);
}

.wl-section-name.wl-drop-target {
  background: var(--accent);
  color: #fff;
}

.wl-add-section-btn {
  padding: 6px 10px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  border-top: 1px solid var(--border);
}
.wl-add-section-btn:hover {
  color: var(--accent);
  background: var(--bg-tertiary);
}

.wl-item {
  display: flex;
  align-items: center;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.08s;
  font-size: 11px;
  gap: 5px;
}

.wl-item:hover { background: var(--bg-tertiary); }
.wl-item.active { background: var(--bg-input); border-left: 2px solid var(--accent); padding-left: 8px; }

.wl-icon {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.wl-icon.up { background: var(--green); }
.wl-icon.down { background: var(--red); }
.wl-icon.flat { background: var(--text-muted); }

.wl-symbol {
  flex: 1;
  font-weight: 600;
  font-size: 10px;
  font-family: var(--font-mono);
}

.wl-price {
  font-family: var(--font-mono);
  font-size: 10px;
  width: 70px;
  text-align: right;
}

.wl-change {
  font-family: var(--font-mono);
  font-size: 10px;
  width: 55px;
  text-align: right;
  font-weight: 600;
}

.wl-change.up { color: var(--green); }
.wl-change.down { color: var(--red); }
.wl-change.flat { color: var(--text-muted); }

.wl-remove {
  display: none;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}
.wl-remove:hover { color: var(--red); }
.wl-item:hover .wl-remove { display: block; }

/* ===== LIGHT MODE ===== */
body.chart-light .right-panel {
  background: #ffffff;
  border-left-color: #d5d8de;
}

body.chart-light .panel-tab.active {
  background: #f0f1f4;
  color: #1a1d26;
}

body.chart-light .order-side.active {
  color: white;
}

body.chart-light input[type="number"],
body.chart-light input[type="text"],
body.chart-light select {
  background: #f0f1f4;
  border-color: #d5d8de;
  color: #1a1d26;
}
