/* ══════════════════════════════════════════════════════════════════════════════
   Speed Signal AI — Dashboard 2.0
   Premium SaaS Design System
   ══════════════════════════════════════════════════════════════════════════════ */

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


/* ─────────────────────────────────────────────────────────────────────────────
   § 2. DESIGN TOKENS — DARK THEME (default)
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  /* ── Spacing scale (4px base) ── */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  28px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* ── Radii ── */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.25);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.15);
  --shadow-glow-green: 0 0 20px rgba(34, 197, 94, 0.15);

  /* ── Transitions ── */
  --transition-fast: 100ms ease;
  --transition-base: 150ms ease;
  --transition-slow: 250ms ease;
  --transition-spring: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ── Typography ── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --text-xs:   0.7rem;
  --text-sm:   0.8rem;
  --text-base: 0.875rem;
  --text-lg:   1rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  2rem;

  --leading-tight:  1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  --tracking-tight:  -0.025em;
  --tracking-normal:  0;
  --tracking-wide:    0.025em;
  --tracking-wider:   0.05em;
  --tracking-widest:  0.1em;

  /* ── Color Palette — Dark ── */
  --bg:        #0A0F1E;
  --bg-subtle: #0D1225;
  --surface:   #111827;
  --elevated:  #1A2332;
  --overlay:   #1F2B3D;
  --tooltip-bg: #1E293B;

  --border:        rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-glass:  rgba(255, 255, 255, 0.07);
  --border-hover:  rgba(255, 255, 255, 0.12);
  --border-focus:  rgba(59, 130, 246, 0.5);

  --text:   #F1F5F9;
  --text2:  #B8C4CE;
  --text3:  #8B99A8;
  --text4:  #5E6D7E;

  /* Brand accent */
  --accent:    #3B82F6;
  --accent-h:  #60A5FA;
  --accent-dim: rgba(59, 130, 246, 0.12);
  --accent-ghost: rgba(59, 130, 246, 0.06);

  /* Semantic colors */
  --green:   #22C55E;
  --green-d: #4ADE80;
  --green-dim: rgba(34, 197, 94, 0.10);
  --green-border: rgba(34, 197, 94, 0.20);

  --red:   #EF4444;
  --red-d: #F87171;
  --red-dim: rgba(239, 68, 68, 0.10);
  --red-border: rgba(239, 68, 68, 0.20);

  --amber:   #F59E0B;
  --amber-d: #FBBF24;
  --amber-dim: rgba(245, 158, 11, 0.10);
  --amber-border: rgba(245, 158, 11, 0.20);

  --cyan:    #06B6D4;
  --purple:  #8B5CF6;
  --purple-d: #A78BFA;

  /* Surface states */
  --sidebar-bg:   #060A14;
  --glass-hi:     rgba(255, 255, 255, 0.05);
  --glass-md:     rgba(255, 255, 255, 0.035);
  --glass-lo:     rgba(255, 255, 255, 0.025);
  --glass-min:    rgba(255, 255, 255, 0.015);
  --glass-end:    rgba(255, 255, 255, 0.005);

  --shadow:   rgba(0, 0, 0, 0.25);
  --shadow-h: rgba(0, 0, 0, 0.35);

  --grid:     rgba(255, 255, 255, 0.04);
  --zeroline: rgba(255, 255, 255, 0.08);

  --row-border: rgba(255, 255, 255, 0.04);
  --row-hover:  rgba(255, 255, 255, 0.03);
  --row-stripe: rgba(255, 255, 255, 0.015);
  --hover-border: rgba(255, 255, 255, 0.12);
  --bar-highlight: rgba(255, 255, 255, 0.15);

  --text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  --donut-shadow: 0px 0px 4px black, 0px 0px 8px black;

  /* Focus ring */
  --ring-color: rgba(59, 130, 246, 0.4);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--ring-color);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 3. DESIGN TOKENS — LIGHT THEME
   ───────────────────────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:        #F8FAFC;
  --bg-subtle: #F1F5F9;
  --surface:   #FFFFFF;
  --elevated:  #F1F5F9;
  --overlay:   #E8EDF3;
  --tooltip-bg: #FFFFFF;

  --border:        rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-glass:  rgba(0, 0, 0, 0.06);
  --border-hover:  rgba(0, 0, 0, 0.15);
  --border-focus:  rgba(59, 130, 246, 0.5);

  --text:   #0F172A;
  --text2:  #4B5B6E;
  --text3:  #566878;
  --text4:  #627484;

  --accent:    #3B82F6;
  --accent-h:  #2563EB;
  --accent-dim: rgba(59, 130, 246, 0.08);
  --accent-ghost: rgba(59, 130, 246, 0.04);

  --green:   #16A34A;
  --green-d: #22C55E;
  --green-dim: rgba(22, 163, 74, 0.08);
  --green-border: rgba(22, 163, 74, 0.18);

  --red:   #DC2626;
  --red-d: #EF4444;
  --red-dim: rgba(220, 38, 38, 0.08);
  --red-border: rgba(220, 38, 38, 0.18);

  --amber:   #D97706;
  --amber-d: #F59E0B;
  --amber-dim: rgba(217, 119, 6, 0.08);
  --amber-border: rgba(217, 119, 6, 0.18);

  --cyan:    #0891B2;
  --purple:  #7C3AED;
  --purple-d: #8B5CF6;

  --sidebar-bg:   #F1F5F9;
  --glass-hi:     rgba(0, 0, 0, 0.03);
  --glass-md:     rgba(0, 0, 0, 0.02);
  --glass-lo:     rgba(0, 0, 0, 0.015);
  --glass-min:    rgba(0, 0, 0, 0.01);
  --glass-end:    rgba(0, 0, 0, 0.004);

  --shadow:   rgba(0, 0, 0, 0.06);
  --shadow-h: rgba(0, 0, 0, 0.1);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);

  --grid:     rgba(0, 0, 0, 0.06);
  --zeroline: rgba(0, 0, 0, 0.1);

  --row-border: rgba(0, 0, 0, 0.06);
  --row-hover:  rgba(0, 0, 0, 0.03);
  --row-stripe: rgba(0, 0, 0, 0.02);
  --hover-border: rgba(0, 0, 0, 0.15);
  --bar-highlight: rgba(255, 255, 255, 0.4);

  --text-shadow: none;
  --donut-shadow: none;

  --ring-color: rgba(59, 130, 246, 0.3);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 4. ANIMATIONS & KEYFRAMES
   ───────────────────────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.06; }
  50%      { opacity: 0.12; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 4px rgba(59, 130, 246, 0.15); }
  50%      { box-shadow: 0 0 16px rgba(59, 130, 246, 0.3); }
}

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

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

@keyframes tabIndicatorSlide {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 5. RESET & BASE STYLES
   ───────────────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: var(--leading-normal);
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

a {
  color: var(--accent-h);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--accent);
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
}

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

::selection {
  background: var(--accent-dim);
  color: var(--text);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 6. SCROLLBAR
   ───────────────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background var(--transition-base);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text4);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 7. LAYOUT — APP CONTAINER
   ───────────────────────────────────────────────────────────────────────────── */
.app-container {
  max-width: 1800px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-6);
  transition: margin-right var(--transition-spring);
}

.app-container.sidebar-open {
  margin-right: max(calc((100vw - 1800px) / 2), 300px);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 8. HEADER
   ───────────────────────────────────────────────────────────────────────────── */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface) 0%, transparent 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
}

.dashboard-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text);
  margin: 0;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  background: linear-gradient(135deg, var(--text) 0%, var(--accent-h) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dashboard-subtitle {
  font-size: var(--text-sm);
  color: var(--text4);
  margin: var(--space-1) 0 0 0;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.tv-chart-placeholder .spinner {
  width: 28px;
  height: 28px;
  border-width: 3px;
}

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

.header-left {
  display: flex;
  flex-direction: column;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 9. STATUS BADGES (Header)
   ───────────────────────────────────────────────────────────────────────────── */
.status-badge {
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.badge-fresh {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
  animation: pulseGlow 3s ease-in-out infinite;
}

.badge-stale {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.badge-closed {
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: var(--space-2);
  animation: pulse 2s ease-in-out infinite;
}

.pulse-dot.green { background: var(--green); }
.pulse-dot.red   { background: var(--red); }
.pulse-dot.amber { background: var(--amber); }


/* ─────────────────────────────────────────────────────────────────────────────
   § 10. METRIC CARDS
   ───────────────────────────────────────────────────────────────────────────── */
.metrics-row {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.metric-card {
  flex: 1;
  background: linear-gradient(135deg, var(--surface) 0%, var(--elevated) 100%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  text-align: center;
  position: relative;
  overflow: visible;
  height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-spring),
    transform var(--transition-spring);
  animation: fadeInUp 0.5s ease-out forwards;
  opacity: 0;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.metric-card:nth-child(1) { animation-delay: 0.0s; }
.metric-card:nth-child(2) { animation-delay: 0.06s; }
.metric-card:nth-child(3) { animation-delay: 0.12s; }
.metric-card:nth-child(4) { animation-delay: 0.18s; }
.metric-card:nth-child(5) { animation-delay: 0.24s; }

/* Top accent gradient border */
.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Subtle glow behind card */
.metric-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, var(--glass-hi) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
  z-index: 0;
  clip-path: inset(0 round var(--radius-lg));
}

.metric-card:hover {
  border-color: var(--hover-border);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg, 0 10px 25px -5px rgba(0,0,0,0.3));
}

.metric-card:hover::after {
  opacity: 1;
}

.metric-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  margin: 0;
  letter-spacing: var(--tracking-tight);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  line-height: 1;
}

.metric-label {
  font-size: var(--text-xs);
  color: var(--text4);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  font-weight: 600;
  line-height: var(--leading-normal);
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text4);
  margin-top: var(--space-1);
  font-variant-numeric: tabular-nums;
}

/* ── Metric card color variants ── */
.mc-green .metric-value  { color: var(--green); text-shadow: 0 0 20px var(--green-dim); }
.mc-green::before        { background: linear-gradient(90deg, var(--green), var(--green-d)); }
.mc-green                { border-bottom: 1px solid var(--green-border); }

.mc-blue .metric-value   { color: var(--accent-h); text-shadow: 0 0 20px var(--accent-dim); }
.mc-blue::before         { background: linear-gradient(90deg, var(--accent), var(--accent-h)); }
.mc-blue                 { border-bottom: 1px solid rgba(59,130,246,0.15); }

.mc-amber .metric-value  { color: var(--amber-d); text-shadow: 0 0 20px var(--amber-dim); }
.mc-amber::before        { background: linear-gradient(90deg, var(--amber), var(--amber-d)); }
.mc-amber                { border-bottom: 1px solid var(--amber-border); }

.mc-purple .metric-value { color: var(--purple-d); text-shadow: 0 0 20px rgba(139,92,246,0.15); }
.mc-purple::before       { background: linear-gradient(90deg, var(--purple), var(--purple-d)); }
.mc-purple               { border-bottom: 1px solid rgba(139,92,246,0.15); }

.mc-default .metric-value { color: var(--text); }
.mc-default::before       { background: linear-gradient(90deg, var(--text4), var(--text3)); }

.mc-red .metric-value    { color: var(--red-d); text-shadow: 0 0 20px var(--red-dim); }
.mc-red::before          { background: linear-gradient(90deg, var(--red), var(--red-d)); }
.mc-red                  { border-bottom: 1px solid var(--red-border); }

.mc-cyan .metric-value   { color: var(--cyan); }
.mc-cyan::before         { background: linear-gradient(90deg, #0891B2, var(--cyan)); }

/* ── Metric label tooltip ── */
.metric-label.mc-tip {
  cursor: help;
  position: relative;
}

.metric-label.mc-tip .tip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--tooltip-bg);
  color: var(--text);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: var(--leading-relaxed);
  white-space: normal;
  width: max-content;
  max-width: 260px;
  text-align: left;
  box-shadow: var(--shadow-xl);
  z-index: 9999;
  transition: opacity var(--transition-base), visibility var(--transition-base), transform var(--transition-base);
  pointer-events: none;
  letter-spacing: normal;
  text-transform: none;
}

.metric-label.mc-tip .tip-text.tip-wide {
  max-width: 380px;
  left: auto;
  right: 0;
  bottom: auto;
  top: calc(100% + 10px);
  transform: translateY(-4px);
}

.metric-label.mc-tip:hover .tip-text.tip-wide {
  transform: translateY(0);
}

.metric-label.mc-tip:hover .tip-text {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Loading skeleton state ── */
.metric-card.loading .metric-value,
.metric-card.loading .metric-sub {
  color: transparent;
  background: linear-gradient(90deg, var(--glass-hi) 25%, var(--glass-md) 50%, var(--glass-hi) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-xs);
  user-select: none;
}

.metric-card.loading .metric-value {
  width: 80px;
  height: 36px;
  margin: 0 auto;
}

.metric-card.loading .metric-sub {
  width: 120px;
  height: 14px;
  margin: var(--space-2) auto 0;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 11. TAB NAVIGATION
   ───────────────────────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0;
  margin-bottom: var(--space-6);
  overflow-x: auto;
  position: relative;
}

/* Hide scrollbar on tab nav */
.tab-nav::-webkit-scrollbar {
  height: 0;
}

.tab-btn {
  padding: var(--space-3) var(--space-5);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--text-base);
  color: var(--text4);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn:hover {
  color: var(--text);
  background: var(--glass-md);
}

.tab-btn.active {
  color: var(--accent-h);
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
  background: linear-gradient(to bottom, var(--accent-ghost) 0%, transparent 100%);
}

.tab-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 12. TAB CONTENT
   ───────────────────────────────────────────────────────────────────────────── */
.tab-content {
  display: none;
  opacity: 0;
}

.tab-content.active {
  display: block;
  animation: fadeInTab 0.25s ease-out forwards;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 13. STATUS PILLS
   ───────────────────────────────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
  line-height: var(--leading-normal);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 14. TOP TICKERS TABLE (Overview)
   ───────────────────────────────────────────────────────────────────────────── */
.top-tickers-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 var(--space-1);
}

.top-tickers-table thead th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text4);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border-glass);
}

.top-tickers-table tbody tr {
  background: linear-gradient(135deg, var(--surface) 0%, var(--elevated) 100%);
  transition: all var(--transition-base);
  border-left: 3px solid transparent;
}

.top-tickers-table tbody tr:hover {
  background: linear-gradient(135deg, var(--glass-hi) 0%, var(--glass-md) 100%);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 1px 0 var(--glass-hi);
}

.top-tickers-table tbody td {
  padding: var(--space-3) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.top-tickers-table tbody td:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.top-tickers-table tbody td:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.top-tickers-table .tc-rank {
  color: var(--text4);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.top-tickers-table .tc-ticker {
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-wide);
}

.top-tickers-table .tc-exchange {
  color: var(--text4);
  font-size: var(--text-xs);
}

.top-tickers-table .tc-score {
  font-weight: 800;
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 15. PILLAR MINI-BARS (Ticker cards)
   ───────────────────────────────────────────────────────────────────────────── */
.pillar-container {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  margin-top: var(--space-1);
}

.pillar-bar {
  height: 5px;
  border-radius: var(--radius-full);
  transition: width var(--transition-spring);
}

.pillar-label {
  font-size: 0.65rem;
  color: var(--text4);
  min-width: 20px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 16. PILLAR PROGRESS BARS (Overview)
   ───────────────────────────────────────────────────────────────────────────── */
.pillar-progress-section {
  margin-bottom: var(--space-6);
}

.pillar-progress-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-h);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  margin-bottom: var(--space-4);
}

.pillar-progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.pillar-progress-name {
  font-size: var(--text-base);
  color: var(--text2);
  min-width: 130px;
  font-weight: 600;
}

.pillar-progress-track {
  flex: 1;
  height: 6px;
  background: var(--glass-md);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.pillar-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.pillar-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, var(--bar-highlight), transparent);
  animation: shimmer 2.5s infinite;
  background-size: 200% 100%;
}

.pillar-progress-value {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 17. DETAIL PANEL (Sections)
   ───────────────────────────────────────────────────────────────────────────── */
.detail-section {
  background: linear-gradient(160deg, var(--surface) 0%, var(--elevated) 100%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-4);
  transition: all var(--transition-base);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.detail-section:hover {
  border-color: var(--hover-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.detail-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-h);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-glass);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast), padding var(--transition-fast);
}

.detail-row:hover {
  background: var(--row-hover);
  border-radius: var(--radius-xs);
  padding: var(--space-2) var(--space-2);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-key {
  color: var(--text3);
  font-size: var(--text-base);
}

.detail-val {
  color: var(--text);
  font-size: var(--text-base);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.detail-val.positive { color: var(--green); }
.detail-val.negative { color: var(--red-d); }
.detail-val.neutral  { color: var(--amber-d); }
.detail-val.muted    { color: var(--text4); }


/* ─────────────────────────────────────────────────────────────────────────────
   § 18. GRID LAYOUTS
   ───────────────────────────────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  min-width: 0;
}

.grid-2 > * { min-width: 0; }

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-4);
  min-width: 0;
}

.grid-3 > * { min-width: 0; }

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 19. CHART CONTAINERS
   ───────────────────────────────────────────────────────────────────────────── */
.chart-container {
  background: linear-gradient(160deg, var(--surface) 0%, var(--elevated) 100%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  min-height: 300px;
  min-width: 0;
  overflow: hidden;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-container:hover {
  border-color: var(--hover-border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.chart-container .chart-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-h);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-glass);
}

.chart-placeholder {
  width: 100%;
  min-height: 280px;
  max-width: 100%;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 19b. TRADINGVIEW CHART WIDGET
   ───────────────────────────────────────────────────────────────────────────── */
.tv-chart-wrapper {
  background: linear-gradient(160deg, var(--surface) 0%, var(--elevated) 100%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.tv-chart-wrapper:hover {
  border-color: var(--hover-border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.chart-provider-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-glass);
}

.chart-provider-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent-h);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
}

.chart-provider-tabs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chart-provider-tab {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.chart-provider-tab:hover {
  border-color: var(--hover-border);
  color: var(--text2);
}

.chart-provider-tab.active {
  background: var(--accent-ghost);
  border-color: var(--accent);
  color: var(--accent-h);
  font-weight: 600;
}

.tv-chart-container {
  width: 100%;
  height: 500px;
  position: relative;
}

.tv-chart-container > div {
  width: 100% !important;
  height: 100% !important;
}

.tv-chart-container iframe {
  border-radius: var(--radius-lg);
}

.tv-chart-container {
  background: var(--bg);
}

.tv-chart-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.tv-chart-placeholder-text {
  color: var(--text4);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 20. TRADINGVIEW LINKS & BUTTONS
   ───────────────────────────────────────────────────────────────────────────── */
.tv-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--accent-ghost);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-sm);
  color: var(--accent-h);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: 600;
  transition: all var(--transition-base);
  letter-spacing: var(--tracking-wide);
}

.tv-link:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  transform: translateY(-1px);
  color: var(--accent-h);
}

.tv-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  background: linear-gradient(135deg, var(--accent-ghost) 0%, var(--accent-dim) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  color: var(--accent-h);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: 600;
  transition: all var(--transition-spring);
}

.tv-btn:hover {
  background: linear-gradient(135deg, var(--accent-dim) 0%, rgba(59, 130, 246, 0.2) 100%);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25), var(--shadow-glow-blue);
  color: var(--accent-h);
}

.tv-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.tv-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  background: var(--accent-ghost);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-sm);
  color: var(--accent-h);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-base);
}

.tv-btn-sm:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
  color: var(--accent-h);
}

.tv-link-sm {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  background: var(--accent-ghost);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-sm);
  color: var(--accent-h);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--transition-base);
}

.tv-link-sm:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 21. INFO TOOLTIPS
   ───────────────────────────────────────────────────────────────────────────── */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 0.6rem;
  color: var(--text4);
  cursor: help;
  vertical-align: middle;
  margin-left: var(--space-2);
  opacity: 0.5;
  transition: opacity var(--transition-base);
}

.info-tip:hover {
  opacity: 1;
}

.info-tip .tip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--tooltip-bg);
  color: var(--text);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: var(--leading-relaxed);
  white-space: normal;
  width: max-content;
  max-width: 260px;
  text-align: left;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: opacity var(--transition-base), visibility var(--transition-base), transform var(--transition-base);
  pointer-events: none;
  letter-spacing: normal;
  text-transform: none;
}

.info-tip:hover .tip-text {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 22. SIDEBAR
   ───────────────────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--bg) 100%);
  border-left: 1px solid var(--border-glass);
  padding: var(--space-5);
  overflow-y: auto;
  z-index: 1000;
  transition: transform var(--transition-spring);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: -4px 0 24px rgba(0,0,0,0.2);
}

.sidebar.collapsed {
  transform: translateX(100%);
}

.sidebar-brand {
  text-align: center;
  padding: var(--space-4) 40px var(--space-6) 0;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: var(--space-6);
}

.sidebar-brand h2 {
  font-size: var(--text-xl);
  color: var(--text);
  margin: 0;
  font-weight: 800;
  line-height: var(--leading-tight);
  background: linear-gradient(135deg, var(--text) 0%, var(--accent-h) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-brand p {
  font-size: 0.55rem;
  color: var(--accent-h);
  margin: var(--space-1) 0 0 0;
  letter-spacing: 3px;
  font-weight: 600;
}

.sidebar-section {
  font-size: 0.68rem;
  color: var(--text4);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  font-weight: 700;
  margin: var(--space-5) 0 var(--space-3) 0;
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-4) 0;
}

.sidebar-toggle-btn {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 1001;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  transition: all var(--transition-base);
}

.sidebar-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--elevated);
}

.sidebar-toggle-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.sidebar.collapsed ~ .sidebar-toggle-btn {
  right: var(--space-4);
}

/* ── Sidebar form elements ── */
.sidebar label {
  display: block;
  font-size: 0.78rem;
  color: var(--text3);
  margin-bottom: var(--space-2);
  font-weight: 500;
}

.sidebar select,
.sidebar input[type="number"],
.sidebar input[type="text"] {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  margin-bottom: var(--space-3);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  appearance: none;
  -webkit-appearance: none;
}

.sidebar select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235E6D7E' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.sidebar select:focus,
.sidebar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.sidebar input[type="range"] {
  width: 100%;
  margin-bottom: var(--space-3);
  accent-color: var(--accent);
  height: 4px;
  border-radius: var(--radius-full);
}

.sidebar-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-3);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.sidebar-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.sidebar-input-wrap:hover:not(:focus-within) {
  border-color: var(--border-hover);
}

.sidebar-input-wrap input[type="number"] {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  border: none;
  color: var(--text2);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  outline: none;
  min-width: 0;
  margin-bottom: 0;
}

.sidebar-input-wrap input[type="number"]::-webkit-outer-spin-button,
.sidebar-input-wrap input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.sidebar-input-wrap input[type="number"] {
  -moz-appearance: textfield;
}

.sidebar .range-value {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--accent-h);
  text-align: center;
  margin-bottom: var(--space-2);
  font-variant-numeric: tabular-nums;
}

.sidebar .ticker-count {
  text-align: center;
  padding: var(--space-3) 0;
}

.sidebar .ticker-count .count-value {
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.sidebar .ticker-count .count-label {
  color: var(--text4);
  font-size: 0.75rem;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 23. THEME TOGGLE
   ───────────────────────────────────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  margin-bottom: var(--space-2);
}

.theme-toggle-label {
  font-size: var(--text-base);
  color: var(--text2);
  font-weight: 600;
}

.theme-toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.theme-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background var(--transition-slow);
}

.theme-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: transform var(--transition-slow);
}

.theme-toggle-switch input:checked + .theme-toggle-slider {
  background: var(--accent);
}

.theme-toggle-switch input:checked + .theme-toggle-slider::before {
  transform: translateX(20px);
}

.theme-toggle-switch:focus-within .theme-toggle-slider {
  box-shadow: var(--ring);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 24. SEARCH BAR
   ───────────────────────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: var(--space-3) var(--space-4);
  padding-left: var(--space-10);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--surface) 0%, var(--elevated) 100%);
  color: var(--text);
  border: 1px solid var(--border-glass);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  transition: border-color var(--transition-base), box-shadow var(--transition-spring);
  position: relative;
}

/* Search icon pseudo-element — applied to wrapper if available, otherwise graceful fallback */
.search-bar {
  position: relative;
}

.search-bar::before {
  content: '';
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235E6D7E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
}

.search-input::placeholder {
  color: var(--text4);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), var(--shadow-glow-blue);
}

.search-bar select {
  padding: var(--space-3) var(--space-8) var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text2);
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235E6D7E' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.search-bar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 25. SIGNALS TABLE
   ───────────────────────────────────────────────────────────────────────────── */
.signals-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.signals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.signals-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.signals-table th {
  background: var(--elevated);
  color: var(--text3);
  font-weight: 700;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  padding: var(--space-3) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
}

.signals-table th:hover {
  color: var(--text);
  background: var(--overlay);
}

/* Sort indicators */
.signals-table th.sorted-asc::after,
.signals-table th.sorted-desc::after {
  margin-left: var(--space-1);
  font-size: 0.55rem;
  opacity: 0.8;
  color: var(--accent-h);
}

.signals-table th.sorted-asc::after  { content: '\25B2'; }
.signals-table th.sorted-desc::after { content: '\25BC'; }

.signals-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
  color: var(--text2);
  white-space: nowrap;
  transition: background var(--transition-fast);
}

/* Alternating rows */
.signals-table tbody tr:nth-child(even) {
  background: var(--row-stripe);
}

.signals-table tbody tr {
  transition: background var(--transition-fast);
  position: relative;
}

.signals-table tbody tr:hover {
  background: var(--row-hover);
}

/* Left accent on hover */
.signals-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.signals-table .col-ticker,
.movers-table .col-ticker,
.top-tickers-table .col-ticker {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
}

.signals-table .col-score {
  font-weight: 800;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 26. TOP MOVERS TABLES
   ───────────────────────────────────────────────────────────────────────────── */
.movers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.movers-table-section {
  background: linear-gradient(160deg, var(--surface) 0%, var(--elevated) 100%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.movers-table-section:hover {
  border-color: var(--hover-border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.movers-table-section .section-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-h);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-glass);
  background: linear-gradient(90deg, var(--accent-ghost) 0%, transparent 100%);
}

.movers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.movers-table th {
  background: var(--elevated);
  color: var(--text4);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.movers-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
  color: var(--text2);
  transition: background var(--transition-fast);
}

.movers-table tbody tr:nth-child(even) {
  background: var(--row-stripe);
}

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

.movers-table tbody tr:hover {
  background: var(--row-hover);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 27. TICKER DETAIL TAB
   ───────────────────────────────────────────────────────────────────────────── */
.ticker-selector {
  margin-bottom: var(--space-5);
}

.ticker-selector label {
  display: block;
  font-size: var(--text-sm);
  color: var(--text3);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.ticker-selector select {
  padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235E6D7E' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 200px;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.ticker-selector select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.ticker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  background: linear-gradient(135deg, var(--surface) 0%, var(--elevated) 100%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  gap: var(--space-4);
  transition: all var(--transition-base);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  position: relative;
  overflow: hidden;
}

.ticker-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-h), var(--purple));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.ticker-header:hover {
  border-color: var(--hover-border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.ticker-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.ticker-header-name {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text);
  letter-spacing: var(--tracking-wide);
  background: linear-gradient(135deg, var(--text) 0%, var(--accent-h) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ticker-header-exchange {
  font-size: var(--text-base);
  color: var(--text4);
}

.ticker-header-price {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.ticker-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 28. PAGINATION
   ───────────────────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  font-size: var(--text-base);
  color: var(--text3);
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.pagination-info {
  font-variant-numeric: tabular-nums;
  font-size: var(--text-sm);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pagination-btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
  background: var(--elevated);
}

.pagination-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-h) 100%);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.page-size-select {
  padding: var(--space-1) var(--space-7) var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235E6D7E' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color var(--transition-base);
}

.page-size-select:focus {
  outline: none;
  border-color: var(--accent);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 29. ELIGIBILITY TAB
   ───────────────────────────────────────────────────────────────────────────── */
.elig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.elig-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.elig-label {
  font-size: var(--text-sm);
  color: var(--text3);
  font-weight: 600;
}

.elig-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.elig-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.elig-input-wrap:hover:not(:focus-within) {
  border-color: var(--border-hover);
}

.elig-input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  border: none;
  color: var(--text);
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
  outline: none;
  min-width: 0;
}

/* Hide native number spinners */
.elig-input::-webkit-outer-spin-button,
.elig-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.elig-input[type="number"] {
  -moz-appearance: textfield;
}

.elig-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  background: var(--elevated);
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text3);
  font-size: var(--text-lg);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
}

.elig-btn:hover {
  background: var(--overlay);
  color: var(--text);
}

.elig-btn:active {
  background: var(--accent-dim);
  color: var(--accent-h);
}

.elig-reset-btn {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text3);
  background: var(--glass-lo);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.elig-reset-btn:hover {
  color: var(--accent-h);
  background: var(--accent-dim);
  border-color: var(--accent);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 30. FOOTER
   ───────────────────────────────────────────────────────────────────────────── */
.dashboard-footer {
  text-align: center;
  padding: var(--space-6) 0 var(--space-4);
  border-top: 1px solid var(--border-glass);
  margin-top: var(--space-8);
  color: var(--text4);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-widest);
  font-weight: 500;
  background: linear-gradient(0deg, var(--bg-subtle) 0%, transparent 100%);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 31. UTILITY CLASSES
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Color utilities ── */
.text-green    { color: var(--green); }
.text-green-d  { color: var(--green-d); }
.text-red      { color: var(--red); }
.text-red-d    { color: var(--red-d); }
.text-amber    { color: var(--amber); }
.text-amber-d  { color: var(--amber-d); }
.text-accent   { color: var(--accent-h); }
.text-purple   { color: var(--purple-d); }
.text-cyan     { color: var(--cyan); }
.text-muted    { color: var(--text4); }

/* ── Typography utilities ── */
.text-mono     { font-family: var(--font-mono); }
.fw-800        { font-weight: 800; }
.fw-700        { font-weight: 700; }
.fw-600        { font-weight: 600; }
.tabnum        { font-variant-numeric: tabular-nums; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }

/* ── Spacing utilities ── */
.mb-8          { margin-bottom: var(--space-2); }
.mb-16         { margin-bottom: var(--space-4); }
.mb-24         { margin-bottom: var(--space-6); }
.mt-16         { margin-top: var(--space-4); }
.gap-16        { gap: var(--space-4); }

/* ── Truncation ── */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Accessibility ── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ── Backdrop blur ── */
.backdrop-blur {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── Skeleton loading ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--glass-hi) 25%,
    var(--glass-md) 50%,
    var(--glass-hi) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-xs);
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}

/* ── Fade animations ── */
.fade-in {
  animation: fadeInTab 0.3s ease-out forwards;
}

.fade-in-up {
  animation: fadeInUp 0.4s ease-out forwards;
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 32. FOCUS STATES (Keyboard Navigation)
   ───────────────────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

/* Reset for elements with their own focus styles */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: none;
}

button:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 33. RESPONSIVE — TABLET (max-width: 1024px)
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .app-container.sidebar-open {
    margin-right: 280px;
  }

  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }

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

  .metrics-row {
    flex-wrap: wrap;
  }

  .metric-card {
    flex: 1 1 calc(50% - var(--space-2));
    min-width: 180px;
  }
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 34. RESPONSIVE — MOBILE (max-width: 768px)
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-container {
    padding: var(--space-3) var(--space-4);
  }

  .app-container.sidebar-open {
    margin-right: 0;
  }

  /* Header */
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-4);
  }

  .dashboard-title {
    font-size: var(--text-xl);
  }

  .dashboard-subtitle {
    font-size: var(--text-sm);
  }

  /* Metric cards — 2-col grid on tablet/mobile */
  .metrics-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .metric-card {
    height: auto;
    min-height: 100px;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    flex: none;
  }

  /* Last card (Market) spans full width if odd count */
  .metric-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .metric-value {
    font-size: 1.8rem !important;
  }

  .metric-label {
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-wider);
  }

  .metric-sub {
    font-size: 0.75rem;
    margin-top: var(--space-1);
  }

  /* Tabs */
  .tab-btn {
    padding: var(--space-3) var(--space-3);
    font-size: var(--text-base);
  }

  /* Grids */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .movers-grid {
    grid-template-columns: 1fr;
  }

  .elig-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  /* Top tickers table */
  .top-tickers-table { font-size: var(--text-xs); }
  .top-tickers-table thead th { padding: var(--space-1) var(--space-2); }
  .top-tickers-table tbody td { padding: var(--space-2) var(--space-2); }

  /* Detail */
  .detail-section {
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-3);
  }

  .detail-title {
    font-size: var(--text-sm);
    letter-spacing: var(--tracking-wider);
  }

  .detail-key,
  .detail-val {
    font-size: var(--text-base);
  }

  /* Ticker header */
  .ticker-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ticker-header-name {
    font-size: var(--text-xl);
  }

  /* TV buttons */
  .tv-btn {
    width: 100%;
    justify-content: center;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-lg);
  }

  .tv-link {
    font-size: var(--text-sm);
    padding: var(--space-1) var(--space-3);
  }

  /* Sidebar */
  .sidebar {
    width: 100%;
  }

  /* Disable hover transforms on touch */
  .metric-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }

  /* Search */
  .search-bar {
    flex-direction: column;
  }

  .search-bar::before {
    top: 22px;
  }

  .search-input {
    min-width: 100%;
  }

  .search-bar select {
    width: 100%;
  }

  /* Charts */
  .chart-container {
    min-height: 250px;
  }

  .chart-placeholder {
    min-height: 230px;
  }

  /* TV Chart widget */
  .tv-chart-container {
    height: 400px;
  }

  /* Tables horizontal scroll indicator */
  .signals-table-wrapper {
    position: relative;
  }

  /* Pillar progress */
  .pillar-progress-name {
    min-width: 90px;
    font-size: var(--text-sm);
  }

  /* Pagination */
  .pagination {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .pagination-controls {
    justify-content: center;
  }

  /* Scrollbar: auto-hide on mobile */
  ::-webkit-scrollbar {
    width: 3px;
    height: 3px;
  }
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 35. RESPONSIVE — SMALL MOBILE (max-width: 480px)
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .app-container {
    padding: var(--space-2) var(--space-3);
  }

  .dashboard-title {
    font-size: var(--text-lg);
  }

  .metric-card {
    min-height: 85px;
    padding: var(--space-3) var(--space-3);
  }

  .metric-value {
    font-size: 1.5rem !important;
    height: 36px;
  }

  .tab-btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
  }

  .ticker-header-name {
    font-size: var(--text-lg);
  }

  .ticker-header-left {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .detail-section {
    padding: var(--space-3);
  }

  /* TV Chart widget */
  .tv-chart-container {
    height: 350px;
  }
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 36. RESPONSIVE — LARGE SCREEN (min-width: 1280px)
   ───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 1280px) {
  .app-container {
    padding: var(--space-6) var(--space-8);
  }
}


/* ─────────────────────────────────────────────────────────────────────────────
   § 37. PRINT STYLES
   ───────────────────────────────────────────────────────────────────────────── */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.4;
  }

  .sidebar,
  .sidebar-toggle-btn,
  .tab-nav,
  .search-bar,
  .pagination,
  .tv-btn,
  .tv-btn-sm,
  .tv-link,
  .tv-link-sm,
  .theme-toggle {
    display: none !important;
  }

  .app-container {
    margin-right: 0 !important;
    max-width: 100%;
    padding: 0;
  }

  .tab-content {
    display: block !important;
    opacity: 1 !important;
  }

  .metric-card {
    border: 1px solid #ddd !important;
    page-break-inside: avoid;
  }

  .signals-table-wrapper {
    max-height: none;
    overflow: visible;
  }

  .signals-table th,
  .signals-table td,
  .movers-table th,
  .movers-table td {
    border: 1px solid #ccc !important;
    padding: 4px 8px;
  }

  .detail-section {
    border: 1px solid #ddd !important;
    page-break-inside: avoid;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #666 !important;
  }
}
