:root {
  --bg: #0f1623;
  --panel: #1a2433;
  --panel-soft: #202c3d;
  --text: #e6eefc;
  --muted: #9fb0cc;
  --primary: #00e5ff;
  --primary-gradient: linear-gradient(90deg, #00e5ff, #0077ff);
  --success: #22c55e;
  --danger: #ef4444;
  --border: #2b3a52;
  --warning: #f59e0b;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  min-height: 30px;
}

label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

select {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 8px;
  outline: none;
  min-width: 85px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

select:focus {
  border-color: var(--primary);
}

.stepper {
  display: flex;
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.stepper:hover {
  border-color: rgba(0, 229, 255, 0.3);
}

.stepper button {
  background: transparent;
  border: none;
  color: var(--text);
  width: 28px;
  height: 28px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.stepper button:hover {
  background-color: rgba(0, 229, 255, 0.1);
}

.stepper span {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Editable stepper cells */
.stepper-input {
  outline: none;
  cursor: text;
  border-radius: 4px;
  min-width: 0;
  transition: background 0.15s, box-shadow 0.15s;
  caret-color: var(--primary);
}

.stepper-input:focus {
  background: rgba(0, 229, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.35);
  white-space: nowrap;
  overflow: visible;
}

.info-box {
  background: var(--panel-soft);
  border-radius: 10px;
  padding: 10px;
  margin: 10px 0;
  border-left: 3px solid var(--primary);
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
}

.info-row:last-child {
  margin-bottom: 0;
}

.toggle {
  width: 44px;
  height: 24px;
  background: #334155;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.3s;
}

.toggle-dot {
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle.active {
  background: var(--primary-gradient);
}

.toggle.active .toggle-dot {
  transform: translateX(20px);
}

.settings-section {
  background: rgba(0, 229, 255, 0.05);
  border-radius: 10px;
  padding: 8px;
  margin: 6px 0;
  border: 1px solid rgba(0, 229, 255, 0.1);
  display: none;
}

.settings-section.active {
  display: block;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profit {
  color: var(--success);
  font-weight: 700;
}

.loss {
  color: var(--danger);
  font-weight: 700;
}

.warning {
  color: var(--warning);
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
}

.btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--primary-gradient);
  border: none;
  color: var(--bg);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 229, 255, 0.3);
}

.status-bar {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.status-message {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.price-indicator {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
}

.price-up {
  background-color: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.price-down {
  background-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.price-warn {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.7) !important;
  color: var(--danger) !important;
  animation: warnPulse 0.4s ease 2;
}

@keyframes warnPulse {
  0%   { opacity: 1; }
  50%  { opacity: 0.4; }
  100% { opacity: 1; }
}

/* Trade Panel Container Styles */
.trade-panel-container {
  display: none;
  position: fixed;
  top: calc(15% + 30px);
  right: 0;
  z-index: 1000;
  width: 320px;
  max-width: 100vw;
  max-height: calc(100vh - 15% - 20px); /* leave ~100px gap at bottom */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--panel-soft);
  box-sizing: border-box;
}

.trade-panel-container::-webkit-scrollbar {
  width: 6px;
}

.trade-panel-container::-webkit-scrollbar-track {
  background: var(--panel-soft);
  border-radius: 3px;
}

.trade-panel-container::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

/* Trade panel inner card */
.trade-panel {
  width: 100%;                     /* fill the container exactly */
  box-sizing: border-box;          /* padding included in width */
  background: var(--panel);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  border: 1px solid rgba(0, 229, 255, 0.1);
  overflow: hidden;
}

/* Optional: Add animation for panel appearance */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.trade-panel-container.show {
  display: block;
  animation: slideUp 0.25s ease-out;
}

/* Prevent body scrolling when panel is open */
body.panel-open {
  overflow: hidden;
}

/* BUY / SELL colour theming on the panel border */
#tradePanel.panel-buy {
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 0 18px rgba(34,197,94,0.15);
}
#tradePanel.panel-sell {
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 0 18px rgba(239,68,68,0.15);
}