@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-main: #060913;
  --bg-card: rgba(15, 22, 42, 0.45);
  --bg-card-hover: rgba(20, 30, 55, 0.6);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-glow: rgba(99, 102, 241, 0.25);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --color-accent: #6366f1;
  --color-accent-hover: #4f46e5;
  --color-accent-glow: rgba(99, 102, 241, 0.4);
  
  --color-up: #10b981;
  --color-up-glow: rgba(16, 185, 129, 0.25);
  --color-up-bg: rgba(16, 185, 129, 0.1);
  
  --color-down: #f43f5e;
  --color-down-glow: rgba(244, 63, 94, 0.25);
  --color-down-bg: rgba(244, 63, 94, 0.1);

  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow-x: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Background glowing orbs */
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
}
.orb-1 {
  top: -10%;
  right: 15%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--color-accent) 0%, transparent 80%);
}
.orb-2 {
  bottom: 10%;
  left: 5%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--color-up-glow) 0%, transparent 80%);
}

/* Header styling */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: rgba(11, 17, 32, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  background: linear-gradient(135deg, var(--color-accent), #818cf8);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  box-shadow: 0 0 15px var(--color-accent-glow);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.market-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  transition: all 0.3s ease;
}

/* Default / Red state (until user logs in) */
.market-status,
.market-status.status-red {
  background: rgba(244, 63, 94, 0.12);
  color: var(--color-down, #f43f5e);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.market-status .status-dot,
.market-status.status-red .status-dot {
  background-color: var(--color-down, #f43f5e);
  box-shadow: 0 0 8px var(--color-down, #f43f5e);
  animation: pulse-red 2s infinite;
}

.market-status #terminalLatency,
.market-status.status-red #terminalLatency {
  color: var(--color-down, #f43f5e) !important;
}

/* Active / Green state (when user logs in) */
.market-status.status-green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-up, #10b981);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.market-status.status-green .status-dot {
  background-color: var(--color-up, #10b981);
  box-shadow: 0 0 8px var(--color-up, #10b981);
  animation: pulse 2s infinite;
}

.market-status.status-green #terminalLatency {
  color: var(--color-up, #10b981) !important;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.balance-preview {
  text-align: right;
}

.balance-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.balance-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--color-accent);
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Layout flex container with active drag-resizing splitters */
.dashboard-container {
  display: flex;
  height: calc(100vh - 60px);
  background: var(--border-color);
  flex-grow: 1;
  overflow: hidden;
}

#panelWatchlist {
  width: 280px;
  flex-shrink: 0;
}

#panelCenter {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#panelOrder {
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
}

/* Premium Workspace Glowing Drag Splitter Bars */
.resizer-col {
  width: 6px;
  background: rgba(255, 255, 255, 0.02);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.15s ease;
  z-index: 50;
  position: relative;
}
.resizer-col::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.15s ease;
}
.resizer-col:hover::after, .resizer-col.dragging::after {
  background: var(--color-accent);
  box-shadow: 0 0 8px var(--color-accent);
}

.resizer-row {
  height: 6px;
  background: rgba(255, 255, 255, 0.02);
  cursor: row-resize;
  flex-shrink: 0;
  transition: background 0.15s ease;
  z-index: 50;
  position: relative;
}
.resizer-row::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.15s ease;
}
.resizer-row:hover::after, .resizer-row.dragging::after {
  background: var(--color-accent);
  box-shadow: 0 0 8px var(--color-accent);
}

.panel {
  background: rgba(8, 13, 27, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

/* Market Category Selector Pills */
.market-category-selector {
  display: flex;
  gap: 0.25rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.2rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.market-category-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 0.15rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.2;
  transition: var(--transition-smooth);
}

.market-category-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
}

.market-category-btn.active {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
}

/* Sidebar / Watchlist Panel */
.watchlist-search {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.search-input-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 0.75rem 0.5rem 2.2rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-smooth);
}

.search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

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

.watchlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.watchlist-item:hover, .watchlist-item.active {
  background: rgba(99, 102, 241, 0.08);
}

.watchlist-item.active {
  border-left: 3px solid var(--color-accent);
}

.asset-info {
  display: flex;
  flex-direction: column;
}

.asset-symbol {
  font-weight: 600;
  font-size: 0.95rem;
}

.asset-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.watchlist-sparkline {
  width: 60px;
  height: 25px;
}

.asset-price-col {
  text-align: right;
}

.asset-price {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.9rem;
}

.asset-change {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
}

.change-up {
  color: var(--color-up);
}

.change-down {
  color: var(--color-down);
}

/* Center Content (Chart + Portfolio) */
.center-content {
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
  border-right: 1px solid var(--border-color);
  border-left: 1px solid var(--border-color);
}

.chart-section {
  height: 420px;
  min-height: 200px;
  max-height: 800px;
  resize: vertical;
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  background: rgba(6, 9, 19, 0.8);
  border-bottom: 1px solid var(--border-color);
}

.chart-controls {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.timeframe-selector {
  display: flex;
  gap: 0.25rem;
  background: rgba(15, 23, 42, 0.85);
  padding: 0.2rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  transition: var(--transition-smooth);
}

.timeframe-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.timeframe-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
}

.timeframe-btn.active {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
}

#btnToggleSMA.active {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
}

#btnIndicators.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--color-accent);
  border-color: rgba(99, 102, 241, 0.4);
}

/* Technical Indicators Dropdown Panel (Base / Dark Mode) */
.indicators-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 99999;
  background: #0b1120;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 8px;
  padding: 0.9rem;
  width: 280px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.indicators-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.4rem;
}

.indicators-panel-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.indicators-panel-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.2rem;
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.indicators-panel-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.indicators-panel-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.indicator-option-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-primary);
  transition: color 0.15s ease;
  user-select: none;
}

.indicator-option-label:hover {
  color: var(--color-accent);
}

.active-asset-display {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.active-symbol {
  font-size: 1.15rem;
  font-weight: 700;
}

.active-price-info {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.active-price {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
}

.chart-canvas-container {
  flex-grow: 1;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
}

canvas#mainChart {
  width: 100%;
  height: 100%;
  display: block;
}

/* Portfolio & Positions Section (Bottom Center) */
.portfolio-section {
  flex-grow: 1;
  background: rgba(8, 13, 27, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.portfolio-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.3);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.portfolio-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
}

.tab-content {
  flex-grow: 1;
  overflow-y: auto;
  position: relative;
}

.tab-pane {
  display: none;
  height: 100%;
}

.tab-pane.active {
  display: block;
}

/* Table Style */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.data-table th {
  padding: 0.6rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.1);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.btn-close-position {
  background: var(--color-down-bg);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--color-down);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: var(--transition-smooth);
}

.btn-close-position:hover {
  background: var(--color-down);
  color: white;
  box-shadow: 0 0 8px var(--color-down-glow);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 150px;
  color: var(--text-muted);
  gap: 0.5rem;
}

/* Order Execution Panel (Right Side) */
.execution-panel {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.trade-type-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.trade-type-btn {
  background: transparent;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.trade-type-btn.btn-buy.active {
  background: var(--color-up);
  color: white;
  box-shadow: 0 0 12px var(--color-up-glow);
}

.trade-type-btn.btn-sell.active {
  background: var(--color-down);
  color: white;
  box-shadow: 0 0 12px var(--color-down-glow);
}

/* Order Type Switcher (Market vs Limit) */
.order-type-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  gap: 0.25rem;
}

.order-type-btn {
  background: transparent;
  border: none;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.order-type-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.order-type-btn.active {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

/* Feature Panel Card (Risk Calculator, Trailing Stop) */
.feature-panel-card {
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  animation: slideDown 0.3s ease-out;
}

/* Calculations / Order Summary Card */
.order-summary-box {
  background: rgba(15, 23, 42, 0.5);
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.input-control {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
}

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

.input-suffix {
  position: absolute;
  right: 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Leverage Slider */
.slider-container {
  margin-top: 0.25rem;
}

.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--color-accent-glow);
  transition: var(--transition-smooth);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.summary-row.total {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 600;
  border-top: 1px dashed var(--border-color);
  padding-top: 0.6rem;
  margin-top: 0.4rem;
}

.btn-execute {
  width: 100%;
  padding: 0.85rem;
  border: none;
  border-radius: 8px;
  color: white;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  margin-top: 0.5rem;
}

.btn-execute.buy {
  background: linear-gradient(135deg, var(--color-up), #34d399);
  box-shadow: 0 4px 15px var(--color-up-glow);
}

.btn-execute.buy:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-execute.sell {
  background: linear-gradient(135deg, var(--color-down), #fb7185);
  box-shadow: 0 4px 15px var(--color-down-glow);
}

.btn-execute.sell:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4);
}

/* Market Sentiment Card */
.sentiment-container {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
}

.sentiment-gauge {
  height: 8px;
  background: linear-gradient(to right, var(--color-down), #eab308, var(--color-up));
  border-radius: 4px;
  position: relative;
  margin: 1rem 0;
}

.sentiment-pointer {
  width: 4px;
  height: 14px;
  background: white;
  border-radius: 2px;
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  transition: left 0.5s ease;
}

/* News Feed list */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  max-height: 250px;
  overflow-y: scroll;
  flex-grow: 1;
}

.news-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 0.75rem;
  animation: fadeIn 0.4s ease-out;
}

body.light-mode .news-item {
  border-bottom-color: rgba(15, 23, 42, 0.06);
}

.news-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  margin-bottom: 0.2rem;
}

.news-source {
  color: var(--color-accent);
  font-weight: 600;
  text-transform: uppercase;
}

.news-time {
  color: var(--text-muted);
}

.news-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
}

.news-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  text-transform: uppercase;
  margin-left: 0.5rem;
}

.news-badge.bullish {
  background: var(--color-up-bg);
  color: var(--color-up);
}

.news-badge.bearish {
  background: var(--color-down-bg);
  color: var(--color-down);
}

.news-badge.neutral {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.asset-vol {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.1rem;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Keyframe animations */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes pulse-red {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(244, 63, 94, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(244, 63, 94, 0);
  }
}

/* Responsive Styles */
@media(max-width: 1024px) {
  .dashboard-container {
    grid-template-columns: 220px 1fr 280px;
  }
}
@media(max-width: 768px) {
  .dashboard-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    overflow-y: auto;
    height: auto;
  }
  .panel {
    max-height: 500px;
  }
  .chart-section {
    min-height: 400px;
  }
}

/* Light Mode Variables & Overrides */
body.light-mode {
  --bg-main: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --border-color: rgba(15, 23, 42, 0.12);
  --border-color-glow: rgba(99, 102, 241, 0.2);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --color-accent: #4f46e5;
  --color-accent-hover: #4338ca;
  --color-accent-glow: rgba(79, 70, 229, 0.25);
  
  --color-up: #059669;
  --color-up-glow: rgba(5, 150, 105, 0.2);
  --color-up-bg: rgba(5, 150, 105, 0.1);
  
  --color-down: #e11d48;
  --color-down-glow: rgba(225, 29, 72, 0.2);
  --color-down-bg: rgba(225, 29, 72, 0.1);
}

body.light-mode .glow-orb {
  opacity: 0.06;
}

/* Header Deposit & Withdraw Action Buttons */
.btn-header-deposit {
  padding: 0.25rem 0.6rem;
  font-weight: 700;
  color: var(--color-up);
  font-size: 0.75rem;
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
  transition: var(--transition-smooth);
}
.btn-header-deposit:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--color-up);
}

.btn-header-withdraw {
  padding: 0.25rem 0.6rem;
  font-weight: 700;
  color: var(--color-down);
  font-size: 0.75rem;
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.1);
  transition: var(--transition-smooth);
}
.btn-header-withdraw:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--color-down);
}

body.light-mode .btn-header-deposit {
  color: #059669;
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.25);
}
body.light-mode .btn-header-deposit:hover {
  background: rgba(5, 150, 105, 0.16);
  border-color: #059669;
}

body.light-mode .btn-header-withdraw {
  color: #e11d48;
  background: rgba(225, 29, 72, 0.08);
  border-color: rgba(225, 29, 72, 0.25);
}
body.light-mode .btn-header-withdraw:hover {
  background: rgba(225, 29, 72, 0.16);
  border-color: #e11d48;
}

/* Header & Branding */
body.light-mode header {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

body.light-mode .logo-text {
  background: linear-gradient(to right, #0f172a, #4f46e5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-mode .latency-pill {
  background: rgba(5, 150, 105, 0.1);
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.25);
}

/* Layout Panels */
body.light-mode .panel {
  background: rgba(255, 255, 255, 0.75);
}

body.light-mode .panel-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

body.light-mode .panel-title {
  color: #0f172a;
  font-weight: 700;
}

body.light-mode .chart-section {
  background: rgba(255, 255, 255, 0.92);
}

/* Watchlist Category Tabs & Search */
body.light-mode .market-category-selector {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

body.light-mode .market-category-btn {
  color: #475569;
  font-weight: 600;
}

body.light-mode .market-category-btn:hover {
  color: var(--color-accent);
  background: rgba(79, 70, 229, 0.08);
}

body.light-mode .market-category-btn.active {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

body.light-mode .search-input {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

body.light-mode .search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

body.light-mode .watchlist-item {
  border-bottom-color: rgba(15, 23, 42, 0.06);
}

body.light-mode .watchlist-item:hover {
  background: rgba(79, 70, 229, 0.05);
}

body.light-mode .watchlist-item.active {
  background: rgba(79, 70, 229, 0.08);
  border-left: 3px solid var(--color-accent);
}

body.light-mode .asset-symbol {
  color: #0f172a;
}

body.light-mode .asset-name {
  color: #64748b;
}

body.light-mode .asset-price {
  color: #0f172a;
}

body.light-mode .asset-vol {
  color: #64748b;
}

/* Active Asset Display in Chart Bar */
body.light-mode .active-symbol {
  color: #0f172a;
}

body.light-mode .active-price {
  color: #0f172a;
}

/* Chart Toolbar Controls */
body.light-mode .timeframe-selector {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

body.light-mode .timeframe-btn {
  color: #334155;
  font-weight: 600;
}

body.light-mode .timeframe-btn:hover {
  background: rgba(79, 70, 229, 0.08);
  color: var(--color-accent);
}

body.light-mode .timeframe-btn.active {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

body.light-mode #btnToggleSMA {
  color: #334155;
}

body.light-mode #btnToggleSMA:hover {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

body.light-mode #btnToggleSMA.active {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
  border-color: #f59e0b;
}

body.light-mode #btnIndicators {
  color: #334155;
}

body.light-mode #btnIndicators:hover {
  background: rgba(79, 70, 229, 0.08);
  color: var(--color-accent);
}

body.light-mode #btnIndicators.active {
  background: rgba(79, 70, 229, 0.14);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Technical Indicators Modal Dropdown in Light Mode */
body.light-mode .indicators-panel,
body.light-mode #indicatorsPanel {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.15);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.15);
  color: #0f172a;
}

body.light-mode .indicators-panel-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

body.light-mode .indicators-panel-title,
body.light-mode #indicatorsPanel span {
  color: #0f172a;
}

body.light-mode .indicators-panel-close,
body.light-mode #btnCloseIndicators {
  color: #64748b;
}

body.light-mode .indicators-panel-close:hover,
body.light-mode #btnCloseIndicators:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.06);
}

body.light-mode .indicator-option-label,
body.light-mode #indicatorsPanel label {
  color: #1e293b;
}

body.light-mode .indicator-option-label:hover,
body.light-mode #indicatorsPanel label:hover {
  color: var(--color-accent);
}

/* Key Levels Box Below Chart */
body.light-mode .key-levels-box {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

body.light-mode .key-levels-header {
  color: #64748b;
  font-weight: 600;
}

body.light-mode .key-level-item {
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

body.light-mode .key-level-item:hover {
  background: rgba(79, 70, 229, 0.06);
  border-color: rgba(79, 70, 229, 0.3);
}

body.light-mode .key-level-label {
  color: #64748b;
  font-weight: 600;
}

body.light-mode .key-level-value {
  color: #0f172a;
  font-weight: 700;
}

/* Workspace Splitter Bars */
body.light-mode .resizer-col,
body.light-mode .resizer-row {
  background: rgba(15, 23, 42, 0.04);
}

body.light-mode .resizer-col::after,
body.light-mode .resizer-row::after {
  background: rgba(15, 23, 42, 0.14);
}

body.light-mode .resizer-col:hover::after,
body.light-mode .resizer-row:hover::after,
body.light-mode .resizer-col.dragging::after,
body.light-mode .resizer-row.dragging::after {
  background: var(--color-accent);
  box-shadow: 0 0 8px rgba(79, 70, 229, 0.4);
}

/* Portfolio Section & Tabs */
body.light-mode .portfolio-section {
  background: rgba(255, 255, 255, 0.85);
}

body.light-mode .portfolio-tabs {
  background: #ffffff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

body.light-mode .tab-btn {
  color: #475569;
  font-weight: 600;
}

body.light-mode .tab-btn:hover {
  color: var(--color-accent);
  background: rgba(79, 70, 229, 0.04);
}

body.light-mode .tab-btn.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 700;
  background: rgba(79, 70, 229, 0.06);
}

body.light-mode .portfolio-stats-grid {
  background: #ffffff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

body.light-mode .stat-card .stat-label {
  color: #64748b;
  font-weight: 600;
}

body.light-mode .stat-card .stat-value {
  color: #0f172a;
  font-weight: 700;
}

/* Data Tables & Blotter */
body.light-mode .data-table th {
  background: rgba(15, 23, 42, 0.03);
  color: #475569;
  font-weight: 700;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

body.light-mode .data-table td {
  color: #0f172a;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

body.light-mode .data-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.02);
}

body.light-mode .btn-close-position {
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.25);
  color: #e11d48;
}

body.light-mode .btn-close-position:hover {
  background: #e11d48;
  color: #ffffff;
}

body.light-mode .empty-state {
  color: #64748b;
}

/* Statistics Pane in Light Mode */
body.light-mode .stat-box-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

body.light-mode .stat-chart-container {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  color: #0f172a;
}

/* Banking Pane in Light Mode */
body.light-mode .banking-form-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.05);
}

body.light-mode .banking-tab-toggle {
  background: rgba(15, 23, 42, 0.04);
}

body.light-mode .banking-fee-card {
  background: rgba(15, 23, 42, 0.03);
  color: #475569;
}

body.light-mode .banking-rail-card,
body.light-mode .banking-ledger-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

body.light-mode .banking-address-box {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.14);
}

/* Order Execution Panel */
body.light-mode .trade-type-tabs {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

body.light-mode .trade-type-btn {
  color: #475569;
  font-weight: 600;
}

body.light-mode .trade-type-btn.btn-buy:not(.active):hover {
  background: rgba(5, 150, 105, 0.08);
  color: var(--color-up);
}

body.light-mode .trade-type-btn.btn-sell:not(.active):hover {
  background: rgba(225, 29, 72, 0.08);
  color: var(--color-down);
}

body.light-mode .order-type-tabs {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

body.light-mode .order-type-btn {
  color: #475569;
}

body.light-mode .order-type-btn:hover {
  background: rgba(79, 70, 229, 0.08);
  color: var(--color-accent);
}

body.light-mode .order-type-btn.active {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

body.light-mode .form-label {
  color: #475569;
  font-weight: 600;
}

body.light-mode .input-control {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

body.light-mode .input-control:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

body.light-mode .input-suffix {
  color: #64748b;
  font-weight: 600;
}

body.light-mode .range-slider {
  background: rgba(15, 23, 42, 0.12);
}

body.light-mode .slider-labels span {
  color: #64748b;
  font-weight: 500;
}

body.light-mode .order-summary-box {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

body.light-mode .summary-row {
  color: #475569;
}

body.light-mode .summary-row span:last-child {
  color: #0f172a;
  font-weight: 600;
}

body.light-mode .summary-row.total {
  color: #0f172a;
  border-top: 1px dashed rgba(15, 23, 42, 0.14);
  font-weight: 700;
}

body.light-mode .summary-row.total span:last-child {
  color: #0f172a;
  font-weight: 700;
}

body.light-mode .feature-panel-card,
body.light-mode #riskCalculatorPanel,
body.light-mode #trailingStopSettings {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

body.light-mode #economicCalendarWidget {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

body.light-mode .calendar-event-item {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: #f8fafc;
}

body.light-mode .calendar-event-item:hover {
  background: #f1f5f9;
}

body.light-mode .calendar-currency-badge {
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
}

body.light-mode .calendar-impact-badge.high {
  color: #e11d48;
  background: rgba(225, 29, 72, 0.1);
}

body.light-mode .calendar-impact-badge.medium {
  color: #b45309;
  background: rgba(217, 119, 6, 0.12);
}

body.light-mode .calendar-impact-badge.low {
  color: #64748b;
  background: rgba(100, 116, 139, 0.12);
}

body.light-mode #chartLegendOverlay {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

body.light-mode .stat-card-enhanced {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

body.light-mode .stat-card-enhanced:hover {
  background: #f8fafc;
  border-color: var(--color-accent);
}

body.light-mode .key-levels-grid {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

body.light-mode .input-control::placeholder,
body.light-mode .search-input::placeholder {
  color: #94a3b8;
}

body.light-mode .btn-close-panel {
  color: #64748b;
}

body.light-mode .btn-close-panel:hover {
  color: #0f172a;
}

/* Order Confirmation Dialog (Light Mode) */
body.light-mode .order-confirm-card {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

body.light-mode .order-confirm-side-badge.buy {
  background: rgba(5, 150, 105, 0.1);
  color: #059669;
  border-color: rgba(5, 150, 105, 0.25);
}

body.light-mode .order-confirm-side-badge.sell {
  background: rgba(225, 29, 72, 0.1);
  color: #e11d48;
  border-color: rgba(225, 29, 72, 0.25);
}

body.light-mode .order-confirm-type-badge {
  color: #475569;
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.1);
}

body.light-mode .order-confirm-row {
  color: #475569;
}

body.light-mode .order-confirm-row.total {
  border-top-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

body.light-mode .order-confirm-label {
  color: #64748b;
}

body.light-mode .order-confirm-val {
  color: #0f172a;
}

body.light-mode .btn-small {
  background: rgba(79, 70, 229, 0.1);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

body.light-mode .btn-small:hover {
  background: rgba(79, 70, 229, 0.18);
}

/* Modals & Cancel Buttons in Light Mode */
body.light-mode .btn-modal-cancel {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: #475569;
}

body.light-mode .btn-modal-cancel:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

/* Footer in Light Mode */
body.light-mode footer {
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  color: #64748b;
}

/* Scrollbars in Light Mode */
body.light-mode ::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.15);
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.28);
}

/* Theme Toggle Button Styling */
.theme-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 50%;
  transition: var(--transition-smooth);
  margin-right: 0.5rem;
}

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

.theme-toggle-btn i {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.theme-toggle-btn:hover i {
  transform: rotate(15deg);
}

/* ============= PROFESSIONAL ENHANCEMENT STYLES ============= */

/* Slide Down Animation */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Risk Calculator Panel */
#riskCalculatorPanel {
  animation: slideDown 0.3s ease-out;
}

/* Button Small Style */
.btn-small {
  background: rgba(99, 102, 241, 0.2);
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  font-size: 0.7rem;
}

.btn-small:hover {
  background: rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

.btn-small:active {
  transform: translateY(0);
}

/* Indicators Panel */
#indicatorsPanel {
  backdrop-filter: blur(8px);
  animation: slideDown 0.3s ease-out;
}

/* Stat Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.stat-card-enhanced {
  padding: 1rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card-enhanced:hover {
  background: rgba(15, 23, 42, 0.7);
  border-color: var(--color-accent);
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: block;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent);
  font-family: var(--font-mono);
}

/* Equity Curve Canvas */
#equityCurveChart {
  width: 100%;
  height: 120px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.3);
}

/* Key Levels Display */
.key-levels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-top: 0.75rem;
}

.key-level-item {
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  text-align: center;
  transition: all 0.2s;
}

.key-level-item:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--color-accent);
}

.key-level-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.key-level-value {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Chart Legend Overlay */
#chartLegendOverlay {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  transition: var(--transition-smooth);
}

/* Economic Calendar */
#economicCalendarWidget {
  animation: slideDown 0.3s ease-out;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-top: 0.5rem;
}

.calendar-event-item {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  gap: 0.2rem;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 0.25rem;
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.calendar-event-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.calendar-currency-badge {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1;
}

.calendar-impact-badge {
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  flex-shrink: 0;
  line-height: 1;
}

.calendar-impact-badge.high {
  color: var(--color-down);
  background: rgba(244, 63, 94, 0.14);
}

.calendar-impact-badge.medium {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
}

.calendar-impact-badge.low {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.14);
}

.news-sim-badge, .calendar-sim-badge {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 3px;
  padding: 0.08rem 0.3rem;
  line-height: 1;
  text-transform: uppercase;
  flex-shrink: 0;
}

.demo-feed-notice, .demo-calendar-notice {
  font-size: 0.65rem;
  color: #94a3b8;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}


/* Indicators Checkbox Style */
#indicatorsPanel input[type="checkbox"] {
  accent-color: var(--color-accent);
  cursor: pointer;
  width: 16px;
  height: 16px;
}

#indicatorsPanel label {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

#indicatorsPanel label:hover {
  color: var(--color-accent);
}

/* Trailing Stop Settings */
#trailingStopSettings {
  animation: slideDown 0.3s ease-out;
}

/* Statistics Performance Table */
#assetPerformanceTable {
  width: 100%;
  font-size: 0.8rem;
}

#assetPerformanceTable tr:hover {
  background: rgba(99, 102, 241, 0.1);
}

#assetPerformanceTable th {
  background: rgba(15, 23, 42, 0.3);
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

#assetPerformanceTable td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

body.light-mode #equityCurveChart {
  background: rgba(15, 23, 42, 0.03);
}

body.light-mode #assetPerformanceTable th {
  background: rgba(15, 23, 42, 0.04);
  color: #475569;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

body.light-mode #assetPerformanceTable td {
  color: #0f172a;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

body.light-mode #assetPerformanceTable tr:hover {
  background: rgba(79, 70, 229, 0.04);
}

/* Risk Calculator Styles */
#calcPositionSize {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-up);
}

#calcRiskReward {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Close Button Style */
.btn-close-panel {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  transition: color 0.2s;
}

.btn-close-panel:hover {
  color: var(--text-primary);
}

/* Order Confirmation Dialog (Base / Dark Mode) */
.order-confirm-dialog {
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.order-confirm-card {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.order-confirm-side-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.order-confirm-side-badge.buy {
  background: rgba(16, 185, 129, 0.16);
  color: var(--color-up);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.order-confirm-side-badge.sell {
  background: rgba(244, 63, 94, 0.16);
  color: var(--color-down);
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.order-confirm-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.order-confirm-rows {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.78rem;
}

.order-confirm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
}

.order-confirm-row.total {
  padding-top: 0.45rem;
  margin-top: 0.3rem;
  border-top: 1px dashed var(--border-color);
  color: var(--text-primary);
  font-weight: 700;
}

.order-confirm-label {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.order-confirm-val {
  color: var(--text-primary);
  font-weight: 600;
}

/* User Authentication & Onboarding Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(6, 9, 19, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

body.light-mode .modal-overlay {
  background: rgba(241, 245, 249, 0.85);
}

.auth-card {
  width: 400px;
  background: rgba(15, 22, 42, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.15);
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.light-mode .auth-card {
  background: #ffffff;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, #ffffff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

body.light-mode .auth-title {
  background: linear-gradient(to right, #0f172a, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.25rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

body.light-mode .auth-tabs {
  background: rgba(15, 23, 42, 0.04);
}

.auth-tab-btn {
  background: transparent;
  border: none;
  padding: 0.4rem;
  border-radius: 4px;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

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

.kyc-status-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  text-transform: uppercase;
  margin-left: 0.5rem;
  border: 1px solid transparent;
}

.kyc-status-badge.unverified {
  background: rgba(244, 63, 94, 0.08);
  color: var(--color-down);
  border-color: rgba(244, 63, 94, 0.2);
}

.kyc-status-badge.pending {
  background: rgba(234, 179, 8, 0.08);
  color: #eab308;
  border-color: rgba(234, 179, 8, 0.2);
}

.kyc-status-badge.verified {
  background: rgba(16, 185, 129, 0.08);
  color: var(--color-up);
  border-color: rgba(16, 185, 129, 0.2);
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ================= RESPONSIVE LAYOUT & RESOLUTION MEDIA QUERIES ================= */
@media (max-width: 1400px) {
  #panelWatchlist {
    width: 240px;
  }
  #panelOrder {
    width: 280px;
  }
}

@media (max-width: 1200px) {
  .dashboard-container {
    height: auto;
    overflow-y: auto;
    flex-wrap: wrap;
  }
  #panelWatchlist {
    width: 240px;
    height: calc(100vh - 60px);
  }
  #panelCenter {
    width: calc(100% - 240px);
    height: calc(100vh - 60px);
  }
  #panelOrder {
    width: 100%;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow-y: auto;
  }
  #panelWatchlist, #panelCenter, #panelOrder {
    width: 100% !important;
    height: auto !important;
  }
  .chart-section {
    height: 350px !important;
  }
  .portfolio-section {
    height: 400px !important;
  }
}

/* Footer & Risk Disclaimer */
footer {
  background: rgba(11, 17, 32, 0.9);
  border-top: 1px solid var(--border-color);
  padding: 0.5rem 1.5rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  z-index: 10;
  flex-shrink: 0;
}
footer strong {
  color: var(--color-down);
}

/* ================= TRADE NOTIFICATION TOASTS & BLOTTER BADGES ================= */
.badge-trade-id {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.badge-trade-id:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: var(--color-accent);
  color: #a5b4fc;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

body.light-mode .badge-trade-id {
  color: #4338ca;
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.22);
}
body.light-mode .badge-trade-id:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--color-accent);
  color: #312e81;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.18);
}

/* Base Toast (Dark Mode Default) */
.trade-toast {
  pointer-events: auto;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-accent);
  border-radius: 8px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7), 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  overflow: hidden;
  color: var(--text-primary);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}

.trade-toast.toast-buy {
  border-left-color: var(--color-up);
}

.trade-toast.toast-sell {
  border-left-color: var(--color-down);
}

.trade-toast.toast-close {
  border-left-color: #38bdf8;
}

.trade-toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trade-toast-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text-primary);
}

.trade-toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  transition: var(--transition-smooth);
}
.trade-toast-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.trade-toast-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.trade-toast-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trade-toast-label {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.trade-toast-value {
  color: var(--text-primary);
  font-weight: 600;
}

.trade-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--color-accent);
  width: 100%;
  animation: toastProgress 5.5s linear forwards;
}
.trade-toast.toast-buy .trade-toast-progress {
  background: var(--color-up);
}
.trade-toast.toast-sell .trade-toast-progress {
  background: var(--color-down);
}
.trade-toast.toast-close .trade-toast-progress {
  background: #38bdf8;
}

/* ================= LIGHT / WHITE MODE THEME OVERRIDES ================= */
body.light-mode .trade-toast {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-left-width: 4px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.04);
  color: #0f172a;
}

body.light-mode .trade-toast-title {
  color: #0f172a;
}

body.light-mode .trade-toast-close {
  color: #64748b;
}
body.light-mode .trade-toast-close:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.06);
}

body.light-mode .trade-toast-body {
  color: #475569;
}

body.light-mode .trade-toast-label {
  color: #64748b;
}

body.light-mode .trade-toast-value {
  color: #0f172a;
}

body.light-mode .trade-toast-row {
  color: #475569;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.96);
  }
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* =========================================================================
   INTERACTIVE CHART DRAWING TOOLS RAIL & BADGE
   ========================================================================= */

.chart-drawing-toolbar {
  position: absolute;
  top: 12px;
  left: 10px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: var(--transition-smooth);
}

.chart-drawing-btn {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.chart-drawing-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.3);
}

.chart-drawing-btn.active {
  background: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.45);
}

.drawing-toolbar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 2px 2px;
}

.drawing-status-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-accent);
  border-radius: 20px;
  padding: 0.3rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: pulseGlow 2s infinite ease-in-out;
}

.drawing-esc-tip {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 0 18px rgba(99, 102, 241, 0.6); }
}

/* =========================================================================
   ORDER PANEL TABS (ORDER ENTRY vs ORDER BOOK / DOM)
   ========================================================================= */

.order-panel-tab-bar {
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.4);
}

.order-panel-tabs {
  display: flex;
  gap: 0.25rem;
  background: rgba(15, 23, 42, 0.7);
  padding: 0.2rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.order-panel-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-smooth);
}

.order-panel-tab:hover {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.1);
}

.order-panel-tab.active {
  background: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.dom-live-pill {
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-up);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 0.12rem 0.45rem;
  display: inline-block;
  letter-spacing: 0.5px;
}

/* =========================================================================
   DEPTH OF MARKET (DOM / ORDER BOOK LADDER)
   ========================================================================= */

#paneOrderBook {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.85rem;
  gap: 0.5rem;
  height: 100%;
}

.dom-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dom-view-modes {
  display: flex;
  gap: 0.2rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.15rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.dom-mode-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  transition: all 0.15s ease;
}

.dom-mode-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dom-mode-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--color-accent);
}

.dom-mode-line {
  width: 14px;
  height: 3px;
  border-radius: 1px;
}

.dom-mode-line.ask { background: var(--color-down); }
.dom-mode-line.bid { background: var(--color-up); }

.dom-precision-selector {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dom-select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.4rem;
  outline: none;
  cursor: pointer;
}

.dom-select:focus {
  border-color: var(--color-accent);
}

.dom-table-header {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.dom-ladder-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow-y: auto;
  min-height: 280px;
  max-height: 420px;
  border-radius: 4px;
  background: rgba(6, 9, 19, 0.4);
}

.dom-asks-list, .dom-bids-list {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.dom-row {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  padding: 0.22rem 0.4rem;
  cursor: pointer;
  transition: background 0.1s ease;
  user-select: none;
  flex-shrink: 0;
}

.dom-row:hover {
  background: rgba(99, 102, 241, 0.15) !important;
}

.dom-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  opacity: 0.18;
  pointer-events: none;
  transition: width 0.2s ease;
  z-index: 1;
}

.dom-row.ask .dom-bar { background: var(--color-down); }
.dom-row.bid .dom-bar { background: var(--color-up); }

.dom-price {
  font-weight: 600;
  z-index: 2;
  text-align: left;
}

.dom-row.ask .dom-price { color: var(--color-down); }
.dom-row.bid .dom-price { color: var(--color-up); }

.dom-size {
  color: var(--text-primary);
  text-align: right;
  z-index: 2;
}

.dom-total {
  color: var(--text-secondary);
  text-align: right;
  z-index: 2;
}

.dom-spread-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.65rem;
  margin: 0.25rem 0;
  background: rgba(15, 23, 42, 0.85);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.dom-mid-price {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dom-price-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-up);
}

.dom-price-trend {
  font-size: 0.75rem;
  color: var(--color-up);
}

.dom-spread-details {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.dom-spread-details strong {
  color: var(--text-secondary);
}

.dom-footer-tip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 0.35rem 0.2rem;
  border-top: 1px solid var(--border-color);
}

/* =========================================================================
   LIGHT MODE OVERRIDES FOR DRAWING RAIL & DOM
   ========================================================================= */

body.light-mode .chart-drawing-toolbar {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

body.light-mode .chart-drawing-btn {
  color: #64748b;
}

body.light-mode .chart-drawing-btn:hover {
  background: rgba(79, 70, 229, 0.12);
  color: #0f172a;
  border-color: rgba(79, 70, 229, 0.25);
}

body.light-mode .chart-drawing-btn.active {
  background: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.35);
}

body.light-mode .drawing-toolbar-divider {
  background: rgba(15, 23, 42, 0.08);
}

body.light-mode .drawing-status-badge {
  background: rgba(255, 255, 255, 0.96);
  border-color: var(--color-accent);
  color: #0f172a;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.15);
}

body.light-mode .drawing-esc-tip {
  color: #64748b;
  background: rgba(15, 23, 42, 0.06);
}

body.light-mode .order-panel-tab-bar {
  background: rgba(241, 245, 249, 0.7);
  border-color: var(--border-color);
}

body.light-mode .order-panel-tabs {
  background: rgba(226, 232, 240, 0.7);
  border-color: var(--border-color);
}

body.light-mode .order-panel-tab {
  color: #64748b;
}

body.light-mode .order-panel-tab:hover {
  color: #0f172a;
  background: rgba(79, 70, 229, 0.08);
}

body.light-mode .order-panel-tab.active {
  background: var(--color-accent);
  color: #ffffff;
}

body.light-mode .dom-live-pill {
  background: rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.3);
  color: #059669;
}

body.light-mode .dom-view-modes {
  background: rgba(241, 245, 249, 0.8);
  border-color: var(--border-color);
}

body.light-mode .dom-mode-btn:hover {
  background: rgba(15, 23, 42, 0.06);
}

body.light-mode .dom-select {
  background: #ffffff;
  border-color: var(--border-color);
  color: #0f172a;
}

body.light-mode .dom-table-header {
  color: #64748b;
  border-color: var(--border-color);
}

body.light-mode .dom-ladder-container {
  background: rgba(248, 250, 252, 0.75);
}

body.light-mode .dom-size {
  color: #0f172a;
}

body.light-mode .dom-total {
  color: #64748b;
}

body.light-mode .dom-row:hover {
  background: rgba(79, 70, 229, 0.1) !important;
}

body.light-mode .dom-spread-banner {
  background: #ffffff;
  border-color: var(--border-color);
}

body.light-mode .dom-spread-details {
  color: #64748b;
}

body.light-mode .dom-spread-details strong {
  color: #0f172a;
}

body.light-mode .dom-footer-tip {
  color: #64748b;
  border-color: var(--border-color);
}

/* ================= DEMO WATERMARK IN CHART AREA ================= */
.chart-demo-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
  user-select: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

.chart-demo-watermark.demo-watermark-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  display: none !important;
}

.chart-demo-watermark-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transform: rotate(-6deg);
  pointer-events: none;
  user-select: none;
}

.demo-watermark-title {
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: clamp(2.2rem, 5.5vw, 4.4rem);
  font-weight: 900;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  line-height: 1;
  color: rgba(255, 255, 255, 0.055);
  text-shadow: 0 0 25px rgba(245, 158, 11, 0.05);
  margin-left: 0.35em;
}

.demo-watermark-subtitle {
  font-family: var(--font-mono, monospace);
  font-size: clamp(0.7rem, 1.2vw, 0.92rem);
  font-weight: 700;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  margin-top: 0.65rem;
  color: rgba(255, 255, 255, 0.04);
  margin-left: 0.4em;
}

.chart-demo-badge {
  position: absolute;
  top: 10px;
  right: 68px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: #fbbf24;
  z-index: 6;
  pointer-events: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.demo-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
  animation: pulse-demo-badge 2s infinite ease-in-out;
}

@keyframes pulse-demo-badge {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 8px #f59e0b;
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85);
    box-shadow: 0 0 2px #f59e0b;
  }
}

.demo-badge-label {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.demo-badge-funds {
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
}

.demo-badge-login-btn {
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fef08a;
  font-weight: 700;
  font-size: 0.68rem;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.demo-badge-login-btn:hover {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #0f172a;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.45);
}

/* Light Mode Theme Overrides for Demo Watermark */
body.light-mode .demo-watermark-title {
  color: rgba(15, 23, 42, 0.065);
  text-shadow: none;
}

body.light-mode .demo-watermark-subtitle {
  color: rgba(15, 23, 42, 0.05);
}

body.light-mode .chart-demo-badge {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(217, 119, 6, 0.35);
  color: #b45309;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-mode .demo-badge-funds {
  color: #78350f;
}

body.light-mode .demo-badge-login-btn {
  background: #d97706;
  border-color: #b45309;
  color: #ffffff;
}

body.light-mode .demo-badge-login-btn:hover {
  background: #b45309;
  box-shadow: 0 0 8px rgba(180, 83, 9, 0.35);
}

/* Light Mode Market Feed Indicator Overrides */
body.light-mode .market-status,
body.light-mode .market-status.status-red {
  background: rgba(225, 29, 72, 0.1);
  color: #e11d48;
  border-color: rgba(225, 29, 72, 0.25);
}

body.light-mode .market-status.status-red .status-dot {
  background-color: #e11d48;
  box-shadow: 0 0 8px #e11d48;
}

body.light-mode .market-status.status-red #terminalLatency {
  color: #e11d48 !important;
}

body.light-mode .market-status.status-green {
  background: rgba(5, 150, 105, 0.1);
  color: #059669;
  border-color: rgba(5, 150, 105, 0.25);
}

body.light-mode .market-status.status-green .status-dot {
  background-color: #059669;
  box-shadow: 0 0 8px #059669;
}

body.light-mode .market-status.status-green #terminalLatency {
  color: #059669 !important;
}




/* --- ADDITIONAL RESPONSIVENESS OVERRIDES --- */
@media (max-width: 1024px) {
  header {
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 1rem;
  }
  .header-left, .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .main-nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow-y: auto !important;
  }
  #panelWatchlist, #panelCenter, #panelOrder {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
  }
  .chart-section {
    min-height: 400px !important;
  }
  .portfolio-stats-grid, .stats-grid, .key-levels-grid, .dom-table-header, .dom-row {
    grid-template-columns: 1fr 1fr !important;
  }
  .dom-table-header, .dom-row {
    grid-template-columns: 1.1fr 1fr 1fr !important; /* Keep order book 3 cols */
  }
}

@media (max-width: 480px) {
  .portfolio-stats-grid, .stats-grid, .key-levels-grid {
    grid-template-columns: 1fr !important;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .user-badge {
    justify-content: center;
  }
  .trade-toast {
    width: 90% !important;
    right: 5% !important;
    left: 5% !important;
    bottom: 20px !important;
  }
}

/* Fix Unrealized PnL Color Override */
.stat-value.change-up { color: var(--color-up) !important; }
.stat-value.change-down { color: var(--color-down) !important; }

.order-confirm-val.change-up { color: var(--color-up) !important; }
.order-confirm-val.change-down { color: var(--color-down) !important; }
