/* ==========================================================================
   VOL SPIKE CANDIDATE — INSTITUTIONAL DESIGN SYSTEM
   Theme: Bloomberg / TradingView Dark Terminal
   Strict Rules: Pure Dark Palette, High Density, Zero Violet/Purple Accents
   ========================================================================== */

:root {
  /* Surface Colors - Standardized Institutional Dark */
  --bg-primary: #07090E;
  --bg-secondary: #0A0E15;
  --bg-card: #0D121B;
  --bg-card-hover: #131A26;
  --bg-header: #090C13;
  --bg-input: #080B10;
  --bg-dropdown: #0E131C;
  --bg-tooltip: #141A24;
  /* Alias tokens consumed by newer feature modules (liquidation suite, etc.) */
  --bg-tertiary: var(--bg-card);

  /* Border & Dividers - Clean Subtle Alpha Lines */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-primary: var(--border-subtle);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-active: #00D2C4;

  /* Typography - High Contrast Light Headers */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-heading: #FFFFFF;

  /* Market Accents - Vivid Identifiable Colors (Strict Zero Purple) */
  --bull-green: #00E676;
  --bull-green-subtle: rgba(0, 230, 118, 0.14);
  --bull-green-glow: rgba(0, 230, 118, 0.25);
  --accent-emerald: #00E676;

  --bear-red: #FF5252;
  --bear-red-subtle: rgba(255, 82, 82, 0.14);
  --bear-red-glow: rgba(255, 82, 82, 0.25);

  --accent-cyan: #00D2C4;
  --accent-cyan-subtle: rgba(0, 210, 196, 0.14);
  --accent-cyan-glow: rgba(0, 210, 196, 0.3);

  --accent-amber: #FFB300;
  --accent-amber-subtle: rgba(255, 179, 0, 0.14);

  --accent-blue: #38BDF8;
  --accent-blue-subtle: rgba(56, 189, 248, 0.14);

  /* Universal Institutional Typography - Standardized Monospace Stack across ALL Themes */
  --font-terminal: "SF Mono", "Menlo", "Consolas", "Liberation Mono", "JetBrains Mono", monospace;
  --font-sans: "SF Mono", "Menlo", "Consolas", "Liberation Mono", "JetBrains Mono", monospace;
  --font-mono: "SF Mono", "Menlo", "Consolas", "Liberation Mono", "JetBrains Mono", monospace;

  /* Shadows - Flat Zero-Shadow Terminal Standard across ALL Themes */
  --shadow-card: none;
  --shadow-panel: none;

  /* Radii - Sharp 2px Institutional Terminal Corners across ALL Themes */
  --radius-sm: 2px;
  --radius-md: 2px;
  --radius-lg: 3px;
  --radius-pill: 2px;

  /* Header & Navigation Heights */
  --header-height: 46px;
  --metrics-height: 52px;
  --tabs-height: 36px;
}

/* ==========================================================================
   STRICT INSTITUTIONAL DARK THEME ENFORCER
   Mandatory: Pure dark terminal environment. Zero light-mode contamination.
   Guarantees color-scheme: dark across all operating systems & browser engines.
   ========================================================================== */
html, body {
  color-scheme: dark !important;
}

/* Accessible Skip Navigation Link */
.skip-link {
  position: absolute;
  top: -999px;
  left: 12px;
  background: var(--bg-card, #0D121B);
  color: var(--accent-cyan, #00D2C4);
  padding: 8px 16px;
  z-index: 99999;
  border: 1px solid var(--accent-cyan, #00D2C4);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: top 0.15s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 12px !important;
  left: 12px !important;
  outline: 2px solid var(--accent-cyan, #00D2C4);
  outline-offset: 2px;
}

/* WCAG Reduced Motion Support */
@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;
  }
}

/* Pure OLED Pitch-Black Mode (High-contrast OLED black surfaces) */
body.oled-mode,
body.oled-mode .app-container,
body.oled-mode .top-header,
body.oled-mode .nav-tabs-bar,
body.oled-mode .metrics-ribbon,
body.oled-mode .session-bar {
  background-color: #000000 !important;
}
body.oled-mode .card,
body.oled-mode .metric-card,
body.oled-mode .table-card,
body.oled-mode .drawer,
body.oled-mode .floating-panel,
body.oled-mode .detail-panel,
body.oled-mode .modal-content,
body.oled-mode .quant-section-card,
body.oled-mode .prompt-filter-bar {
  background-color: #050505 !important;
  border-color: #222222 !important;
}
body.oled-mode .card-header,
body.oled-mode .table-header,
body.oled-mode .drawer-header,
body.oled-mode .panel-header {
  background-color: #0A0A0A !important;
}

/* High-Contrast Terminal Hairline Dividers */
body.high-contrast-borders .card,
body.high-contrast-borders .metric-card,
body.high-contrast-borders .table-card,
body.high-contrast-borders .drawer,
body.high-contrast-borders .top-header,
body.high-contrast-borders .nav-tabs-bar,
body.high-contrast-borders .metrics-ribbon,
body.high-contrast-borders .session-bar,
body.high-contrast-borders table th,
body.high-contrast-borders table td,
body.high-contrast-borders input,
body.high-contrast-borders select,
body.high-contrast-borders textarea,
body.high-contrast-borders .theme-picker-card {
  border-color: #383838 !important;
}

/* Custom UI Font Stack Modifiers */
body.font-mono-mode,
body.font-mono-mode *,
body.font-mono-mode .tab-btn {
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace !important;
}
body.font-jetbrains-mode,
body.font-jetbrains-mode *,
body.font-jetbrains-mode .tab-btn {
  font-family: "JetBrains Mono", "Fira Code", monospace !important;
}
body.font-sans-mode,
body.font-sans-mode *,
body.font-sans-mode .tab-btn {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

/* CSS Reset & Defaults */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body, .app-container {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-terminal);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: -0.15px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* ==========================================================================
   Universal Institutional Terminal Density & Flat Geometry (Standardized for ALL Themes)
   ========================================================================== */
.card,
.metric-card,
.table-card,
.drawer,
.floating-panel,
.detail-panel,
.modal-content,
.quant-section-card,
.prompt-filter-bar,
.widget-card,
.box-card,
.tab-dropdown-menu,
.header-dropdown-menu,
.theme-picker-card,
.settings-group-card,
.settings-stat-box,
.settings-section-card {
  border-radius: var(--radius-sm, 2px) !important;
  box-shadow: none !important;
}

.card-header,
.table-header,
.drawer-header,
.panel-header,
.settings-drawer-header,
.modal-header {
  border-radius: var(--radius-sm, 2px) var(--radius-sm, 2px) 0 0 !important;
}

.card-title,
.table-title,
.panel-title,
.settings-section-title {
  font-family: var(--font-terminal) !important;
  letter-spacing: 0.2px;
}

table thead th,
table tbody td {
  font-family: var(--font-terminal);
}

/* ==========================================================================
   Universal Form Controls & Inputs (Strictly Dark, Zero Ugly Browser Defaults)
   ========================================================================== */
input[type="text"],
input[type="number"],
input[type="search"],
input[type="password"],
input[type="email"],
select,
textarea {
  background-color: #0A0F18 !important;
  border: 1px solid #1E293B !important;
  color: #F1F5F9 !important;
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
  padding: 8px 12px !important;
  border-radius: var(--radius-sm, 2px) !important;
  outline: none !important;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: #00D2C4 !important;
  background-color: #0E1624 !important;
  box-shadow: 0 0 0 2px rgba(0, 210, 196, 0.18) !important;
}

input::placeholder,
textarea::placeholder {
  color: #64748B !important;
}

select {
  cursor: pointer;
  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%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px !important;
  appearance: none;
  -webkit-appearance: none;
}

select option {
  background-color: #0E1420;
  color: #F1F5F9;
  padding: 8px;
}

/* Layout Hierarchy */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-primary);
}

/* Utility Classes */
.mono { font-family: var(--font-mono); }
.text-bull { color: var(--bull-green) !important; }
.text-bear { color: var(--bear-red) !important; }
.text-cyan { color: var(--accent-cyan) !important; }
.text-amber { color: var(--accent-amber) !important; }
.text-muted { color: var(--text-muted) !important; }
.bg-bull-subtle { background: var(--bull-green-subtle); }
.bg-bear-subtle { background: var(--bear-red-subtle); }
.bg-cyan-subtle { background: var(--accent-cyan-subtle); }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Institutional Header Bar - Sleek Single Line */
.top-header {
  height: var(--header-height);
  min-height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  position: sticky;
  top: 0;
  z-index: 200;
  gap: 8px;
  flex-wrap: nowrap;
  overflow: visible;
}

.brand-section {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--text-heading);
  margin-left: 8px;
  user-select: none;
  display: inline-block;
  transition: color 0.15s ease;
}

.brand-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.brand-logo:hover .brand-icon-wrap {
  transform: scale(1.06);
  filter: drop-shadow(0 0 8px rgba(0, 210, 196, 0.7));
}

.brand-logo:hover .brand-name {
  color: var(--accent-cyan);
}

.brand-icon-svg {
  display: block;
}

/* Header Live Market Ticker Strip (BTC, ETH, SOL, Fear & Greed, Regime) */
.header-market-ticker {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 10px;
  flex-wrap: nowrap;
  transition: opacity 0.2s ease;
}
.header-market-ticker::-webkit-scrollbar {
  display: none;
}
.header-market-ticker.is-hidden {
  display: none !important;
}

.header-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  height: 26px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  white-space: nowrap;
  justify-content: center;
}
.header-ticker-item:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
}

.ticker-badge {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--accent-cyan);
  background: var(--accent-cyan-subtle);
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.ticker-badge.fng {
  color: var(--accent-amber);
  background: var(--accent-amber-subtle);
}

.ticker-price {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
}

.ticker-chg {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.fng-item {
  position: relative;
}

.fng-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--bull-green);
  box-shadow: 0 0 6px var(--bull-green);
}
.fng-dot.bull {
  background: var(--bull-green);
  box-shadow: 0 0 6px var(--bull-green);
}
.fng-dot.bear {
  background: var(--bear-red);
  box-shadow: 0 0 6px var(--bear-red);
}
.fng-dot.neutral {
  background: var(--accent-amber);
  box-shadow: 0 0 6px var(--accent-amber);
}

.ticker-sentiment {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Header Live Status & Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  height: 26px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.status-pill:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
}

.status-live-text {
  font-size: 10px;
  font-weight: 800;
  color: var(--bull-green);
  letter-spacing: 0.5px;
}

.status-sep {
  color: var(--border-strong);
  font-size: 10px;
  user-select: none;
}

.status-countdown-text {
  font-size: 10px;
  color: var(--text-muted);
}

.status-refresh-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, color 0.15s ease;
  line-height: 1;
}
.status-refresh-btn:hover {
  color: var(--accent-cyan);
  transform: rotate(90deg);
}

.header-vdivider {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
  margin: 0 3px;
  flex-shrink: 0;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bull-green);
  box-shadow: 0 0 6px var(--bull-green);
  flex-shrink: 0;
}
.status-dot.connecting {
  background: var(--accent-amber);
  box-shadow: 0 0 6px var(--accent-amber);
  animation: pulse-dot 1.5s infinite;
}
.status-dot.disconnected {
  background: var(--bear-red);
  box-shadow: 0 0 6px var(--bear-red);
}
/* REST fallback is DEGRADED, not healthy: it used to inherit the green base dot. */
.status-dot.fallback {
  background: var(--accent-amber);
  box-shadow: 0 0 6px var(--accent-amber);
}
.status-dot.stalled {
  background: var(--bear-red);
  box-shadow: 0 0 6px var(--bear-red);
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  font-size: 11px;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--accent-cyan);
  border-color: var(--border-strong);
}

.icon-btn.active {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-subtle);
}

select.terminal-select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  outline: none;
  cursor: pointer;
}
select.terminal-select:focus {
  border-color: var(--accent-cyan);
}

/* Metrics Ribbon (Uniform Compact Institutional Grid — All Box Sizes Exact Same Height & Sizing) */
.metrics-ribbon {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 4px 10px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  height: 52px;
  max-height: 52px;
  box-sizing: border-box;
  width: 100%;
  transition: all 0.2s ease;
}
.metrics-ribbon::-webkit-scrollbar {
  display: none;
}
.metrics-ribbon.is-hidden {
  display: none !important;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.metric-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.metric-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.1;
  display: block;
}

.metric-value {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.15;
  margin: 0;
}

.val-badge {
  font-size: 9.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  display: inline-block;
  margin-left: 2px;
}

.metric-sub {
  font-size: 7.5px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1;
  display: block;
}

/* Institutional Tab Navigation (Streamlined Single Line & Non-Wrapping) */
.nav-tabs-bar {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: var(--tabs-height);
  min-height: var(--tabs-height);
  position: relative;
  z-index: 100;
  flex-wrap: nowrap;
  overflow: visible;
}

.tabs-left-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex-wrap: nowrap;
}
.tabs-left-group::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  height: 32px;
  font-family: var(--font-terminal);
  letter-spacing: -0.1px;
}

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

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

.tab-count {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.tab-count:empty,
.tab-count.count-zero {
  display: none !important;
}
.tab-btn.active .tab-count {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Dropdown Menu for Quant Suite - Fixed Min-Width, Never Wraps */
.tab-dropdown,
#quant-dropdown-wrapper {
  position: relative;
  display: inline-flex;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  min-width: 125px !important;
}

.tab-dropdown-btn,
#quant-dropdown-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  min-width: 125px !important;
  height: 28px;
}
.tab-dropdown-btn span,
#active-quant-label {
  white-space: nowrap !important;
  display: inline-block !important;
}
.tab-dropdown-btn:hover,
.tab-dropdown.open .tab-dropdown-btn {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Ensure Top Header elements fit without wrapping or overlapping on 1280px-1650px displays */
@media (max-width: 1650px) {
  .gas-tracker-widget .gas-strip-item:last-of-type,
  .gas-tracker-widget .gas-strip-divider:last-of-type {
    display: none !important;
  }
  .header-ticker-item.regime-item .ticker-sentiment {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .terminal-select#refresh-interval-select {
    display: none !important;
  }
  #header-conn-status #conn-text {
    display: none !important;
  }
}

.tab-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  background: #0E1420;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.5);
  min-width: 220px;
  max-height: 480px;
  overflow-y: auto;
  padding: 6px;
  z-index: 10000 !important;
  animation: fadeIn 0.12s ease;
}
.tab-dropdown.open .tab-dropdown-menu {
  display: flex !important;
  flex-direction: column;
  gap: 2px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s ease;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  white-space: nowrap;
}
.dropdown-item:hover {
  background: rgba(0, 210, 196, 0.1);
  color: #FFFFFF;
}
.dropdown-item.active {
  background: rgba(0, 210, 196, 0.15);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Header Tools & Utilities Dropdown */
.header-tools-dropdown {
  position: relative;
  display: inline-flex;
}

.header-tools-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  height: 28px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.header-tools-btn:hover,
.header-tools-dropdown.open .header-tools-btn {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 210, 196, 0.1);
}

.header-tools-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #0E1420;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.5);
  min-width: 220px;
  padding: 6px;
  z-index: 10000 !important;
  animation: fadeIn 0.12s ease;
}

.header-tools-dropdown.open .header-tools-menu {
  display: flex !important;
  flex-direction: column;
  gap: 2px;
}

.header-tool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.1s ease;
}

.header-tool-item:hover {
  background: rgba(0, 210, 196, 0.1);
  color: #FFFFFF;
}

.header-tool-item .tool-icon {
  font-size: 14px;
  line-height: 1;
  width: 18px;
  text-align: center;
}

.header-tool-item .tool-label {
  flex: 1;
}

.header-tool-item .routine-badge {
  background: rgba(0, 210, 196, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 210, 196, 0.35);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
}

.header-tool-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

/* Category Ticker Strip in Sectors Tab */
.category-ticker-strip.sector-page-strip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-top: 10px;
  margin-bottom: 14px;
  padding: 6px 12px;
}

/* View Content Container */
.view-viewport {
  flex: 1;
  padding: 12px 16px;
  position: relative;
}

.view-page {
  display: none;
  animation: fadeIn 0.15s ease;
}
.view-page:not(.active) {
  display: none !important;
  content-visibility: hidden;
}
.view-page.active {
  display: block;
  content-visibility: visible;
}

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

/* ==========================================================================
   Slide-Over Settings Drawer
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.75);
  backdrop-filter: blur(5px);
  z-index: 1020;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.settings-drawer {
  position: fixed;
  top: 0;
  right: -450px;
  width: 420px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-strong);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.8);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: right 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
  visibility: hidden;
  overflow-y: auto;
}
.settings-drawer.open {
  right: 0;
  visibility: visible;
}

.drawer-header {
  padding: 16px 20px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.drawer-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-cyan);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-row-label strong {
  font-size: 12px;
  color: var(--text-primary);
}
.settings-row-label span {
  font-size: 10px;
  color: var(--text-muted);
}

/* Custom Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border-strong);
  transition: 0.2s;
  border-radius: 20px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #FFFFFF;
  transition: 0.2s;
  border-radius: 50%;
}
.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent-cyan);
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(16px);
  background-color: #080B10;
}

/* Compact High Density Table Mode */
body.compact-mode .market-table th,
body.compact-mode .market-table td {
  padding: 4px 8px !important;
  font-size: 11px !important;
}
body.hide-sparklines .sparkline-canvas {
  display: none !important;
}

/* GPU Acceleration & Performance Optimizations (60fps Target) */
.table-wrapper,
.heatmap-container,
.matrix-grid-container {
  will-change: transform;
  contain: paint layout style;
  -webkit-overflow-scrolling: touch;
}

/* Virtualized Row Spacers */
.virtual-spacer-row td {
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  height: inherit;
  background: transparent !important;
}

/* Keyboard Navigation & Accessible Focus Outlines */
:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Touch Target Compliance (Minimum 40-44px targets on mobile/touch) */
@media (max-width: 768px) {
  .btn,
  .chip-btn,
  .icon-btn,
  .tab-btn,
  .header-ticker-item,
  .liq-suite-tab-btn,
  .liq-exchange-chip,
  .liq-margin-chip,
  .liq-dir-chip,
  .heatmap-sym-chip,
  .cascade-preset-chip,
  .liq-autofill-btn,
  .cascade-run-btn {
    min-height: 40px;
    min-width: 40px;
  }
}

/* Core Institutional Typography & Alignment Utilities */
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-xs { font-size: 10px !important; }
.text-sm { font-size: 12px !important; }
.font-mono { font-family: var(--font-mono) !important; }
.font-bold { font-weight: 700 !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

/* ==========================================================================
   OPENTERMINAL 1:1 THEME (ErTasselli/OpenTerminal)
   Accurate 1:1 replica of ErTasselli/OpenTerminal:
   Pitch Black #000000 background, #0A0A0A panels, #111111 panel-2 headers,
   #262626 hairline borders, #FF9900 Bloomberg amber accents,
   #00C853 emerald up, #FF3D3D crimson down, #D9D9D9 / #808080 text,
   and dense SF Mono terminal typography.
   ========================================================================== */

html[data-theme="openterminal"],
html[data-theme="openterminal"] body,
html[data-theme="openterminal"] .app-container {
  background-color: #000000 !important;
  color: #D9D9D9 !important;
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace !important;
  letter-spacing: -0.15px;
}

/* OpenTerminal Scrollbar */
html[data-theme="openterminal"] ::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
}
html[data-theme="openterminal"] ::-webkit-scrollbar-track {
  background: #0A0A0A !important;
}
html[data-theme="openterminal"] ::-webkit-scrollbar-thumb {
  background: #333333 !important;
  border-radius: 2px !important;
}
html[data-theme="openterminal"] ::-webkit-scrollbar-thumb:hover {
  background: #B36B00 !important;
}

/* Headers & Navigation Surfaces */
html[data-theme="openterminal"] .top-header,
html[data-theme="openterminal"] .nav-tabs-bar {
  background-color: #000000 !important;
  border-bottom: 1px solid #262626 !important;
}
html[data-theme="openterminal"] .metrics-ribbon,
html[data-theme="openterminal"] .session-bar {
  background-color: #000000 !important;
  border-bottom: 1px solid #262626 !important;
}

/* OpenTerminal Cards, Panels, Drawers & Boxes */
html[data-theme="openterminal"] .card,
html[data-theme="openterminal"] .metric-card,
html[data-theme="openterminal"] .table-card,
html[data-theme="openterminal"] .drawer,
html[data-theme="openterminal"] .floating-panel,
html[data-theme="openterminal"] .detail-panel,
html[data-theme="openterminal"] .modal-content,
html[data-theme="openterminal"] .quant-section-card,
html[data-theme="openterminal"] .prompt-filter-bar,
html[data-theme="openterminal"] .widget-card,
html[data-theme="openterminal"] .box-card,
html[data-theme="openterminal"] .tab-dropdown-menu,
html[data-theme="openterminal"] .header-dropdown-menu {
  background-color: #0A0A0A !important;
  border: 1px solid #262626 !important;
  border-radius: 2px !important;
  box-shadow: none !important;
}

html[data-theme="openterminal"] .metric-card:hover,
html[data-theme="openterminal"] .card:hover {
  background-color: #121212 !important;
  border-color: #383838 !important;
}

/* OpenTerminal Panel Headers (--panel-2: #111111) */
html[data-theme="openterminal"] .card-header,
html[data-theme="openterminal"] .table-header,
html[data-theme="openterminal"] .drawer-header,
html[data-theme="openterminal"] .panel-header,
html[data-theme="openterminal"] .settings-drawer-header,
html[data-theme="openterminal"] .modal-header {
  background-color: #111111 !important;
  border-bottom: 1px solid #262626 !important;
  border-radius: 2px 2px 0 0 !important;
}

html[data-theme="openterminal"] .card-title,
html[data-theme="openterminal"] .table-title,
html[data-theme="openterminal"] .panel-title,
html[data-theme="openterminal"] .settings-section-title {
  color: #FF9900 !important;
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace !important;
  font-weight: 700;
  letter-spacing: 0.4px;
}

/* OpenTerminal Tab Navigation */
html[data-theme="openterminal"] .tab-btn {
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace !important;
  color: #808080 !important;
  border-radius: 2px 2px 0 0 !important;
  border-bottom: 2px solid transparent !important;
}
html[data-theme="openterminal"] .tab-btn:hover {
  color: #D9D9D9 !important;
  background-color: #111111 !important;
}
html[data-theme="openterminal"] .tab-btn.active {
  color: #FF9900 !important;
  border-bottom: 2px solid #FF9900 !important;
  background: rgba(255, 153, 0, 0.08) !important;
}

/* OpenTerminal Form Controls & Terminal Inputs */
html[data-theme="openterminal"] input[type="text"],
html[data-theme="openterminal"] input[type="number"],
html[data-theme="openterminal"] input[type="search"],
html[data-theme="openterminal"] input[type="password"],
html[data-theme="openterminal"] input[type="email"],
html[data-theme="openterminal"] select,
html[data-theme="openterminal"] textarea,
html[data-theme="openterminal"] .terminal-select {
  background-color: #0A0A0A !important;
  border: 1px solid #262626 !important;
  color: #D9D9D9 !important;
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace !important;
  border-radius: 2px !important;
}
html[data-theme="openterminal"] input:focus,
html[data-theme="openterminal"] select:focus,
html[data-theme="openterminal"] textarea:focus,
html[data-theme="openterminal"] .terminal-select:focus {
  border-color: #FF9900 !important;
  box-shadow: 0 0 0 1px #FF9900 !important;
  background-color: #0E0E0E !important;
}

/* Buttons, Chips, and Toggles */
html[data-theme="openterminal"] .icon-btn,
html[data-theme="openterminal"] .btn-secondary,
html[data-theme="openterminal"] .chip-btn,
html[data-theme="openterminal"] .tab-dropdown-btn {
  background-color: #0A0A0A !important;
  border: 1px solid #262626 !important;
  color: #808080 !important;
  border-radius: 2px !important;
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace !important;
}
html[data-theme="openterminal"] .icon-btn:hover,
html[data-theme="openterminal"] .btn-secondary:hover,
html[data-theme="openterminal"] .chip-btn:hover,
html[data-theme="openterminal"] .tab-dropdown-btn:hover {
  background-color: #141414 !important;
  border-color: #FF9900 !important;
  color: #FF9900 !important;
}
html[data-theme="openterminal"] .icon-btn.active,
html[data-theme="openterminal"] .chip-btn.active,
html[data-theme="openterminal"] .btn-primary {
  background-color: rgba(255, 153, 0, 0.15) !important;
  color: #FF9900 !important;
  border-color: #FF9900 !important;
  border-radius: 2px !important;
}

/* OpenTerminal Tables */
html[data-theme="openterminal"] table thead th {
  background-color: #111111 !important;
  color: #808080 !important;
  border-bottom: 1px solid #262626 !important;
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace !important;
}
html[data-theme="openterminal"] table tbody td {
  border-bottom: 1px solid #1A1A1A !important;
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace !important;
}
html[data-theme="openterminal"] table tbody tr:hover td {
  background-color: rgba(255, 153, 0, 0.04) !important;
}

/* Status Pills, Badges & Labels */
html[data-theme="openterminal"] .status-pill,
html[data-theme="openterminal"] .badge,
html[data-theme="openterminal"] .tab-count,
html[data-theme="openterminal"] .fng-pill {
  background-color: #0A0A0A !important;
  border: 1px solid #262626 !important;
  border-radius: 2px !important;
  font-family: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace !important;
}

/* OpenTerminal Up / Down Color Overrides */
html[data-theme="openterminal"] .text-bull,
html[data-theme="openterminal"] .bull,
html[data-theme="openterminal"] .text-emerald {
  color: #00C853 !important;
}
html[data-theme="openterminal"] .text-bear,
html[data-theme="openterminal"] .bear {
  color: #FF3D3D !important;
}
html[data-theme="openterminal"] .text-cyan {
  color: #FF9900 !important;
}

/* ==========================================================================
   SETTINGS WORKSTATION TAB & MODULE MANAGER
   Full-page institutional settings suite with multi-column workstation grid
   ========================================================================== */
.settings-page-wrapper {
  padding: 16px 20px 40px 20px;
  max-width: 1650px;
  margin: 0 auto;
}

.settings-page-header {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm, 4px);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.settings-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-header-icon {
  font-size: 22px;
}

.settings-header-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--text-heading);
  font-family: var(--font-mono);
  margin: 0;
}

.settings-header-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0;
}

.settings-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(490px, 1fr));
  gap: 16px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm, 4px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

.settings-card-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.card-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm, 4px);
  background: var(--accent-cyan-subtle);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
  font-family: var(--font-mono);
}

.settings-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-subsection-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-amber);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 12px 0 4px 0;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
  font-family: var(--font-mono);
}

/* Tabs & Modules Visibility Grid */
.tabs-visibility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.tab-visibility-item {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm, 4px);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.15s ease;
}

.tab-visibility-item:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
}

.tab-visibility-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* OpenTerminal Overrides for Settings Page */
html[data-theme="openterminal"] .settings-card,
html[data-theme="openterminal"] .settings-page-header,
html[data-theme="openterminal"] .tab-visibility-item {
  background-color: #0A0A0A !important;
  border-color: #262626 !important;
  border-radius: 2px !important;
}
html[data-theme="openterminal"] .settings-card-header {
  background-color: #111111 !important;
  border-color: #262626 !important;
}
html[data-theme="openterminal"] .settings-card-title,
html[data-theme="openterminal"] .settings-subsection-title {
  color: #FF9900 !important;
}

@media (max-width: 1024px) {
  .settings-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* Dedicated DEX Radar Gas & TPS Banner */
.dex-gas-banner {
  margin: 4px 0 14px 0;
  width: 100%;
}
.dex-gas-banner .gas-tracker-widget {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  height: auto;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  font-size: 11px;
  transition: border-color 0.15s ease;
}
.dex-gas-banner .gas-tracker-widget:hover {
  border-color: var(--accent-cyan);
}

/* OpenTerminal Overrides for Header & Banner */
html[data-theme="openterminal"] .brand-name {
  color: #FF9900 !important;
}
html[data-theme="openterminal"] .header-ticker-item,
html[data-theme="openterminal"] .status-pill,
html[data-theme="openterminal"] .dex-gas-banner .gas-tracker-widget {
  background-color: #0A0A0A !important;
  border-color: #262626 !important;
  border-radius: 2px !important;
}

/* ═══════════════════════════════════════════════════════════
   LIQUIDATION INTELLIGENCE SUITE — Full 5-Feature Styling
   ═══════════════════════════════════════════════════════════ */

/* Data-provenance notice for panels backed by local simulation */
.liq-sim-notice {
  margin: 12px 16px 0;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.5;
  color: #F59E0B;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 2px;
}

.liq-suite-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  overflow: hidden;
}

.liq-suite-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-primary);
  background: rgba(0, 0, 0, 0.2);
}

/* Sub-Tab Navigation */
.liq-suite-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--border-primary);
  overflow-x: auto;
}

.liq-suite-tab-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.liq-suite-tab-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.liq-suite-tab-btn.active {
  background: rgba(0, 210, 196, 0.12);
  color: #00D2C4;
  border: 1px solid rgba(0, 210, 196, 0.25);
}

/* Panel */
.liq-suite-panel {
  padding: 20px;
}

/* ─── Calculator Controls ─── */
.liq-calc-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  border: 1px solid var(--border-primary);
}

.liq-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.liq-label {
  font-size: 10px;
  font-weight: 700;
  /* --text-muted is ~3.9:1 on --bg-secondary, below WCAG AA for 10px text. */
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.liq-input {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  color: var(--text-heading);
  font-family: var(--font-mono);
  font-size: 13px;
  width: 140px;
  outline: none;
  transition: border-color 0.2s ease;
}

.liq-input:focus {
  border-color: #00D2C4;
  box-shadow: 0 0 0 2px rgba(0, 210, 196, 0.15);
}

.liq-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.liq-input-suffix {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.liq-autofill-btn {
  padding: 8px 12px;
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.1);
  color: #F59E0B;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.liq-autofill-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: #F59E0B;
}

/* Chip Groups */
.liq-chip-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.liq-exchange-chip,
.liq-margin-chip,
.liq-dir-chip,
.heatmap-sym-chip,
.cascade-preset-chip {
  padding: 6px 12px;
  border: 1px solid var(--border-primary);
  border-radius: 5px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.liq-exchange-chip:hover,
.liq-margin-chip:hover,
.liq-dir-chip:hover,
.heatmap-sym-chip:hover,
.cascade-preset-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.liq-exchange-chip.active,
.liq-margin-chip.active,
.heatmap-sym-chip.active {
  background: rgba(0, 210, 196, 0.12);
  border-color: rgba(0, 210, 196, 0.35);
  color: #00D2C4;
}

.liq-dir-chip.active[data-dir="LONG"] {
  background: rgba(0, 230, 118, 0.12);
  border-color: rgba(0, 230, 118, 0.35);
  color: #00E676;
}

.liq-dir-chip.active[data-dir="SHORT"] {
  background: rgba(255, 59, 105, 0.12);
  border-color: rgba(255, 59, 105, 0.35);
  color: #FF3B69;
}

/* ─── Safety Zone Meter ─── */
.liq-safety-zone-meter {
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid var(--border-primary);
  margin-bottom: 16px;
}

.liq-safety-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.liq-safety-bar-track {
  position: relative;
  height: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 7px;
  overflow: hidden;
}

.liq-safety-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 7px;
  transition: width 0.5s ease;
}

.liq-safety-markers {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  height: 0;
}

.liq-safety-markers span {
  position: absolute;
  font-size: 9px;
  color: var(--text-muted);
  transform: translateX(-50%);
  font-family: var(--font-mono);
}

/* ─── Cross-Exchange Grid ─── */
.liq-exchange-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.liq-exchange-card {
  padding: 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.liq-exchange-card.liq-exchange-active {
  border-color: rgba(0, 210, 196, 0.4);
  box-shadow: 0 0 12px rgba(0, 210, 196, 0.08);
}

.liq-exch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.liq-exch-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-heading);
}

.liq-exch-badge {
  font-size: 9px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  color: var(--text-muted);
  font-weight: 600;
}

.liq-exch-price-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-heading);
  font-family: var(--font-mono);
  display: block;
}

.liq-exch-dist {
  font-size: 11px;
  font-family: var(--font-mono);
}

.liq-exch-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ─── Position Summary ─── */
.liq-position-summary {
  display: flex;
  gap: 24px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  border: 1px solid var(--border-primary);
}

.liq-sum-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.liq-sum-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.liq-sum-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-heading);
  font-family: var(--font-mono);
}

/* ─── Cascade Simulator ─── */
.cascade-controls {
  margin-bottom: 20px;
}

.cascade-control-row {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.cascade-run-btn {
  padding: 10px 24px;
  border: 1px solid rgba(255, 107, 53, 0.4);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(255, 59, 105, 0.15));
  color: #FF6B35;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cascade-run-btn:hover {
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.25), rgba(255, 59, 105, 0.25));
  border-color: #FF6B35;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.2);
}

.cascade-empty-state {
  text-align: center;
  padding: 48px 24px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  border: 1px dashed var(--border-primary);
}

/* Cascade KPIs */
.cascade-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.cascade-kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid var(--border-primary);
}

.cascade-kpi-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cascade-kpi-val {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Cascade Price Journey */
.cascade-price-journey {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  border: 1px solid var(--border-primary);
  margin-bottom: 16px;
  overflow-x: auto;
}

.cascade-price-start,
.cascade-price-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.cascade-arrow-track {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.cascade-step-node {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.cascade-step-node.node-rekt {
  background: rgba(255, 59, 105, 0.2);
  border: 2px solid #FF3B69;
  color: #FF3B69;
}

.cascade-step-node.node-safe {
  background: rgba(0, 230, 118, 0.1);
  border: 2px solid rgba(0, 230, 118, 0.4);
  color: #00E676;
}

.cascade-node-label {
  font-family: var(--font-mono);
}

.cascade-arrow {
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
}

/* Cascade Table */
.cascade-table-wrap {
  margin-bottom: 16px;
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border-primary);
  -webkit-overflow-scrolling: touch;
}

.cascade-table {
  margin: 0;
}

.cascade-row-rekt {
  background: rgba(255, 59, 105, 0.04) !important;
}

.cascade-row-rekt:hover {
  background: rgba(255, 59, 105, 0.08) !important;
}

.cascade-status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.cascade-status-badge.badge-rekt {
  background: rgba(255, 59, 105, 0.15);
  color: #FF3B69;
}

.cascade-status-badge.badge-safe {
  background: rgba(0, 230, 118, 0.1);
  color: #00E676;
}

/* Cascade Insight */
.cascade-insight {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 8px;
}

/* ─── Liquidation Heatmap ─── */
.liq-heatmap-visual {
  display: flex;
  flex-direction: column;
  gap: 3px;
  /* Fixed-width price/leverage/volume/distance columns overflow on phones.
     Keep the row layout but let the user scroll horizontally instead of
     clipping the last two columns behind `overflow-x: hidden` on <body>. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

.liq-heat-row {
  display: grid;
  grid-template-columns: 110px 90px 1fr 80px 60px;
  gap: 8px;
  align-items: center;
  padding: 6px 12px;
  /* The five columns need ~307px of fixed width; without a min-width they
     collapse and the text overlaps instead of scrolling. */
  min-width: 340px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.liq-heat-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.liq-heat-row.heat-danger-zone {
  background: rgba(255, 59, 105, 0.04);
  border-left: 2px solid #FF3B69;
}

.heat-price {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-heading);
}

.heat-leverage-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}

.heat-leverage-tag.tag-bear {
  background: rgba(255, 59, 105, 0.1);
  color: #FF3B69;
}

.heat-leverage-tag.tag-bull {
  background: rgba(0, 230, 118, 0.1);
  color: #00E676;
}

.heat-bar-container {
  height: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 5px;
  overflow: hidden;
}

.heat-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.heat-volume {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
}

.heat-dist {
  font-size: 10px;
  text-align: right;
}

/* Current Price Marker */
.heat-current-price-marker {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  margin: 4px 0;
}

.heat-marker-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #F59E0B, transparent);
}

.heat-marker-tag {
  font-size: 11px;
  font-weight: 700;
  color: #F59E0B;
  font-family: var(--font-mono);
  white-space: nowrap;
  padding: 4px 12px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ─── Ratio Tracker ─── */
.ratio-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.ratio-kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid var(--border-primary);
}

.ratio-kpi-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.ratio-kpi-val {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.ratio-kpi-trend {
  font-size: 11px;
  font-weight: 600;
}

.ratio-chart-wrap {
  padding: 16px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  border: 1px solid var(--border-primary);
}

.ratio-chart-svg {
  width: 100%;
  height: auto;
}

.ratio-chart-legend {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 10px;
}

.ratio-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.ratio-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ─── Margin What-If ─── */
.margin-whatif-controls {
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  border: 1px solid var(--border-primary);
}

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

.margin-status-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid var(--border-primary);
}

.margin-status-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
}

.margin-status-val {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.margin-status-sub {
  font-size: 10px;
  color: var(--text-secondary);
}

.margin-scenarios-wrap {
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-primary);
}

.margin-scenarios-header {
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-primary);
}

.margin-scenario-table {
  margin: 0;
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .liq-exchange-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cascade-kpi-row,
  .ratio-kpi-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .margin-current-status {
    grid-template-columns: repeat(2, 1fr);
  }
  .liq-heat-row {
    grid-template-columns: 90px 70px 1fr 65px 50px;
    font-size: 11px;
  }
}

@media (max-width: 640px) {
  .liq-suite-tabs {
    padding: 4px 8px;
  }
  .liq-suite-tab-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
  .liq-exchange-grid {
    grid-template-columns: 1fr;
  }
  .cascade-kpi-row,
  .ratio-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .liq-calc-controls {
    flex-direction: column;
  }
  .liq-input {
    width: 100%;
  }
  .liq-position-summary {
    flex-wrap: wrap;
    gap: 12px;
  }
  .margin-current-status {
    grid-template-columns: 1fr;
  }
  .cascade-control-row {
    flex-direction: column;
    align-items: stretch;
  }
}
