/* ============================================================================
   BOT LIVE TRADING INTERFACE - Marketplace-Inspired Design
   Advanced TradingView integration with darker charcoal theme and Montserrat
   ============================================================================ */

/* Import Montserrat for premium typography */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900&display=swap');

.live-trading-interface {
  height: 100%;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: visible;
  box-sizing: border-box;
}

/* ============================================================================
   TRADING CONTROLS HEADER
   ============================================================================ */

.trading-controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.symbol-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.trading-symbol {
  font-size: 2rem;
  font-weight: 900;
  font-family: 'Montserrat', sans-serif;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.02em;
}

.exchange-badge {
  background: linear-gradient(135deg, #00D4AA, #11e0ff);
  color: #000000;
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 800;
  font-family: 'Montserrat', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.bot-status-indicator {
  padding: 0.35rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.bot-status-indicator.running {
  background: rgba(16, 185, 129, 0.15);
  color: var(--buy);
  border: 1px solid var(--buy);
}

.bot-status-indicator.stopped {
  background: rgba(239, 68, 68, 0.15);
  color: var(--sell);
  border: 1px solid var(--sell);
}

.bot-status-indicator.paused {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid #fbbf24;
}

.trading-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(30, 30, 35, 0.8); /* Professional dark button */
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn.danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--sell);
  color: var(--sell);
}

.action-btn.danger:hover {
  background: var(--sell);
  color: white;
}

.action-btn.secondary:hover {
  background: rgba(17, 224, 255, 0.1);
  border-color: var(--accent-1);
  color: var(--accent-1);
}

/* ============================================================================
   MAIN TRADING LAYOUT
   ============================================================================ */

.trading-layout {
  flex: 1;
  display: flex; /* Use flexbox for better control */
  flex-direction: row;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 500px;
  max-height: 700px;
  overflow: hidden;
  box-sizing: border-box;
}

/* ============================================================================
   CHART SECTION
   ============================================================================ */

.chart-section {
  flex: 1; /* FLEXIBLE - takes remaining space */
  flex-shrink: 1; /* CAN shrink */
  min-width: 250px; /* But not smaller than this */
  background: #050506;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

.chart-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.05);
  display: none; /* Remove unnecessary header elements above TradingView */
}

.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#timeframeSelect {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-weight: 600;
}

.chart-tools {
  display: flex;
  gap: 0.5rem;
}

.tool-btn {
  min-width: 100px;
  height: 36px;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.tool-btn:hover {
  background: rgba(17, 224, 255, 0.1);
  border-color: var(--accent-1);
}

.tool-btn.active {
  background: var(--accent-1);
  color: white;
  border-color: var(--accent-1);
}

/* TradingView Chart - Fill available space */
.tradingview-chart-container {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 350px;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

/* Make TradingView widget fill container completely */
.tradingview-chart-container div {
  width: 100% !important;
  height: 100% !important;
}

/* Ensure chart-container from tradingview-clean.html has proper overflow */
.chart-container {
  overflow: visible !important;
}

/* Ensure TradingView widget container allows sidebar */
div[id^="tradingview_widget_"] {
  overflow: visible !important;
  pointer-events: auto !important;
  position: relative !important;
  z-index: 10 !important;
}

/* Fix TradingView iframe interactions in modal context */
div[id^="tradingview_widget_"] iframe {
  pointer-events: auto !important;
  position: relative !important;
  z-index: 10 !important;
  border: none !important;
}

/* Ensure modal doesn't interfere with TradingView drawing tools */
.live-trading-interface {
  position: relative;
  z-index: 1;
}

.live-trading-interface .chart-section {
  position: relative;
  z-index: 2;
}

.live-trading-interface .chart-container {
  position: relative;
  z-index: 3;
}

/* AGGRESSIVE FIXES for TradingView drawing tools in modal */
.modal-content .live-trading-interface,
.modal-content .chart-section,
.modal-content .chart-container,
.modal-content div[id^="tradingview_widget_"],
.modal-content div[id^="tradingview_widget_"] iframe {
  pointer-events: auto !important;
  touch-action: auto !important;
  user-select: auto !important;
}

/* Ensure modal overlay doesn't block iframe interactions */
.modal-overlay {
  pointer-events: auto !important;
}

.modal-content {
  pointer-events: auto !important;
  position: relative !important;
}

/* Prevent any interference from bot management modals */
.bot-modal .modal-content,
.bot-modal .modal-body,
.bot-modal .live-trading-interface {
  overflow: visible !important;
  pointer-events: auto !important;
}

/* Fallback Chart - Hidden to prevent empty boxes */
.fallback-chart-container {
  display: none; /* Hide fallback chart completely */
}

.custom-chart-placeholder {
  display: none; /* Hide placeholder to prevent empty space */
}

.chart-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.custom-chart-placeholder h3 {
  color: var(--text);
  margin-bottom: 0.5rem;
}

.custom-chart-placeholder p {
  color: var(--muted);
  margin-bottom: 1rem;
}

.loading-bars {
  display: flex;
  gap: 0.25rem;
}

.loading-bars .bar {
  width: 8px;
  height: 20px;
  background: var(--accent-1);
  border-radius: 4px;
  animation: loadingPulse 1.2s infinite;
}

.loading-bars .bar:nth-child(2) {
  animation-delay: 0.1s;
}

.loading-bars .bar:nth-child(3) {
  animation-delay: 0.2s;
}

/* Custom Candlestick Chart */
.candlestick-grid {
  position: relative;
  background: var(--bg-canvas);
  border-radius: 0.5rem;
}

.candlestick {
  position: absolute;
  width: 8px;
  cursor: pointer;
}

.candlestick.green .body {
  background: var(--buy);
}

.candlestick.red .body {
  background: var(--sell);
}

.candlestick .wick {
  width: 2px;
  height: 20px;
  background: var(--muted);
  margin: 0 auto;
}

.candlestick .body {
  width: 8px;
  height: 15px;
  margin-top: 2px;
  border-radius: 2px;
}

.chart-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

/* ============================================================================
   ACTIVITY FEED - COMPACT
   ============================================================================ */

.activity-feed-section.compact {
  background: var(--bg-surface);
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 1rem;
  overflow: hidden;
}

.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.activity-header:hover {
  background: rgba(0, 0, 0, 0.2);
}

.activity-header h4 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.activity-count {
  color: var(--muted);
  font-size: 0.75rem;
}

.activity-toggle {
  color: var(--muted);
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.activity-feed-section.expanded .activity-toggle {
  transform: rotate(180deg);
}

.activity-feed.collapsed {
  height: 0;
  overflow: hidden;
  transition: height 0.3s ease;
}

.activity-feed-section.expanded .activity-feed.collapsed {
  height: 150px;
  overflow-y: auto;
}

.activity-placeholder {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  font-style: italic;
}

/* ============================================================================
   TRADING PANEL WITH TABS
   ============================================================================ */

.trading-panel {
  /* Fills parent container - parent controls the width */
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  background: #0d0d10;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden; /* NO SCROLLBAR */
  box-sizing: border-box;
}

/* Trading Panel Tab Navigation - Binance Dark Style */
.trading-panel-tabs {
  display: flex;
  border-bottom: 1px solid #2B3139;
  background: #181A20;
  padding: 4px;
  border-radius: 8px 8px 0 0;
  gap: 2px;
}

.trading-panel-tab {
  flex: 1;
  padding: 14px 20px;
  background: #2B3139;
  border: none;
  color: #848E9C;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  margin: 2px;
}
  transition: all 0.2s ease;
  border-radius: 4px;
  text-align: center;
}

.trading-panel-tab:hover {
  background: #2B3139;
  color: #EAECEF;
}

.trading-panel-tab.active {
  background: #F0F3F7 !important;
  color: #1E2329 !important;
  font-weight: 600;
}

/* Tab Content Container */
.trading-panel-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #2B3139 transparent;
  background: #0d0d10;
  min-height: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.trading-tab-pane {
  display: none;
}

.trading-tab-pane.active {
  display: block;
}

.trading-panel::-webkit-scrollbar {
  width: 4px;
}

.trading-panel::-webkit-scrollbar-track {
  background: transparent;
}

.trading-panel::-webkit-scrollbar-thumb {
  background: rgba(17, 224, 255, 0.2);
  border-radius: 2px;
}

.trading-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(17, 224, 255, 0.4);
}

.position-section,
.orders-section,
.quick-actions-section,
.live-stats-section {
  background: var(--bg-surface);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem;
}

.trading-panel h4 {
  color: var(--text);
  font-weight: 700;
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Position Section */
.position-card {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.position-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.position-side {
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.position-side.long {
  background: rgba(16, 185, 129, 0.15);
  color: var(--buy);
}

.position-side.short {
  background: rgba(239, 68, 68, 0.15);
  color: var(--sell);
}

.position-size {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.position-prices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.price-value {
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

.price-value.pnl-positive {
  color: var(--buy);
}

.price-value.pnl-negative {
  color: var(--sell);
}

/* Orders Section */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.order-item {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.order-type {
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
}

.order-status {
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.order-status.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--buy);
}

.order-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-price {
  color: var(--accent-1);
  font-weight: 700;
}

.cancel-order-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--sell);
  color: var(--sell);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cancel-order-btn:hover {
  background: var(--sell);
  color: white;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-canvas);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quick-action-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.quick-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Button Color Classes */
.quick-action-btn.red-btn {
  background: #dc2626;
  color: white;
  border-color: #b91c1c;
}

.quick-action-btn.red-btn:hover:not(:disabled) {
  background: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.quick-action-btn.blue-btn {
  background: #2563eb;
  color: white;
  border-color: #1d4ed8;
}

.quick-action-btn.blue-btn:hover:not(:disabled) {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.quick-action-btn.grey-btn {
  background: #6b7280;
  color: white;
  border-color: #4b5563;
}

.quick-action-btn.grey-btn:hover:not(:disabled) {
  background: #4b5563;
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.quick-action-btn.green-btn {
  background: #16a34a;
  color: white;
  border-color: #15803d;
}

.quick-action-btn.green-btn:hover:not(:disabled) {
  background: #15803d;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

/* Color classes for action-btn and tool-btn */
.action-btn.red-btn, .tool-btn.red-btn {
  background: #dc2626;
  color: white;
  border-color: #b91c1c;
}

.action-btn.red-btn:hover, .tool-btn.red-btn:hover {
  background: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.action-btn.blue-btn, .tool-btn.blue-btn {
  background: #2563eb;
  color: white;
  border-color: #1d4ed8;
}

.action-btn.blue-btn:hover, .tool-btn.blue-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.action-btn.grey-btn, .tool-btn.grey-btn {
  background: #6b7280;
  color: white;
  border-color: #4b5563;
}

.action-btn.grey-btn:hover, .tool-btn.grey-btn:hover {
  background: #4b5563;
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.action-btn.green-btn, .tool-btn.green-btn {
  background: #16a34a;
  color: white;
  border-color: #15803d;
}

.action-btn.green-btn:hover, .tool-btn.green-btn:hover {
  background: #15803d;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

/* Live Stats */
.live-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-value {
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

.stat-value.positive {
  color: var(--buy);
}

.stat-value.negative {
  color: var(--sell);
}

/* ============================================================================
   ACTIVITY FEED
   ============================================================================ */

.activity-feed-section {
  background: var(--bg-surface);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem;
}

.activity-feed-section h4 {
  color: var(--text);
  font-weight: 700;
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.activity-feed {
  max-height: 150px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 224, 255, 0.3) rgba(255, 255, 255, 0.1);
}

.activity-event {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  animation: fadeInLeft 0.3s ease-out;
}

.activity-event:last-child {
  border-bottom: none;
}

.event-time {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
  min-width: 60px;
}

.event-text {
  color: var(--text);
  font-size: 0.85rem;
  flex: 1;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes loadingPulse {
  0%, 100% {
    opacity: 0.4;
    transform: scaleY(0.8);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 1024px) {
  .trading-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  
  .trading-panel {
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 768px) {
  .trading-controls-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .symbol-info {
    flex-wrap: wrap;
  }
  
  .trading-actions {
    align-self: stretch;
  }
  
  .action-btn {
    flex: 1;
    justify-content: center;
  }
  
  .chart-controls {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .chart-tools {
    justify-content: center;
  }
  
  .quick-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .trading-symbol {
    font-size: 1.25rem;
  }
  
  .tradingview-chart-container,
  .custom-chart-placeholder {
    min-height: 350px;
  }
  
  .trading-panel {
    gap: 0.75rem;
  }
  
  .position-section,
  .orders-section,
  .quick-actions-section,
  .live-stats-section {
    padding: 0.75rem;
  }
}

/* ============================================================================
   DARK MODE ENHANCEMENTS
   ============================================================================ */

.theme-dark .chart-section {
  background: rgba(15, 19, 23, 0.95);
}

.theme-dark .chart-header {
  background: rgba(0, 0, 0, 0.2);
}

.theme-dark .position-card,
.theme-dark .order-item {
  background: rgba(0, 0, 0, 0.2);
}

.theme-dark .candlestick-grid {
  background: rgba(15, 19, 23, 0.8);
}

/* ============================================================================
   NO DATA STATES (API ENDPOINTS NOT READY)
   ============================================================================ */

/* No Position/Orders/Activity States */
.no-position-card,
.no-orders-message,
.no-activity-message {
  text-align: center;
  padding: 24px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.no-position-message {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.start-trading-btn {
  padding: 12px 24px;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  border: none;
  border-radius: 8px;
  color: var(--bg-canvas);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.start-trading-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(17, 224, 255, 0.3);
}

.orders-placeholder,
.activity-placeholder {
  margin-top: 12px;
}

.placeholder-text {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  margin: 0;
}

.no-orders-message,
.no-activity-message {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

/* ============================================================================
   EXCHANGE-STYLE TRADING INTERFACE
   ============================================================================ */

.exchange-style-container {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.exchange-trading-controls {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  background: transparent;
}

/* Order Type Tabs */
.order-type-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 2px;
  margin-bottom: 16px;
  border: 1px solid #2B3139;
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: #2B3139 !important;
  border: none !important;
  color: #848E9C !important;
  font-size: 14px;
  font-weight: 500;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
  margin: 2px;
  border-bottom: none !important;
}

.tab-btn.active {
  background: #F0F3F7 !important;
  color: #1E2329 !important;
  font-weight: 600;
  border: none;
}

.tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

/* Trade Action Buttons - Binance Style */
.trade-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
  width: 100%;
}

.trade-btn {
  padding: 16px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  font-size: 18px;
}

/* Trading Button Colors - Hard Green/Red, Square Edges */
.trade-btn.buy-btn {
  background: #00C853;
  border: none;
  border-radius: 4px;
  color: white;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.trade-btn.buy-btn:hover {
  background: #00E676;
  transform: none;
  box-shadow: 0 0 12px rgba(0, 200, 83, 0.4);
}

.trade-btn.sell-btn {
  background: #D32F2F;
  border: none;
  border-radius: 4px;
  color: white;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.trade-btn.sell-btn:hover {
  background: #F44336;
  transform: none;
  box-shadow: 0 0 12px rgba(211, 47, 47, 0.4);
}

/* Amount Section */
.amount-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-label {
  color: #EAECEF;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.amount-input-group,
.price-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.amount-input,
.price-input {
  flex: 1;
  padding: 12px 16px;
  padding-right: 60px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #2B3139;
  border-radius: 4px;
  color: #EAECEF;
  font-size: 16px;
  font-weight: 400;
  transition: all 0.2s ease;
}

.amount-input:focus,
.price-input:focus {
  outline: none;
  border-color: #FCD535;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(252, 213, 53, 0.2);
}

.currency-label {
  position: absolute;
  right: 16px;
  color: #848E9C;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

/* Percentage Buttons */
.percentage-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.pct-btn {
  padding: 10px 16px;
  background: #2B3139 !important;
  border: 1px solid #43484D !important;
  border-radius: 4px;
  color: #848E9C !important;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pct-btn:hover {
  background: #43484D;
  border-color: #5E6369;
  color: #EAECEF;
}

.pct-btn.active {
  background: #F0F3F7 !important;
  border-color: #F0F3F7 !important;
  color: #1E2329 !important;
  font-weight: 600;
}

/* Leverage Section */
.leverage-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leverage-display {
  color: var(--accent-1);
  font-weight: 600;
}

.leverage-slider-container {
  position: relative;
}

.leverage-slider {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.leverage-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent-1);
  border-radius: 50%;
  cursor: pointer;
}

.leverage-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent-1);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.leverage-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

/* TP/SL Section */
.tp-sl-section {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 20px;
}

.tp-sl-header h4 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.tp-sl-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tp-input-group,
.sl-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-input-group label,
.sl-input-group label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.tp-input-container,
.sl-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.tp-input-container input,
.sl-input-container input {
  flex: 1;
  padding: 10px 12px;
  padding-right: 50px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

.tp-input-container input:focus,
.sl-input-container input:focus {
  outline: none;
  border-color: var(--accent-1);
}

.adjust-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 10px;
  background: var(--accent-1);
  color: var(--bg-canvas);
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.adjust-btn:hover {
  background: var(--accent-2);
}

/* Bot Allocation Section */
.bot-allocation-section {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.allocation-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.allocation-details {
  margin-bottom: 12px;
}

.allocation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.allocation-row span:first-child {
  color: var(--muted);
}

.allocation-value {
  color: var(--text);
  font-weight: 600;
}

.increase-allocation-btn {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.increase-allocation-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-1);
}

/* Pair Selector */
.pair-selector-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pair-selector-dropdown {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pair-selector-dropdown:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-1);
}

.selected-pair {
  color: var(--text);
  font-weight: 600;
}

.dropdown-arrow {
  color: var(--muted);
  font-size: 12px;
}

/* Modal Styles */
.order-preview-modal,
.allocation-modal,
.pair-selector-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: var(--bg-surface);
  border-radius: 12px;
  min-width: 320px;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.close-btn,
.modal-header button {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
}

.order-preview-details {
  margin-bottom: 20px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.preview-row span:first-child {
  color: var(--muted);
  font-size: 14px;
}

.preview-row span:last-child {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.preview-row .long {
  color: var(--buy);
}

.preview-row .short {
  color: var(--sell);
}

.modal-actions {
  display: flex;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.cancel-btn,
.confirm-btn {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cancel-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.confirm-btn {
  border: none;
  color: white;
}

.confirm-btn.long {
  background: var(--buy);
}

.confirm-btn.short {
  background: var(--sell);
}

.confirm-btn:not(.long):not(.short) {
  background: var(--accent-1);
  color: var(--bg-canvas);
}

.confirm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Pair Selector Specific */
.pair-search {
  padding: 0 0 16px 0;
}

.pair-search input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

.pairs-list {
  max-height: 300px;
  overflow-y: auto;
}

.pair-item {
  padding: 12px 20px;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.pair-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Responsive Design for Exchange Interface */
@media (max-width: 768px) {
  .exchange-trading-controls {
    gap: 16px;
  }
  
  .trade-action-buttons {
    grid-template-columns: 1fr;
  }
  
  .tp-sl-inputs {
    grid-template-columns: 1fr;
  }
  
  .percentage-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================================
   POSITION MANAGEMENT SECTION
   ============================================================================ */

.position-management-section {
  margin-top: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.position-header h4 {
  margin: 0 0 16px 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.position-actions {
  display: grid;
  gap: 8px;
}

.position-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
}

.position-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.position-action-btn .action-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.position-action-btn.add-position-btn:hover {
  border-color: var(--buy);
  background: rgba(185, 255, 102, 0.08);
}

.position-action-btn.flip-position-btn:hover {
  border-color: var(--accent-1);
  background: rgba(17, 224, 255, 0.08);
}

.position-action-btn.close-position-btn:hover {
  border-color: var(--sell);
  background: rgba(255, 92, 122, 0.08);
}

/* ============================================================================
   POSITION ACTION MODALS
   ============================================================================ */

.position-action-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.position-action-modal .modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.position-action-modal .modal-content {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 0;
  max-width: 420px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.position-action-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.position-action-modal .modal-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
}

.position-action-modal .close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.position-action-modal .close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.position-action-modal .modal-body {
  padding: 16px 24px;
  color: var(--text);
}

.position-action-modal .warning-box {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin: 16px 0;
}

.position-action-modal .warning-box p {
  margin: 4px 0;
  color: #fbbf24;
  font-size: 14px;
}

.position-action-modal .modal-input-group {
  margin: 16px 0;
}

.position-action-modal .modal-input-group label {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.position-action-modal .modal-input-group input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}

.position-action-modal .modal-input-group input:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(17, 224, 255, 0.1);
}

.position-action-modal .flip-visualization {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  margin: 16px 0;
}

.position-action-modal .current-side,
.position-action-modal .new-side {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
}

.position-action-modal .current-side {
  background: rgba(185, 255, 102, 0.2);
  color: var(--buy);
}

.position-action-modal .new-side {
  background: rgba(255, 92, 122, 0.2);
  color: var(--sell);
}

.position-action-modal .flip-arrow {
  color: var(--muted);
  font-size: 18px;
  font-weight: bold;
}

.position-action-modal .close-options {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.position-action-modal .option-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.position-action-modal .option-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.position-action-modal .option-btn .option-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.position-action-modal .option-btn .option-text {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.position-action-modal .option-btn .option-desc {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.position-action-modal .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.position-action-modal .btn-secondary,
.position-action-modal .btn-primary,
.position-action-modal .btn-danger {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid;
}

.position-action-modal .btn-secondary {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--muted);
}

.position-action-modal .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.position-action-modal .btn-primary {
  background: var(--accent-1);
  border-color: var(--accent-1);
  color: white;
}

.position-action-modal .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(17, 224, 255, 0.3);
}

.position-action-modal .btn-danger {
  background: var(--sell);
  border-color: var(--sell);
  color: white;
}

.position-action-modal .btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 92, 122, 0.3);
}

/* ============================================================================
   NOTIFICATIONS
   ============================================================================ */

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px 20px;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transform: translateX(120%);
  transition: transform 0.3s ease;
}

.notification.show {
  transform: translateX(0);
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notification-icon {
  font-size: 20px;
}

.notification-message {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.notification-success {
  border-color: var(--buy);
  background: rgba(185, 255, 102, 0.1);
}

.notification-error {
  border-color: var(--sell);
  background: rgba(255, 92, 122, 0.1);
}

.notification-info {
  border-color: var(--accent-1);
  background: rgba(17, 224, 255, 0.1);
}

/* ============================================================================
   COMPACT TWO-COLUMN LAYOUT
   ============================================================================ */

.exchange-trading-controls.compact-layout {
  display: flex;
  flex-direction: column; /* Changed to vertical stacking instead of side-by-side */
  gap: 16px;
  padding: 20px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.primary-controls-column,
.secondary-controls-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ============================================================================
   COMPACT ORDER TYPE & TRADE BUTTONS
   ============================================================================ */

.order-trade-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-type-tabs.compact {
  display: flex;
  gap: 6px;
}

.order-type-tabs.compact .tab-btn {
  flex: 1;
  padding: 8px 16px;
  font-size: 12px;
  border-radius: 4px;
  background: #2B3139;
  border: 1px solid #2B3139;
  color: #848E9C;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  min-height: 32px;
}

.order-type-tabs.compact .tab-btn.active {
  background: #FCD535;
  color: #1E2329;
  border-color: #FCD535;
  font-weight: 600;
}

.order-type-tabs.compact .tab-btn:hover:not(.active) {
  background: #373D47;
  color: #EAECEF;
}

.trade-action-buttons.compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.trade-action-buttons.compact .trade-btn {
  padding: 14px 12px;
  font-size: 13px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border: 2px solid;
  transition: all 0.2s ease;
}

/* Compact Buy Button - Professional Style */
.trade-action-buttons.compact .trade-btn.buy-btn {
  background: linear-gradient(135deg, #0ecb81 0%, #00d68f 100%);
  border: none;
  color: white;
  font-weight: 700;
}

.trade-action-buttons.compact .trade-btn.buy-btn:hover {
  background: linear-gradient(135deg, #00d68f 0%, #0ecb81 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 203, 129, 0.4);
}

/* Compact Sell Button - Professional Style */
.trade-action-buttons.compact .trade-btn.sell-btn {
  background: linear-gradient(135deg, #f6465d 0%, #ee4758 100%);
  border: none;
  color: white;
  font-weight: 700;
}

.trade-action-buttons.compact .trade-btn.sell-btn:hover {
  background: linear-gradient(135deg, #ee4758 0%, #f6465d 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(246, 70, 93, 0.4);
}

/* ============================================================================
   COMPACT AMOUNT & LEVERAGE
   ============================================================================ */

.amount-leverage-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.amount-controls,
.leverage-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.amount-input-group.compact {
  display: flex;
  align-items: center;
  gap: 8px;
}

.amount-input-group.compact .amount-input {
  flex: 1;
  padding: 8px;
  font-size: 12px;
  border-radius: 4px;
}

.amount-input-group.compact .currency-label {
  font-size: 10px;
  color: var(--muted);
}

.percentage-buttons.compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.percentage-buttons.compact .pct-btn {
  padding: 6px 8px;
  font-size: 11px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.percentage-buttons.compact .pct-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.leverage-slider.compact {
  width: 100%;
  height: 4px;
  margin: 4px 0;
}

/* ============================================================================
   COMPACT TP/SL
   ============================================================================ */

.tp-sl-section.compact {
  padding: 0;
}

.tp-sl-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tp-input-group,
.sl-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tp-input-group label,
.sl-input-group label {
  font-size: 10px;
  color: var(--muted);
  margin: 0;
}

.tp-input-group input,
.sl-input-group input {
  padding: 6px;
  font-size: 11px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* ============================================================================
   COMPACT PRICE INPUT
   ============================================================================ */

.price-section.compact {
  padding: 0;
}

.price-section.compact input {
  width: 100%;
  padding: 8px;
  font-size: 12px;
  border-radius: 4px;
}

/* ============================================================================
   COMPACT POSITION ACTIONS
   ============================================================================ */

.position-management-section.compact {
  padding: 12px;
  margin: 0;
}

.position-management-section.compact h4 {
  margin-bottom: 8px;
  font-size: 12px;
}

.position-actions.compact {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}

.position-action-btn.compact {
  padding: 8px 6px;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border-radius: 4px;
}

.position-action-btn.compact .action-icon {
  font-size: 12px;
}

.position-action-btn.compact .action-text {
  font-size: 9px;
}

/* ============================================================================
   COMPACT BOT STATUS
   ============================================================================ */

.bot-allocation-section.compact {
  padding: 12px;
  margin: 0;
}

.bot-allocation-section.compact h4 {
  margin-bottom: 8px;
  font-size: 12px;
}

.allocation-details.compact {
  margin-bottom: 8px;
}

.allocation-details.compact .allocation-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 2px;
}

.increase-allocation-btn.compact {
  width: 100%;
  padding: 6px;
  font-size: 10px;
  border-radius: 4px;
}

/* ============================================================================
   COMPACT PAIR SELECTOR
   ============================================================================ */

.pair-selector-section.compact {
  padding: 0;
}

.pair-selector-dropdown.compact {
  padding: 8px;
  font-size: 12px;
  border-radius: 4px;
}

/* ============================================================================
   COMPACT QUICK STATS
   ============================================================================ */

.quick-stats-section {
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.quick-stats-section h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: var(--text);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-label {
  font-size: 10px;
  color: var(--muted);
}

.stat-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.stat-value.positive {
  color: var(--buy);
}

.stat-value.negative {
  color: var(--sell);
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 768px) {
  .exchange-trading-controls.compact-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
  
  .position-actions.compact {
    grid-template-columns: 1fr 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   HEDGE MODE MODAL STYLES
   ============================================================================ */

.hedge-mode-modal .modal-content {
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.hedge-dialog .modal-body {
  padding: 24px;
}

.hedge-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.warning-icon {
  font-size: 24px;
  line-height: 1;
}

.warning-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

.current-position-info {
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.current-position-info h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--text);
}

.position-details-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.position-details-row span:first-child {
  color: var(--muted);
}

.position-details-row span:last-child {
  color: var(--text);
  font-weight: 600;
}

.pos-side.long {
  color: var(--buy);
}

.pos-side.short {
  color: var(--sell);
}

.hedge-options h4 {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: var(--text);
}

.hedge-option-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hedge-option-card:hover {
  border-color: var(--accent-1);
  background: rgba(17, 224, 255, 0.05);
}

.hedge-option-card.selected {
  border-color: var(--accent-1);
  background: rgba(17, 224, 255, 0.1);
}

.option-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.option-icon {
  font-size: 18px;
  line-height: 1;
}

.option-title {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.option-details {
  margin-left: 30px;
}

.option-details p {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--muted);
}

.hedge-calc {
  font-size: 12px;
  color: var(--accent-1);
  font-weight: 600;
}

.custom-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.custom-inputs input,
.custom-inputs select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text);
}

.custom-inputs input:focus,
.custom-inputs select:focus {
  border-color: var(--accent-1);
  outline: none;
}

/* ============================================================================
   HEDGE CONFIRMATION MODAL
   ============================================================================ */

.hedge-confirmation-modal .modal-content {
  max-width: 500px;
}

.confirmation-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(220, 38, 127, 0.1);
  border: 1px solid rgba(220, 38, 127, 0.3);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.confirmation-warning .warning-icon {
  font-size: 24px;
  color: #dc267f;
}

.confirmation-warning .warning-text {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}

.hedge-summary {
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}

.summary-row:last-child {
  margin-bottom: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.summary-row span:first-child {
  color: var(--muted);
}

.summary-row span:last-child {
  color: var(--text);
  font-weight: 600;
}

.risk-notice {
  background: rgba(17, 224, 255, 0.05);
  border: 1px solid rgba(17, 224, 255, 0.2);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.risk-notice p {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--text);
}

.risk-notice ul {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  color: var(--muted);
}

.risk-notice li {
  margin-bottom: 4px;
}

.confirmation-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.confirmation-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-1);
}

.confirmation-checkbox label {
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.hedge-execute-btn {
  background: var(--sell) !important;
  color: white !important;
}

.hedge-execute-btn:hover {
  background: rgba(255, 92, 122, 0.8) !important;
}

/* Position action button for hedge mode */
.position-action-btn.hedge-mode {
  background: rgba(123, 97, 255, 0.1);
  border-color: rgba(123, 97, 255, 0.3);
}

.position-action-btn.hedge-mode:hover {
  background: rgba(123, 97, 255, 0.2);
  border-color: var(--accent-2);
}

/* ============================================================================
   ADVANCED TP/SL CONTROLS
   ============================================================================ */

.tp-sl-section.compact.advanced {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.tp-sl-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.tp-sl-settings-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.tp-sl-settings-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-1);
}

.tp-input-group.advanced,
.sl-input-group.advanced {
  flex-direction: column;
  gap: 6px;
}

.input-with-validation {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-validation input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 8px 32px 8px 10px;
  font-size: 12px;
  color: var(--text);
  transition: all 0.2s ease;
}

.input-with-validation input:focus {
  border-color: var(--accent-1);
  outline: none;
}

.validation-indicator {
  position: absolute;
  right: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid;
  transition: all 0.2s ease;
}

.validation-indicator::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.validation-indicator.tp.valid,
.validation-indicator.sl.valid {
  border-color: var(--buy);
}

.validation-indicator.tp.valid::after,
.validation-indicator.sl.valid::after {
  background: var(--buy);
}

.validation-indicator.tp.warning,
.validation-indicator.sl.warning {
  border-color: #ffc107;
}

.validation-indicator.tp.warning::after,
.validation-indicator.sl.warning::after {
  background: #ffc107;
}

.validation-indicator.tp.high,
.validation-indicator.sl.high {
  border-color: #ff9800;
}

.validation-indicator.tp.high::after,
.validation-indicator.sl.high::after {
  background: #ff9800;
}

.validation-indicator.tp.invalid,
.validation-indicator.sl.invalid {
  border-color: var(--sell);
}

.validation-indicator.tp.invalid::after,
.validation-indicator.sl.invalid::after {
  background: var(--sell);
}

.tp-sl-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  margin-top: 4px;
}

.profit-percentage {
  color: var(--buy);
  font-weight: 600;
}

.profit-percentage.warning,
.loss-percentage.warning {
  color: #ffc107;
}

.profit-percentage.high,
.loss-percentage.high {
  color: #ff9800;
}

.profit-percentage.invalid,
.loss-percentage.invalid {
  color: var(--sell);
}

.loss-percentage {
  color: var(--sell);
  font-weight: 600;
}

.distance-info {
  color: var(--muted);
  font-size: 9px;
}

.tp-sl-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 8px;
}

.quick-tp-btn,
.quick-sl-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 10px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-tp-btn {
  border-color: rgba(185, 255, 102, 0.3);
  color: var(--buy);
}

.quick-tp-btn:hover {
  background: rgba(185, 255, 102, 0.1);
  border-color: var(--buy);
}

.quick-sl-btn {
  border-color: rgba(255, 92, 122, 0.3);
  color: var(--sell);
}

.quick-sl-btn:hover {
  background: rgba(255, 92, 122, 0.1);
  border-color: var(--sell);
}

.risk-reward-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(17, 224, 255, 0.05);
  border: 1px solid rgba(17, 224, 255, 0.2);
  border-radius: 4px;
}

.rr-label {
  font-size: 10px;
  color: var(--muted);
}

.rr-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.rr-value.excellent {
  color: #4caf50;
}

.rr-value.good {
  color: var(--buy);
}

.rr-value.acceptable {
  color: #ffc107;
}

.rr-value.poor {
  color: var(--sell);
}

/* ============================================================================
   TP/SL SETTINGS MODAL
   ============================================================================ */

.tp-sl-settings-modal .modal-content {
  max-width: 550px;
  max-height: 85vh;
  overflow-y: auto;
}

.tp-sl-settings .modal-body {
  padding: 24px;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section h4 {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.threshold-setting {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.threshold-setting label {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}

.threshold-setting input {
  width: 80px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text);
  text-align: center;
}

.threshold-setting input:focus {
  border-color: var(--accent-1);
  outline: none;
}

.threshold-setting .unit {
  font-size: 12px;
  color: var(--muted);
  width: 20px;
}

.feature-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.feature-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-1);
}

.feature-toggle label {
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.preset-btn {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 12px 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.preset-btn:hover {
  border-color: var(--accent-1);
  background: rgba(17, 224, 255, 0.05);
}

.preset-btn.conservative {
  border-color: rgba(76, 175, 80, 0.3);
  color: #4caf50;
}

.preset-btn.conservative:hover {
  background: rgba(76, 175, 80, 0.1);
}

.preset-btn.balanced {
  border-color: rgba(255, 193, 7, 0.3);
  color: #ffc107;
}

.preset-btn.balanced:hover {
  background: rgba(255, 193, 7, 0.1);
}

.preset-btn.aggressive {
  border-color: rgba(255, 92, 122, 0.3);
  color: var(--sell);
}

.preset-btn.aggressive:hover {
  background: rgba(255, 92, 122, 0.1);
}

/* OVERRIDE CSS - Force Binance Colors */
.live-trading-interface .trading-panel .order-type-tabs .tab-btn {
  background: #2B3139 !important;
  color: #848E9C !important;
  border-bottom: none !important;
}

.live-trading-interface .trading-panel .order-type-tabs .tab-btn.active {
  background: #F0F3F7 !important;
  color: #1E2329 !important;
  border-bottom: none !important;
}

.live-trading-interface .trading-panel .percentage-buttons .pct-btn {
  background: #2B3139 !important;
  color: #848E9C !important;
  border: 1px solid #43484D !important;
}

.live-trading-interface .trading-panel .percentage-buttons .pct-btn.active {
  background: #F0F3F7 !important;
  color: #1E2329 !important;
  border-color: #F0F3F7 !important;
}

.live-trading-interface .trading-panel-tabs .trading-panel-tab {
  background: #131318 !important;
  color: #9aa6b2 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-weight: 500 !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .trading-panel-tabs .trading-panel-tab:hover {
  background: #16161d !important;
  color: #f4f4f8 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.live-trading-interface .trading-panel-tabs .trading-panel-tab.active {
  background: linear-gradient(135deg, rgba(255, 41, 79, 0.2), rgba(255, 90, 90, 0.12)) !important;
  color: #f4f4f8 !important;
  border-color: rgba(255, 41, 79, 0.4) !important;
  box-shadow: 0 4px 20px rgba(255, 41, 79, 0.15) !important;
}

/* ============================================================================
   PROFESSIONAL DARK THEME - TRADING CONTROLS REDESIGN
   Matches the spectacular dashboard theme
   ============================================================================ */

/* =============================================================================
   SMART LAYOUT - JavaScript sets exact pixel widths via inline styles
   These classes are fallbacks; JS overrides with inline styles
   ============================================================================= */

/* Container - no padding to maximize space */
.live-trading-interface {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  padding: 0 !important;
}

/* Smart Layout Container - CSS Grid */
/* Chart LEFT (fills remaining), Trading Controls RIGHT (300px) */
.trading-layout-smart {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  width: 100%;
  flex: 1;
  min-height: 620px; /* Taller to match trading panel with Recent Activity section */
  overflow: visible;
  box-sizing: border-box;
  align-items: stretch;
}

/* Chart Section - Grid child, fills 1fr column */
.chart-section-smart {
  min-width: 0;
  height: 100%;
  min-height: 620px; /* Match trading-layout-smart height */
  overflow: hidden;
  box-sizing: border-box;
  background: #0a0a0f;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

/* TradingView Container */
.tv-container-smart {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Trading Panel - Grid child, fills 300px column, NO scrollbar */
.trading-panel-smart {
  width: 300px;
  height: 100%;
  overflow: visible;
  box-sizing: border-box;
  background: #0d0d10;
  border-radius: 8px;
  padding: 0;
}

/* Position details container - fill the trading panel */
.trading-panel-smart .position-details,
.trading-panel-smart .exchange-trading-controls {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
}

/* ============================================================================
   LIVE TRADING LAYOUT - Chart LEFT, Trading Controls RIGHT
   Chart fills available space, Trading Controls fixed on right
   ============================================================================ */

/* Grid: Chart LEFT (fills remaining), Trading Controls RIGHT (300px) */
.live-trading-interface .trading-layout,
.live-trading-interface .trading-layout-smart {
  display: grid !important;
  grid-template-columns: 1fr 300px !important;
  gap: 16px !important;
  width: 100% !important;
  flex: 1 !important;
  min-height: 620px !important; /* Taller for Recent Activity section */
  overflow: visible !important;
  align-items: stretch !important;
}

/* Chart section - fills 1fr column, matches Trading Panel height */
.live-trading-interface .chart-section-smart {
  min-width: 0 !important;
  height: 100% !important;
  min-height: 620px !important; /* Match trading panel with Recent Activity */
  overflow: hidden !important;
  background: #0a0a0f !important;
  border-radius: 8px !important;
  display: flex !important;
  flex-direction: column !important;
}

/* TradingView widget inside chart section - FILL the container */
.live-trading-interface .chart-section-smart > div {
  flex: 1 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}

/* Trading Panel - 300px fixed width, NO scrollbar */
.live-trading-interface .trading-panel,
.live-trading-interface .trading-panel-smart {
  width: 300px !important;
  min-width: 300px !important;
  max-width: 300px !important;
  height: 100% !important;
  overflow: visible !important;
  background: #0d0d10 !important;
  border-radius: 8px !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Ensure position-details fills trading panel */
.live-trading-interface .position-details {
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Ensure content inside trading panel fits */
.live-trading-interface .trading-panel-content {
  width: 100% !important;
  max-width: 100% !important;
  padding: 12px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

/* Compact tabs to fit */
.live-trading-interface .trading-panel-tabs {
  padding: 4px !important;
  gap: 2px !important;
  flex-shrink: 0 !important;
}

.live-trading-interface .trading-panel-tabs .trading-panel-tab {
  padding: 8px 8px !important;
  font-size: 10px !important;
  min-height: 32px !important;
  white-space: nowrap !important;
}

/* Compact buttons to fit within 260px panel */
.live-trading-interface .trade-action-buttons {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  width: 100% !important;
}

.live-trading-interface .trade-btn {
  min-width: 0 !important;
  padding: 12px 8px !important;
  font-size: 11px !important;
  white-space: nowrap !important;
}

/* Compact percentage buttons */
.live-trading-interface .percentage-buttons {
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 4px !important;
}

.live-trading-interface .percentage-buttons .pct-btn {
  padding: 6px 2px !important;
  font-size: 10px !important;
}

.live-trading-interface .trading-panel-tabs {
  background: #050506 !important;
  padding: 8px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  gap: 6px !important;
}

/* Order Type Tabs (Market/Limit) */
.live-trading-interface .order-type-tabs {
  display: flex !important;
  gap: 8px !important;
  margin-bottom: 16px !important;
}

.live-trading-interface .order-type-tabs .tab-btn {
  flex: 1 !important;
  padding: 12px 16px !important;
  background: #131318 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  color: #9aa6b2 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  cursor: pointer !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .order-type-tabs .tab-btn:hover {
  background: #16161d !important;
  color: #f4f4f8 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.live-trading-interface .order-type-tabs .tab-btn.active {
  background: linear-gradient(135deg, rgba(255, 41, 79, 0.15), rgba(255, 90, 90, 0.1)) !important;
  color: #f4f4f8 !important;
  border-color: rgba(255, 41, 79, 0.3) !important;
}

/* Buy/Sell Buttons - Professional Style */
.live-trading-interface .trade-action-buttons {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
  margin-bottom: 20px !important;
}

.live-trading-interface .trade-btn {
  padding: 16px 20px !important;
  border-radius: 14px !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  transition: all 180ms ease !important;
  position: relative !important;
  overflow: hidden !important;
}

.live-trading-interface .trade-btn::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%) !important;
  pointer-events: none !important;
}

.live-trading-interface .trade-btn.buy-btn {
  background: linear-gradient(135deg, #2adf8c, #1db96e) !important;
  border: none !important;
  color: #050506 !important;
  box-shadow: 0 6px 24px rgba(42, 223, 140, 0.25) !important;
}

.live-trading-interface .trade-btn.buy-btn:hover {
  background: linear-gradient(135deg, #34f59d, #2adf8c) !important;
  box-shadow: 0 8px 32px rgba(42, 223, 140, 0.35) !important;
  transform: translateY(-2px) !important;
}

.live-trading-interface .trade-btn.sell-btn {
  background: linear-gradient(135deg, #ff294f, #e61d41) !important;
  border: none !important;
  color: #ffffff !important;
  box-shadow: 0 6px 24px rgba(255, 41, 79, 0.25) !important;
}

.live-trading-interface .trade-btn.sell-btn:hover {
  background: linear-gradient(135deg, #ff4d6d, #ff294f) !important;
  box-shadow: 0 8px 32px rgba(255, 41, 79, 0.35) !important;
  transform: translateY(-2px) !important;
}

/* Amount Controls */
.live-trading-interface .amount-controls {
  margin-bottom: 20px !important;
}

.live-trading-interface .input-label {
  color: #9aa6b2 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  margin-bottom: 8px !important;
}

.live-trading-interface .amount-input-group {
  position: relative !important;
  margin-bottom: 12px !important;
}

.live-trading-interface .amount-input,
.live-trading-interface .price-input {
  width: 100% !important;
  padding: 14px 16px !important;
  padding-right: 60px !important;
  background: #131318 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  color: #f4f4f8 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .amount-input:focus,
.live-trading-interface .price-input:focus {
  outline: none !important;
  border-color: rgba(255, 41, 79, 0.4) !important;
  background: #16161d !important;
  box-shadow: 0 0 0 3px rgba(255, 41, 79, 0.1) !important;
}

.live-trading-interface .currency-label {
  position: absolute !important;
  right: 16px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: #9aa6b2 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

/* Percentage Buttons */
.live-trading-interface .percentage-buttons {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 8px !important;
}

.live-trading-interface .percentage-buttons .pct-btn {
  padding: 10px 12px !important;
  background: #131318 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  color: #9aa6b2 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .percentage-buttons .pct-btn:hover {
  background: #16161d !important;
  color: #f4f4f8 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.live-trading-interface .percentage-buttons .pct-btn.active {
  background: linear-gradient(135deg, rgba(255, 41, 79, 0.2), rgba(255, 90, 90, 0.12)) !important;
  color: #f4f4f8 !important;
  border-color: rgba(255, 41, 79, 0.4) !important;
}

/* Leverage Controls */
.live-trading-interface .leverage-controls {
  margin-bottom: 20px !important;
  padding: 16px !important;
  background: #131318 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 14px !important;
}

.live-trading-interface .leverage-display {
  color: #ff294f !important;
  font-weight: 600 !important;
  font-size: 14px !important;
}

.live-trading-interface .leverage-slider {
  width: 100% !important;
  height: 6px !important;
  background: #16161d !important;
  border-radius: 3px !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 12px 0 !important;
}

.live-trading-interface .leverage-slider::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  background: linear-gradient(135deg, #ff294f, #e61d41) !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  box-shadow: 0 2px 10px rgba(255, 41, 79, 0.4) !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .leverage-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15) !important;
  box-shadow: 0 4px 16px rgba(255, 41, 79, 0.5) !important;
}

.live-trading-interface .leverage-presets {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 8px !important;
  margin-top: 12px !important;
}

.live-trading-interface .leverage-preset {
  padding: 8px 12px !important;
  background: #16161d !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
  color: #9aa6b2 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .leverage-preset:hover {
  background: rgba(255, 41, 79, 0.1) !important;
  color: #f4f4f8 !important;
  border-color: rgba(255, 41, 79, 0.3) !important;
}

/* Position Management Section */
.live-trading-interface .position-management-section {
  padding: 16px !important;
  background: #131318 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 14px !important;
  margin-bottom: 16px !important;
}

.live-trading-interface .position-management-section h4 {
  color: #f4f4f8 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  margin: 0 0 16px 0 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.live-trading-interface .position-actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
}

.live-trading-interface .position-action-btn {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 16px 12px !important;
  background: #16161d !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  color: #9aa6b2 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .position-action-btn:hover {
  background: #1a1a22 !important;
  color: #f4f4f8 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  transform: translateY(-2px) !important;
}

.live-trading-interface .position-action-btn .action-icon {
  font-size: 20px !important;
}

.live-trading-interface .position-action-btn .action-text {
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
}

.live-trading-interface .position-action-btn.danger {
  border-color: rgba(255, 41, 79, 0.2) !important;
}

.live-trading-interface .position-action-btn.danger:hover {
  background: rgba(255, 41, 79, 0.1) !important;
  border-color: rgba(255, 41, 79, 0.4) !important;
  color: #ff5f7a !important;
}

/* Bot Allocation Section */
.live-trading-interface .bot-allocation-section {
  padding: 16px !important;
  background: #131318 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 14px !important;
}

.live-trading-interface .bot-allocation-section h4 {
  color: #f4f4f8 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  margin: 0 0 16px 0 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.live-trading-interface .allocation-row {
  display: flex !important;
  justify-content: space-between !important;
  padding: 10px 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  color: #9aa6b2 !important;
  font-size: 13px !important;
}

.live-trading-interface .allocation-row:last-child {
  border-bottom: none !important;
}

.live-trading-interface .allocation-value {
  color: #f4f4f8 !important;
  font-weight: 500 !important;
}

.live-trading-interface .allocation-value.positive {
  color: #2adf8c !important;
}

.live-trading-interface .increase-allocation-btn {
  width: 100% !important;
  margin-top: 16px !important;
  padding: 12px 20px !important;
  background: linear-gradient(135deg, rgba(255, 41, 79, 0.15), rgba(255, 90, 90, 0.1)) !important;
  border: 1px solid rgba(255, 41, 79, 0.3) !important;
  border-radius: 12px !important;
  color: #f4f4f8 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .increase-allocation-btn:hover {
  background: linear-gradient(135deg, rgba(255, 41, 79, 0.25), rgba(255, 90, 90, 0.15)) !important;
  border-color: rgba(255, 41, 79, 0.5) !important;
  box-shadow: 0 4px 20px rgba(255, 41, 79, 0.2) !important;
}

/* TP/SL Section */
.live-trading-interface .tp-sl-section {
  padding: 16px !important;
  background: #131318 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 14px !important;
}

.live-trading-interface .tp-sl-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 16px !important;
}

.live-trading-interface .section-title {
  color: #f4f4f8 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.live-trading-interface .tp-sl-settings-btn {
  background: transparent !important;
  border: none !important;
  color: #9aa6b2 !important;
  font-size: 16px !important;
  cursor: pointer !important;
  padding: 4px !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .tp-sl-settings-btn:hover {
  color: #f4f4f8 !important;
}

.live-trading-interface .tp-sl-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 12px !important;
  margin-bottom: 16px !important;
}

.live-trading-interface .tp-input-group,
.live-trading-interface .sl-input-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.live-trading-interface .tp-input-group label,
.live-trading-interface .sl-input-group label {
  color: #9aa6b2 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
}

.live-trading-interface .tp-input-group input,
.live-trading-interface .sl-input-group input {
  padding: 12px 14px !important;
  background: #16161d !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  color: #f4f4f8 !important;
  font-size: 14px !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .tp-input-group input:focus,
.live-trading-interface .sl-input-group input:focus {
  outline: none !important;
  border-color: rgba(255, 41, 79, 0.4) !important;
  box-shadow: 0 0 0 3px rgba(255, 41, 79, 0.1) !important;
}

.live-trading-interface .tp-sl-quick-actions {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 8px !important;
  margin-bottom: 16px !important;
}

.live-trading-interface .quick-tp-btn,
.live-trading-interface .quick-sl-btn {
  padding: 8px 12px !important;
  background: #16161d !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
  color: #9aa6b2 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 180ms ease !important;
}

.live-trading-interface .quick-tp-btn:hover {
  background: rgba(42, 223, 140, 0.1) !important;
  border-color: rgba(42, 223, 140, 0.3) !important;
  color: #2adf8c !important;
}

.live-trading-interface .quick-sl-btn:hover {
  background: rgba(255, 41, 79, 0.1) !important;
  border-color: rgba(255, 41, 79, 0.3) !important;
  color: #ff5f7a !important;
}

.live-trading-interface .risk-reward-display {
  display: flex !important;
  justify-content: space-between !important;
  padding: 12px 16px !important;
  background: #16161d !important;
  border-radius: 10px !important;
}

.live-trading-interface .rr-label {
  color: #9aa6b2 !important;
  font-size: 13px !important;
}

.live-trading-interface .rr-value {
  color: #f4f4f8 !important;
  font-weight: 600 !important;
  font-size: 14px !important;
}

/* Header Controls */
.live-trading-interface .trading-controls-header {
  background: #0d0d10 !important;
  padding: 16px 20px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.live-trading-interface .trading-symbol {
  color: #f4f4f8 !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  margin: 0 !important;
}

.live-trading-interface .exchange-badge {
  background: linear-gradient(135deg, rgba(255, 41, 79, 0.15), rgba(255, 90, 90, 0.1)) !important;
  border: 1px solid rgba(255, 41, 79, 0.3) !important;
  color: #ff294f !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.live-trading-interface .bot-status-indicator {
  padding: 4px 10px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.live-trading-interface .bot-status-indicator.running {
  background: rgba(42, 223, 140, 0.15) !important;
  border: 1px solid rgba(42, 223, 140, 0.3) !important;
  color: #2adf8c !important;
}

.live-trading-interface .bot-status-indicator.stopped {
  background: rgba(255, 95, 122, 0.15) !important;
  border: 1px solid rgba(255, 95, 122, 0.3) !important;
  color: #ff5f7a !important;
}

/* Action Buttons in Header */
.live-trading-interface .action-btn {
  padding: 10px 18px !important;
  border-radius: 10px !important;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 180ms ease !important;
  border: none !important;
}

.live-trading-interface .action-btn.danger {
  background: linear-gradient(135deg, #ff294f, #e61d41) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(255, 41, 79, 0.25) !important;
}

.live-trading-interface .action-btn.danger:hover {
  background: linear-gradient(135deg, #ff4d6d, #ff294f) !important;
  box-shadow: 0 6px 24px rgba(255, 41, 79, 0.35) !important;
  transform: translateY(-1px) !important;
}

.live-trading-interface .action-btn.secondary {
  background: #131318 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #9aa6b2 !important;
}

.live-trading-interface .action-btn.secondary:hover {
  background: #16161d !important;
  color: #f4f4f8 !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Chart Section - Dark Theme */
.live-trading-interface .chart-section {
  background: #050506 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.live-trading-interface .tradingview-chart-container {
  background: #050506 !important;
}

/* Ensure TradingView iframe fills container */
.live-trading-interface .tradingview-chart-container iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}

/* ============================================================================
   CRITICAL FIX: TradingView Widget Must Fill Chart Section
   ============================================================================ */

/* Chart section smart - force fill entire grid cell */
.chart-section-smart {
  width: 100% !important;
  height: 100% !important;
  min-height: 620px !important; /* Taller for Recent Activity section */
  position: relative !important;
}

/* TradingView widget container - must fill parent completely */
.chart-section-smart > div,
.chart-section-smart div[id^="tradingview_widget_"] {
  width: 100% !important;
  height: 100% !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

/* TradingView iframe - fill the widget container */
.chart-section-smart div[id^="tradingview_widget_"] iframe,
.chart-section-smart iframe {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  display: block !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
}

/* ============================================================================
   POSITION OVERLAY SYSTEM
   Displays open positions on TradingView chart with entry, SL, and TP lines
   ============================================================================ */

/* Position Overlays Container - positioned over chart */
.position-overlays-container {
  position: absolute;
  top: 50px;         /* Below TradingView toolbar */
  left: 50px;        /* Account for TradingView left sidebar */
  right: 70px;       /* Account for price scale */
  bottom: 30px;      /* Account for time scale */
  pointer-events: none;
  z-index: 1000;     /* Higher z-index to ensure visibility */
  overflow: visible;
  /* DEBUG: Uncomment to see container bounds */
  /* border: 2px dashed yellow; */
}

/* Individual position container */
.position-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

/* Position Line Base */
.position-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

/* Entry Lines - Solid with glow */
.position-long .entry-line {
  background: linear-gradient(90deg,
    transparent 0%,
    #2adf8c 5%,
    #2adf8c 95%,
    transparent 100%
  );
  box-shadow: 0 0 12px rgba(42, 223, 140, 0.6), 0 0 4px rgba(42, 223, 140, 0.8);
}

.position-short .entry-line {
  background: linear-gradient(90deg,
    transparent 0%,
    #ff294f 5%,
    #ff294f 95%,
    transparent 100%
  );
  box-shadow: 0 0 12px rgba(255, 41, 79, 0.6), 0 0 4px rgba(255, 41, 79, 0.8);
}

/* TP Lines - Dashed green/red */
.position-long .tp-line {
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 8px,
    #2adf8c 8px,
    #2adf8c 20px
  );
  opacity: 0.8;
  height: 1px;
}

.position-short .tp-line {
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 8px,
    #ff294f 8px,
    #ff294f 20px
  );
  opacity: 0.8;
  height: 1px;
}

/* SL Lines - Dashed warning colors (opposite of position) */
.position-long .sl-line {
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 8px,
    #ff5f7a 8px,
    #ff5f7a 20px
  );
  opacity: 0.8;
  height: 1px;
}

.position-short .sl-line {
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 8px,
    #2adf8c 8px,
    #2adf8c 20px
  );
  opacity: 0.8;
  height: 1px;
}

/* Line Labels - Base */
.position-line .line-label {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  font-family: 'Space Grotesk', 'Outfit', monospace;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  backdrop-filter: blur(4px);
}

/* Entry Labels */
.position-long .entry-label {
  background: rgba(42, 223, 140, 0.15);
  border: 1px solid rgba(42, 223, 140, 0.4);
  color: #2adf8c;
}

.position-short .entry-label {
  background: rgba(255, 41, 79, 0.15);
  border: 1px solid rgba(255, 41, 79, 0.4);
  color: #ff294f;
}

/* TP/SL Labels */
.position-long .tp-label {
  background: rgba(42, 223, 140, 0.12);
  border: 1px solid rgba(42, 223, 140, 0.3);
  color: #2adf8c;
}

.position-long .sl-label {
  background: rgba(255, 95, 122, 0.12);
  border: 1px solid rgba(255, 95, 122, 0.3);
  color: #ff5f7a;
}

.position-short .tp-label {
  background: rgba(255, 41, 79, 0.12);
  border: 1px solid rgba(255, 41, 79, 0.3);
  color: #ff294f;
}

.position-short .sl-label {
  background: rgba(42, 223, 140, 0.12);
  border: 1px solid rgba(42, 223, 140, 0.3);
  color: #2adf8c;
}

/* Side Badge */
.side-badge {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.position-long .side-badge {
  background: #2adf8c;
  color: #050506;
}

.position-short .side-badge {
  background: #ff294f;
  color: #ffffff;
}

/* TP/SL Badge */
.tp-sl-badge {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.position-long .tp-label .tp-sl-badge {
  background: rgba(42, 223, 140, 0.3);
  color: #2adf8c;
}

.position-long .sl-label .tp-sl-badge {
  background: rgba(255, 95, 122, 0.3);
  color: #ff5f7a;
}

.position-short .tp-label .tp-sl-badge {
  background: rgba(255, 41, 79, 0.3);
  color: #ff294f;
}

.position-short .sl-label .tp-sl-badge {
  background: rgba(42, 223, 140, 0.3);
  color: #2adf8c;
}

/* Price Text */
.line-label .price {
  font-family: 'Space Grotesk', monospace;
  font-weight: 600;
  font-size: 11px;
}

/* Size Text */
.line-label .size {
  font-size: 10px;
  opacity: 0.8;
}

/* Hover effects */
.position-line:hover {
  opacity: 1 !important;
}

.position-line:hover .line-label {
  transform: translateY(-50%) scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}


/* ============================================================================
   LIGHTWEIGHT CHARTS STYLING
   Full-featured trading chart with exact price line positioning
   ============================================================================ */

/* Main chart wrapper */
.lw-chart-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 400px;
  background: #000000;
  border-radius: 8px;
  overflow: visible;
  position: relative;
}

/* Subtle dark red gradient overlay - bottom-left red to top-right black */
.lw-chart-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(80, 15, 20, 0.2) 0%,
    rgba(60, 12, 18, 0.12) 25%,
    rgba(40, 8, 12, 0.05) 50%,
    transparent 70%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
  border-radius: 8px;
}

/* Chart toolbar */
/* ===== TOP TOOLBAR - TRADINGVIEW STYLE ===== */
.lw-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  background: #1e222d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  gap: 8px;
  flex-shrink: 0;
  height: 42px;
  position: relative;
  z-index: 2;
}

/* Timeframe buttons */
.lw-timeframe-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 100%;
}

.lw-tf-btn {
  padding: 0 10px;
  height: 28px;
  font-size: 12px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', sans-serif;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lw-tf-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.lw-tf-btn.active {
  background: #ffffff;
  color: #131722;
  font-weight: 600;
  border-radius: 4px;
}

/* Chart info display - TradingView Style Header */
.lw-chart-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: flex-start;
  padding-left: 12px;
}

.lw-symbol {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', sans-serif;
  letter-spacing: -0.02em;
  position: relative;
}

/* Symbol exchange badge inline */
.lw-symbol::after {
  content: attr(data-exchange);
  font-size: 9px;
  font-weight: 600;
  color: #787b86;
  text-transform: uppercase;
  margin-left: 6px;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  vertical-align: middle;
}

.lw-price {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', sans-serif;
  letter-spacing: -0.01em;
}

.lw-price.up {
  color: #26a69a;
}

.lw-price.down {
  color: #ef5350;
}

.lw-change {
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', sans-serif;
}

.lw-change.up {
  background: rgba(38, 166, 154, 0.15);
  color: #26a69a;
}

.lw-change.down {
  background: rgba(239, 83, 80, 0.15);
  color: #ef5350;
}

/* Price info divider */
.lw-chart-info .lw-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
}

/* OHLC data row */
.lw-ohlc-row {
  display: flex;
  gap: 12px;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', sans-serif;
}

.lw-ohlc-item {
  display: flex;
  gap: 4px;
}

.lw-ohlc-label {
  color: #787b86;
  font-weight: 500;
}

.lw-ohlc-value {
  color: #d1d4dc;
  font-weight: 600;
}

.lw-ohlc-value.up { color: #26a69a; }
.lw-ohlc-value.down { color: #ef5350; }

/* Chart action buttons */
.lw-chart-actions {
  display: flex;
  gap: 4px;
}

.lw-action-btn {
  width: 32px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #787b86;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #d1d4dc;
}

/* Chart container */
.lw-chart-container {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* ===== CHART BODY WITH LEFT TOOLBAR ===== */
.lw-chart-body {
  display: flex;
  flex: 1;
  min-height: 350px;
  overflow: visible;
  position: relative;
  z-index: 1;
}

/* Toolbar left section */
.lw-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lw-toolbar-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 4px;
}

/* ===== LEFT DRAWING TOOLBAR - TradingView Pro Style ===== */
.lw-drawing-toolbar {
  display: flex;
  flex-direction: column;
  width: 44px;
  min-width: 44px;
  background: linear-gradient(180deg, #1e222d 0%, #181c25 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 4px;
  gap: 2px;
  overflow: visible; /* CRITICAL: Allow dropdowns to extend beyond toolbar */
  scrollbar-width: none;
  position: relative; /* Establish stacking context for dropdowns */
  z-index: 60; /* Above chart content so dropdowns appear on top */
}

.lw-drawing-toolbar::-webkit-scrollbar {
  display: none;
}

.lw-draw-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.lw-draw-btn::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  margin-left: 8px;
  padding: 6px 10px;
  background: #2a2e39;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #d1d4dc;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lw-draw-btn:hover::after {
  opacity: 1;
  visibility: visible;
}

.lw-draw-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #d1d4dc;
}

.lw-draw-btn.active {
  background: #ffffff;
  color: #131722;
}

.lw-draw-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

.lw-draw-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.08) 50%, transparent 100%);
  margin: 6px 6px;
}

.lw-draw-delete,
.lw-draw-clear {
  color: #787b86;
  margin-top: auto;
}

.lw-draw-delete:hover,
.lw-draw-clear:hover {
  color: #f7525f;
  background: rgba(247, 82, 95, 0.15);
}

/* ===== EXPANDABLE TOOL GROUPS ===== */
.lw-tool-group {
  position: relative;
  z-index: 1; /* Base z-index for groups */
}

.lw-tool-group.expanded {
  z-index: 100; /* Raise expanded group above others */
}

.lw-group-btn {
  position: relative;
}

.lw-expand-arrow {
  position: absolute;
  right: 2px;
  bottom: 2px;
  font-size: 8px;
  color: rgba(255, 255, 255, 0.4);
  transition: transform 0.2s ease;
}

.lw-tool-group.expanded .lw-expand-arrow {
  transform: rotate(90deg);
}

.lw-tool-dropdown {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 4px; /* Small gap from toolbar */
  min-width: 160px;
  background: linear-gradient(180deg, #2a2e39 0%, #1e222d 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 6px;
  display: none;
  z-index: 9999; /* Very high to ensure visibility over everything */
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.1);
}

.lw-tool-group.expanded .lw-tool-dropdown {
  display: block;
  animation: slideIn 0.15s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.lw-tool-dropdown .lw-draw-btn {
  width: 100%;
  height: auto;
  padding: 8px 10px;
  justify-content: flex-start;
  gap: 8px;
}

.lw-tool-dropdown .lw-draw-btn span {
  font-size: 12px;
  color: #d1d4dc;
}

.lw-tool-dropdown .lw-draw-btn:hover span {
  color: #ffffff;
}

.lw-tool-dropdown .lw-draw-btn::after {
  display: none;
}

.lw-tool-dropdown .lw-draw-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ===== TOOLBAR BUTTONS & DROPDOWNS ===== */
.lw-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lw-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #d1d4dc;
}

.lw-toolbar-btn.active {
  background: #ffffff;
  color: #131722;
}

.lw-toolbar-btn svg {
  flex-shrink: 0;
}

.lw-dropdown-arrow {
  margin-left: 2px;
  opacity: 0.6;
}

/* Dropdown containers */
.lw-indicator-dropdown,
.lw-compare-dropdown {
  position: relative;
}

.lw-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 180px;
  background: #1e222d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  overflow: hidden;
}

.lw-indicator-dropdown.open .lw-dropdown-menu,
.lw-compare-dropdown.open .lw-dropdown-menu {
  display: block;
}

.lw-dropdown-section {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  color: #787b86;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lw-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.lw-dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: #d1d4dc;
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lw-dropdown-item.active {
  background: rgba(41, 98, 255, 0.2);
  color: #2962ff;
}

.lw-dropdown-item.active::before {
  content: '✓';
  margin-right: 8px;
  color: #2962ff;
}

.lw-clear-indicators,
.lw-compare-clear {
  color: #787b86;
}

.lw-clear-indicators:hover,
.lw-compare-clear:hover {
  color: #f7525f;
  background: rgba(247, 82, 95, 0.1);
}

/* Custom timeframe input - Enhanced */
.lw-custom-tf {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.lw-custom-tf-input {
  width: 48px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #d1d4dc;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Space Mono', monospace;
  text-align: center;
  transition: all 0.2s ease;
  /* Hide default number spinners */
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Hide spinners in WebKit browsers */
.lw-custom-tf-input::-webkit-outer-spin-button,
.lw-custom-tf-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.lw-custom-tf-input:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.lw-custom-tf-input:focus {
  outline: none;
  border-color: #2962ff;
  background: rgba(41, 98, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(41, 98, 255, 0.15);
  color: #fff;
}

.lw-custom-tf-input::placeholder {
  color: #5d606b;
  font-weight: 400;
}

.lw-custom-tf-btn {
  padding: 6px 12px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  min-width: unset !important;
  background: linear-gradient(135deg, rgba(41, 98, 255, 0.2) 0%, rgba(41, 98, 255, 0.1) 100%) !important;
  border: 1px solid rgba(41, 98, 255, 0.4) !important;
  color: #2962ff !important;
  border-radius: 6px !important;
  transition: all 0.2s ease !important;
}

.lw-custom-tf-btn:hover {
  background: linear-gradient(135deg, rgba(41, 98, 255, 0.35) 0%, rgba(41, 98, 255, 0.2) 100%) !important;
  border-color: rgba(41, 98, 255, 0.6) !important;
  color: #5b8cff !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(41, 98, 255, 0.25);
}

/* ===== POSITION LEGEND - SOPHISTICATED GLASS DESIGN ===== */

.lw-position-legend-wrapper {
  display: flex;
  align-items: stretch;
  background: linear-gradient(180deg, #0f0f14 0%, #0a0a0e 100%); /* Solid opaque background */
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  flex-shrink: 0;
  min-height: 110px;
  z-index: 50; /* Above chart overflow content */
}

.lw-legend-scroll-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  z-index: 2;
  backdrop-filter: blur(8px);
}

.lw-legend-scroll-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.lw-scroll-left {
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.lw-scroll-right {
  border-left: 1px solid rgba(255, 255, 255, 0.04);
}

.lw-position-legend {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  align-items: stretch;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lw-position-legend::-webkit-scrollbar {
  display: none;
}

.lw-no-positions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.lw-no-pos-icon {
  font-size: 18px;
  opacity: 0.5;
}

/* ===== POSITION CARD - GLASS MORPHISM ===== */

.lw-pos-card {
  position: relative;
  min-width: 180px;
  max-width: 200px;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lw-pos-card-inner {
  height: 100%;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.02) 50%,
    rgba(255, 255, 255, 0.04) 100%);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
}

.lw-pos-card-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--pos-dark) 0%, var(--pos-color) 50%, var(--pos-light) 100%);
  opacity: 0.9;
}

.lw-pos-card:hover .lw-pos-card-inner {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.04) 50%,
    rgba(255, 255, 255, 0.06) 100%);
  border-color: var(--pos-color);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px var(--pos-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.lw-pos-card.focused .lw-pos-card-inner {
  animation: cardPulse 0.6s ease-out;
}

@keyframes cardPulse {
  0% { box-shadow: 0 0 0 0 var(--pos-glow); }
  50% { box-shadow: 0 0 20px 8px var(--pos-glow); }
  100% { box-shadow: 0 0 0 0 var(--pos-glow); }
}

/* Card Header */
.lw-pos-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
}

.lw-pos-badge-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lw-pos-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 8px;
  background: linear-gradient(135deg, var(--pos-color) 0%, var(--pos-dark) 100%);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.lw-pos-dir {
  font-size: 14px;
  font-weight: 700;
}

.lw-pos-dir.long {
  color: #34d399;
  text-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

.lw-pos-dir.short {
  color: #fb7185;
  text-shadow: 0 0 8px rgba(251, 113, 133, 0.5);
}

.lw-pos-pnl {
  font-size: 12px;
  font-weight: 700;
  font-family: 'Space Mono', monospace;
  padding: 4px 8px;
  border-radius: 6px;
}

.lw-pos-pnl.profit {
  color: #34d399;
  background: rgba(52, 211, 153, 0.15);
}

.lw-pos-pnl.loss {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.15);
}

/* Card Body */
.lw-pos-card-body {
  padding: 0 12px 10px;
}

.lw-pos-main-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.lw-pos-entry-label {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.lw-pos-entry-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--pos-light);
  font-family: 'Space Mono', monospace;
  letter-spacing: -0.5px;
}

.lw-pos-levels {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lw-pos-level {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lw-pos-level:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lw-level-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.lw-level-dot.sl {
  background: #fb7185;
  box-shadow: 0 0 6px rgba(251, 113, 133, 0.6);
}

.lw-level-dot.tp {
  background: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.6);
}

.lw-level-label {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 18px;
}

.lw-level-price {
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  color: rgba(255, 255, 255, 0.8);
  margin-left: auto;
}

/* Card Footer */
.lw-pos-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.lw-pos-size {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-family: 'Space Mono', monospace;
}

.lw-pos-action {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lw-pos-card:hover .lw-pos-action {
  opacity: 1;
}

/* Legacy compatibility */
.lw-position-item, .lw-position-card { display: none; }

/* Chart section smart - ensure proper sizing for Lightweight Charts */
.chart-section-smart {
  position: relative;
  min-height: 620px; /* Taller to match trading panel with Recent Activity */
  height: 100%;
}

/* Lightweight Charts canvas styling */
.lw-chart-container canvas {
  display: block;
}

/* Price line labels from Lightweight Charts */
.tv-lightweight-charts .price-line-title {
  font-family: 'Space Mono', monospace !important;
  font-size: 11px !important;
}

/* ===== ENHANCED POSITION LEGEND WITH STYLED SCROLLBAR ===== */

.lw-position-legend {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  align-items: stretch;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  flex: 1;
  /* Show styled scrollbar on hover */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* Styled scrollbar for position legend */
.lw-position-legend::-webkit-scrollbar {
  height: 6px;
  display: block;
}

.lw-position-legend::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  margin: 0 12px;
}

.lw-position-legend::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, rgba(100,100,120,0.4) 0%, rgba(140,140,160,0.4) 100%);
  border-radius: 3px;
  transition: background 0.3s ease;
}

.lw-position-legend::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, rgba(120,120,140,0.6) 0%, rgba(160,160,180,0.6) 100%);
}

/* ===== PREMIUM POSITION CARDS ===== */

.lw-pos-card {
  position: relative;
  min-width: 195px;
  max-width: 220px;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center center;
}

.lw-pos-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, var(--pos-glow) 0%, transparent 50%, var(--pos-glow) 100%);
  border-radius: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.lw-pos-card:hover::before {
  opacity: 0.5;
  animation: cardGlowPulse 2s ease-in-out infinite;
}

@keyframes cardGlowPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.lw-pos-card-inner {
  height: 100%;
  background: linear-gradient(160deg,
    rgba(25, 25, 35, 0.95) 0%,
    rgba(15, 15, 22, 0.98) 50%,
    rgba(20, 20, 28, 0.95) 100%);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Shimmer effect on top edge */
.lw-pos-card-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--pos-dark) 20%,
    var(--pos-color) 50%,
    var(--pos-light) 80%,
    transparent 100%);
  opacity: 1;
}

/* Corner accent */
.lw-pos-card-inner::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 0;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle at top right, var(--pos-glow) 0%, transparent 70%);
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.lw-pos-card:hover .lw-pos-card-inner {
  background: linear-gradient(160deg,
    rgba(35, 35, 48, 0.98) 0%,
    rgba(20, 20, 30, 1) 50%,
    rgba(28, 28, 38, 0.98) 100%);
  border-color: var(--pos-color);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px var(--pos-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(-4px) scale(1.02);
}

.lw-pos-card:hover .lw-pos-card-inner::after {
  opacity: 0.7;
}

/* Focused state with enhanced pulse */
.lw-pos-card.focused .lw-pos-card-inner {
  animation: cardFocusPulse 0.7s ease-out;
}

@keyframes cardFocusPulse {
  0% {
    box-shadow: 0 0 0 0 var(--pos-glow);
    transform: scale(1);
  }
  30% {
    box-shadow: 0 0 30px 12px var(--pos-glow);
    transform: scale(1.03);
  }
  100% {
    box-shadow: 0 0 0 0 var(--pos-glow);
    transform: scale(1);
  }
}

/* Enhanced card header */
.lw-pos-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  position: relative;
}

.lw-pos-badge-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lw-pos-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  padding: 0 10px;
  background: linear-gradient(135deg, var(--pos-color) 0%, var(--pos-dark) 100%);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  box-shadow: 0 2px 8px var(--pos-glow);
}

.lw-pos-dir {
  font-size: 16px;
  font-weight: 700;
  animation: directionBounce 2s ease-in-out infinite;
}

@keyframes directionBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.lw-pos-dir.long {
  color: #4ade80;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.6);
}

.lw-pos-dir.short {
  color: #f87171;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.6);
}

/* Enhanced PnL badge */
.lw-pos-pnl {
  font-size: 12px;
  font-weight: 800;
  font-family: 'Space Mono', monospace;
  padding: 5px 10px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.lw-pos-pnl::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: pnlShimmer 3s ease-in-out infinite;
}

@keyframes pnlShimmer {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

.lw-pos-pnl.profit {
  color: #4ade80;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.15) 0%, rgba(34, 197, 94, 0.1) 100%);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.lw-pos-pnl.loss {
  color: #f87171;
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.15) 0%, rgba(239, 68, 68, 0.1) 100%);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Enhanced card body */
.lw-pos-card-body {
  padding: 0 14px 12px;
}

.lw-pos-main-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.lw-pos-entry-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.lw-pos-entry-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--pos-light);
  font-family: 'Space Mono', monospace;
  letter-spacing: -0.5px;
  text-shadow: 0 0 20px var(--pos-glow);
}

/* Enhanced level rows */
.lw-pos-levels {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.lw-pos-level {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: linear-gradient(90deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.15) 100%);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}

.lw-pos-level:hover {
  background: linear-gradient(90deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.03) 100%);
  transform: translateX(3px);
}

.lw-pos-level.lw-pos-sl:hover {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(90deg, rgba(239,68,68,0.12) 0%, rgba(0,0,0,0.2) 100%);
}

.lw-pos-level.lw-pos-tp:hover {
  border-color: rgba(34, 197, 94, 0.4);
  background: linear-gradient(90deg, rgba(34,197,94,0.12) 0%, rgba(0,0,0,0.2) 100%);
}

.lw-level-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lw-level-dot.sl {
  background: radial-gradient(circle, #f87171 30%, #ef4444 100%);
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.7);
}

.lw-level-dot.tp {
  background: radial-gradient(circle, #4ade80 30%, #22c55e 100%);
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.7);
}

.lw-level-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  min-width: 20px;
}

.lw-level-price {
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  color: rgba(255, 255, 255, 0.85);
  margin-left: auto;
  font-weight: 500;
}

/* Enhanced card footer */
.lw-pos-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.35) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.lw-pos-size {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  font-family: 'Space Mono', monospace;
  font-weight: 500;
}

.lw-pos-action {
  font-size: 9px;
  color: var(--pos-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lw-pos-action::before {
  content: '◎';
  font-size: 8px;
}

.lw-pos-card:hover .lw-pos-action {
  opacity: 1;
  transform: translateX(2px);
}

/* ===== LABEL RIPPLE ANIMATION ===== */
@keyframes labelRipple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* ===== CLOSED POSITION CARD VARIANT ===== */
.lw-pos-card.closed .lw-pos-card-inner {
  background: linear-gradient(160deg,
    rgba(40, 40, 50, 0.7) 0%,
    rgba(30, 30, 38, 0.75) 100%);
  opacity: 0.75;
  filter: saturate(0.6);
}

.lw-pos-card.closed:hover .lw-pos-card-inner {
  opacity: 0.9;
  filter: saturate(0.8);
}

.lw-pos-card.closed .lw-pos-num {
  background: linear-gradient(135deg, rgba(100,100,110,0.8) 0%, rgba(70,70,80,0.8) 100%);
}

.lw-pos-card.closed .lw-pos-pnl {
  border: 1px dashed currentColor;
}

/* ===== NO POSITIONS STATE ===== */
.lw-no-positions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  padding: 20px;
  width: 100%;
}

.lw-no-pos-icon {
  font-size: 24px;
  opacity: 0.4;
  animation: noPosBounce 2s ease-in-out infinite;
}

@keyframes noPosBounce {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.1); opacity: 0.6; }
}

/* ===== FOCUS HIGHLIGHT LINE ===== */
.lw-focus-highlight {
  animation: focusLineFlash 0.6s ease-out;
}

@keyframes focusLineFlash {
  0% { opacity: 1; }
  50% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* ===== CHART GRADIENT BACKGROUND - Dashboard Inspired ===== */
.lw-chart-container {
  position: relative;
  background: linear-gradient(
    160deg,
    #0a0a0f 0%,
    #0d0d14 30%,
    #0f0f18 60%,
    #0a0a0f 100%
  );
}

/* Subtle red/magenta radial glow - matches dashboard accent */
.lw-chart-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    ellipse at 0% 0%,
    rgba(255, 41, 79, 0.06) 0%,
    transparent 45%
  );
  pointer-events: none;
  z-index: 0;
}

/* Secondary subtle cyan accent glow */
.lw-chart-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    ellipse at 100% 100%,
    rgba(55, 240, 228, 0.03) 0%,
    transparent 35%
  );
  pointer-events: none;
  z-index: 0;
}

/* Chart area wrapper - ensure it's above the gradient */
[id^="lw-chart-area-"] {
  position: relative;
  z-index: 1;
}

/* Dark red gradient overlay ON TOP of chart - bottom-left to top-right */
[id^="lw-chart-area-"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(100, 20, 30, 0.15) 0%,
    rgba(70, 15, 22, 0.1) 20%,
    rgba(45, 10, 15, 0.05) 40%,
    transparent 60%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 2;
  border-radius: 0;
}

/* Enhanced chart body with subtle border accent */
.lw-chart-body {
  border: 1px solid rgba(255, 41, 79, 0.1);
  border-top: none;
  background: transparent;
}

/* ===== TRADING PANEL GLASS MORPHISM UPGRADE ===== */

/* Main trading panel wrapper */
.live-trading-interface .trading-panel,
.live-trading-interface .order-panel {
  background: linear-gradient(160deg,
    rgba(20, 20, 28, 0.95) 0%,
    rgba(12, 12, 18, 0.98) 50%,
    rgba(16, 16, 22, 0.95) 100%) !important;
  backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 16px !important;
}

/* Order Type Tabs - Glass Style */
.live-trading-interface .order-type-tabs {
  display: flex !important;
  gap: 6px !important;
  padding: 6px !important;
  background: rgba(0, 0, 0, 0.3) !important;
  border-radius: 12px !important;
  margin-bottom: 16px !important;
}

.live-trading-interface .order-type-tabs .tab-btn {
  flex: 1 !important;
  padding: 10px 14px !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  color: rgba(255, 255, 255, 0.5) !important;
  font-family: 'Space Mono', monospace !important;
  font-weight: 500 !important;
  font-size: 11px !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.live-trading-interface .order-type-tabs .tab-btn:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: rgba(255, 255, 255, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.live-trading-interface .order-type-tabs .tab-btn.active {
  background: linear-gradient(135deg,
    rgba(255, 41, 79, 0.15) 0%,
    rgba(255, 41, 79, 0.08) 100%) !important;
  color: #fff !important;
  border-color: rgba(255, 41, 79, 0.4) !important;
  box-shadow: 0 0 12px rgba(255, 41, 79, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

/* Buy/Sell Buttons - Glass with Glow */
.live-trading-interface .trade-action-buttons {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
  margin-bottom: 20px !important;
}

.live-trading-interface .trade-btn {
  padding: 14px 18px !important;
  border-radius: 8px !important;
  font-family: 'Space Mono', monospace !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  letter-spacing: 0.8px !important;
  text-transform: uppercase !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative !important;
  overflow: hidden !important;
  border: none !important;
}

.live-trading-interface .trade-btn::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 50% !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%) !important;
  pointer-events: none !important;
}

.live-trading-interface .trade-btn.buy-btn {
  background: linear-gradient(135deg, #00C853 0%, #00a844 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 20px rgba(0, 200, 83, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.live-trading-interface .trade-btn.buy-btn:hover {
  background: linear-gradient(135deg, #00E676 0%, #00C853 100%) !important;
  box-shadow: 0 6px 28px rgba(0, 200, 83, 0.45),
              inset 0 1px 0 rgba(255, 255, 255, 0.25),
              0 0 20px rgba(0, 200, 83, 0.3) !important;
  transform: translateY(-2px) !important;
}

.live-trading-interface .trade-btn.sell-btn {
  background: linear-gradient(135deg, #D32F2F 0%, #b71c1c 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 20px rgba(211, 47, 47, 0.3),
              inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.live-trading-interface .trade-btn.sell-btn:hover {
  background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%) !important;
  box-shadow: 0 6px 28px rgba(211, 47, 47, 0.45),
              inset 0 1px 0 rgba(255, 255, 255, 0.25),
              0 0 20px rgba(211, 47, 47, 0.3) !important;
  transform: translateY(-2px) !important;
}

/* Input Fields - Glass Style */
.live-trading-interface .amount-input,
.live-trading-interface .price-input,
.live-trading-interface input[type="number"],
.live-trading-interface input[type="text"] {
  width: 100% !important;
  padding: 12px 14px !important;
  background: rgba(0, 0, 0, 0.4) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
  /* Hide spinners */
  -moz-appearance: textfield !important;
}

.live-trading-interface input::-webkit-outer-spin-button,
.live-trading-interface input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

.live-trading-interface .amount-input:focus,
.live-trading-interface .price-input:focus,
.live-trading-interface input:focus {
  outline: none !important;
  border-color: rgba(255, 41, 79, 0.5) !important;
  background: rgba(0, 0, 0, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(255, 41, 79, 0.15),
              0 0 15px rgba(255, 41, 79, 0.1) !important;
}

/* Percentage/Preset Buttons - Glass Style */
.live-trading-interface .percentage-buttons,
.live-trading-interface .amount-presets {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 6px !important;
}

.live-trading-interface .percentage-buttons .pct-btn,
.live-trading-interface .amount-presets button,
.live-trading-interface .preset-btn {
  padding: 8px 10px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  backdrop-filter: blur(4px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 6px !important;
  color: rgba(255, 255, 255, 0.6) !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.live-trading-interface .percentage-buttons .pct-btn:hover,
.live-trading-interface .amount-presets button:hover,
.live-trading-interface .preset-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-1px) !important;
}

.live-trading-interface .percentage-buttons .pct-btn.active,
.live-trading-interface .amount-presets button.active,
.live-trading-interface .preset-btn.active {
  background: linear-gradient(135deg,
    rgba(255, 41, 79, 0.2) 0%,
    rgba(255, 41, 79, 0.1) 100%) !important;
  color: #fff !important;
  border-color: rgba(255, 41, 79, 0.5) !important;
  box-shadow: 0 0 10px rgba(255, 41, 79, 0.2) !important;
}

/* Leverage Controls - Glass Style */
.live-trading-interface .leverage-controls {
  margin-bottom: 16px !important;
  padding: 14px !important;
  background: rgba(0, 0, 0, 0.3) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 10px !important;
}

.live-trading-interface .leverage-display {
  color: #ff294f !important;
  font-family: 'Space Mono', monospace !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  text-shadow: 0 0 10px rgba(255, 41, 79, 0.3) !important;
}

.live-trading-interface .leverage-slider {
  width: 100% !important;
  height: 4px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 2px !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 12px 0 !important;
}

.live-trading-interface .leverage-slider::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  width: 16px !important;
  height: 16px !important;
  background: linear-gradient(135deg, #ff294f, #d32f2f) !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  box-shadow: 0 0 10px rgba(255, 41, 79, 0.5),
              0 2px 8px rgba(0, 0, 0, 0.3) !important;
  transition: all 0.2s ease !important;
}

.live-trading-interface .leverage-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2) !important;
  box-shadow: 0 0 18px rgba(255, 41, 79, 0.6),
              0 3px 12px rgba(0, 0, 0, 0.4) !important;
}

.live-trading-interface .leverage-presets {
  display: flex !important;
  gap: 6px !important;
  margin-top: 10px !important;
}

.live-trading-interface .leverage-preset {
  flex: 1 !important;
  padding: 6px 8px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 6px !important;
  color: rgba(255, 255, 255, 0.5) !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  text-align: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.live-trading-interface .leverage-preset:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.live-trading-interface .leverage-preset.active {
  background: linear-gradient(135deg, rgba(255, 41, 79, 0.25), rgba(255, 41, 79, 0.15)) !important;
  color: #fff !important;
  border-color: rgba(255, 41, 79, 0.5) !important;
  box-shadow: 0 0 12px rgba(255, 41, 79, 0.25) !important;
}

/* TP/SL Section - Glass Style */
.live-trading-interface .tp-sl-section {
  padding: 14px !important;
  background: rgba(0, 0, 0, 0.25) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 10px !important;
  margin-bottom: 16px !important;
}

.live-trading-interface .tp-sl-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 12px !important;
}

.live-trading-interface .tp-sl-header h4,
.live-trading-interface .tp-sl-header .title {
  color: rgba(255, 255, 255, 0.7) !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
}

.live-trading-interface .tp-sl-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
}

.live-trading-interface .tp-input,
.live-trading-interface .sl-input {
  padding: 10px 12px !important;
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 6px !important;
  color: #fff !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 12px !important;
}

.live-trading-interface .tp-input:focus {
  border-color: rgba(0, 200, 83, 0.5) !important;
  box-shadow: 0 0 10px rgba(0, 200, 83, 0.15) !important;
}

.live-trading-interface .sl-input:focus {
  border-color: rgba(211, 47, 47, 0.5) !important;
  box-shadow: 0 0 10px rgba(211, 47, 47, 0.15) !important;
}

/* Labels with subtle glow */
.live-trading-interface .input-label,
.live-trading-interface label {
  color: rgba(255, 255, 255, 0.5) !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 10px !important;
  font-weight: 500 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.8px !important;
  margin-bottom: 6px !important;
  display: block !important;
}

/* Section Headers */
.live-trading-interface .section-header,
.live-trading-interface .panel-header {
  color: rgba(255, 255, 255, 0.8) !important;
  font-family: 'Space Mono', monospace !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  padding-bottom: 10px !important;
  margin-bottom: 14px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* ===== INDICATOR LEGEND PANEL (Top-Left Overlay) - Compact TradingView Style ===== */

.lw-indicator-legend {
  position: absolute;
  top: 8px;
  left: 8px;
  right: auto !important; /* DO NOT stretch to right */
  z-index: 50;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start; /* Align children to left */
  gap: 4px;
  pointer-events: auto;
  width: auto !important;
  max-width: 280px !important; /* Cap max width */
  background: transparent !important; /* No background on container */
}

.lw-indicator-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: linear-gradient(145deg, rgba(15, 15, 22, 0.92), rgba(20, 20, 30, 0.92));
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--indicator-color, #2962ff);
  border-radius: 6px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  width: auto !important;
  max-width: fit-content !important;
  white-space: nowrap;
  align-self: flex-start; /* Don't stretch in flex container */
}

.lw-indicator-item:hover {
  background: linear-gradient(145deg, rgba(20, 20, 30, 0.96), rgba(25, 25, 40, 0.96));
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.lw-indicator-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.lw-indicator-name {
  flex: 0 0 auto; /* Don't stretch - fit content only */
  font-weight: 600;
  white-space: nowrap;
  color: #fff;
  letter-spacing: 0.3px;
}

.lw-indicator-value {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.lw-indicator-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.lw-indicator-item:hover .lw-indicator-actions {
  opacity: 1;
}

.lw-indicator-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-indicator-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.lw-indicator-btn.settings:hover {
  background: rgba(41, 98, 255, 0.25);
  border-color: rgba(41, 98, 255, 0.4);
  color: #4f8cff;
}

.lw-indicator-btn.remove:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.lw-indicator-btn svg {
  width: 12px;
  height: 12px;
}

/* Indicator Legend Header with Collapse Toggle */
.lw-indicator-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(15, 15, 22, 0.95);
  border-radius: 6px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  cursor: default;
  user-select: none;
  width: auto !important;
  max-width: fit-content !important;
  align-self: flex-start; /* Don't stretch */
}

.lw-indicator-toggle {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-indicator-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.lw-indicator-count {
  font-family: 'Space Mono', monospace;
}

/* ===== INDICATOR SETTINGS MODAL - TradingView Style ===== */

.lw-indicator-settings-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: linear-gradient(145deg, rgba(20, 20, 28, 0.98), rgba(15, 15, 22, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 0, 0, 0.4);
  min-width: 320px;
  overflow: hidden;
}

.lw-settings-content {
  display: flex;
  flex-direction: column;
}

.lw-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lw-settings-title {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.3px;
}

.lw-settings-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-settings-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.lw-settings-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lw-settings-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lw-settings-row label {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lw-settings-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  color: #fff;
  outline: none;
  transition: all 0.2s ease;
}

.lw-settings-input:focus {
  border-color: rgba(41, 98, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(41, 98, 255, 0.15);
}

.lw-settings-colors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lw-color-opt {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-color-opt:hover {
  transform: scale(1.1);
}

.lw-color-opt.active {
  border-color: #fff;
  box-shadow: 0 0 10px currentColor;
}

.lw-settings-widths {
  display: flex;
  gap: 8px;
}

.lw-width-opt {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-width-opt:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.lw-width-opt.active {
  background: rgba(41, 98, 255, 0.3);
  border-color: #2962ff;
  color: #fff;
}

.lw-settings-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.lw-settings-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lw-settings-btn.cancel {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

.lw-settings-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.lw-settings-btn.apply {
  background: linear-gradient(135deg, #2962ff, #1e4bd8);
  color: #fff;
}

.lw-settings-btn.apply:hover {
  background: linear-gradient(135deg, #3b73ff, #2962ff);
  box-shadow: 0 4px 12px rgba(41, 98, 255, 0.3);
}

/* ===== DRAWING PROPERTIES PANEL ===== */

.lw-drawing-props {
  position: absolute;
  top: 50px;
  right: 80px;
  z-index: 25;
  width: 220px;
  background: linear-gradient(160deg,
    rgba(25, 25, 35, 0.98) 0%,
    rgba(15, 15, 22, 0.99) 100%);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.lw-props-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lw-props-title {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lw-props-close {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-props-close:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.lw-props-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lw-props-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lw-props-row label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.lw-color-picker {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.lw-color-btn {
  width: 22px;
  height: 22px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-color-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 0 8px currentColor;
}

.lw-color-btn.active {
  border-color: #fff;
  box-shadow: 0 0 10px currentColor;
}

.lw-thickness-picker,
.lw-style-picker {
  display: flex;
  gap: 4px;
}

.lw-thickness-btn,
.lw-style-btn {
  flex: 1;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-thickness-btn:hover,
.lw-style-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.lw-thickness-btn.active,
.lw-style-btn.active {
  background: linear-gradient(135deg, rgba(41, 98, 255, 0.3), rgba(41, 98, 255, 0.15));
  border-color: rgba(41, 98, 255, 0.5);
  color: #fff;
}

.lw-props-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.lw-props-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lw-props-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.lw-props-btn.lw-props-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Drawing selected state highlight */
.lw-drawing-selected {
  filter: drop-shadow(0 0 4px rgba(41, 98, 255, 0.6));
}

/* ===== ANCHOR POINTS - TradingView Style (Show on Hover) ===== */
.lw-anchor-point {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #2962ff;
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: grab;
  z-index: 60;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.1s ease;
  transform: translate(-50%, -50%);
}

.lw-anchor-point:hover {
  transform: translate(-50%, -50%) scale(1.3);
  cursor: grab;
}

.lw-anchor-point:active {
  cursor: grabbing;
}

/* Show anchors when hovering on chart area with drawings */
.lw-chart-area:hover .lw-anchor-point,
.lw-chart-area.drawing-selected .lw-anchor-point {
  opacity: 1;
}

/* Always show anchors when drawing is selected */
.lw-drawing-hover .lw-anchor-point {
  opacity: 1;
}

/* Right-click context menu for drawings */
.lw-drawing-context-menu {
  position: fixed;
  background: rgba(30, 34, 45, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 0;
  min-width: 160px;
  z-index: 10000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.lw-drawing-context-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: #d1d4dc;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease;
}

.lw-drawing-context-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lw-drawing-context-menu button.danger {
  color: #f87171;
}

.lw-drawing-context-menu button.danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

.lw-drawing-context-menu .separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

/* ============================================================================
   PROFESSIONAL TRADING UI OVERHAUL - November 2025
   White text, subtle gray hover/active states, professional look
   ============================================================================ */

/* ===== GLOBAL BUTTON STYLING - TradingView Exact Style ===== */

/* Timeframe buttons - white active, grey inactive */
.lw-tf-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #d1d4dc !important;
}

.lw-tf-btn.active {
  background: #ffffff !important;
  color: #131722 !important;
  font-weight: 600 !important;
}

/* Drawing toolbar buttons - white active */
.lw-draw-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #d1d4dc !important;
}

.lw-draw-btn.active {
  background: #ffffff !important;
  color: #131722 !important;
}

/* Toolbar buttons - white active */
.lw-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #d1d4dc !important;
}

.lw-toolbar-btn.active {
  background: #ffffff !important;
  color: #131722 !important;
}

/* Dropdown items */
.lw-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #d1d4dc !important;
}

.lw-dropdown-item.active {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

.lw-dropdown-item.active::before {
  color: #ffffff !important;
}

/* Thickness and style buttons */
.lw-thickness-btn:hover,
.lw-style-btn:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

.lw-thickness-btn.active,
.lw-style-btn.active {
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
}

/* Custom timeframe button */
.lw-custom-tf-btn {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}

.lw-custom-tf-btn:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1) !important;
}

/* Props panel buttons */
.lw-props-btn:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

/* Action buttons */
.lw-action-btn:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

/* ===== TIMEFRAME DROPDOWN STYLES ===== */
.lw-timeframe-dropdown {
  position: relative;
  display: inline-flex;
}

.lw-tf-more-btn {
  padding: 0 14px !important;
  min-width: 70px;
}

.lw-timeframe-dropdown .lw-dropdown-menu {
  min-width: 120px;
  right: 0;
  left: auto;
}

.lw-timeframe-dropdown.open .lw-dropdown-menu {
  display: block;
}

/* ===== FIX: INDICATORS BUTTON SPACING ===== */
/* Ensure proper spacing and no overlap in toolbar */
.lw-chart-toolbar {
  gap: 8px !important;
  padding: 0 12px !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: thin;
  scrollbar-color: #ff294f #1a1a1f;
}

/* Dark charcoal + red scrollbar for chart toolbar */
.lw-chart-toolbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.lw-chart-toolbar::-webkit-scrollbar-track {
  background: #1a1a1f;
  border-radius: 4px;
}

.lw-chart-toolbar::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #ff294f, #cc2040);
  border-radius: 4px;
}

.lw-chart-toolbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #ff3d5e, #ff294f);
}

.lw-chart-toolbar::-webkit-scrollbar-corner {
  background: #1a1a1f;
}

.lw-toolbar-left {
  gap: 8px !important;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

.lw-timeframe-buttons {
  gap: 2px !important;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

.lw-indicator-dropdown,
.lw-compare-dropdown {
  flex-shrink: 0;
  margin-left: 12px;
}

.lw-indicator-dropdown .lw-toolbar-btn,
.lw-compare-dropdown .lw-toolbar-btn {
  padding: 8px 14px !important;
  white-space: nowrap;
  font-size: 12px !important;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.lw-indicator-dropdown .lw-toolbar-btn:hover,
.lw-compare-dropdown .lw-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Indicator legend positioning - move below toolbar */
.lw-indicator-legend {
  top: 8px !important;
  left: 8px !important;
  z-index: 20 !important;
}

/* ===== FIX: CHART WIDTH & Y-AXIS VISIBILITY ===== */
/* Ensure the price scale on the right is visible */
.trading-layout-smart {
  display: grid !important;
  /* Chart fills remaining, trading panel fixed - ensure room for price axis */
  grid-template-columns: 1fr 300px !important;
  gap: 16px !important;
  width: calc(100% - 20px) !important; /* Leave space for price scale */
  max-width: calc(100% - 20px) !important;
  overflow: visible !important;
  box-sizing: border-box !important;
  padding: 0 !important;
}

.chart-section-smart {
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: visible !important; /* Allow price scale to show */
  box-sizing: border-box !important;
  position: relative !important;
}

.lw-chart-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important; /* Allow price scale labels to show fully */
  box-sizing: border-box !important;
}

/* Ensure custom labels can extend over price scale */
.lw-custom-labels {
  pointer-events: none;
  z-index: 100 !important;
}

.lw-custom-labels > * {
  pointer-events: auto;
}

.lw-chart-body {
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
  box-sizing: border-box !important;
  flex: 1;
  min-height: 0;
  display: flex;
}

.lw-chart-container {
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
  box-sizing: border-box !important;
  position: relative !important;
  flex: 1;
  min-height: 300px;
  height: 100%; /* Fill chart-body height */
}

/* Ensure Lightweight Charts canvas shows properly */
.lw-chart-container > div,
.lw-chart-container canvas {
  overflow: visible !important;
}

/* Glass labels container - position ON the price scale axis */
.lw-custom-labels {
  position: absolute !important;
  top: 0 !important;
  /* Right position set by JS to align with price scale width */
  bottom: 0 !important;
  pointer-events: none !important;
  z-index: 200 !important;
  overflow: visible !important;
}

.lw-custom-labels > * {
  pointer-events: auto !important;
}

/* Individual glass labels - align right edge with price scale */
.lw-glass-label {
  right: 0 !important;
  margin-right: 2px !important;
}

/* Price scale (Y-axis) visibility fix */
.tv-lightweight-charts {
  max-width: 100% !important;
  overflow: visible !important;
}

/* Drawing toolbar takes fixed width, chart fills rest */
.lw-drawing-toolbar {
  flex-shrink: 0 !important;
  width: 44px !important;
  min-width: 44px !important;
}

.lw-chart-main,
.lw-chart-container {
  flex: 1 !important;
  min-width: 0 !important;
  /* Allow labels and overlays to extend beyond boundaries */
  overflow: visible !important;
}

/* Ensure the chart canvas respects container boundaries */
.lw-chart-container .tv-lightweight-charts,
.lw-chart-container > div:first-child {
  width: 100% !important;
  max-width: 100% !important;
}

/* Right padding for price scale visibility - CRITICAL */
.lw-chart-body {
  display: flex !important;
  padding-right: 0 !important;
}

/* Ensure grid doesn't overflow into trading panel */
.trading-layout-smart {
  overflow: hidden !important;
  padding-right: 0 !important;
}

/* Price scale needs to be visible */
.chart-section-smart {
  overflow: visible !important;
  padding-right: 10px !important;
}

/* ===== PROFESSIONAL RIGHT SIDE PANEL BUTTONS ===== */

/* Trading Panel Tabs - Professional Dark Style */
.trading-panel-tabs {
  background: #0f0f12 !important;
  padding: 6px !important;
  gap: 4px !important;
  border-radius: 10px 10px 0 0 !important;
}

.trading-panel-tab {
  flex: 1;
  padding: 14px 16px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.6) !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  cursor: pointer;
  min-height: 46px !important;
  border-radius: 8px !important;
  transition: all 0.2s ease;
}

.trading-panel-tab:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.trading-panel-tab.active {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

/* Order Type Tabs (Market/Limit) - Professional */
.order-type-tabs {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  padding: 4px !important;
}

.tab-btn {
  padding: 12px 16px !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  color: rgba(255, 255, 255, 0.6) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  border-radius: 8px !important;
  min-height: 42px !important;
  margin: 2px !important;
  transition: all 0.2s ease !important;
}

.tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Long/Short Trade Buttons - Professional Gradient */
.trade-action-buttons {
  gap: 12px !important;
  margin: 16px 0 !important;
}

.trade-btn {
  padding: 18px 20px !important;
  border-radius: 12px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  min-height: 56px !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  transition: all 0.25s ease !important;
  border: none !important;
}

.trade-btn.buy-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3) !important;
}

.trade-btn.buy-btn:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4) !important;
}

.trade-btn.sell-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3) !important;
}

.trade-btn.sell-btn:hover {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4) !important;
}

/* Percentage Buttons - Professional Style */
.percentage-buttons {
  gap: 8px !important;
  margin: 12px 0 !important;
}

.pct-btn {
  padding: 12px 14px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 10px !important;
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  min-height: 42px !important;
  transition: all 0.2s ease !important;
}

.pct-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

.pct-btn.active {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* Leverage Section - Professional */
.leverage-section {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 12px !important;
  padding: 16px !important;
}

.leverage-display {
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 18px !important;
}

.leverage-slider {
  height: 6px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 3px !important;
}

.leverage-slider::-webkit-slider-thumb {
  width: 20px !important;
  height: 20px !important;
  background: linear-gradient(135deg, #ffffff 0%, #e5e5e5 100%) !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* TP/SL Inputs - Professional */
.tp-sl-section {
  border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
  padding-top: 16px !important;
}

.tp-input-group input,
.sl-input-group input {
  padding: 14px 16px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 10px !important;
  color: #ffffff !important;
  font-size: 14px !important;
  transition: all 0.2s ease !important;
}

.tp-input-group input:focus,
.sl-input-group input:focus {
  border-color: rgba(255, 255, 255, 0.3) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  outline: none !important;
}

.tp-input-group label,
.sl-input-group label {
  color: rgba(255, 255, 255, 0.6) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

/* Position Action Buttons - Professional */
.position-action-btn {
  padding: 14px 18px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  color: rgba(255, 255, 255, 0.8) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
}

.position-action-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
}

.position-action-btn.add-position-btn:hover {
  border-color: rgba(16, 185, 129, 0.4) !important;
  background: rgba(16, 185, 129, 0.1) !important;
}

.position-action-btn.flip-position-btn:hover {
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.position-action-btn.close-position-btn:hover {
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

/* Quick Action Buttons - Professional */
.quick-action-btn {
  padding: 14px 12px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  min-height: 52px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  transition: all 0.2s ease !important;
}

.quick-action-btn:hover:not(:disabled) {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2) !important;
}

/* Bot Allocation Section - Professional */
.bot-allocation-section {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 12px !important;
  padding: 18px !important;
}

.increase-allocation-btn {
  padding: 14px 18px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 10px !important;
  color: rgba(255, 255, 255, 0.8) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
}

.increase-allocation-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

/* Amount & Price Inputs - Professional */
.amount-input,
.price-input {
  padding: 14px 16px !important;
  padding-right: 60px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 10px !important;
  color: #ffffff !important;
  font-size: 15px !important;
  transition: all 0.2s ease !important;
}

.amount-input:focus,
.price-input:focus {
  border-color: rgba(255, 255, 255, 0.3) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1) !important;
  outline: none !important;
}

/* Currency Label */
.currency-label {
  color: rgba(255, 255, 255, 0.5) !important;
  font-weight: 500 !important;
}

/* Input Labels */
.input-label {
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  margin-bottom: 8px !important;
}

/* Section Headers */
.trading-panel h4 {
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px !important;
}

/* Trading Panel Content */
.trading-panel-content {
  padding: 18px !important;
  background: #0a0a0e !important;
}

/* Exchange Trading Controls */
.exchange-trading-controls {
  padding: 16px !important;
  gap: 16px !important;
}

/* Cancel/Confirm Modal Buttons */
.cancel-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 10px !important;
  color: rgba(255, 255, 255, 0.8) !important;
  font-weight: 600 !important;
  padding: 14px 20px !important;
}

.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

.confirm-btn {
  border-radius: 10px !important;
  font-weight: 600 !important;
  padding: 14px 20px !important;
}

/* Position Section - Professional */
.position-section,
.orders-section,
.quick-actions-section,
.live-stats-section {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 12px !important;
  padding: 16px !important;
}

/* Stats Items */
.stat-item {
  padding: 10px 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
}

.stat-label {
  color: rgba(255, 255, 255, 0.5) !important;
}

.stat-value {
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* Compact Styles Override */
.order-type-tabs.compact .tab-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.6) !important;
  border-radius: 8px !important;
}

.order-type-tabs.compact .tab-btn.active {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.order-type-tabs.compact .tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.percentage-buttons.compact .pct-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.7) !important;
  border-radius: 8px !important;
}

.percentage-buttons.compact .pct-btn:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

/* Compact Trade Buttons */
.trade-action-buttons.compact .trade-btn {
  border-radius: 10px !important;
  font-weight: 700 !important;
}

.trade-action-buttons.compact .trade-btn.buy-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border: none !important;
}

.trade-action-buttons.compact .trade-btn.sell-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  border: none !important;
}



/* Indicator hint text */
.lw-indicator-hint {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
  margin-left: 6px;
  font-style: italic;
}

/* Indicator legend - DUPLICATE RULES REMOVED - see line ~6111 for canonical styles */
/* Only override specific fixes here */

/* Drawing button active state - white background */
.lw-draw-btn.active {
  background: #ffffff !important;
  color: #131722 !important;
}

/* ===== RECENT USER ACTIONS SECTION - PREMIUM STYLE ===== */
.user-actions-section {
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg,
    rgba(25, 25, 35, 0.95) 0%,
    rgba(15, 15, 22, 0.98) 50%,
    rgba(10, 10, 14, 1) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex: 1;
  min-height: 160px;
  max-height: 280px;
  position: relative;
}

/* Shimmer effect on top edge */
.user-actions-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(120, 120, 140, 0.3) 20%,
    rgba(160, 160, 180, 0.5) 50%,
    rgba(120, 120, 140, 0.3) 80%,
    transparent 100%);
  opacity: 0.8;
}

.user-actions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
}

.user-actions-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.user-actions-stats {
  display: flex;
  gap: 12px;
  align-items: center;
}

.stat-badge {
  font-size: 11px;
  font-weight: 600;
  font-family: 'Space Mono', monospace;
  color: rgba(255, 255, 255, 0.6);
  background: none;
  padding: 0;
  letter-spacing: 0.3px;
}

.stat-badge.stat-orders {
  color: rgba(255, 255, 255, 0.5);
}

.stat-badge.stat-long {
  color: #4ade80;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

.stat-badge.stat-short {
  color: #f87171;
  text-shadow: 0 0 8px rgba(248, 113, 113, 0.4);
}

.user-actions-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px;
  scrollbar-width: thin;
  scrollbar-color: #4a1a1a #0a0a0c;
}

/* Dark red scrollbar for webkit browsers */
.user-actions-list::-webkit-scrollbar {
  width: 6px;
}

.user-actions-list::-webkit-scrollbar-track {
  background: #0a0a0c;
  border-radius: 3px;
}

.user-actions-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #5a2020 0%, #3a1515 100%);
  border-radius: 3px;
}

.user-actions-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6a2525 0%, #4a1a1a 100%);
}

.user-action-empty {
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  text-align: center;
  padding: 20px 10px;
  font-style: italic;
}

/* Premium action item card styling */
.user-action-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: linear-gradient(160deg,
    rgba(35, 35, 48, 0.6) 0%,
    rgba(20, 20, 30, 0.7) 50%,
    rgba(28, 28, 38, 0.6) 100%);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Subtle corner glow */
.user-action-item::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 30px;
  background: radial-gradient(circle at top right, var(--action-glow, rgba(255,255,255,0.1)) 0%, transparent 70%);
  opacity: 0.3;
  transition: opacity 0.25s ease;
}

.user-action-item:hover {
  background: linear-gradient(160deg,
    rgba(45, 45, 60, 0.8) 0%,
    rgba(28, 28, 40, 0.85) 50%,
    rgba(35, 35, 48, 0.8) 100%);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.user-action-item:hover::after {
  opacity: 0.6;
}

/* Action type specific styling - BUY/LONG */
.user-action-item.action-buy {
  border-left-color: #22c55e;
  --action-glow: rgba(34, 197, 94, 0.4);
}

.user-action-item.action-buy.active {
  animation: actionPulseGreen 2s ease-in-out infinite;
}

/* Action type specific styling - SELL/SHORT */
.user-action-item.action-sell {
  border-left-color: #ef4444;
  --action-glow: rgba(239, 68, 68, 0.4);
}

.user-action-item.action-sell.active {
  animation: actionPulseRed 2s ease-in-out infinite;
}

/* Action type specific styling - Stop Loss */
.user-action-item.action-sl {
  border-left-color: #f59e0b;
  --action-glow: rgba(245, 158, 11, 0.4);
}

/* Action type specific styling - Take Profit */
.user-action-item.action-tp {
  border-left-color: #3b82f6;
  --action-glow: rgba(59, 130, 246, 0.4);
}

/* Action type specific styling - Close */
.user-action-item.action-close {
  border-left-color: #a855f7;
  --action-glow: rgba(168, 85, 247, 0.4);
}

/* Action type specific styling - Modify */
.user-action-item.action-modify {
  border-left-color: #6b7280;
  --action-glow: rgba(107, 114, 128, 0.3);
}

/* Closed/completed actions - no animation, muted */
.user-action-item.closed {
  opacity: 0.7;
  background: linear-gradient(160deg,
    rgba(25, 25, 35, 0.5) 0%,
    rgba(18, 18, 26, 0.6) 100%);
}

.user-action-item.closed:hover {
  opacity: 0.85;
}

/* Pulse animations for active trades */
@keyframes actionPulseGreen {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0),
                inset 0 0 0 rgba(34, 197, 94, 0);
  }
  50% {
    box-shadow: 0 0 12px 2px rgba(34, 197, 94, 0.2),
                inset 0 0 8px rgba(34, 197, 94, 0.05);
  }
}

@keyframes actionPulseRed {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0),
                inset 0 0 0 rgba(239, 68, 68, 0);
  }
  50% {
    box-shadow: 0 0 12px 2px rgba(239, 68, 68, 0.2),
                inset 0 0 8px rgba(239, 68, 68, 0.05);
  }
}

.user-action-icon {
  font-size: 14px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.user-action-item:hover .user-action-icon {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.1);
}

.user-action-content {
  flex: 1;
  min-width: 0;
}

.user-action-text {
  font-size: 13px;
  color: #ffffff;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.user-action-time {
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
  letter-spacing: 0.3px;
}

/* Make trading panel use full height with flex */
.exchange-trading-controls {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.trading-panel-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

