/* ==========================================================================
   HartForge Labs Redline - Quantitative Valuation & Technical Terminal Styles
   Operating Entity: HartForge Labs LLC (New York DOS ID: 8042447)
   Bespoke Forensic Terminal Theme:
   - Obsidian #070709, Crimson #ef4444, Amber Gold #f59e0b, Emerald #10b981, Violet #a855f7
   - 3-Column Bento Grid, Interactive DCF Simulator Sliders, Operating Leverage Matrix
   - Autocomplete Dropdowns, Multi-Point Drawing Canvas, Alpha Sweep Matrix
   Modern Web Standards:
   - @container queries (container-type: inline-size) for modular responsive cards
   - Dynamic viewport units (dvh) for fullscreen & chart containers
   - Fluid typography via clamp() for headline metrics and section headers
   - Accessible sticky-header responsive tables (inset-block-start: 0)
   ========================================================================== */

:root {
  --quant-bg-obsidian: #070709;
  --quant-bg-deep: #07090e;
  --quant-bg-card: #0b101b;
  --quant-bg-card-alt: #0f1524;
  --quant-bg-elevated: #131c30;
  
  --quant-border: rgba(148, 163, 184, 0.12);
  --quant-border-crimson: rgba(239, 68, 68, 0.28);
  --quant-border-strong: rgba(239, 68, 68, 0.45);
  --quant-border-emerald: rgba(16, 185, 129, 0.35);
  --quant-border-amber: rgba(245, 158, 11, 0.35);

  --quant-crimson: #ef4444;
  --quant-crimson-glow: rgba(239, 68, 68, 0.35);
  --quant-rose: #f43f5e;
  --quant-amber: #f59e0b;
  --quant-amber-glow: rgba(245, 158, 11, 0.35);
  --quant-emerald: #10b981;
  --quant-emerald-glow: rgba(16, 185, 129, 0.35);
  --quant-violet: #a855f7;
  --quant-violet-glow: rgba(168, 85, 247, 0.35);
  --quant-cyan: #06b6d4;
  --quant-cyan-glow: rgba(6, 182, 212, 0.35);
  --quant-blue: #3b82f6;
  --quant-orange: #f97316;
  --quant-pink: #ec4899;
  --quant-lime: #a3e635;
}

/* ==========================================================================
   1. Container Query Contexts & Fluid Typography
   ========================================================================== */

.quant-portal-wrapper {
  container-type: inline-size;
  container-name: quant-portal;
  width: 100%;
}

.quant-card-container {
  container-type: inline-size;
  container-name: quant-card;
}

.quant-section-eyebrow {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: clamp(0.68rem, 0.8vw, 0.8rem);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #ef4444;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.quant-section-eyebrow::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

.quant-section-title {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: clamp(1.65rem, 3.2vw + 0.5rem, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: #f8fafc;
}

.quant-section-subtitle {
  font-family: var(--font-sans, system-ui, sans-serif);
  font-size: clamp(0.88rem, 1.1vw + 0.4rem, 1.08rem);
  color: #94a3b8;
  line-height: 1.6;
  max-width: 48rem;
  margin-inline: auto;
}

.quant-peg-hero-number {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: clamp(2.5rem, 4.5vw + 1rem, 4.2rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.05em;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(239, 68, 68, 0.28);
}

.quant-price-hero {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: clamp(1.4rem, 2.2vw + 0.5rem, 2.2rem);
  font-weight: 800;
  line-height: 1.1;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   2. Quant Panels, Bespoke Bento Cards & Layout Paradigms
   ========================================================================== */

.quant-panel {
  background: linear-gradient(180deg, rgba(14, 20, 33, 0.94) 0%, rgba(7, 10, 16, 0.98) 100%);
  border: 1px solid var(--quant-border-crimson);
  border-radius: 0.875rem;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.85), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  position: relative;
}

.quant-panel:hover {
  border-color: rgba(239, 68, 68, 0.45);
}

.quant-panel-glow {
  background: linear-gradient(180deg, rgba(19, 27, 45, 0.96) 0%, rgba(9, 13, 22, 0.99) 100%);
  border: 1px solid rgba(239, 68, 68, 0.42);
  border-radius: 0.875rem;
  box-shadow: 0 18px 48px -12px rgba(0, 0, 0, 0.92), 0 0 28px -6px rgba(239, 68, 68, 0.22);
}

/* 3-Column Bento Grid */
.quant-bento-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@container quant-portal (min-width: 1040px) {
  .quant-bento-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Mobile Bento Segmented Switcher & Active States */
#quant-bento-mobile-switcher {
  display: flex;
}

#quant-bento-mobile-switcher button {
  color: #94a3b8;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#quant-bento-mobile-switcher button:hover {
  color: #ffffff;
}

#quant-bento-mobile-switcher button.active {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

@media (max-width: 767.98px) {
  .quant-bento-grid.quant-bento-mobile-active-val .quant-bento-card:not(.quant-bento-card-val) {
    display: none !important;
  }
  .quant-bento-grid.quant-bento-mobile-active-audit .quant-bento-card:not(.quant-bento-card-audit) {
    display: none !important;
  }
  .quant-bento-grid.quant-bento-mobile-active-thesis .quant-bento-card:not(.quant-bento-card-thesis) {
    display: none !important;
  }
}

@container quant-portal (max-width: 767.98px) {
  .quant-bento-grid.quant-bento-mobile-active-val .quant-bento-card:not(.quant-bento-card-val) {
    display: none !important;
  }
  .quant-bento-grid.quant-bento-mobile-active-audit .quant-bento-card:not(.quant-bento-card-audit) {
    display: none !important;
  }
  .quant-bento-grid.quant-bento-mobile-active-thesis .quant-bento-card:not(.quant-bento-card-thesis) {
    display: none !important;
  }
}

@media (min-width: 768px) {
  #quant-bento-mobile-switcher {
    display: none !important;
  }
  .quant-bento-grid .quant-bento-card {
    display: flex !important;
  }
}

/* Filing Event Flag Pins on Chart Timeline */
.quant-filing-pin {
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.15s ease-out;
}

.quant-filing-pin * {
  pointer-events: auto;
}

.quant-filing-pin:hover {
  transform: translateY(-2px);
}

.quant-filing-pin rect {
  transition: all 0.15s ease;
}

.quant-filing-pin:hover rect:last-of-type {
  stroke-width: 2px;
  filter: brightness(1.2) drop-shadow(0 4px 12px rgba(168, 85, 247, 0.6));
}

#quant-filing-pin-tooltip {
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 50;
}

.quant-bento-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(13, 19, 32, 0.96) 0%, rgba(7, 10, 16, 0.98) 100%);
  border: 1px solid rgba(239, 68, 68, 0.24);
  border-radius: 0.875rem;
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.85), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.quant-bento-card:hover {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.92), 0 0 20px -5px rgba(239, 68, 68, 0.2);
}

.quant-bento-header {
  padding: 1.15rem 1.35rem 0.9rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(9, 13, 22, 0.65);
}

.quant-bento-body {
  padding: 1.25rem 1.35rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* Theme Layout Overrides */
body[data-layout="swiss"] .quant-panel,
body[data-layout="swiss"] .quant-bento-card {
  border-radius: 0px !important;
}

body[data-layout="bloomberg"] .quant-panel,
body[data-layout="bloomberg"] .quant-bento-card {
  border-radius: 0.2rem !important;
  background: #05070a !important;
  border-color: #334155 !important;
}

/* ==========================================================================
   3. Workspace View Switcher Tabs & Command Bar
   ========================================================================== */

.quant-workspace-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.25rem;
}

.quant-workspace-tabs::-webkit-scrollbar {
  display: none;
}

.quant-workspace-pill {
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(11, 16, 27, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.18s ease;
}

.quant-workspace-pill:hover {
  background: rgba(22, 30, 48, 0.9);
  color: #ffffff;
  border-color: rgba(239, 68, 68, 0.4);
}

.quant-workspace-pill.active {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(185, 28, 28, 0.32) 100%);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
}

/* Autocomplete Dropdown */
.quant-autocomplete-box {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: #090e1a;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 0.65rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.95), 0 0 24px rgba(239, 68, 68, 0.2);
  z-index: 100;
  scrollbar-width: thin;
}

.quant-autocomplete-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  transition: background-color 0.12s ease;
}

.quant-autocomplete-item:hover,
.quant-autocomplete-item.active {
  background: rgba(239, 68, 68, 0.16);
}

/* ==========================================================================
   4. Interactive DCF & Return Sensitivity Simulator
   ========================================================================== */

.quant-simulator-card {
  background: rgba(7, 10, 16, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 0.65rem;
  padding: 0.85rem 1rem;
}

.quant-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: #1e293b;
  outline: none;
  transition: all 0.15s ease;
}

.quant-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: #f59e0b;
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
  transition: transform 0.15s ease, background 0.15s ease;
}

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

.quant-range-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: #f59e0b;
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.7);
}

@media (pointer: coarse) {
  .quant-range-slider {
    height: 8px;
    margin-block: 0.5rem;
  }
  .quant-range-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }
  .quant-range-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 639px) {
  .quant-portal-wrapper {
    padding-top: 0.75rem !important;
    padding-bottom: 1.25rem !important;
  }
  .quant-portal-wrapper > .space-y-10,
  .quant-portal-wrapper.space-y-10 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-y-reverse: 0;
    margin-top: 1.5rem;
  }
  .quant-section-subtitle {
    display: none;
  }
}

/* ==========================================================================
   5. Operating Leverage Horizontal Delta Matrix & Grades
   ========================================================================== */

.quant-delta-row {
  display: grid;
  grid-template-columns: 4.8rem 1fr 3.6rem 3.4rem;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  padding: 0.2rem 0;
}

.quant-delta-track {
  position: relative;
  width: 100%;
  height: 0.6rem;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.quant-delta-axis {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 29.4%; /* -50% to +120%: zero is at 50/170 = 29.41% */
  width: 1.5px;
  background: rgba(255, 255, 255, 0.4);
  z-index: 2;
}

.quant-delta-bar-neg {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 70.6%; /* from zero axis expanding left */
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
  border-radius: 2px 0 0 2px;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.quant-delta-bar-pos {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 29.4%; /* from zero axis expanding right */
  border-radius: 0 2px 2px 0;
}

.quant-bar-pass {
  background: linear-gradient(90deg, #059669 0%, #10b981 100%);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.quant-bar-watch {
  background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.quant-bar-fail {
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.quant-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.12rem 0.35rem;
  border-radius: 3px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.quant-status-pass {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.quant-status-watch {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.quant-status-fail {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

/* Institutional Shield Grade Badges */
.quant-grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  height: 2.6rem;
  padding: 0 0.65rem;
  border-radius: 0.6rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.quant-grade-A {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.quant-grade-B {
  background: rgba(6, 182, 212, 0.18);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.55);
  box-shadow: 0 0 18px rgba(6, 182, 212, 0.25);
}

.quant-grade-C {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.25);
}

.quant-grade-D {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  border: 1px solid rgba(249, 115, 22, 0.55);
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.25);
}

.quant-grade-F {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.35);
}

/* ==========================================================================
   6. Full Charting Terminal & Interactive Drawing
   ========================================================================== */

.quant-chart-terminal {
  background: #07090e;
  border: 1px solid rgba(239, 68, 68, 0.32);
  border-radius: 0.875rem;
  overflow: hidden;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
}

.quant-chart-terminal.is-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  z-index: 90;
  border-radius: 0;
  border: none;
}

.quant-chart-stage {
  position: relative;
  width: 100%;
  min-height: 560px;
  height: clamp(560px, 74dvh, 780px);
  background:
    radial-gradient(circle at 50% 25%, rgba(185, 28, 28, 0.08) 0%, transparent 70%),
    #06080d;
  user-select: none;
}

.quant-chart-stage.drawing-mode-active {
  cursor: crosshair;
}

.quant-chart-terminal.is-fullscreen .quant-chart-stage {
  height: calc(100dvh - 110px);
}

.quant-tf-btn {
  padding: 0.25rem 0.6rem;
  border-radius: 0.375rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quant-tf-btn:hover {
  color: #f8fafc;
  background: rgba(30, 41, 59, 0.7);
}

.quant-tf-btn.active {
  color: #ffffff;
  background: #b91c1c;
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.quant-ma-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.55rem;
  border-radius: 0.375rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quant-ma-toggle.off {
  opacity: 0.38;
  text-decoration: line-through;
}

/* Extended Chart Timeframe Select (Branded on desktop fine pointers; native sheet preserved on coarse touch) */
.quant-tf-select {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 0.5rem;
  padding: 0.32rem 0.65rem;
  min-height: 2.1rem;
  min-width: 11.25rem;
  max-width: 100%;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.quant-tf-select:focus-visible {
  outline: 2px solid #ef4444;
  outline-offset: 2px;
}

.quant-tf-select optgroup {
  background-color: #090d16;
  color: #94a3b8;
  font-weight: 800;
}

.quant-tf-select option {
  background-color: #0f172a;
  color: #f8fafc;
}

@media (hover: hover) and (pointer: fine) {
  .quant-tf-select,
  .quant-tf-select::picker(select) {
    appearance: base-select;
  }

  .quant-tf-select::picker(select) {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.75rem;
    background-color: #090d16;
    color: #f8fafc;
    border: 1px solid rgba(239, 68, 68, 0.45);
    border-radius: 0.6rem;
    padding: 0.35rem;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.88);
  }

  .quant-tf-select::picker-icon {
    color: #f87171;
  }

  .quant-tf-select option {
    padding: 0.4rem 0.55rem;
    border-radius: 0.375rem;
    color: #e2e8f0;
    cursor: pointer;
  }

  .quant-tf-select option:hover,
  .quant-tf-select option:focus {
    background-color: rgba(239, 68, 68, 0.18);
    color: #ffffff;
  }

  .quant-tf-select option::checkmark {
    color: #ef4444;
  }
}

.quant-zoom-btn {
  min-height: 1.7rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

@media (max-width: 639.98px) {
  .quant-chart-stage {
    min-height: 0 !important;
    height: auto !important;
  }

  #quant-terminal-svg {
    width: 100%;
    height: auto !important;
    display: block;
  }

  .quant-chart-terminal.is-fullscreen {
    padding-top: max(env(safe-area-inset-top, 0px), var(--safe-top, 0px));
    padding-right: max(env(safe-area-inset-right, 0px), var(--safe-right, 0px));
    padding-bottom: max(env(safe-area-inset-bottom, 0px), var(--safe-bottom, 0px));
    padding-left: max(env(safe-area-inset-left, 0px), var(--safe-left, 0px));
  }

  .quant-chart-terminal.is-fullscreen .quant-chart-stage {
    height: calc(100dvh - 140px - max(env(safe-area-inset-top, 0px), var(--safe-top, 0px)) - max(env(safe-area-inset-bottom, 0px), var(--safe-bottom, 0px))) !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .quant-tf-select {
    font-size: 16px !important;
    height: 40px;
    min-height: 40px;
    min-width: 0;
    flex: 1 1 auto;
    width: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.35rem 0.6rem;
  }

  .quant-zoom-btn {
    min-height: 32px;
    min-width: 30px;
  }
}

/* ==========================================================================
   7. Daily Scans Alpha Matrix & Watchlist X-Ray
   ========================================================================== */

.quant-scan-tabs-scroll {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
}

.quant-scan-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border-radius: 9999px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(13, 18, 30, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.18s ease;
}

.quant-scan-pill:hover {
  background: rgba(28, 38, 60, 0.9);
  color: #f1f5f9;
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.quant-scan-pill.active {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(185, 28, 28, 0.35) 100%);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.35);
}

.quant-scan-bar-group {
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.quant-scan-bar-group:hover {
  filter: brightness(1.22);
}

/* ==========================================================================
   8. HartForge Macro Regime Callout Bar
   ========================================================================== */

.quant-macro-callout,
.quant-lynch-callout {
  background: linear-gradient(135deg, rgba(16, 22, 36, 0.92) 0%, rgba(9, 12, 20, 0.98) 100%);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-left: 4px solid #ef4444;
  border-radius: 0.875rem;
  padding: 1.25rem 1.6rem;
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   9. Accessible Responsive Tables
   ========================================================================== */

.quant-table-region {
  width: 100%;
  overflow-x: auto;
  max-height: 420px;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(7, 9, 14, 0.8);
}

.quant-table-region:focus-visible {
  outline: 2px solid #ef4444;
  outline-offset: 2px;
}

.quant-data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.quant-data-table thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 10;
  background: #0f1524;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  white-space: nowrap;
}

.quant-data-table tbody tr {
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  transition: background-color 0.12s ease;
}

.quant-data-table tbody tr:hover {
  background-color: rgba(239, 68, 68, 0.08);
}

.quant-data-table td {
  padding: 0.6rem 0.85rem;
  white-space: nowrap;
}

/* Institutional Light Mode Overrides for Quant Engine */
html:not([data-theme="dark"]) .quant-section-title,
html:not([data-theme="dark"]) .quant-peg-hero-number,
html:not([data-theme="dark"]) .quant-price-hero {
  color: #0f172a !important;
  text-shadow: none !important;
}
html:not([data-theme="dark"]) .quant-section-subtitle {
  color: #475569 !important;
}
html:not([data-theme="dark"]) .quant-bento-card,
html:not([data-theme="dark"]) .quant-panel,
html:not([data-theme="dark"]) .quant-chart-stage {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
}
html:not([data-theme="dark"]) .quant-subcard,
html:not([data-theme="dark"]) .quant-kpi-pill,
html:not([data-theme="dark"]) .quant-table-region {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
html:not([data-theme="dark"]) .quant-data-table thead th {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-bottom-color: #cbd5e1 !important;
}
html:not([data-theme="dark"]) .quant-data-table tbody tr {
  border-bottom-color: #e2e8f0 !important;
}
html:not([data-theme="dark"]) .quant-panel-glow {
  background: #ffffff !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  box-shadow: 0 4px 20px -4px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(239, 68, 68, 0.08) !important;
}
html:not([data-theme="dark"]) .quant-bento-header {
  background: #f8fafc !important;
  border-bottom-color: #e2e8f0 !important;
}
html:not([data-theme="dark"]) #quant-bento-mobile-switcher button {
  color: #475569 !important;
}
html:not([data-theme="dark"]) #quant-bento-mobile-switcher button:hover {
  color: #0f172a !important;
  background: #f1f5f9 !important;
}
html:not([data-theme="dark"]) #quant-bento-mobile-switcher button.active {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25) !important;
}
html:not([data-theme="dark"]) .quant-workspace-pill {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}
html:not([data-theme="dark"]) .quant-workspace-pill:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #ef4444 !important;
}
html:not([data-theme="dark"]) .quant-workspace-pill.active {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  box-shadow: 0 1px 6px rgba(239, 68, 68, 0.16) !important;
}
html:not([data-theme="dark"]) .quant-autocomplete-box {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14) !important;
}
html:not([data-theme="dark"]) .quant-autocomplete-item {
  border-bottom-color: #f1f5f9 !important;
}
html:not([data-theme="dark"]) .quant-autocomplete-item:hover,
html:not([data-theme="dark"]) .quant-autocomplete-item.active {
  background: #fef2f2 !important;
}
html:not([data-theme="dark"]) .quant-simulator-card {
  background: #fffbeb !important;
  border-color: #fcd34d !important;
}
html:not([data-theme="dark"]) .quant-range-slider {
  background: #e2e8f0 !important;
}
html:not([data-theme="dark"]) .quant-delta-track {
  background: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
}
html:not([data-theme="dark"]) .quant-delta-axis {
  background: rgba(15, 23, 42, 0.35) !important;
}
html:not([data-theme="dark"]) .quant-chart-terminal {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 20px -4px rgba(15, 23, 42, 0.08) !important;
}
html:not([data-theme="dark"]) .quant-tf-btn {
  color: #475569 !important;
  background: transparent !important;
}
html:not([data-theme="dark"]) .quant-tf-btn:hover {
  color: #0f172a !important;
  background: #e2e8f0 !important;
}
html:not([data-theme="dark"]) .quant-tf-btn.active {
  color: #ffffff !important;
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  box-shadow: 0 1px 6px rgba(220, 38, 38, 0.3) !important;
}
html:not([data-theme="dark"]) .quant-tf-select {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #fca5a5 !important;
}
html:not([data-theme="dark"]) .quant-tf-select optgroup {
  background-color: #f8fafc !important;
  color: #475569 !important;
}
html:not([data-theme="dark"]) .quant-tf-select option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}
@media (hover: hover) and (pointer: fine) {
  html:not([data-theme="dark"]) .quant-tf-select::picker(select) {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16) !important;
  }
  html:not([data-theme="dark"]) .quant-tf-select::picker-icon {
    color: #dc2626 !important;
  }
  html:not([data-theme="dark"]) .quant-tf-select option:hover,
  html:not([data-theme="dark"]) .quant-tf-select option:focus {
    background-color: #fef2f2 !important;
    color: #b91c1c !important;
  }
  html:not([data-theme="dark"]) .quant-tf-select option::checkmark {
    color: #dc2626 !important;
  }
}
html:not([data-theme="dark"]) .quant-zoom-btn {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}
html:not([data-theme="dark"]) .quant-zoom-btn:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}
html:not([data-theme="dark"]) .quant-ma-toggle {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}
html:not([data-theme="dark"]) .quant-ma-toggle:hover {
  background: #f1f5f9 !important;
}
html:not([data-theme="dark"]) .quant-scan-pill {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}
html:not([data-theme="dark"]) .quant-scan-pill:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #ef4444 !important;
}
html:not([data-theme="dark"]) .quant-scan-pill.active {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  box-shadow: 0 1px 6px rgba(239, 68, 68, 0.16) !important;
}
html:not([data-theme="dark"]) .quant-macro-callout,
html:not([data-theme="dark"]) .quant-lynch-callout {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  border-left: 4px solid #dc2626 !important;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06) !important;
}
html:not([data-theme="dark"]) body[data-layout="bloomberg"] .quant-panel,
html:not([data-theme="dark"]) body[data-layout="bloomberg"] .quant-bento-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}
