/* public/css/okas.css - Clean Modern Fintech Prediction Market Design System */

:root {
  /* ================= 1. COLOR SYSTEM & DESIGN TOKENS (OKX / FINTECH PALETTE) ================= */
  --app-bg: #f7f8fa;
  --surface: #ffffff;
  --surface-subtle: #f9fafb;
  --surface-hover: #f3f4f6;
  --surface-active: #e5e7eb;
  
  --border: #e5e7eb;
  --border-subtle: #f3f4f6;
  --border-hover: #d1d5db;
  --border-focus: #2f5bea;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-inverse: #ffffff;

  --brand: #FF382F;
  --brand-hover: #E02E26;
  --brand-subtle: rgba(255, 56, 47, 0.08);
  --brand-border: rgba(255, 56, 47, 0.25);

  --secondary-accent: #2f5bea;
  --secondary-accent-hover: #2563eb;
  --secondary-accent-subtle: rgba(47, 91, 234, 0.08);

  --positive: #16A36A;
  --positive-hover: #138757;
  --positive-subtle: #E8F7F0;
  --positive-border: rgba(22, 163, 106, 0.25);

  --negative: #E5484D;
  --negative-hover: #CC3D42;
  --negative-subtle: #FDECEC;
  --negative-border: rgba(229, 72, 77, 0.25);

  --warning: #F59E0B;
  --warning-subtle: #FEF3C7;
  --info: #0284C7;
  --info-subtle: #E0F2FE;

  /* Backward Compatibility Token Aliases */
  --emerald: var(--positive);
  --rose: var(--negative);

  /* Typography: Inter with tabular figures */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Inter', ui-sans-serif, system-ui, monospace;

  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Shadows (Minimal Fintech) */
  --shadow-sm: 0 1px 2px 0 rgba(16, 24, 40, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(16, 24, 40, 0.04), 0 1px 2px -1px rgba(16, 24, 40, 0.02);
  --shadow-card-hover: 0 4px 12px -2px rgba(16, 24, 40, 0.06), 0 2px 6px -1px rgba(16, 24, 40, 0.03);
  --shadow-dropdown: 0 8px 24px -4px rgba(16, 24, 40, 0.10), 0 2px 6px -1px rgba(16, 24, 40, 0.04);
  --shadow-modal: 0 16px 36px -8px rgba(16, 24, 40, 0.14), 0 4px 12px -2px rgba(16, 24, 40, 0.05);

  /* Focus Ring */
  --focus-ring: 0 0 0 2px #FFFFFF, 0 0 0 4px #2f5bea;

  /* Transitions */
  --transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 120ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================= VIEW MODE TOGGLE (CLIENT VS ADMIN) ================= */
[data-mode="client"] #navItemAdmin,
[data-mode="client"] #btnNavAdmin,
[data-mode="client"] .sidebar-nav-item[data-view="admin"],
body[data-mode="client"] #navItemAdmin,
body[data-mode="client"] #btnNavAdmin,
body[data-mode="client"] .sidebar-nav-item[data-view="admin"] {
  display: none !important;
}

[data-mode="admin"] #navItemMarkets,
[data-mode="admin"] #navItemTerminal,
[data-mode="admin"] .sidebar-nav-item[data-view="markets"],
[data-mode="admin"] .sidebar-nav-item[data-view="terminal"],
body[data-mode="admin"] #navItemMarkets,
body[data-mode="admin"] #navItemTerminal,
body[data-mode="admin"] .sidebar-nav-item[data-view="markets"],
body[data-mode="admin"] .sidebar-nav-item[data-view="terminal"] {
  display: none !important;
}

/* ================= 2. BASE & RESET ================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--app-bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
}

/* Tabular numerals for price & metrics */
.tabular-nums, .price-val, .stat-val, .metric-value, .outcome-prob, .outcome-cents, .book-val, .card-odds-num, .outcome-price-val, .outcome-odds-val {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Focus styles */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ================= 3. TOP TICKER RIBBON ================= */
.marquee-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 30px;
  overflow: hidden;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 101;
}
.marquee-track {
  display: flex;
  white-space: nowrap;
  animation: marquee 50s linear infinite;
  gap: 32px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.marquee-bar:hover .marquee-track {
  animation-play-state: paused;
}
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.marquee-item .lbl {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 10.5px;
  text-transform: uppercase;
}
.marquee-item .val {
  color: var(--text-primary);
  font-weight: 600;
}
.marquee-item .up { color: var(--positive); }
.marquee-item .down { color: var(--negative); }
.marquee-item .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand);
}

/* ================= 4. HEADER NAVBAR ================= */
.navbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 30px;
  z-index: 100;
  gap: 20px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}
.logo-glyph {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #17191D;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.logo-glyph-circle {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
}
.brand-name {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.brand-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Center Search in Navbar */
.nav-center {
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
}
.nav-search-wrapper {
  position: relative;
  width: 100%;
}
.nav-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.nav-search-input {
  width: 100%;
  height: 36px;
  padding: 0 36px 0 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-size: 12.5px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: var(--transition-fast);
}
.nav-search-input:focus {
  background: var(--surface);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(21, 82, 160, 0.12);
}
.nav-search-input::placeholder {
  color: var(--text-muted);
}
.nav-search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Right Nav Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.engine-status-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-weight: 500;
}
.engine-status-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
}

.capital-chip {
  display: flex;
  flex-direction: column;
  padding: 3px 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: right;
  line-height: 1.2;
}
.capital-chip .lbl {
  font-size: 9.5px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
}
.capital-chip .val {
  font-size: 12.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.btn-connect {
  background: var(--brand);
  color: #FFFFFF;
  border: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-connect:hover {
  background: var(--brand-hover);
}

.btn-admin-portal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-admin-portal:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  color: var(--text-primary);
  cursor: pointer;
}

/* ================= 5. MAIN DASHBOARD LAYOUT & SIDEBAR ================= */
.dashboard-layout {
  display: flex;
  min-height: calc(100vh - 90px);
}

/* Persistent Left Sidebar */
.app-sidebar {
  width: 224px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
  position: sticky;
  top: 90px;
  height: calc(100vh - 90px);
  overflow-y: auto;
}

.sidebar-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 10px 4px;
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.sidebar-nav-item, .nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: var(--transition-fast);
}
.sidebar-nav-item:hover, .nav-tab:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
}
.sidebar-nav-item.active, .nav-tab.active {
  background: var(--secondary-accent-subtle);
  color: var(--secondary-accent);
  font-weight: 600;
  border-color: rgba(21, 82, 160, 0.2);
}
.sidebar-nav-item svg, .nav-tab svg {
  flex-shrink: 0;
  color: inherit;
}
.sidebar-nav-item .badge {
  margin-left: auto;
  font-size: 10.5px;
  font-family: var(--font-mono);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-weight: 600;
}
.sidebar-nav-item.active .badge {
  background: #FFFFFF;
  color: var(--secondary-accent);
  border-color: rgba(21, 82, 160, 0.25);
}

.sidebar-info-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}
.sidebar-info-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.sidebar-info-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}
.sidebar-meta-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.sidebar-meta-item {
  display: flex;
  justify-content: space-between;
}
.sidebar-meta-item .val {
  color: var(--text-primary);
  font-weight: 600;
}

/* Main Content Workspace */
.dashboard-content {
  flex: 1;
  min-width: 0;
  padding: 24px 32px 64px;
}

.view-section {
  display: none;
}
.view-section.active {
  display: block;
}

/* ================= 6. VIEW 1: MARKETS DISCOVERY HUB ================= */
.markets-header-banner {
  margin-bottom: 20px;
}
.markets-page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.markets-page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Category Filter Bar & Toolbar */
.markets-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.filter-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}
.filter-pill:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.filter-pill.active {
  background: var(--text-primary);
  color: #FFFFFF;
  border-color: var(--text-primary);
  font-weight: 600;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  width: 200px;
  transition: var(--transition-fast);
}
.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}
.sort-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Markets Grid (3-columns on desktop, 2 on tablet, 1 on mobile) */
.markets-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1280px) {
  .markets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 768px) {
  .markets-grid {
    grid-template-columns: 1fr;
  }
}

/* Market Card Component */
.market-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.market-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.market-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.market-badge-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.league-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}
.line-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--secondary-accent);
  background: var(--secondary-accent-subtle);
  border: 1px solid rgba(21, 82, 160, 0.18);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}
.match-status-pill {
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.match-status-pill .status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--positive);
}

.match-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.match-meta {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-bottom: 14px;
}
.match-meta-sep {
  color: var(--text-muted);
  margin: 0 4px;
}

/* OUTCOMES & INTERACTIVE PRICING BLOCK */
.outcome-wrapper {
  margin-bottom: 12px;
}
.outcome-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-outcome {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
}
.btn-outcome:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}
.btn-outcome-yes {
  border-left: 3px solid var(--positive);
}
.btn-outcome-yes:hover {
  background: var(--positive-subtle);
  border-color: var(--positive-border);
}
.btn-outcome-no {
  border-left: 3px solid var(--negative);
}
.btn-outcome-no:hover {
  background: var(--negative-subtle);
  border-color: var(--negative-border);
}

.outcome-row-top {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.btn-outcome-yes .outcome-row-top .label { color: var(--positive); }
.btn-outcome-no .outcome-row-top .label { color: var(--negative); }

.outcome-row-bottom {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
}
.outcome-price-val {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.outcome-odds-val {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Split Probability Bar */
.prob-bar {
  height: 4px;
  background: #E2E8F0;
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
  width: 100%;
}
.prob-fill-yes {
  background: var(--positive);
  height: 100%;
  transition: width 250ms ease;
}
.prob-fill-no {
  background: var(--negative);
  height: 100%;
  transition: width 250ms ease;
}

/* Card Footer */
.market-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-secondary);
}
.card-stats-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-stress-card {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-stress-card:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.btn-trade-card {
  background: var(--secondary-accent-subtle);
  color: var(--secondary-accent);
  border: 1px solid rgba(21, 82, 160, 0.2);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-trade-card:hover {
  background: var(--secondary-accent);
  color: #FFFFFF;
}

/* ================= 7. VIEW 2: TRADING TERMINAL ================= */
.terminal-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap;
}
.btn-back-markets {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-back-markets:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.terminal-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.terminal-breadcrumbs .sep {
  color: var(--text-muted);
}
.terminal-breadcrumbs .active {
  color: var(--text-primary);
  font-weight: 600;
}
.live-pulse-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--positive);
  background: var(--positive-subtle);
  border: 1px solid var(--positive-border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 2px rgba(22, 163, 106, 0.2);
}

/* Terminal 2-Column Grid Layout */
.terminal-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
}
@media (max-width: 1100px) {
  .terminal-layout {
    grid-template-columns: 1fr;
  }
}

.terminal-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.terminal-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Match Header Card */
.match-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  gap: 20px;
  flex-wrap: wrap;
}
.match-header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
}
.match-header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.match-info-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.25;
}
.match-tag-status {
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--positive);
  background: var(--positive-subtle);
  border: 1px solid var(--positive-border);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.match-info-sub {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Header Live Stats Strip */
.match-header-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
}
.header-stat-item {
  display: flex;
  flex-direction: column;
}
.header-stat-item .stat-lbl {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.header-stat-item .stat-val {
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.header-stat-item .stat-val.primary {
  color: var(--secondary-accent);
}

.match-selector-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.match-selector-box label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.match-selector-box select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  max-width: 240px;
  transition: var(--transition-fast);
}
.match-selector-box select:hover {
  border-color: var(--border-hover);
}
.match-selector-box select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(21, 82, 160, 0.12);
}

/* Timeline Controls Card */
.timeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  box-shadow: var(--shadow-card);
}
.timeline-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.playback-btn-group {
  display: inline-flex;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}
.btn-ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}
.btn-ctl:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.btn-ctl.active {
  background: var(--secondary-accent);
  color: #FFFFFF;
  font-weight: 600;
}
.btn-play-pause {
  min-width: 68px;
}
.timeline-speed-box {
  display: flex;
  align-items: center;
  gap: 6px;
}
.speed-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}
.timeline-speed-select {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 11.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.timeline-speed-select:focus {
  outline: none;
  border-color: var(--border-focus);
}
.timeline-scrubber-wrapper {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
}
.scrub-range {
  width: 100%;
  height: 6px;
  accent-color: var(--secondary-accent);
  cursor: pointer;
  background: var(--surface-subtle);
  border-radius: 3px;
}
.tick-display-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pulse-indicator {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--secondary-accent);
}

/* Chart Card */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}
.chart-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.chart-title-group {
  display: flex;
  flex-direction: column;
}
.chart-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.chart-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}
.chart-right-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}
.chart-live-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.live-stat-label {
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
}
.live-stat-val {
  font-weight: 700;
  color: var(--secondary-accent);
  font-variant-numeric: tabular-nums;
}
.chart-toggles {
  display: flex;
  background: var(--surface-subtle);
  padding: 2px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  gap: 2px;
}
.chart-btn {
  border: none;
  background: transparent;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.chart-btn:hover {
  color: var(--text-primary);
}
.chart-btn.active {
  background: var(--surface);
  color: var(--secondary-accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.chart-svg {
  width: 100%;
  height: 280px;
  overflow: visible;
  user-select: none;
}

/* DUAL ORDERBOOK */
.orderbook-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 680px) {
  .orderbook-grid {
    grid-template-columns: 1fr;
  }
}
.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.book-card-yes {
  border-top: 3px solid var(--positive);
}
.book-card-no {
  border-top: 3px solid var(--negative);
}
.book-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.book-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.book-badge-accent {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.book-badge-accent.yes { background: var(--positive); }
.book-badge-accent.no { background: var(--negative); }
.book-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.book-title.yes { color: var(--positive); }
.book-title.no { color: var(--negative); }

.book-vol-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
}
.book-vol-label {
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 600;
}
.book-vol-val.yes { color: var(--positive); font-weight: 600; font-variant-numeric: tabular-nums; }
.book-vol-val.no { color: var(--negative); font-weight: 600; font-variant-numeric: tabular-nums; }

.book-cols-header {
  display: grid;
  grid-template-columns: 85px minmax(0, 1fr) 85px;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 3px 6px;
  margin-bottom: 2px;
}
.book-rows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 290px;
  overflow-y: auto;
}
.book-row {
  display: grid;
  grid-template-columns: 85px minmax(0, 1fr) 85px;
  align-items: center;
  padding: 3px 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  user-select: none;
  transition: var(--transition-fast);
}
.book-row:hover {
  background: var(--surface-hover);
}
.book-row.ask .px { color: var(--negative); font-weight: 600; }
.book-row.bid .px { color: var(--positive); font-weight: 600; }
.book-row .sz {
  color: var(--text-primary);
  display: grid;
  grid-template-columns: 8ch max-content;
  align-items: center;
  gap: 4px;
}
.book-row .sz b { text-align: right; }
.book-row .tot { color: var(--text-secondary); text-align: right; }

.book-depth-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  opacity: 0.10;
  border-radius: 2px;
}
.book-depth-bg.ask { background: var(--negative); }
.book-depth-bg.bid { background: var(--positive); }

.owner-tag {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
  line-height: 1.2;
}
.owner-tag.mm {
  background: var(--secondary-accent-subtle);
  color: var(--secondary-accent);
}
.owner-tag.user {
  background: var(--brand-subtle);
  color: var(--brand);
}
.owner-tag.bot {
  background: var(--surface-subtle);
  color: var(--text-muted);
}
.user-order {
  outline: 1px solid var(--secondary-accent);
  background: var(--secondary-accent-subtle);
}

.spread-divider {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  margin: 4px 0;
  background: var(--surface-subtle);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--secondary-accent);
  font-variant-numeric: tabular-nums;
}

/* REAL-TIME EXECUTION TAPE */
.tape-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-card);
}
.tape-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--secondary-accent);
}
.tape-badge-tag {
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}
.tape-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 6px;
}
.tape-empty-item {
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
  font-size: 12px;
}
.tape-item {
  font-size: 11.5px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  padding: 5px 8px;
  border-radius: 4px;
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

/* USER MARGIN ACCOUNT & EQUITY CARD */
.user-portfolio-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.portfolio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.portfolio-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
}
.portfolio-status-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--positive);
  background: var(--positive-subtle);
  border: 1px solid var(--positive-border);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}
.dot-online {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--positive);
}

.portfolio-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.portfolio-kpi {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
}
.portfolio-kpi.highlight {
  background: var(--secondary-accent-subtle);
  border-color: rgba(21, 82, 160, 0.2);
}
.portfolio-kpi.highlight .val {
  color: var(--secondary-accent);
}
.portfolio-kpi .lbl {
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.portfolio-kpi .val {
  font-size: 13.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.portfolio-kpi .val.pnl {
  color: var(--positive);
}

.portfolio-action-row {
  display: flex;
  gap: 6px;
}
.btn-deposit-sm {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--positive-border);
  color: var(--positive);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-deposit-sm:hover {
  background: var(--positive-subtle);
}
.btn-reset-sm {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-reset-sm:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* ORDER ENTRY CARD WITH LEVERAGE */
.order-entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.order-entry-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}
.title-with-icon {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
}
.leverage-info-pill {
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--secondary-accent);
  background: var(--secondary-accent-subtle);
  border: 1px solid rgba(21, 82, 160, 0.2);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.order-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 10px;
}
.order-type-btn {
  border: none;
  background: transparent;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.order-type-btn.active {
  background: #FFFFFF;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.trade-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.trade-mode-btn {
  padding: 7px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-secondary);
}
.trade-mode-btn.buy.active {
  background: var(--positive);
  color: #FFFFFF;
  border-color: var(--positive);
}
.trade-mode-btn.sell.active {
  background: var(--negative);
  color: #FFFFFF;
  border-color: var(--negative);
}

.contract-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.contract-btn {
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-fast);
}
.contract-header {
  display: flex;
  flex-direction: column;
}
.contract-side-tag {
  font-weight: 800;
  font-size: 13px;
}
.contract-side-tag.yes { color: var(--positive); }
.contract-side-tag.no { color: var(--negative); }
.contract-label {
  font-size: 10px;
  color: var(--text-muted);
}
.contract-btn .price {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.contract-btn.yes { border-left: 3px solid var(--positive); }
.contract-btn.yes.active {
  background: var(--positive-subtle);
  border-color: var(--positive);
}
.contract-btn.no { border-left: 3px solid var(--negative); }
.contract-btn.no.active {
  background: var(--negative-subtle);
  border-color: var(--negative);
}

.leverage-control-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.lev-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.lev-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.lev-badge {
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  background: #FFFFFF;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--secondary-accent);
}
.lev-chips-row {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.lev-chip {
  flex: 1;
  padding: 4px 0;
  text-align: center;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}
.lev-chip:hover { border-color: var(--border-focus); }
.lev-chip.active {
  background: var(--secondary-accent);
  color: #FFFFFF;
  border-color: var(--secondary-accent);
}
.lev-slider-wrapper { margin-top: 4px; }
.leverage-range {
  width: 100%;
  height: 5px;
  accent-color: var(--secondary-accent);
  cursor: pointer;
}
.lev-slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 2px;
}
.lev-slider-ticks span { cursor: pointer; }
.lev-warning {
  margin-top: 8px;
  font-size: 11px;
  color: var(--negative);
  background: var(--negative-subtle);
  border: 1px solid var(--negative-border);
  padding: 6px 8px;
  border-radius: 4px;
}

.input-group {
  margin-bottom: 10px;
}
.input-group label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.input-with-addon {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  transition: var(--transition-fast);
}
.input-with-addon:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(21, 82, 160, 0.12);
}
.input-with-addon input {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.input-with-addon input:focus { outline: none; }
.input-addon {
  padding: 0 10px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border-left: 1px solid var(--border);
  height: 36px;
  display: flex;
  align-items: center;
}

.quick-amount-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.chip-btn {
  padding: 5px 0;
  text-align: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}
.chip-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.order-tpsl-section {
  margin-bottom: 12px;
}
.tpsl-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
}
.order-tpsl-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.tpsl-subgroup label {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}
.tpsl-subgroup input {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  background: var(--surface);
}

.payout-preview-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}
.preview-lbl {
  color: var(--text-secondary);
}
.preview-row .val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.preview-row .val.margin {
  color: var(--secondary-accent);
}
.preview-row .val.liq {
  color: var(--negative);
}
.preview-row .val.roi {
  color: var(--positive);
}

.btn-place-order {
  width: 100%;
  height: 42px;
  background: var(--positive);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-place-order:hover {
  filter: brightness(0.94);
}
.order-entry-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  text-align: center;
}

/* ================= FULL-WIDTH BOTTOM TRADING DOCK ================= */
.terminal-bottom-dock {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-top: 14px;
}
.dock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
}
.dock-tabs {
  display: flex;
  gap: 4px;
}
.dock-tab {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition-fast);
}
.dock-tab:hover {
  color: var(--text-primary);
}
.dock-tab.active {
  color: var(--secondary-accent);
  font-weight: 600;
  border-bottom-color: var(--secondary-accent);
}
.dock-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: 4px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.dock-tab.active .dock-badge {
  background: var(--secondary-accent-subtle);
  color: var(--secondary-accent);
  border-color: rgba(21, 82, 160, 0.25);
}
.dock-actions {
  display: flex;
  gap: 8px;
}
.btn-dock-danger {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--negative);
  background: var(--negative-subtle);
  border: 1px solid var(--negative-border);
  border-radius: 4px;
  cursor: pointer;
}
.btn-dock-warning {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--warning);
  background: var(--warning-subtle);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 4px;
  cursor: pointer;
}
.dock-content {
  padding: 0;
}
.dock-pane {
  display: none;
}
.dock-pane.active {
  display: block;
}
.dock-table-wrapper {
  overflow-x: auto;
}
.binance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.binance-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
}
.binance-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}
.binance-table tr:hover td {
  background: var(--surface-subtle);
}
.binance-empty-row {
  text-align: center;
  padding: 36px !important;
}
.binance-empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.binance-empty-content span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.binance-empty-content p {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.pos-symbol-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pos-side-pill {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.pos-side-pill.long {
  background: var(--positive-subtle);
  color: var(--positive);
  border: 1px solid var(--positive-border);
}
.pos-side-pill.short {
  background: var(--negative-subtle);
  color: var(--negative);
  border: 1px solid var(--negative-border);
}
.pos-contract-text {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-primary);
}
.pos-match-tag {
  font-size: 10.5px;
  color: var(--text-muted);
}
.pos-stacked-cell {
  display: flex;
  flex-direction: column;
}
.pos-bold-mono {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--text-primary);
}
.pos-sub-mono {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}
.pos-pnl-text.green { color: var(--positive); font-family: var(--font-mono); font-weight: 700; }
.pos-pnl-text.red { color: var(--negative); font-family: var(--font-mono); font-weight: 700; }
.pos-roe-text.green { color: var(--positive); font-family: var(--font-mono); font-size: 10.5px; }
.pos-roe-text.red { color: var(--negative); font-family: var(--font-mono); font-size: 10.5px; }

.pos-tpsl-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pos-tpsl-text {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 10px;
}
.t-tp { color: var(--positive); font-weight: 600; }
.t-sl { color: var(--negative); font-weight: 600; }
.t-none { color: var(--text-muted); }
.btn-tpsl-inline {
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
}
.btn-market-close {
  background: var(--negative-subtle);
  color: var(--negative);
  border: 1px solid var(--negative-border);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-market-close:hover {
  background: var(--negative);
  color: #FFFFFF;
}
.btn-cancel-binance {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-cancel-binance:hover {
  background: var(--negative-subtle);
  color: var(--negative);
  border-color: var(--negative-border);
}
.pos-badge-limit {
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-secondary);
}

/* TP/SL MODAL STYLING */
.tpsl-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-modal);
}
.tpsl-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.tpsl-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.tpsl-modal-sub {
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  margin-top: 2px;
}
.tpsl-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.tpsl-kpi-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}
.tpsl-kpi-item {
  display: flex;
  flex-direction: column;
}
.tpsl-kpi-item .lbl {
  font-size: 9.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tpsl-kpi-item .val {
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}
.tpsl-input-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
}
.tpsl-input-card.tp { border-left: 3px solid var(--positive); }
.tpsl-input-card.sl { border-left: 3px solid var(--negative); }
.tpsl-input-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.tpsl-input-card-title {
  font-size: 11.5px;
  font-weight: 600;
}
.tpsl-input-card-title.tp { color: var(--positive); }
.tpsl-input-card-title.sl { color: var(--negative); }
.tpsl-pnl-preview {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
}
.tpsl-quick-chips {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.tpsl-chip {
  flex: 1;
  padding: 4px 0;
  text-align: center;
  font-size: 10.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  cursor: pointer;
  transition: var(--transition-fast);
}
.tpsl-chip.tp { color: var(--positive); }
.tpsl-chip.sl { color: var(--negative); }
.tpsl-chip:hover { border-color: var(--border-hover); }
.tpsl-note {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 6px;
}
.tpsl-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ================= 8. VIEW 3: MM ADMIN & QUANT DESK ================= */
.admin-header-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

.admin-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-desk-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}
.admin-desk-chip .chip-label {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.admin-desk-chip .chip-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.admin-subnav-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  padding-bottom: 8px;
  overflow-x: auto;
}
.admin-subtab-btn {
  background: transparent;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
  white-space: nowrap;
}
.admin-subtab-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.admin-subtab-btn.active {
  background: var(--surface);
  color: var(--secondary-accent);
  font-weight: 600;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.admin-subtab-btn .tab-counter {
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}
.admin-subtab-btn.active .tab-counter {
  background: var(--secondary-accent-subtle);
  border-color: rgba(21, 82, 160, 0.25);
  color: var(--secondary-accent);
  font-weight: 700;
}

/* 5 MODEL COCKPIT CARDS */
.admin-models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.admin-model-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-fast);
}
.admin-model-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover);
}
.admin-model-card.disabled {
  opacity: 0.6;
  background: var(--surface-subtle);
}
.model-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.model-id-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.model-toggle-pill {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-muted);
  transition: var(--transition-fast);
}
.model-toggle-pill.active {
  background: var(--positive-subtle);
  color: var(--positive);
  border-color: var(--positive-border);
}
.model-card-formula {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 10px;
}
.model-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.model-metric-item {
  display: flex;
  flex-direction: column;
}
.model-metric-item .lbl {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.model-metric-item .val {
  font-weight: 700;
  color: var(--text-primary);
}
.model-metric-item .val.fair { color: var(--secondary-accent); }
.model-metric-item .val.spr { color: var(--positive); }

/* PARAMETER TUNING CONSOLE */
.admin-console-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}
.admin-console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.admin-console-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-console-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}
.admin-panels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}
.admin-group-panel {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.group-panel-header {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.mm-param-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}
.mm-param-row label {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
  flex: 1;
}
.param-input-box {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  width: 120px;
}
.param-input-box input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  outline: none;
}
.param-input-box .unit {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.param-slider-inline {
  width: 100%;
  margin: 4px 0 10px 0;
  accent-color: var(--secondary-accent);
}
.group-panel-status {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 10px;
}
.btn-mm-tgl {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-mm-tgl:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.btn-mm-tgl.active {
  background: var(--positive-subtle);
  color: var(--positive);
  border-color: var(--positive-border);
}
.mm-toggles-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* SETTLEMENT AUDIT SECTION */
.settle-audit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-top: 24px;
}
.settle-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) auto;
  gap: 12px;
  margin-top: 14px;
  align-items: flex-end;
}
.settle-field-group label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  font-family: var(--font-mono);
  font-weight: 600;
}
.settle-output-card {
  margin-top: 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 12px;
}

/* HISTORICAL BACKTEST & SHARPE RATIO SECTION */
.stress-buttons-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.btn-stress-preset {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.btn-stress-preset:hover {
  border-color: var(--secondary-accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.btn-stress-preset.active {
  border-color: var(--secondary-accent);
  background: var(--secondary-accent-subtle);
}
.preset-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.preset-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.35;
}
.btn-stress-action {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-stress-action:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}
.btn-stress-action.primary {
  background: var(--secondary-accent);
  color: #FFFFFF;
  border-color: var(--secondary-accent);
}
.btn-stress-action.primary:hover {
  background: var(--secondary-accent-hover);
}
.btn-stress-action.danger {
  background: var(--negative-subtle);
  color: var(--negative);
  border-color: var(--negative-border);
}
.btn-stress-action.danger:hover {
  background: var(--negative);
  color: #FFFFFF;
}

/* STRESS PROGRESS BOX */
.stress-progress-card {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.stress-progress-card.active {
  display: block;
}
.stress-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--surface-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--secondary-accent), var(--positive));
  transition: width 150ms ease;
}
.progress-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 6px;
  flex-wrap: wrap;
  gap: 6px;
}

/* KPI SCORECARD & SHARPE HERO */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-fast);
}
.kpi-card.sharpe-hero {
  border: 1px solid rgba(21, 82, 160, 0.4);
  background: linear-gradient(135deg, var(--surface) 0%, rgba(21, 82, 160, 0.04) 100%);
  box-shadow: var(--shadow-card-hover);
}
.kpi-card.sharpe-hero .kpi-title {
  color: var(--secondary-accent);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.kpi-card.sharpe-hero .kpi-value {
  color: var(--secondary-accent);
  font-size: 26px;
}
.kpi-title {
  font-size: 10.5px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.kpi-value.green { color: var(--positive); }
.kpi-value.red { color: var(--negative); }
.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* BACKTEST REPORT TABLE & TOOLBAR */
.backtest-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.backtest-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.backtest-filter-btn {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.backtest-filter-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}
.backtest-filter-btn.active {
  background: var(--surface);
  color: var(--secondary-accent);
  border-color: var(--secondary-accent);
  font-weight: 600;
}
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.okas-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.okas-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
  white-space: nowrap;
}
.okas-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}
.okas-table tr:hover td {
  background: var(--surface-subtle);
}
.table-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.table-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.table-actions {
  display: flex;
  gap: 8px;
}


/* ================= 9. TOASTS & MODALS ================= */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: color-mix(in srgb, var(--surface) 94%, white);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--secondary-accent);
  border-radius: 12px;
  padding: 14px 16px;
  width: min(390px, calc(100vw - 32px));
  box-shadow: 0 14px 38px rgba(16, 24, 40, 0.16), 0 2px 8px rgba(16, 24, 40, 0.08);
  color: var(--text-primary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastIn 220ms cubic-bezier(.2,.8,.2,1) both;
  transition: opacity 250ms ease, transform 250ms ease;
  backdrop-filter: blur(12px);
}
.toast > div:first-child {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 15px !important;
  background: var(--secondary-accent-subtle);
  color: var(--secondary-accent);
}
.toast-content {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.toast-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.toast-msg {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.toast-success { border-left-color: var(--positive); }
.toast-success > div:first-child { background: color-mix(in srgb, var(--positive) 12%, white); color: var(--positive); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning > div:first-child { background: color-mix(in srgb, var(--warning) 14%, white); color: var(--warning); }
.toast-error { border-left-color: var(--negative); }
.toast-error > div:first-child { background: color-mix(in srgb, var(--negative) 12%, white); color: var(--negative); }
.toast-info { border-left-color: var(--secondary-accent); }

@media (max-width: 540px) {
  .toast-container { top: 12px; right: 12px; left: 12px; }
  .toast { width: 100%; }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-modal);
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .app-sidebar {
    display: none;
  }
  .mobile-menu-btn {
    display: block;
  }
  .dashboard-content {
    padding: 16px;
  }
  .navbar {
    padding: 0 16px;
  }
  .nav-center {
    display: none;
  }
}
