:root {
  /* Milky White & Warm Porcelain Palette (eye-friendly, low-glare institutional light mode) */
  --bg-base: hsl(42, 24%, 96.5%);
  --bg-surface: hsl(40, 20%, 99.5%);
  --bg-elevated: hsl(40, 18%, 94%);
  --bg-hover: hsl(40, 18%, 91%);
  --bg-active: hsl(198, 42%, 93%);

  --border-subtle: hsl(40, 14%, 88%);
  --border-strong: hsl(40, 13%, 79%);

  --text-primary: hsl(220, 24%, 15%);
  --text-secondary: hsl(220, 14%, 38%);
  --text-muted: hsl(220, 10%, 54%);

  /* Semantic Quant Accents (tuned for crisp WCAG contrast on milky white) */
  --bull-primary: hsl(156, 72%, 33%);
  --bull-bg: hsla(156, 72%, 36%, 0.10);
  --bull-border: hsla(156, 72%, 36%, 0.28);

  --bear-primary: hsl(350, 72%, 48%);
  --bear-bg: hsla(350, 72%, 50%, 0.09);
  --bear-border: hsla(350, 72%, 50%, 0.26);

  --amber-primary: hsl(34, 86%, 39%);
  --amber-bg: hsla(36, 88%, 46%, 0.11);
  --amber-border: hsla(36, 88%, 46%, 0.28);

  --cyan-primary: hsl(198, 80%, 38%);
  --cyan-bg: hsla(198, 80%, 42%, 0.10);

  --font-sans: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

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

html,
body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   TOP BENCHMARK & LIVE FEED RIBBON
   ========================================================================== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: linear-gradient(180deg, hsl(40, 22%, 99.5%) 0%, var(--bg-surface) 100%);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 1px 3px rgba(30, 35, 45, 0.04);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  padding: 3px 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.brand-bar {
  width: 3px;
  background: var(--bull-primary);
  border-radius: 1px;
}
.brand-bar.b1 { height: 7px; opacity: 0.55; }
.brand-bar.b2 { height: 11px; opacity: 0.8; }
.brand-bar.b3 { height: 15px; }

.brand-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  background: var(--bull-bg);
  color: var(--bull-primary);
  border: 1px solid var(--bull-border);
  border-radius: var(--radius-sm);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.page-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  padding: 3px;
  border-radius: var(--radius-md);
  margin-left: 8px;
}

.page-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.page-nav-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.page-nav-btn.active {
  background: var(--bull-bg);
  color: var(--bull-primary);
  border-color: var(--bull-border);
}

.kin-canvas-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.kin-quad-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kin-canvas-wrap {
  position: relative;
  width: 100%;
  height: 540px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

#kinematics-canvas,
#trajectory-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.kin-leaders-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 245px;
  overflow-y: auto;
}

.kin-leader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.kin-leader-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.kin-leader-row.active {
  background: var(--bg-active);
  border-color: var(--bull-primary);
}

/* ==========================================================================
   PAGE 0: METHODOLOGY & QUANTITATIVE SPECIFICATION
   ========================================================================== */
.meth-hero-card {
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.meth-hero-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 6px 0 4px;
}

.meth-hero-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  max-width: 920px;
  line-height: 1.55;
}

.meth-cta-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meth-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.meth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.meth-card-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.meth-step-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--bull-primary);
}

.meth-card-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.meth-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.meth-text code {
  font-family: var(--font-mono);
  background: var(--bg-base);
  color: var(--text-primary);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

.meth-formula-box {
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  overflow-x: auto;
}

.meth-eq-main {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--bull-primary);
}

.meth-eq-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.meth-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.meth-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.meth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.meth-table th {
  text-align: left;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 6px 8px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
}

.meth-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
  line-height: 1.45;
}

/* ==========================================================================
   PAGE 3: MARKET BREADTH, REGIME VERDICT & SECTOR FLOW
   ========================================================================== */
.mkt-verdict-banner {
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
  gap: 16px;
  align-items: center;
}

.mkt-verdict-tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mkt-verdict-title {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 5px 0 4px;
}

.mkt-verdict-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.48;
}

.mkt-gauges-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mkt-gauge-card {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mkt-gauge-lbl {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.mkt-gauge-val {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

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

.mkt-gauge-bar {
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2px;
}

.mkt-gauge-fill {
  height: 100%;
  border-radius: 3px;
}

.mkt-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mkt-dist-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mkt-dist-box {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.mkt-dist-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mkt-dist-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
}

.mkt-dist-row:hover {
  background: var(--bg-hover);
}

.mkt-dist-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
}

.mkt-dist-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.mkt-dist-fill {
  height: 100%;
  border-radius: 3px;
}

.mkt-stage-stack {
  display: flex;
  width: 118px;
  height: 8px;
  background: var(--bg-base);
  border-radius: 4px;
  overflow: hidden;
}

.stack-seg {
  height: 100%;
}

.leader-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 3px;
  cursor: pointer;
}

.leader-chip:hover {
  border-color: var(--bull-primary);
  color: var(--bull-primary);
}

.benchmark-ribbon {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-md);
}

.bench-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.bench-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.bench-val {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.bench-delta {
  font-size: 11px;
  font-weight: 500;
}

.bench-divider {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.directory-search-wrap {
  position: relative;
}

.directory-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 390px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(25, 30, 42, 0.12);
  z-index: 100;
}

.dir-header {
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
}

.dir-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s ease;
}

.dir-item:hover {
  background: var(--bg-hover);
}

.dir-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dir-sym-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dir-sym {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-primary);
}

.dir-sector {
  font-size: 9.5px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 3px;
}

.dir-name {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 230px;
}

.dir-right {
  text-align: right;
  flex-shrink: 0;
}

.dir-price {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.dir-action {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--bull-primary);
}

.ticker-lookup-form .input-group {
  display: flex;
  align-items: center;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 2px 3px 2px 10px;
  transition: border-color 0.15s ease;
}

.ticker-lookup-form .input-group:focus-within {
  border-color: var(--bull-primary);
}

.input-icon {
  color: var(--text-muted);
  margin-right: 6px;
  flex-shrink: 0;
}

.ticker-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 11.5px;
  width: 215px;
  outline: none;
  padding: 4px 0;
}

.ticker-input::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  background: var(--bull-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: wait;
}

.feed-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bull-primary);
  box-shadow: 0 0 8px var(--bull-primary);
}

.status-text {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.spinning {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toast-banner {
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.toast-banner.toast-success {
  background: var(--bull-bg);
  color: var(--bull-primary);
  border-color: var(--bull-border);
}
.toast-banner.toast-error {
  background: var(--bear-bg);
  color: var(--bear-primary);
  border-color: var(--bear-border);
}

.cloud-feed-bar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-strong);
  padding: 8px 20px;
}

.cloud-feed-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cloud-feed-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--cyan-primary);
}

.cloud-url-input {
  width: 390px;
  max-width: 100%;
}

/* ==========================================================================
   MAIN WORKSPACE & OVERVIEW BAND
   ========================================================================== */
.workspace {
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.overview-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 365px;
  gap: 10px;
}

.podium-section,
.sector-pulse-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.section-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.formula-badge {
  font-size: 10px;
  color: var(--text-secondary);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.podium-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.podium-card {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.podium-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.podium-card.active {
  border-color: var(--bull-primary);
  background: var(--bg-active);
}

.podium-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.podium-sym-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.podium-rank {
  font-size: 10px;
  font-weight: 700;
  color: var(--amber-primary);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  padding: 1px 5px;
  border-radius: 3px;
}

.podium-symbol {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.podium-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  margin-top: 2px;
}

.podium-rs-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.podium-rs-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--bull-primary);
  line-height: 1.1;
}

.podium-rs-lbl {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.podium-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.pm-col {
  display: flex;
  flex-direction: column;
}

.pm-lbl {
  font-size: 9.5px;
  color: var(--text-muted);
}

.pm-val {
  font-size: 11.5px;
  font-weight: 600;
}

/* Sector RS Matrix */
.sector-col-headers {
  display: grid;
  grid-template-columns: 128px 1fr 28px 34px 34px;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 9px 4px 5px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.sector-col-headers .num,
.sector-row .num {
  text-align: right;
}

.sector-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.sector-bars::-webkit-scrollbar {
  width: 5px;
}
.sector-bars::-webkit-scrollbar-track {
  background: transparent;
}
.sector-bars::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.sector-row {
  display: grid;
  grid-template-columns: 128px 1fr 28px 34px 34px;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.sector-row:hover {
  background: var(--bg-hover);
}

.sector-row.active-sector {
  background: var(--bg-active);
  border-color: var(--bull-primary);
}

.sector-name {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.sector-track {
  height: 7px;
  background: var(--bg-base);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.sector-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.sector-stats {
  text-align: right;
  font-size: 10.5px;
}

/* ==========================================================================
   SCREENER TOOLBAR
   ========================================================================== */
.screener-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 8px 14px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-tab:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.filter-tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.filter-input,
.control-select {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  outline: none;
}

.filter-input {
  width: 210px;
}

.filter-input:focus,
.control-select:focus {
  border-color: var(--border-strong);
}

.rs-slider-wrap {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  gap: 6px;
}

.dual-range-container {
  position: relative;
  width: 96px;
  height: 18px;
  display: flex;
  align-items: center;
}

.dual-range-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
}

.dual-range-fill {
  position: absolute;
  height: 4px;
  background: var(--bull-primary);
  border-radius: 2px;
  left: 0%;
  right: 0%;
}

.dual-range-input {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.dual-range-input::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--bull-primary);
  cursor: grab;
  box-shadow: 0 1px 4px rgba(25, 30, 42, 0.22);
  transition: transform 0.1s ease;
}

.dual-range-input::-webkit-slider-thumb:hover,
.dual-range-input::-webkit-slider-thumb:active {
  transform: scale(1.15);
  cursor: grabbing;
}

.dual-range-input::-moz-range-thumb {
  pointer-events: auto;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--bull-primary);
  cursor: grab;
  box-shadow: 0 1px 4px rgba(25, 30, 42, 0.22);
  transition: transform 0.1s ease;
}

.rs-readout {
  display: inline-block;
  min-width: 20px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--bull-primary);
}

.regime-filter-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.regime-check-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.regime-check-pill:hover {
  filter: brightness(1.15);
}

.regime-check-pill.unchecked {
  opacity: 0.35;
  filter: grayscale(0.6);
}

.regime-check-pill input {
  width: 11px;
  height: 11px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--bull-primary);
}

.regime-quick-btn {
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 9.5px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.regime-quick-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ==========================================================================
   METRIC DEFINITIONS LEGEND BAR & CORE SPLIT
   ========================================================================== */
.metric-guide-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 10.5px;
  color: var(--text-secondary);
}

.metric-guide-bar strong {
  color: var(--text-primary);
}

.guide-sep {
  color: var(--border-strong);
}

.guide-code {
  background: var(--bg-elevated);
  color: var(--bull-primary);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
}

.terminal-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 10px;
  align-items: start;
}

.table-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-width: 0;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 1360px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

#desktop-table-scroll {
  min-height: 1280px;
  max-height: 1360px;
}

.momentum-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.momentum-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: hsl(40, 20%, 95.5%);
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 8px 7px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  user-select: none;
}

.momentum-table th.num,
.momentum-table td.num {
  text-align: right;
}

.momentum-table th.sortable {
  cursor: pointer;
  transition: color 0.15s ease;
}

.momentum-table th.sortable:hover,
.momentum-table th.active-sort {
  color: var(--text-primary);
}

.momentum-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.1s ease;
}

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

.momentum-table tbody tr.selected-row {
  background: var(--bg-active);
}

.momentum-table td {
  padding: 7px 7px;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 12px;
}

.watch-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}
.watch-btn.watched {
  color: var(--amber-primary);
}

.rank-cell {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

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

.asset-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.asset-sym {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

.etf-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--cyan-bg);
  color: var(--cyan-primary);
}

.asset-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  max-width: 175px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* RS Rating Badge in Table */
.rs-cell-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-end;
}

.rs-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 12px;
}

.rs-tier-elite {
  background: var(--bull-bg);
  color: var(--bull-primary);
  border: 1px solid var(--bull-border);
}

.rs-tier-strong {
  background: hsla(165, 65%, 45%, 0.1);
  color: hsl(165, 70%, 55%);
  border: 1px solid hsla(165, 65%, 45%, 0.25);
}

.rs-tier-neutral {
  background: var(--amber-bg);
  color: var(--amber-primary);
  border: 1px solid var(--amber-border);
}

.rs-tier-lag {
  background: var(--bear-bg);
  color: var(--bear-primary);
  border: 1px solid var(--bear-border);
}

.rs-mini-bar {
  width: 36px;
  height: 5px;
  background: var(--bg-base);
  border-radius: 3px;
  overflow: hidden;
}

.rs-mini-fill {
  height: 100%;
  border-radius: 3px;
}

/* Return Colors */
.pos { color: var(--bull-primary); }
.neg { color: var(--bear-primary); }
.neutral { color: var(--text-secondary); }

/* Regime Pill */
.regime-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.03em;
}

.regime-breakout {
  background: var(--bull-bg);
  color: var(--bull-primary);
  border: 1px solid var(--bull-border);
}

.regime-stage2 {
  background: var(--cyan-bg);
  color: var(--cyan-primary);
  border: 1px solid hsla(196, 88%, 54%, 0.28);
}

.regime-pullback {
  background: var(--amber-bg);
  color: var(--amber-primary);
  border: 1px solid var(--amber-border);
}

.regime-lagging {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   RIGHT PANEL: DEEP-DIVE TECHNICAL & RS INSPECTOR
   ========================================================================== */
.inspector-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: 66px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inspector-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.inspector-symbol-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inspector-symbol {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.inspector-grade {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bull-bg);
  color: var(--bull-primary);
  border: 1px solid var(--bull-border);
}

.inspector-regime-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

.inspector-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2px;
}

.inspector-sector {
  font-size: 11px;
  color: var(--text-muted);
}

.inspector-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inspector-price-block {
  text-align: right;
}

.inspector-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: hsla(196, 88%, 54%, 0.14);
  border: 1px solid hsla(196, 88%, 54%, 0.48);
  color: var(--cyan-primary);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.inspector-expand-btn:hover {
  background: var(--cyan-primary);
  border-color: var(--cyan-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px hsla(198, 80%, 38%, 0.25);
}

.inspector-body-grid,
.inspector-col-charts,
.inspector-col-metrics {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inspector-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.inspector-day {
  font-size: 12px;
  font-weight: 600;
}

/* RS Scorecard inside Inspector */
.rs-scorecard {
  display: grid;
  grid-template-columns: 106px 1fr;
  gap: 10px;
  margin-top: 12px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
}

.rs-dial-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px;
}

.rs-dial-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.rs-dial-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--bull-primary);
  line-height: 1.1;
  margin: 2px 0;
}

.rs-dial-sub {
  font-size: 9.5px;
  color: var(--text-secondary);
}

.horizon-matrix {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  align-items: center;
}

.hz-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hz-lbl {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.hz-val {
  font-size: 11px;
  font-weight: 700;
}

/* Chart Card */
.chart-card {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.chart-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.chart-tf-pills {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1px;
}

.chart-tf-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.14s ease;
}

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

.chart-tf-btn.active {
  background: hsla(196, 88%, 54%, 0.2);
  color: var(--cyan-primary);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text-secondary);
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.leg-dot {
  width: 8px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.price-dot { background: var(--bull-primary); }
.sma20-dot { background: var(--cyan-primary); }
.sma50-dot { background: var(--amber-primary); }
.sma200-dot { background: hsl(275, 82%, 66%); }

.chart-inline-expand-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--cyan-primary);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.14s ease;
}

.chart-inline-expand-btn:hover {
  background: var(--cyan-primary);
  border-color: var(--cyan-primary);
  color: #ffffff;
}

.canvas-container {
  position: relative;
  width: 100%;
  height: 215px;
  cursor: zoom-in;
}

/* Desktop Widescreen Deep-Dive Theater Modal (.inspector-panel.desktop-expanded) */
body:not(.mobile-mode) .mobile-sheet-backdrop.sheet-visible {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(25, 30, 42, 0.38);
  backdrop-filter: blur(4px);
  z-index: 115;
}

body:not(.mobile-mode) #inspector-panel.desktop-expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1420px, 95vw);
  max-height: 91vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 120;
  padding: 18px 22px 24px;
  border: 1px solid hsla(198, 80%, 38%, 0.40);
  box-shadow: 0 24px 64px rgba(25, 30, 42, 0.22), 0 0 0 1px rgba(25, 30, 42, 0.06);
}

body:not(.mobile-mode) #inspector-panel.desktop-expanded .mobile-sheet-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: -18px;
  background: var(--bg-surface);
  z-index: 10;
  padding-top: 4px;
}

.desktop-theater-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

body.mobile-mode .desktop-theater-hint,
body.mobile-mode .inspector-expand-btn,
body.mobile-mode .chart-inline-expand-btn {
  display: none;
}

body:not(.mobile-mode) #inspector-panel.desktop-expanded .inspector-body-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(380px, 1fr);
  gap: 18px;
  align-items: start;
}

body:not(.mobile-mode) #inspector-panel.desktop-expanded #insp-price-canvas-wrap {
  height: 360px;
  cursor: zoom-out;
}

body:not(.mobile-mode) #inspector-panel.desktop-expanded #insp-traj-canvas-wrap {
  height: 230px !important;
}

#inspector-chart {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-tooltip {
  position: absolute;
  top: 6px;
  left: 8px;
  background: hsla(40, 20%, 99.5%, 0.94);
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 12px rgba(25, 30, 42, 0.08);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  color: var(--text-primary);
  pointer-events: none;
}

/* 52W Range Card */
.range-card {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.range-dist {
  color: var(--bull-primary);
  font-weight: 600;
}

.range-track {
  position: relative;
  height: 7px;
  background: var(--bg-elevated);
  border-radius: 4px;
}

.range-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber-primary), var(--bull-primary));
  border-radius: 4px;
}

.range-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 2px solid var(--bg-base);
}

/* Stage 2 Trend Checklist */
.checklist-card {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

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

.checklist-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.checklist-score {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--bull-primary);
}

.checklist-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
}

.check-status {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
}

/* Quant Grid */
.quant-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quant-cell {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
}

.quant-lbl {
  font-size: 9.5px;
  color: var(--text-muted);
  display: block;
}

.quant-val {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
  display: block;
}

.mobile-overview-toggle,
.nav-lbl-short,
.mobile-bench-strip,
.mobile-filter-drawer-btn,
.mobile-list-header,
.mobile-cards-list,
.mobile-sheet-nav,
.mobile-sheet-backdrop {
  display: none;
}

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

/* Floating Touch / Mouse Zoom Controls on Page 2 Kinematics Canvas */
.kin-touch-zoom-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 6;
}

.kin-zoom-btn {
  width: 30px;
  height: 28px;
  background: hsla(40, 20%, 99.5%, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(25, 30, 42, 0.10);
  transition: all 0.12s ease;
}

.kin-zoom-btn:hover,
.kin-zoom-btn:active {
  background: var(--bg-active);
  border-color: var(--bull-primary);
  color: var(--bull-primary);
}

.kin-zoom-fit {
  font-size: 9px;
  letter-spacing: 0.04em;
}

/* Responsive Breakpoints — keep chart side-by-side next to table even in 900px+ Google Sites embeds */
@media (max-width: 1180px) {
  .overview-band {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
  .terminal-split {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .asset-sub {
    max-width: 115px;
  }
}

@media (max-width: 880px) {
  .overview-band,
  .terminal-split,
  .meth-grid-2,
  .mkt-grid-2,
  .mkt-verdict-banner,
  .mkt-dist-split {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .meth-card,
  .table-panel,
  .podium-section,
  .sector-pulse-card,
  .kin-canvas-card {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }
  .table-scroll,
  .meth-table-wrap,
  .xray-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  #momentum-table {
    min-width: 1120px;
  }
  #mkt-benchmarks-table {
    min-width: 780px;
  }
  #mkt-sector-breadth-table {
    min-width: 580px;
  }
  #mkt-pivots-table {
    min-width: 620px;
  }
  .meth-table {
    min-width: 560px;
  }
  .inspector-panel {
    position: static;
  }
  .podium-grid,
  .mkt-gauges-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .benchmark-ribbon {
    display: none;
  }
}

/* ==========================================================================
   AUTOMATIC MOBILE APP VERSION (`body.mobile-mode` or `<= 768px` without `.force-desktop-mode`)
   Purpose-built Native Mobile Trading App UI:
   - Fit-to-screen Mobile Stock Cards (Zero Horizontal Scroll)
   - Tap-to-Open Slide-Up Bottom Sheet Inspector with Prev/Next Thumb Steppers
   - Collapsible Filter & Sliders Drawer
   - 1-Line Live Benchmark Tape & Compact 4-Tab App Bar
   ========================================================================== */
body.mobile-mode .nav-lbl-full {
  display: none;
}
body.mobile-mode .nav-lbl-short {
  display: inline;
}

body.mobile-mode .benchmark-ribbon {
  display: none;
}

body.mobile-mode .mobile-bench-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 5px 10px;
  font-size: 10.5px;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: nowrap;
}

body.mobile-mode .top-bar {
  padding: 6px 8px;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 40;
}

body.mobile-mode .brand-subtitle {
  display: none;
}

body.mobile-mode .brand-title {
  font-size: 13.5px;
}

body.mobile-mode .brand-lockup {
  width: 100%;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
}

body.mobile-mode .page-nav {
  margin-left: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}

body.mobile-mode .page-nav-btn {
  justify-content: center;
  padding: 6px 4px;
  font-size: 10.5px;
  white-space: nowrap;
}

body.mobile-mode .header-actions {
  width: 100%;
  justify-content: space-between;
  gap: 5px;
}

body.mobile-mode .directory-search-wrap {
  flex: 1;
  min-width: 0;
}

body.mobile-mode .ticker-input {
  width: 100%;
  min-width: 0;
  font-size: 11px;
}

body.mobile-mode .directory-dropdown {
  width: calc(100vw - 20px);
}

body.mobile-mode .live-indicator {
  padding: 3px 6px;
}

body.mobile-mode .status-text {
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

body.mobile-mode .workspace {
  padding: 6px 6px 140px;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body.mobile-mode .workspace > *,
body.mobile-mode .overview-band,
body.mobile-mode .terminal-split,
body.mobile-mode .meth-grid-2,
body.mobile-mode .mkt-grid-2,
body.mobile-mode .mkt-verdict-banner,
body.mobile-mode .mkt-dist-split {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body.mobile-mode .meth-card,
body.mobile-mode .table-panel,
body.mobile-mode .podium-section,
body.mobile-mode .sector-pulse-card,
body.mobile-mode .kin-canvas-card {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

body.mobile-mode .meth-card {
  padding: 12px 10px;
}

body.mobile-mode .meth-card > * + * {
  margin-top: 8px;
}

body.mobile-mode .mkt-gauges-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.table-scroll::-webkit-scrollbar,
.meth-table-wrap::-webkit-scrollbar,
.xray-table-wrap::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.table-scroll::-webkit-scrollbar-track,
.meth-table-wrap::-webkit-scrollbar-track,
.xray-table-wrap::-webkit-scrollbar-track {
  background: var(--bg-elevated);
  border-radius: 3px;
}

.table-scroll::-webkit-scrollbar-thumb,
.meth-table-wrap::-webkit-scrollbar-thumb,
.xray-table-wrap::-webkit-scrollbar-thumb {
  background: hsla(220, 14%, 58%, 0.45);
  border-radius: 3px;
}

body.mobile-mode .meth-table-wrap,
body.mobile-mode .xray-table-wrap,
body.mobile-mode .table-scroll {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

body.mobile-mode .meth-table-wrap *,
body.mobile-mode .xray-table-wrap *,
body.mobile-mode .table-scroll * {
  touch-action: pan-x pan-y;
}

body.mobile-mode .meth-table {
  min-width: 560px;
}

/* Collapsible Top Vanguard & 11-Sector Matrix Drawer */
body.mobile-mode .mobile-overview-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}

body.mobile-mode .mobile-toggle-pill {
  color: var(--bull-primary);
  background: var(--bull-bg);
  border: 1px solid var(--bull-border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
}

body.mobile-mode .overview-band {
  display: none;
}

body.mobile-mode .overview-band.mobile-expanded {
  display: grid;
  gap: 6px;
}

body.mobile-mode .podium-section,
body.mobile-mode .sector-pulse-card {
  padding: 8px;
}

body.mobile-mode .section-desc,
body.mobile-mode .formula-badge,
body.mobile-mode .metric-guide-bar {
  display: none;
}

body.mobile-mode .podium-grid {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  gap: 6px;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
}

body.mobile-mode .podium-card {
  min-width: 152px;
  flex-shrink: 0;
  padding: 7px 8px;
  gap: 4px;
  scroll-snap-align: start;
}

/* Mobile Screener Toolbar & Collapsible Filter Drawer */
body.mobile-mode .screener-toolbar {
  padding: 7px 8px;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

body.mobile-mode .mobile-toolbar-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

body.mobile-mode .filter-tabs {
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  padding-bottom: 2px;
  gap: 4px;
}

body.mobile-mode .filter-tab {
  flex-shrink: 0;
  padding: 5px 8px;
  font-size: 10.5px;
}

body.mobile-mode .mobile-filter-drawer-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 5px 8px;
  border-radius: var(--radius-md);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

body.mobile-mode .mobile-filter-badge {
  background: var(--bull-bg);
  color: var(--bull-primary);
  border: 1px solid var(--bull-border);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 9px;
}

body.mobile-mode #screener-toolbar-controls,
body.mobile-mode #kin-toolbar-controls {
  display: none;
  width: 100%;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  gap: 6px;
}

body.mobile-mode #screener-toolbar-controls.mobile-filters-open,
body.mobile-mode #kin-toolbar-controls.mobile-filters-open {
  display: flex;
}

/* Rationalize Page 2 Kinematics Chart Header & 4 RS Quadrant Pills + SURGE Button on Mobile */
body.mobile-mode .kin-canvas-card {
  padding: 8px 8px;
}

body.mobile-mode .kin-card-header {
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  margin-bottom: 6px;
}

body.mobile-mode #kin-chart-title {
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mobile-mode #kin-reset-zoom-btn,
body.mobile-mode .kin-quad-lbl {
  display: none;
}

body.mobile-mode .kin-quad-badges {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 4px;
  width: 100%;
}

body.mobile-mode .kin-quad-badges .regime-check-pill {
  justify-content: center;
  padding: 3px 3px;
  font-size: 8.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mobile-mode #kin-quad-toggle-btn {
  padding: 3px 6px;
  font-size: 8.8px;
}

/* Mobile Screener Header & Full Swipeable Table (Default) + Optional Compact Cards View */
body.mobile-mode #desktop-table-scroll {
  display: block !important;
  min-height: 0 !important;
  max-height: 68vh !important;
}

body.mobile-mode .table-panel.mobile-cards-active #desktop-table-scroll {
  display: none !important;
}

body.mobile-mode #momentum-table {
  min-width: 1120px;
}

body.mobile-mode #momentum-table th,
body.mobile-mode #momentum-table td {
  padding: 6px 6px;
  font-size: 11px;
}

/* Sticky Rank + Ticker columns when swiping Page 1 #momentum-table left and right on mobile */
body.mobile-mode #momentum-table th:first-child,
body.mobile-mode #momentum-table td:first-child {
  position: sticky;
  left: 0;
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  padding: 6px 3px;
  text-align: center;
  box-shadow: none;
}

body.mobile-mode #momentum-table th:nth-child(2) {
  position: sticky;
  left: 28px;
  top: 0;
  background: hsl(40, 20%, 95.5%);
  z-index: 15;
  max-width: 122px;
  box-shadow: 2px 0 6px rgba(25, 30, 42, 0.08);
}

body.mobile-mode #momentum-table td:nth-child(2) {
  position: sticky;
  left: 28px;
  background: var(--bg-surface);
  z-index: 4;
  max-width: 122px;
  box-shadow: 2px 0 6px rgba(25, 30, 42, 0.08);
}

body.mobile-mode #momentum-table .asset-sub {
  max-width: 105px;
}

body.mobile-mode .mobile-list-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  padding: 7px 10px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 9.5px;
  color: var(--text-muted);
}

.mobile-list-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.m-view-toggle-btn {
  background: var(--bg-base);
  border: 1px solid var(--cyan-primary);
  color: var(--cyan-primary);
  font-size: 9.2px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

body.mobile-mode .mobile-sort-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  padding-bottom: 2px;
}

body.mobile-mode .m-sort-btn {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}

body.mobile-mode .m-sort-btn.active {
  background: var(--bull-bg);
  color: var(--bull-primary);
  border-color: var(--bull-border);
}

body.mobile-mode .mobile-cards-list {
  display: flex;
  flex-direction: column;
  max-height: 62vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.m-stock-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 74px 42px 58px;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid hsla(220, 18%, 18%, 0.65);
  cursor: pointer;
  transition: background 0.12s ease;
}

.m-stock-card:active,
.m-stock-card.active {
  background: var(--bg-active);
}

.m-stock-card.active {
  box-shadow: inset 3px 0 0 var(--bull-primary);
}

.m-rk {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.m-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m-sym-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}

.m-sym {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.m-stage-mini {
  font-size: 8.5px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
  white-space: nowrap;
}

.m-name {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-price-col {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

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

.m-day {
  font-size: 10px;
  font-weight: 600;
}

.m-rs-col {
  display: flex;
  justify-content: center;
}

.m-kin-col {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 10px;
}

/* Mobile Slide-Up Bottom Sheet Inspector Modal (Page 1) & Inline Inspector (Page 2) */
body.mobile-mode #inspector-panel {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  z-index: 100;
  background: var(--bg-surface);
  border-top: 2px solid var(--bull-primary);
  border-radius: 14px 14px 0 0;
  padding: 10px 12px 32px;
  box-shadow: 0 -10px 36px rgba(25, 30, 42, 0.16);
}

body.mobile-mode #inspector-panel.mobile-sheet-open {
  display: flex;
}

/* On Page 2 (RS Kinematics), display the unified inspector inline directly below the graph on mobile */
body.mobile-mode #page-kinematics #inspector-panel {
  display: flex;
  position: static;
  max-height: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 10px;
  box-shadow: none;
  z-index: 1;
}

body.mobile-mode #page-kinematics #inspector-panel .mobile-sheet-nav {
  display: none;
}

body.mobile-mode .mobile-sheet-backdrop.sheet-visible {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(25, 30, 42, 0.36);
  backdrop-filter: blur(2px);
  z-index: 95;
}

body.mobile-mode .mobile-sheet-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: -10px;
  background: var(--bg-surface);
  z-index: 5;
  padding-top: 4px;
}

.mobile-sheet-steppers {
  display: flex;
  align-items: center;
  gap: 6px;
}

.m-step-btn,
.m-sheet-close-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.m-step-btn:active,
.m-sheet-close-btn:active {
  background: var(--bull-bg);
  color: var(--bull-primary);
  border-color: var(--bull-border);
}

.m-sheet-close-btn {
  background: var(--bear-bg);
  border-color: var(--bear-border);
  color: var(--bear-primary);
}

.m-step-pos {
  font-size: 10.5px;
  color: var(--text-secondary);
  font-weight: 700;
}

/* Sticky Left Ticker Column for Any Tables on Mobile (Page 3 Benchmarks / Sector Breadth / Pocket Pivots) */
body.mobile-mode .momentum-table th:first-child {
  position: sticky;
  left: 0;
  top: 0;
  background: hsl(40, 20%, 95.5%);
  z-index: 15;
  box-shadow: 2px 0 6px rgba(25, 30, 42, 0.08);
}

body.mobile-mode .momentum-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--bg-surface);
  z-index: 3;
  box-shadow: 2px 0 6px rgba(25, 30, 42, 0.08);
}

body.mobile-mode #mkt-benchmarks-table {
  min-width: 780px;
}

body.mobile-mode #mkt-sector-breadth-table {
  min-width: 580px;
}

body.mobile-mode #mkt-pivots-table {
  min-width: 620px;
}

body.mobile-mode .kin-canvas-wrap {
  height: 360px;
  touch-action: none;
}

body.mobile-mode .canvas-container {
  height: 175px;
}

/* ==========================================================================
   NASDAQ / ZACKS FUNDAMENTAL RESEARCH (OPTION A & OPTION B X-RAY)
   ========================================================================== */
.fund-cell-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.22;
}

.fund-sub {
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.earn-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.earn-imminent {
  background: var(--amber-bg);
  color: var(--amber-primary);
  border: 1px solid var(--amber-border);
}

.earn-safe {
  color: var(--text-secondary);
  font-size: 10.5px;
}

.ext-session-pill {
  display: inline-block;
  font-size: 9px;
  padding: 0 4px;
  border-radius: 3px;
  margin-top: 1px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.xray-card {
  margin-top: 10px;
  border: 1px solid hsla(196, 88%, 54%, 0.28);
  background: linear-gradient(180deg, hsla(196, 88%, 54%, 0.04) 0%, var(--bg-surface) 100%);
  min-width: 0;
  max-width: 100%;
}

.xray-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11.5px;
  min-width: 0;
  max-width: 100%;
}

.xray-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.xray-kpi-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.xray-kpi-lbl {
  font-size: 9.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.xray-kpi-val {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.xray-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
}

.xray-mini-table {
  width: 100%;
  min-width: 340px;
  border-collapse: collapse;
  font-size: 10.5px;
}

.xray-mini-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 600;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.xray-mini-table td {
  padding: 4px 6px;
  border-bottom: 1px solid hsla(220, 16%, 18%, 0.55);
  color: var(--text-secondary);
  white-space: nowrap;
}

.xray-bar-track {
  width: 100%;
  height: 7px;
  background: var(--bg-base);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}

.xray-ai-note {
  background: hsla(196, 88%, 54%, 0.08);
  border-left: 2px solid var(--cyan-primary);
  padding: 6px 8px;
  border-radius: 0 4px 4px 0;
  font-size: 10.8px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Visual Methodology Diagrams */
.meth-diagram-wrap {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  margin: 4px 0 10px;
  overflow-x: auto;
}

/* Interactive Hover Zones & Floating Tooltip for Methodology Diagrams */
.meth-hover-zone {
  cursor: help;
  transition: opacity 0.14s ease, filter 0.14s ease;
}

.meth-hover-zone:hover {
  filter: drop-shadow(0 2px 6px rgba(25, 30, 42, 0.14));
  opacity: 0.96;
}

.meth-hover-tooltip {
  position: fixed;
  z-index: 200;
  max-width: 340px;
  background: hsla(40, 20%, 99.5%, 0.98);
  border: 1px solid var(--cyan-primary);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: 0 10px 28px rgba(25, 30, 42, 0.16);
  pointer-events: none;
  color: var(--text-primary);
}

.meth-tip-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan-primary);
  margin-bottom: 4px;
}

.meth-tip-body {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.meth-tip-formula {
  font-size: 10.5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 7px;
  color: var(--text-primary);
  word-break: break-word;
}
