/* =========================================================================
   HEXA TRADE (ALGOVIA) — PROFESSIONAL ALGORITHMIC TRADING WORKSTATION
   UI/UX PRO MAX DESIGN SYSTEM — CYBER OLED & GLASSMORPHISM EDITION
   ========================================================================= */

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

:root {
  /* Surface Layers (Deep OLED & Midnight Blue) */
  --bg-base: #06080e;
  --bg-primary: #090d16;
  --bg-secondary: #0e1320;
  --bg-tertiary: #141b2c;
  --bg-card: #111728;
  --bg-hover: #1b243b;
  --bg-active: #222d4a;

  /* Borders & Dividers */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: rgba(99, 102, 241, 0.6);
  --border-glow: rgba(99, 102, 241, 0.35);

  /* High Contrast Typography */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-bright: #ffffff;

  /* Financial Trading Signals (Luminous Emerald & Rose) */
  --bull-green: #10b981;
  --bull-green-hover: #059669;
  --bull-green-glow: rgba(16, 185, 129, 0.28);
  --bull-green-soft: rgba(16, 185, 129, 0.12);

  --bear-red: #f43f5e;
  --bear-red-hover: #e11d48;
  --bear-red-glow: rgba(244, 63, 94, 0.28);
  --bear-red-soft: rgba(244, 63, 94, 0.12);

  /* Brand & Accents */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-primary-glow: rgba(99, 102, 241, 0.32);
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.28);
  --accent-teal: #14b8a6;
  --accent-orange: #f59e0b;

  /* Workstation Metrics */
  --nav-height: 84px;
  --toolbar-width: 44px;
  --sidebar-width: 330px;

  /* Modern Typography Pairing */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', "Consolas", monospace;

  /* Elevation, Shadows & Glass */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 0 24px -4px var(--accent-primary-glow);
  --glass-bg: rgba(14, 19, 32, 0.88);
  --glass-blur: blur(14px);
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================================================
   BASE & RESET
   ========================================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.bull-text {
  color: var(--bull-green) !important;
}

.bear-text {
  color: var(--bear-red) !important;
}

/* Focus outline for keyboard navigation accessibility */
:focus-visible {
  outline: 2px solid var(--accent-primary) !important;
  outline-offset: 2px !important;
}

/* Custom Sleek Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* =========================================================================
   TOP NAVIGATION BAR (FROSTED GLASS & 2-ROW WORKSTATION HEADER)
   ========================================================================= */
.top-nav {
  min-height: var(--nav-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  row-gap: 5px;
  padding: 8px 14px 6px 14px;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.top-nav > .primary-nav-row {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  height: 32px;
  flex: 0 0 auto;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.brand:hover {
  opacity: 0.9;
}

.brand-logo {
  display: block;
  height: 22px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.2));
}

.btn-hub-return {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: 12px;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex: 0 0 auto;
}

.btn-hub-return:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.brand-badge {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(6, 182, 212, 0.2) 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 6px;
}

/* WORKSTATION TABS */
.nav-tabs-group {
  display: flex;
  align-items: center;
  background: rgba(10, 14, 23, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  margin-left: 14px;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs-group::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

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

.nav-tab-btn.active {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.22) 0%, rgba(99, 102, 241, 0.1) 100%);
  border: 1px solid rgba(99, 102, 241, 0.45);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.25);
}

/* SECOND ROW: CHART TOOLBAR */
.top-nav > .chart-toolbar-row {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding-top: 3px;
  border-top: 1px solid var(--border-subtle);
}

.chart-toolbar-row .toolbar-section {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.chart-toolbar-row .toolbar-section + .toolbar-section {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--border-color);
}

.chart-toolbar-row .select-wrapper {
  width: clamp(210px, 24vw, 290px);
  min-width: 0;
  flex: 0 1 290px;
}

.nav-select {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}

.nav-select:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-hover);
}

.nav-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary-glow);
}

.chart-toolbar-row .market-section .select-wrapper .nav-select {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* Timeframe Selector Group */
.tf-btn-group {
  display: flex;
  background-color: rgba(10, 14, 23, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  padding: 2px;
  gap: 2px;
  flex: 0 0 auto;
}

.tf-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  min-width: 32px;
  min-height: 26px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.tf-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.tf-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 1px 8px var(--accent-primary-glow);
}

/* General Buttons */
.btn {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-hover);
  color: #fff;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border-color: #6366f1;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
}

.btn-success {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
}

.btn-danger {
  background: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%);
  border-color: #f43f5e;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(244, 63, 94, 0.35);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #be123c 0%, #e11d48 100%);
}

/* Toolbar menu button variants */
.chart-toolbar-row .toolbar-section > .btn,
.chart-toolbar-row .toolbar-section > .dropdown > .btn {
  background: rgba(20, 27, 44, 0.6);
  border-color: var(--border-color);
  color: var(--text-secondary);
  min-height: 29px;
  font-size: 12px;
}

.chart-toolbar-row .toolbar-section > .btn:hover,
.chart-toolbar-row .toolbar-section > .dropdown > .btn:hover {
  color: #fff;
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

/* Dropdown styling */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: rgba(14, 19, 32, 0.96);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  min-width: 250px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  z-index: 100;
  animation: fadeIn 0.15s ease-out;
}

.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content {
  display: block;
}

.indicator-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.indicator-item:hover {
  color: #ffffff;
}

.toolbar-menu-content {
  min-width: 170px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 3px;
}

.toolbar-menu:hover .toolbar-menu-content,
.toolbar-menu:focus-within .toolbar-menu-content {
  display: flex;
}

.toolbar-menu-content .btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent !important;
  border: none !important;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
  min-height: 28px !important;
  padding: 4px 8px !important;
}

.toolbar-menu-content .btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

/* Replay Status & Progress in Toolbar */
.chart-toolbar-row .toolbar-section.replay-status-section {
  margin-left: auto;
  gap: 10px;
  min-height: 29px;
}

.chart-toolbar-row .replay-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
}

.chart-toolbar-row .replay-progress {
  width: 60px;
  height: 4px;
  flex: 0 0 60px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
}

.chart-toolbar-row .replay-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan) 0%, var(--bull-green) 100%);
  transition: width 0.12s linear;
}

/* =========================================================================
   MAIN VIEWPORT & TABS
   ========================================================================= */
.main-viewport {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-base);
}

.view-pane {
  display: none;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.view-pane.active {
  display: flex;
}

/* =========================================================================
   VIEW 1: CHART WORKSPACE
   ========================================================================= */
/* LEFT DRAWING TOOLBAR */
.drawing-toolbar {
  width: var(--toolbar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 3px;
  overflow-y: auto;
  scrollbar-width: none;
  z-index: 40;
  position: relative;
}

.drawing-toolbar::-webkit-scrollbar {
  display: none;
}

.toolbar-tool-group {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  position: relative;
}

.toolbar-tool-group + .toolbar-tool-group {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.draw-tool-btn {
  width: 34px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.draw-tool-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.draw-tool-btn:hover {
  background-color: var(--bg-hover);
  color: #ffffff;
}

.draw-tool-btn.active {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  box-shadow: inset 2px 0 0 var(--accent-cyan);
}

.draw-tool-btn[aria-pressed="true"] {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
}

.position-long { color: var(--bull-green); }
.position-short, .danger-tool { color: var(--bear-red); }
.text-tool { font-family: Georgia, serif; font-size: 16px; font-weight: 700; }

.flyout-caret {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  opacity: 0.7;
}

/* Drawing Flyouts */
.toolbar-flyout {
  position: fixed;
  z-index: 150;
  display: none;
  width: min(280px, calc(100vw - 16px));
  max-height: min(78vh, 590px);
  overflow-y: auto;
  padding: 6px;
  color: var(--text-primary);
  background: rgba(14, 19, 32, 0.98);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

.toolbar-tool-group.open > .toolbar-flyout {
  display: block;
  animation: fadeIn 0.12s ease-out;
}

.flyout-heading {
  padding: 6px 10px 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toolbar-flyout .flyout-item {
  display: flex;
  width: 100%;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 10px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toolbar-flyout .flyout-item:hover {
  color: #fff;
  background: var(--bg-hover);
}

.toolbar-flyout .flyout-item.active {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
}

.toolbar-flyout .flyout-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.toolbar-flyout .flyout-item small {
  margin-left: auto;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* Tooltip */
.tooltip {
  visibility: hidden;
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  background: rgba(14, 19, 32, 0.95);
  backdrop-filter: var(--glass-blur);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  z-index: 100;
  pointer-events: none;
}

.draw-tool-btn:hover .tooltip {
  visibility: visible;
}

/* =========================================================================
   CENTER CHART AREA
   ========================================================================= */
.chart-center-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-primary);
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.chart-header {
  position: absolute;
  top: 10px;
  left: 14px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.chart-symbol-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-symbol-info .symbol {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.chart-symbol-info .tf {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
}

.chart-ohlc {
  display: flex;
  gap: 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.chart-ohlc strong {
  color: #fff;
}

.chart-data-identity {
  position: absolute;
  top: 36px;
  left: 14px;
  z-index: 5;
  max-width: min(72%, 780px);
  overflow: hidden;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chart-container {
  width: 100%;
  height: 100%;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

/* TradingView Style Auto-Scale Badge */
.chart-scale-badge {
  position: absolute;
  right: 6px;
  bottom: 32px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: rgba(14, 19, 32, 0.88);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  transition: all 0.15s ease;
  user-select: none;
}

.chart-scale-badge:hover {
  color: #ffffff;
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(24, 32, 54, 0.95);
  transform: translateY(-1px);
}

.chart-scale-badge.active {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(14, 165, 233, 0.15);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

/* Floating Drawing Favorites Bar */
.drawing-favorites-bar {
  position: absolute;
  z-index: 35;
  top: 48px;
  right: 14px;
  display: flex;
  max-width: min(620px, calc(100% - 96px));
  min-height: 36px;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  padding: 3px 8px;
  color: var(--text-primary);
  background: rgba(14, 19, 32, 0.94);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  scrollbar-width: none;
}

.drawing-favorites-bar[hidden] {
  display: none;
}

.favorites-drag-handle {
  display: grid;
  width: 18px;
  height: 26px;
  flex: 0 0 18px;
  place-items: center;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border-color);
  margin-right: 3px;
  cursor: grab;
}

.favorites-drag-handle:active {
  cursor: grabbing;
}

.drawing-favorite-btn {
  position: relative;
  display: grid;
  width: 32px;
  height: 28px;
  flex: 0 0 32px;
  place-items: center;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.drawing-favorite-btn:hover,
.drawing-favorite-btn.active {
  color: #fff;
  background: var(--bg-hover);
}

.drawing-favorite-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.tool-favorite-toggle {
  display: grid;
  width: 22px;
  height: 24px;
  flex: 0 0 22px;
  place-items: center;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
}

.tool-favorite-toggle:hover,
.tool-favorite-toggle.selected {
  color: var(--accent-orange);
}

/* =========================================================================
   FLOATING REPLAY DOCK (CAPSULE FROSTED GLASS)
   ========================================================================= */
.replay-dock {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 14, 24, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 30;
  transition: all var(--transition-normal);
}

.replay-dock-grip {
  display: grid;
  width: 18px;
  height: 26px;
  flex: 0 0 18px;
  place-items: center;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--border-color);
  margin-right: 2px;
  cursor: grab;
}

.replay-dock-grip:active {
  cursor: grabbing;
}

.replay-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition-fast);
}

.replay-btn:hover {
  background-color: var(--bg-hover);
  color: #fff;
}

.replay-btn-set-start {
  width: auto;
  min-width: 76px;
  padding: 0 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.replay-btn-set-start.cut-active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-primary-glow);
}

.replay-btn-play {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #fff;
  box-shadow: 0 2px 10px var(--accent-primary-glow);
}

.replay-btn-play:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  transform: scale(1.05);
}

.replay-btn-play[aria-pressed="true"] {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  box-shadow: 0 2px 10px var(--bull-green-glow);
}

.replay-speed-select {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 4px 10px;
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

.replay-time-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  padding: 0 8px;
  border-left: 1px solid var(--border-color);
  white-space: nowrap;
}

/* =========================================================================
   RIGHT SIDEBAR: ORDER EXECUTION & RISK MANAGEMENT
   ========================================================================= */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
  flex: 0 0 var(--sidebar-width);
}

.sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 14, 23, 0.4);
}

.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffffff;
}

/* ACCOUNT METRICS (BENTO GRID STYLE) */
.account-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
}

.account-metrics .stat-pill {
  min-width: 0;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.account-metrics .stat-pill .label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.account-metrics .stat-pill .value {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}

.account-metrics .clickable-pill:hover {
  background: var(--bg-hover);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

/* ACTIVE POSITION WIDGET CARD */
.position-card {
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, rgba(14, 19, 32, 0.7) 100%);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow-md);
}

.pos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pos-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pos-badge.long {
  background: var(--bull-green-soft);
  color: var(--bull-green);
  border: 1px solid var(--bull-green);
}

.pos-badge.short {
  background: var(--bear-red-soft);
  color: var(--bear-red);
  border: 1px solid var(--bear-red);
}

.pos-pnl {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pos-details {
  font-size: 11px;
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.pos-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.pos-row span:last-child {
  color: #ffffff;
}

.pos-row input {
  width: 120px;
  max-width: 55%;
  padding: 4px 6px;
  color: var(--text-primary);
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font: 11px var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pos-actions {
  display: flex;
  gap: 6px;
}

.pos-actions button {
  flex: 1;
}

/* ORDER ENTRY FORM */
.panel-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.order-type-switch {
  display: flex;
  background-color: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  padding: 2px;
  gap: 2px;
  margin-bottom: 12px;
}

.type-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 0;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.type-btn.active {
  background-color: var(--bg-tertiary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.field-group {
  margin-bottom: 12px;
}

.field-group label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.input-with-addons {
  display: flex;
  background-color: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.input-with-addons:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary-glow);
}

.input-with-addons input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 6px 10px;
  outline: none;
}

.input-addon {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  padding: 6px 9px;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border-color);
}

.chips-row {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.chip {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip:hover {
  background-color: var(--bg-hover);
  color: #fff;
  border-color: var(--border-hover);
}

.chip.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 1px 6px var(--accent-primary-glow);
}

/* EXECUTION BUTTONS (BUY / SELL RADIANT GRADIENTS) */
.exec-buttons {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn-buy, .btn-sell {
  flex: 1;
  border: none;
  padding: 11px 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: #ffffff;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-buy {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-buy:hover {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

.btn-buy:active {
  transform: scale(0.98);
}

.btn-sell {
  background: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%);
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.3);
}

.btn-sell:hover {
  background: linear-gradient(135deg, #be123c 0%, #e11d48 100%);
  box-shadow: 0 6px 22px rgba(244, 63, 94, 0.45);
  transform: translateY(-1px);
}

.btn-sell:active {
  transform: scale(0.98);
}

#order-calc-preview {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  margin-top: 10px;
  line-height: 1.6;
}

/* Pending Orders Panel */
.pending-orders-panel {
  margin: 0 12px 12px;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.pending-orders-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.pending-order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font: 11px var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   PINE SCRIPT BOTTOM DRAWER & SEPARATE PANES
   ========================================================================= */
.pine-editor-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 290px;
  background: #0d121c;
  border-top: 2px solid var(--border-color);
  z-index: 25;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.2s ease-out;
}

.pine-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.pine-drawer-heading {
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
}

.pine-drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pine-drawer-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.pine-code-editor {
  width: 100%;
  height: 100%;
  background: #080b12;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 12px 16px;
  border: none;
  outline: none;
  resize: none;
  tab-size: 2;
  white-space: pre;
}

.pine-drawer-footer {
  padding: 5px 14px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* Chart Analysis Panel */
.chart-analysis-panel {
  flex: 0 0 224px;
  min-height: 150px;
  max-height: 44%;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  z-index: 8;
  overflow: hidden;
}

.chart-analysis-header {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(10, 14, 23, 0.4);
}

.chart-analysis-tabs {
  height: 100%;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
}

.chart-analysis-tabs button {
  padding: 0 16px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chart-analysis-tabs button.active {
  color: #ffffff;
  border-bottom-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
}

.chart-analysis-content {
  height: calc(100% - 38px);
  overflow: auto;
  padding: 12px 16px;
}

/* Separate Indicator Pane */
.indicator-pane {
  flex: 0 0 180px;
  min-height: 90px;
  max-height: 360px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.indicator-pane header {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.indicator-pane-resize {
  height: 5px;
  flex: 0 0 5px;
  background: var(--border-color);
  cursor: ns-resize;
  transition: background var(--transition-fast);
}

.indicator-pane-resize:hover {
  background: var(--accent-primary);
}

/* Context Menu */
.chart-context-menu {
  position: absolute;
  z-index: 100;
  width: 175px;
  padding: 4px;
  background: rgba(14, 19, 32, 0.96);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

.chart-context-menu button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 7px 10px;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chart-context-menu button:hover {
  background: var(--bg-hover);
  color: #fff;
}

/* =========================================================================
   GENERIC WORKSPACE PAGES (BACKTEST, LAB, DATA, ANALYTICS, SETTINGS, STUDIO)
   ========================================================================= */
.workspace-page {
  flex: 1;
  background-color: var(--bg-base);
  padding: 24px clamp(16px, 2.5vw, 40px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

/* Bento Grid Layouts */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* Card Styling (Bento Box with Frosted Border) */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}

.card:hover {
  border-color: var(--border-hover);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.01em;
}

/* Metric KPI Boxes */
.metric-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.metric-box:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.metric-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  font-weight: 600;
}

.metric-val {
  font-size: 20px;
  font-weight: 800;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  margin-top: 6px;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.data-table th {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr {
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: var(--bg-hover);
}

/* Pine Script Studio Full Page Layout */
.pine-studio-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  margin-top: 12px;
}

.pine-studio-editor-col {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.pine-studio-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.pine-studio-console {
  padding: 10px 14px;
  background: #080b12;
  border-top: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.pine-doc-box {
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.pine-doc-box code {
  color: var(--accent-cyan);
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
}

/* =========================================================================
   MODALS & TOAST NOTIFICATIONS
   ========================================================================= */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 5, 10, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 520px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.close-btn:hover {
  color: #fff;
  background: var(--bg-hover);
}

.jump-date-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.jump-date-fields label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}

.jump-date-fields input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: #ffffff;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.jump-date-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: rgba(14, 19, 32, 0.95);
  backdrop-filter: var(--glass-blur);
  color: #fff;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease-out;
}

.toast.success { border-left-color: var(--bull-green); }
.toast.error { border-left-color: var(--bear-red); }
.toast.info { border-left-color: var(--accent-cyan); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =========================================================================
   RESPONSIVE LAYOUT & BREAKPOINTS (UI/UX PRO MAX COMPLIANT)
   ========================================================================= */
@media (max-width: 1320px) {
  .top-nav {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    row-gap: 6px;
  }

  .top-nav > .primary-nav-row {
    grid-row: 1;
  }

  .top-nav > .chart-toolbar-row {
    grid-row: 2;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .sidebar {
    width: 290px;
    flex-basis: 290px;
  }
}

@media (max-width: 900px) {
  .brand-badge {
    display: none;
  }

  .chart-toolbar-row .market-section {
    flex-wrap: wrap;
  }

  .chart-toolbar-row .market-section .select-wrapper {
    width: min(100%, 260px);
    flex: 1 1 200px;
  }

  .sidebar {
    width: 260px;
    flex-basis: 260px;
  }
}

@media (max-width: 720px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .top-nav {
    padding: 8px 10px;
  }

  .top-nav > .chart-toolbar-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .chart-toolbar-row .toolbar-section {
    width: 100%;
    flex-wrap: wrap;
  }

  .chart-toolbar-row .toolbar-section + .toolbar-section {
    margin: 0;
    padding: 6px 0 0;
    border-left: 0;
    border-top: 1px solid var(--border-color);
  }

  .main-viewport {
    display: block;
    overflow: visible;
  }

  .view-pane.active {
    position: relative;
    height: auto;
    min-height: calc(100dvh - 180px);
  }

  #tab-chart.view-pane.active {
    display: flex;
    flex-direction: column;
  }

  .drawing-toolbar {
    width: 100%;
    height: 44px;
    flex: 0 0 44px;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }

  .chart-center-area {
    width: 100%;
    height: 65dvh;
    min-height: 400px;
    flex: none;
  }

  .sidebar {
    width: 100%;
    flex: none;
    border-left: 0;
    border-top: 1px solid var(--border-color);
  }

  .grid-cols-4,
  .grid-cols-3,
  .grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .grid-cols-4,
  .grid-cols-3,
  .grid-cols-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-metrics {
    grid-template-columns: 1fr;
  }

  .replay-dock {
    width: max-content;
    max-width: calc(100% - 16px);
    overflow-x: auto;
  }
}

/* =========================================================================
   DASHBOARD TAB & BENTO WORKSPACE
   ========================================================================= */
#tab-dashboard {
  overflow-y: auto;
  background: var(--bg-primary);
  height: 100%;
}

.dashboard-workspace {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 28px 60px 28px;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
  margin-bottom: 30px;
}

.bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.2s ease, 
              box-shadow 0.2s ease;
}

.bento-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.15), var(--shadow-md);
  transform: translateY(-2px);
}

.bento-equity { grid-column: span 8; min-height: 380px; }
.bento-risk { grid-column: span 4; }
.bento-markets { grid-column: span 5; }
.bento-pine { grid-column: span 4; }
.bento-launcher { grid-column: span 3; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-box {
  background: rgba(3, 7, 18, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
}

.kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-val {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.kpi-val.positive {
  color: #10b981;
}

.market-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.market-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(3, 7, 18, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: all 0.16s ease;
  cursor: pointer;
}

.market-row-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateX(3px);
}

.market-sym-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.market-ticker {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-weight: 700;
  font-size: 13px;
}

.market-type-tag {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
}

.market-pricing {
  display: flex;
  align-items: center;
  gap: 14px;
}

.market-price {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 13px;
  font-weight: 600;
}

.market-chg {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.chg-bull {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.chg-bear {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.1);
}

.risk-meter-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 6px;
}

.risk-meter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meter-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.meter-name {
  color: var(--text-secondary);
  font-weight: 500;
}

.meter-val {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-weight: 600;
  color: #fff;
}

.meter-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.meter-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.fill-emerald { background: linear-gradient(90deg, #10b981, #34d399); }
.fill-amber { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.fill-indigo { background: linear-gradient(90deg, #6366f1, #818cf8); }

.risk-rule-pill {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  font-size: 12px;
  color: #34d399;
}

.launcher-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  flex: 1;
}

.launch-tile-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(3, 7, 18, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.16s ease;
  cursor: pointer;
}

.launch-tile-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: #6366f1;
  color: #ffffff;
  transform: translateY(-1px);
}

.tile-icon-svg {
  width: 18px;
  height: 18px;
  color: #38bdf8;
}

@media (max-width: 1080px) {
  .bento-equity { grid-column: span 12; }
  .bento-risk { grid-column: span 12; }
  .bento-markets { grid-column: span 6; }
  .bento-pine { grid-column: span 6; }
  .bento-launcher { grid-column: span 12; }
  .launcher-actions-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .bento-markets { grid-column: span 12; }
  .bento-pine { grid-column: span 12; }
  .launcher-actions-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================================================
   PROP FIRM EVALUATION OBJECTIVE HUD & STATISTICS MATRIX (ANTI-AI SLOP)
   Understated Obsidian Palette, Dense Quantitative Information, Tabular Figures
   ========================================================================= */

/* Top Navbar Prop Firm Badge Toggle */
.btn-propfirm-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #38bdf8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-propfirm-toggle:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateY(-1px);
}

.propfirm-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bull-green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.propfirm-status-dot.violated {
  background: var(--bear-red);
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.6);
}

/* Slim Chart Prop Firm HUD Strip */
.propfirm-hud-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 18px;
  background: #080c14;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 15;
  font-family: var(--font-sans);
  flex-wrap: wrap;
}

.hud-col {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding-right: 14px;
}

.hud-shield-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  flex-shrink: 0;
}

.hud-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hud-phase {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.2;
}

.hud-meter {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}

.hud-meter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-meter-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.hud-meter-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.hud-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.hud-fill {
  height: 100%;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
  border-radius: 2px;
}

.hud-fill-target {
  background: linear-gradient(90deg, #38bdf8, #60a5fa);
}

.hud-fill-target.passed {
  background: #10b981;
}

.hud-fill-daily {
  background: #10b981;
}

.hud-fill-daily.warn {
  background: #f59e0b;
}

.hud-fill-daily.danger {
  background: #f43f5e;
}

.hud-fill-max {
  background: #38bdf8;
}

.hud-fill-max.warn {
  background: #f59e0b;
}

.hud-fill-max.danger {
  background: #f43f5e;
}

.hud-meter-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.hud-badge.status-active {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.hud-badge.status-passed {
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.hud-badge.status-violated {
  background: rgba(244, 63, 94, 0.16);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.btn-hud-matrix {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.btn-hud-matrix:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* =========================================================================
   DETAILED PROPFIRM EVALUATION MATRIX MODAL
   ========================================================================= */
.modal-propfirm-card {
  max-width: 780px !important;
  width: 95%;
  background: #090d16 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 14px !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85) !important;
  max-height: 90vh;
  overflow-y: auto;
}

.propfirm-top-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.propfirm-matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.matrix-kpi-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.matrix-kpi-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

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

.matrix-kpi-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.matrix-kpi-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.matrix-kpi-val {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.matrix-kpi-detail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

/* Compliance Checklist */
.propfirm-rules-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 12px;
}

.propfirm-rules-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.propfirm-rules-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.rule-check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.rule-check-pass {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.rule-check-pending {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.rule-check-fail {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
}

.target-select-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(56, 189, 248, 0.04);
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 8px;
}

.target-chip-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.target-chip-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.target-chip-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #ffffff;
}
