/* EquiSense — Shared component styles for all revamped pages */
/* Theme variables + layout primitives shared across all pages */

/* ═══════════════════════════════════════════════════════════════════════════
   FONT CONFIG — Single source of truth. Change fonts here only.
   --font-body    → prose, paragraphs, labels, UI text
   --font-heading → page titles, section headings, brand
   --font-data    → financial numbers, tables, percentages, prices
   --font-mono    → code snippets, kbd shortcuts only
   ═══════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;500;600;700;800&family=DM+Serif+Display&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;800&display=swap');

:root {
  --font-body: 'Lexend', -apple-system, system-ui, sans-serif;
  --font-heading: 'DM Serif Display', Georgia, serif;
  --font-data: 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME VARIABLES — Single source of truth for all pages
   ═══════════════════════════════════════════════════════════════════════════ */
:root, :root[data-theme="dark"] {
  --bg: #0c0e14;
  --bg-elevated: #11141b;
  --card-bg: #161923;
  --border: rgba(255,255,255,0.08);
  --text-primary: #e6e8ed;
  --text-secondary: #9ca3af;
  --text-tertiary: #8b95a5;
  --accent: #34d399;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --blue: #60a5fa;
  --purple: #a78bfa;

  /* Tint layers (white overlays on dark bg) */
  --tint-1: rgba(255,255,255,0.02);
  --tint-2: rgba(255,255,255,0.025);
  --tint-3: rgba(255,255,255,0.03);
  --tint-4: rgba(255,255,255,0.04);
  --tint-5: rgba(255,255,255,0.05);
  --tint-6: rgba(255,255,255,0.06);
  --tint-8: rgba(255,255,255,0.08);
  --tint-10: rgba(255,255,255,0.1);
  --tint-12: rgba(255,255,255,0.12);
  --tint-14: rgba(255,255,255,0.14);
  --tint-15: rgba(255,255,255,0.15);

  /* Shadows */
  --shadow-card: 0 8px 32px rgba(0,0,0,0.3);
  --shadow-card-sm: 0 4px 16px rgba(0,0,0,0.2);
  --shadow-modal: 0 24px 80px rgba(0,0,0,0.5);
  --shadow-dropdown: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-popover: 0 20px 60px rgba(0,0,0,0.5);
  --overlay-bg: rgba(0,0,0,0.6);

  /* Accent overlays */
  --accent-tint: rgba(52,211,153,0.1);
  --accent-tint-soft: rgba(52,211,153,0.04);
  --accent-tint-subtle: rgba(52,211,153,0.03);
  --accent-tint-xs: rgba(52,211,153,0.06);
  --accent-tint-bg: rgba(52,211,153,0.08);
  --accent-tint-badge: rgba(52,211,153,0.12);
  --accent-tint-15: rgba(52,211,153,0.15);
  --accent-tint-20: rgba(52,211,153,0.2);
  --accent-border: rgba(52,211,153,0.2);
  --accent-border-subtle: rgba(52,211,153,0.08);
  --accent-border-soft: rgba(52,211,153,0.12);
  --accent-border-mid: rgba(52,211,153,0.15);
  --accent-border-strong: rgba(52,211,153,0.18);
  --accent-border-vivid: rgba(52,211,153,0.4);
  --accent-focus: 0 0 0 3px rgba(52,211,153,0.08);
  --accent-gradient: linear-gradient(135deg, rgba(52,211,153,0.04) 0%, rgba(22,25,35,1) 60%);

  --red-tint: rgba(248,113,113,0.15);
  --red-tint-soft: rgba(248,113,113,0.03);
  --red-tint-xs: rgba(248,113,113,0.06);
  --red-tint-bg: rgba(248,113,113,0.08);
  --red-tint-badge: rgba(248,113,113,0.12);
  --red-tint-soft-bg: rgba(248,113,113,0.04);
  --red-border-mid: rgba(248,113,113,0.15);
  --red-border-subtle: rgba(248,113,113,0.1);
  --red-border-strong: rgba(248,113,113,0.18);
  --red-border-vivid: rgba(248,113,113,0.4);
  --red-gradient: linear-gradient(135deg, rgba(248,113,113,0.04) 0%, rgba(22,25,35,1) 60%);

  --blue-border-vivid: rgba(96,165,250,0.4);
  --blue-tint-bg: rgba(96,165,250,0.08);
  --blue-border-mid: rgba(96,165,250,0.15);
  --blue-border-dashed: rgba(96,165,250,0.25);

  --amber-tint-badge: rgba(251,191,36,0.12);
  --amber-border-mid: rgba(251,191,36,0.15);
  --amber-border-strong: rgba(251,191,36,0.18);
  --amber-gradient: linear-gradient(135deg, rgba(251,191,36,0.04) 0%, rgba(22,25,35,1) 60%);
  --purple-tint-badge: rgba(139,92,246,0.12);
  --blue-alt-border-mid: rgba(59,130,246,0.15);
  --blue-alt-border-subtle: rgba(59,130,246,0.1);
  --blue-alt-gradient: linear-gradient(135deg, rgba(59,130,246,0.03) 0%, rgba(22,25,35,1) 60%);
  --green-alt-tint: rgba(110,231,183,0.04);

  /* Contrast */
  --on-accent: #000;
  --chart-grid: rgba(255,255,255,0.04);
  --chart-label: rgba(255,255,255,0.18);
}

:root[data-theme="light"] {
  --bg: #f8f9fb;
  --bg-elevated: #ffffff;
  --card-bg: #ffffff;
  --border: rgba(0,0,0,0.08);
  --text-primary: #1a1d26;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --accent: #047857;
  --green: #047857;
  --red: #dc2626;
  --amber: #d97706;
  --blue: #2563eb;
  --purple: #7c3aed;

  /* Tint layers (black overlays on light bg) */
  --tint-1: rgba(0,0,0,0.015);
  --tint-2: rgba(0,0,0,0.02);
  --tint-3: rgba(0,0,0,0.025);
  --tint-4: rgba(0,0,0,0.03);
  --tint-5: rgba(0,0,0,0.04);
  --tint-6: rgba(0,0,0,0.05);
  --tint-8: rgba(0,0,0,0.06);
  --tint-10: rgba(0,0,0,0.08);
  --tint-12: rgba(0,0,0,0.1);
  --tint-14: rgba(0,0,0,0.12);
  --tint-15: rgba(0,0,0,0.13);

  /* Shadows */
  --shadow-card: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-card-sm: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-modal: 0 16px 48px rgba(0,0,0,0.12);
  --shadow-dropdown: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-popover: 0 12px 32px rgba(0,0,0,0.1);
  --overlay-bg: rgba(0,0,0,0.4);

  /* Accent overlays */
  --accent-tint: rgba(5,150,105,0.08);
  --accent-tint-soft: rgba(5,150,105,0.03);
  --accent-tint-subtle: rgba(5,150,105,0.02);
  --accent-tint-xs: rgba(5,150,105,0.04);
  --accent-tint-bg: rgba(5,150,105,0.06);
  --accent-tint-badge: rgba(5,150,105,0.1);
  --accent-tint-15: rgba(5,150,105,0.12);
  --accent-tint-20: rgba(5,150,105,0.15);
  --accent-border: rgba(5,150,105,0.2);
  --accent-border-subtle: rgba(5,150,105,0.08);
  --accent-border-soft: rgba(5,150,105,0.1);
  --accent-border-mid: rgba(5,150,105,0.12);
  --accent-border-strong: rgba(5,150,105,0.15);
  --accent-border-vivid: rgba(5,150,105,0.3);
  --accent-focus: 0 0 0 3px rgba(5,150,105,0.08);
  --accent-gradient: linear-gradient(135deg, rgba(5,150,105,0.04) 0%, rgba(255,255,255,1) 60%);

  --red-tint: rgba(220,38,38,0.1);
  --red-tint-soft: rgba(220,38,38,0.02);
  --red-tint-xs: rgba(220,38,38,0.04);
  --red-tint-bg: rgba(220,38,38,0.06);
  --red-tint-badge: rgba(220,38,38,0.1);
  --red-tint-soft-bg: rgba(220,38,38,0.03);
  --red-border-mid: rgba(220,38,38,0.12);
  --red-border-subtle: rgba(220,38,38,0.08);
  --red-border-strong: rgba(220,38,38,0.15);
  --red-border-vivid: rgba(220,38,38,0.3);
  --red-gradient: linear-gradient(135deg, rgba(220,38,38,0.04) 0%, rgba(255,255,255,1) 60%);

  --blue-border-vivid: rgba(37,99,235,0.3);
  --blue-tint-bg: rgba(37,99,235,0.06);
  --blue-border-mid: rgba(37,99,235,0.12);
  --blue-border-dashed: rgba(37,99,235,0.2);

  --amber-tint-badge: rgba(217,119,6,0.1);
  --amber-border-mid: rgba(217,119,6,0.12);
  --amber-border-strong: rgba(217,119,6,0.15);
  --amber-gradient: linear-gradient(135deg, rgba(217,119,6,0.04) 0%, rgba(255,255,255,1) 60%);
  --purple-tint-badge: rgba(124,58,237,0.1);
  --blue-alt-border-mid: rgba(37,99,235,0.12);
  --blue-alt-border-subtle: rgba(37,99,235,0.08);
  --blue-alt-gradient: linear-gradient(135deg, rgba(37,99,235,0.03) 0%, rgba(255,255,255,1) 60%);
  --green-alt-tint: rgba(5,150,105,0.04);

  /* Contrast */
  --on-accent: #fff;
  --chart-grid: rgba(0,0,0,0.06);
  --chart-label: rgba(0,0,0,0.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea { font-family: inherit; }
html { font-family: var(--font-body); }
body {
  background: var(--bg); color: var(--text-primary);
  font-family: var(--font-body); margin: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}

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

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  animation: fadeIn 0.4s ease both;
}
.hover-card { transition: all 0.2s ease; }
.hover-card:hover {
  border-color: var(--tint-14);
  transform: translateY(-1px);
}
/* Focus-visible for keyboard navigation */
.hover-card:focus-visible, .news-page-btn:focus-visible, .tab-btn:focus-visible, .range-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: var(--shadow-card);
}

/* Badge */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap;
}

/* Typing animation */
.typing-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-tertiary);
  animation: typing 1.2s infinite;
  display: inline-block;
}
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Shimmer skeleton */
.shimmer-line, .shimmer-block {
  background: linear-gradient(90deg, var(--tint-4) 25%, var(--tint-8) 50%, var(--tint-4) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
/* Skeleton container — matches loaded page min-height to prevent layout shift */
.page-skeleton {
  min-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Input — only style standalone inputs, not inputs nested inside custom wrappers */
input::placeholder { color: var(--text-tertiary); }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint-bg); }
input[style*="border:none"]:focus,
input[style*="border: none"]:focus,
.alerts-search-wrap input:focus,
.lp-login-field input:focus,
.cmd-input:focus,
.referral-code-box input:focus { border: none !important; box-shadow: none !important; outline: none !important; }

/* Command Palette */
.cmd-overlay {
  position: fixed; inset: 0;
  background: var(--overlay-bg); backdrop-filter: blur(8px);
  z-index: 1000; display: flex;
  align-items: flex-start; justify-content: center;
  padding-top: 120px;
}
.cmd-box {
  width: 520px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; box-shadow: var(--shadow-modal);
}
.cmd-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.cmd-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 15px; font-family: inherit;
}
.cmd-results { max-height: 320px; overflow-y: auto; padding: 8px; }
.cmd-result-item {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px; border-radius: 10px;
  cursor: pointer; transition: background 0.15s;
}
.cmd-result-item:hover { background: var(--tint-5); }

/* Floating Chat — Glowing logo FAB */
.chat-fab {
  position: fixed; bottom: 15%; right: 24px;
  width: 52px; height: 52px; border-radius: 50%;
  border: none; font-size: 20px; font-weight: 800;
  font-family: var(--font-body);
  cursor: grab; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s ease;
  touch-action: none; /* prevent scroll during drag on mobile */
  background: rgba(16, 185, 129, 0.15);
  box-shadow:
    0 0 16px 4px rgba(16, 185, 129, 0.5),
    0 0 40px 8px rgba(16, 185, 129, 0.25),
    0 0 80px 16px rgba(16, 185, 129, 0.1);
  animation: fabGlow 2.5s ease-in-out infinite;
}
.chat-fab-logo {
  display: block;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.6)) drop-shadow(0 0 16px rgba(16, 185, 129, 0.3));
}
@keyframes fabGlow {
  0%, 100% {
    box-shadow:
      0 0 16px 4px rgba(16, 185, 129, 0.5),
      0 0 40px 8px rgba(16, 185, 129, 0.25),
      0 0 80px 16px rgba(16, 185, 129, 0.1);
  }
  50% {
    box-shadow:
      0 0 24px 8px rgba(16, 185, 129, 0.65),
      0 0 56px 12px rgba(16, 185, 129, 0.35),
      0 0 100px 24px rgba(16, 185, 129, 0.15);
  }
}
.chat-fab:hover {
  transform: scale(1.1);
  background: rgba(16, 185, 129, 0.2);
  box-shadow:
    0 0 28px 8px rgba(16, 185, 129, 0.7),
    0 0 64px 16px rgba(16, 185, 129, 0.4),
    0 0 120px 32px rgba(16, 185, 129, 0.15);
}
.chat-fab:active { transform: scale(0.96); cursor: grabbing; }
.chat-fab.dragging { cursor: grabbing; transition: none; animation: none !important; opacity: 0.85; }
/* Open state — close button */
.chat-fab-open {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  box-shadow: var(--shadow-dropdown);
  animation: none;
}
.chat-fab-open:hover { background: var(--tint-5); box-shadow: var(--shadow-dropdown); transform: scale(1.05); }
/* Hover tooltip */
.chat-fab[data-tooltip] { position: fixed; }
.chat-fab[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px); right: 0;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px; font-weight: 600;
  letter-spacing: -0.006em;
  color: var(--text-primary);
  background: rgba(28, 32, 38, 0.88);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
[data-theme="light"] .chat-fab[data-tooltip]::after {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.chat-fab[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateY(0);
}
.chat-panel {
  position: fixed; bottom: calc(15% + 60px); right: 24px;
  width: 380px; height: 520px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 20px; z-index: 300;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-popover);
  animation: fadeIn 0.25s ease;
}

/* ─── ECS Info Tooltip ────────────────────────────────────────────────── */
.ecs-info-wrap { position: relative; display: inline-flex; align-items: center; }
.ecs-info-icon {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--tint-6); color: var(--text-tertiary);
  font-size: 10px; font-weight: 700; font-style: italic;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: help; font-family: var(--font-body);
}
.ecs-tooltip {
  display: none; position: absolute; left: 50%; top: calc(100% + 8px);
  transform: translateX(-50%); z-index: 20;
  width: 280px; padding: 12px 14px; border-radius: 10px;
  background: var(--card-bg); border: 1px solid var(--border);
  box-shadow: var(--shadow-popover);
  font-size: 11px; line-height: 1.6; color: var(--text-secondary);
  pointer-events: none;
}
.ecs-info-wrap:hover .ecs-tooltip { display: block; }

/* Suggestion buttons */
.sug-btn {
  padding: 5px 10px; border-radius: 14px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-size: 11px;
  cursor: pointer; transition: all 0.15s;
}
.sug-btn:hover { border-color: var(--accent); color: var(--accent); }
.sug-btn.lg { padding: 8px 14px; border-radius: 20px; font-size: 12px; }

/* Logo blend fix */
.logo-img {
  border-radius: 6px; object-fit: contain;
  mix-blend-mode: screen;
}
:root[data-theme="light"] .logo-img { mix-blend-mode: multiply; }

/* Theme toggle */
.theme-toggle-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--tint-4);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  color: var(--text-secondary); flex-shrink: 0;
}
.theme-toggle-btn:hover { background: var(--tint-5); border-color: var(--tint-12); }
.theme-toggle-btn svg { width: 18px; height: 18px; }

/* Header */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 20, 27, 0.85);
  position: sticky; top: 0; z-index: 100;
  font-family: var(--font-body);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
:root[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.88);
}

/* Header structure — 3-column: logo | centered nav | actions */
.header-left { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.header-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.header-logo-text {
  font-size: 18px; font-weight: 800;
  color: var(--text-primary); font-family: var(--font-heading);
}
/* .header-logo-badge removed — logo is clean without badge */

/* Desktop nav links — centered in header */
.app-nav { display: flex; align-items: center; gap: 20px; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-link {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 500;
  color: var(--text-tertiary); text-decoration: none;
  transition: color 0.15s, background 0.15s;
  font-family: var(--font-body); white-space: nowrap;
}
.nav-link:hover { color: var(--text-secondary); background: var(--tint-4); }
.nav-link.active { color: var(--accent); font-weight: 700; background: var(--accent-tint-bg); }
.nav-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); display: inline-block; margin-right: 6px;
  box-shadow: 0 0 6px var(--accent), 0 0 12px rgba(52,211,153,0.3);
  animation: nav-pulse 2.5s ease-in-out infinite; vertical-align: middle;
}
@keyframes nav-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.nav-link.active .nav-dot { opacity: 1; animation: none; }

/* Header search trigger */
.header-search {
  padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--tint-1);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
  min-height: 38px; min-width: 200px;
}
.header-search:hover { border-color: var(--tint-12); background: var(--tint-4); }
.header-search-icon { color: var(--text-tertiary); font-size: 13px; }
.header-search-text { color: var(--text-tertiary); font-size: 12px; white-space: nowrap; }
.header-search-kbd {
  font-size: 10px; color: var(--text-tertiary);
  background: var(--tint-5); padding: 1px 5px; border-radius: 3px;
  font-family: var(--font-mono); border: 1px solid var(--tint-6); line-height: 1.4;
}

/* Hamburger (hidden on desktop) */
.hamburger-btn {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: none; border-radius: 8px;
  background: transparent; cursor: pointer; padding: 0;
  transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--tint-5); }
.hamburger-icon { display: flex; flex-direction: column; gap: 4px; width: 18px; }
.hamburger-icon span {
  display: block; height: 2px; width: 100%;
  background: var(--text-secondary); border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.hamburger-btn.open .hamburger-icon span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger-btn.open .hamburger-icon span:nth-child(2) { opacity: 0; }
.hamburger-btn.open .hamburger-icon span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile nav drawer */
.mobile-nav-drawer {
  display: none;
  position: fixed; top: 54px; left: 0; right: 0;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px 12px; z-index: 99;
  animation: drawerSlide 0.2s ease;
  box-shadow: var(--shadow-dropdown);
}
.mobile-nav-drawer.open { display: block; }
@keyframes drawerSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.mobile-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary); text-decoration: none;
  transition: background 0.15s;
}
.mobile-nav-link:hover { background: var(--tint-4); }
.mobile-nav-link.active { color: var(--accent); font-weight: 700; background: var(--accent-tint-xs); }
.mobile-nav-icon { font-size: 14px; width: 20px; text-align: center; }

/* Account dropdown */
/* ── Account Dropdown — Ive-inspired frosted glass panel ── */
.acct-dropdown-wrap { position: relative; }
.acct-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--tint-3);
  color: var(--text-secondary); cursor: pointer;
  transition: all 0.2s ease;
}
.acct-btn:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-tint-xs);
}
.acct-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  min-width: 240px; padding: 6px;
  background: rgba(28, 32, 38, 0.82);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 200;
  animation: acctReveal 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  transform-origin: top right;
}
[data-theme="light"] .acct-dropdown {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
@keyframes acctReveal {
  from { opacity: 0; transform: scale(0.96) translateY(-6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.acct-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  letter-spacing: -0.008em;
  text-decoration: none; cursor: pointer;
  border: none; background: none; width: 100%;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
  text-align: left;
  -webkit-user-select: none; user-select: none;
}
.acct-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}
[data-theme="light"] .acct-item:hover {
  background: rgba(0, 0, 0, 0.05);
}
.acct-item:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.98);
}
[data-theme="light"] .acct-item:active {
  background: rgba(0, 0, 0, 0.08);
}
.acct-item svg {
  flex-shrink: 0; color: var(--text-tertiary);
  opacity: 0.6; transition: opacity 0.15s ease;
}
.acct-item:hover svg { opacity: 0.8; color: var(--text-secondary); }
.acct-divider {
  height: 1px; margin: 4px 14px;
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .acct-divider {
  background: rgba(0, 0, 0, 0.06);
}
.acct-logout {
  color: #f87171;
}
.acct-logout:hover {
  background: rgba(248, 113, 113, 0.08);
  color: #f87171;
}
.acct-logout:active {
  background: rgba(248, 113, 113, 0.14);
}
.acct-logout svg { color: #f87171; opacity: 0.6; }
.acct-logout:hover svg { color: #f87171; opacity: 0.8; }
.acct-backdrop {
  position: fixed; inset: 0; z-index: 99; background: transparent;
}
/* Smooth theme transitions */
.theme-ready, .theme-ready *, .theme-ready *::before, .theme-ready *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease !important;
}

/* AI response card — subtle left accent border */
.research-ai-row {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 16px 20px;
}

/* Research AI content */
.research-ai-content p { margin: 8px 0; line-height: 1.75; }
.research-ai-content strong { color: var(--text-primary); font-weight: 700; }
.research-ai-content em { font-style: italic; }
.research-ai-content li { margin-bottom: 4px; padding-left: 4px; }
.research-ai-content ul { margin: 8px 0; padding-left: 8px; }
.research-ai-content h3, .research-ai-content h4 { color: var(--text-primary); }
.research-ai-content hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.research-ai-content code {
  background: var(--tint-6); padding: 1px 5px;
  border-radius: 4px; font-family: var(--font-mono); font-size: 0.9em;
}

/* Research avatar */
.research-avatar {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Research input textarea */
.research-input-area textarea { transition: border-color 0.15s, box-shadow 0.15s; }
.research-input-area textarea:focus { border-color: var(--accent) !important; box-shadow: var(--accent-focus); }
.research-input-area textarea::placeholder { color: var(--text-tertiary); }

/* ── Thinking status ─────────────────────────────────────────────────────── */
.thinking-status {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600; color: var(--accent);
  margin-bottom: 12px;
}
.thinking-orb {
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, var(--accent), rgba(52,211,153,0.2));
  animation: orbPulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes orbPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.6; box-shadow: 0 0 0 0 rgba(52,211,153,0.3); }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px 4px rgba(52,211,153,0.15); }
}
.thinking-text {
  animation: thinkFade 0.4s ease;
}
@keyframes thinkFade {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Follow-up chip */
.research-followup-chip {
  opacity: 0;
  animation: chipFadeIn 0.4s ease forwards;
  background: var(--tint-4);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  line-height: 1.4;
}
/* ── News Pagination ──────────────────────────────────────────────────────── */
.news-page-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; transition: all 0.15s ease;
}
.news-page-btn:hover:not(:disabled) {
  background: var(--accent-tint-bg); border-color: var(--accent); color: var(--accent);
}
.news-page-btn.active {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
}
.news-page-btn:disabled { pointer-events: none; }

.research-followup-chip:hover {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
@keyframes chipFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive: shared tablet/mobile overrides ─────────────────────────────── */
@media (max-width: 768px) {
  .app-header { padding: 0 16px; }
  .app-nav { display: none; }
  .hamburger-btn { display: flex; }
  .header-search-text { display: none; }
  .header-search-kbd { display: none; }
  .header-search { padding: 6px 10px; width: auto; min-width: 0; }
  .chat-panel { width: calc(100vw - 32px); right: 16px; }
  .cmd-box { width: calc(100vw - 40px); max-width: 520px; }
  .cmd-overlay { padding-top: 80px; }
  .research-grid { grid-template-columns: 1fr !important; }

  /* Layout primitives */
  .grid-4 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-3 { grid-template-columns: 1fr !important; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .data-table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .range-btn {
    padding: 10px 14px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 480px) {
  .app-header { height: 48px; padding: 0 12px; }
  .mobile-nav-drawer { top: 48px; }
  .cmd-box { width: calc(100vw - 24px); }
  .cmd-overlay { padding-top: 60px; }
  .research-grid { grid-template-columns: 1fr !important; }
  .research-followup-chip { font-size: 11px; padding: 6px 10px; }
  .research-input-area textarea { padding: 10px 12px; font-size: 13px; }

  /* Layout primitives */
  .page-main { padding: 10px 12px 16px !important; }
  .grid-4 { grid-template-columns: 1fr !important; }
  .range-btn {
    padding: 12px 14px !important;
    font-size: 12px !important;
  }
  .chat-panel {
    width: calc(100vw - 16px); right: 8px;
    bottom: 80px; height: 70vh; max-height: 480px;
  }
  .chat-fab {
    width: 44px; height: 44px;
    bottom: 30%; right: 16px; border-radius: 50%;
  }
  .chat-fab[data-tooltip]::after { display: none; }
  .acct-dropdown {
    position: fixed;
    top: auto; right: 8px; left: 8px;
    top: 56px;
    min-width: unset; width: auto;
    border-radius: 14px;
  }
}

/* ─── Account Dropdown (duplicate removed — see primary block above) ───── */

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT PRIMITIVES — Shared across Discover, Deep Dive, Portfolio, etc.
   ═══════════════════════════════════════════════════════════════════════════ */
.card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 18px;
}

/* Stat boxes */
.stat-box { padding: 10px 12px; background: var(--tint-3); border-radius: 8px; }
.stat-label { display: block; font-size: 11px; color: var(--text-tertiary); font-weight: 600; margin-bottom: 4px; }
.stat-value { font-size: 18px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }

.badge.tone-positive { background: var(--accent-tint-15); color: var(--green); }
.badge.tone-negative { background: var(--red-tint); color: var(--red); }
.badge.tone-neutral { background: var(--tint-6); color: var(--text-secondary); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-tertiary); font-weight: 600;
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.06em; background: var(--tint-1);
}
.data-table td { padding: 11px 12px; }
.data-table tbody tr { border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--tint-1); }

/* Grid layouts */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Chart range buttons */
.range-btn {
  padding: 10px 16px; border-radius: 8px; border: none;
  cursor: pointer; font-size: 12px; font-weight: 700;
  transition: all 0.15s; line-height: 1.2;
  min-height: 36px;
}
.range-btn.active { background: var(--accent); color: var(--on-accent); }
.range-btn:not(.active) { background: var(--tint-4); color: var(--text-tertiary); }

/* Tab buttons */
.tab-btn {
  padding: 12px 20px; border-radius: 8px 8px 0 0; border: none;
  cursor: pointer; font-weight: 700; font-size: 13px;
  text-transform: capitalize; transition: all 0.15s;
  font-family: var(--font-body);
}
.tab-btn.active {
  background: var(--card-bg); color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
.tab-btn:not(.active) {
  background: transparent; color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER DISCLAIMER — shared across all pages
   ═══════════════════════════════════════════════════════════════════════════ */
/* Sticky footer: #app is a flex column filling viewport; main grows, footer stays at bottom */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.page-main { max-width: 1200px; width: 100%; margin: 0 auto; padding: 14px 24px 20px; font-family: var(--font-body); flex: 1; min-height: 0; }
#app > .app-footer { flex-shrink: 0; }

.app-footer {
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  text-align: center;
  flex-shrink: 0;
}
.app-footer p {
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 10000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none; max-width: 400px; width: calc(100% - 32px);
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: 14px;
  background: var(--bg-elevated, #11141b);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
  pointer-events: auto; cursor: default;
  opacity: 0; transform: translateX(80px) scale(0.95);
  transition: opacity 0.35s cubic-bezier(0.16,1,0.3,1), transform 0.35s cubic-bezier(0.16,1,0.3,1);
  position: relative; overflow: hidden;
  font-family: var(--font-body, 'Lexend', sans-serif);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.toast.show { opacity: 1; transform: translateX(0) scale(1); }
.toast.hide { opacity: 0; transform: translateX(80px) scale(0.95); pointer-events: none; }
.toast-icon {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.toast-icon svg { width: 18px; height: 18px; }
.toast-body { flex: 1; min-width: 0; padding-top: 2px; }
.toast-title {
  font-size: 13px; font-weight: 700; line-height: 1.3;
  color: var(--text-primary, #e6e8ed); margin-bottom: 2px;
}
.toast-msg {
  font-size: 12px; font-weight: 400; line-height: 1.4;
  color: var(--text-tertiary, #8b95a5);
}
.toast-close {
  background: none; border: none; cursor: pointer; padding: 2px;
  color: var(--text-tertiary, #8b95a5); flex-shrink: 0;
  opacity: 0; transition: opacity 0.15s, color 0.15s;
  margin-top: 1px;
}
.toast:hover .toast-close { opacity: 1; }
.toast-close:hover { color: var(--text-primary, #e6e8ed); }
.toast-close svg { width: 14px; height: 14px; }
.toast-progress {
  position: absolute; bottom: 0; left: 0; height: 3px;
  border-radius: 0 0 14px 14px;
  animation: toast-shrink var(--toast-duration, 3s) linear forwards;
}
@keyframes toast-shrink {
  from { width: 100%; }
  to   { width: 0%; }
}
/* Type: success */
.toast-success .toast-icon { background: rgba(52,211,153,0.12); color: #34d399; }
.toast-success .toast-progress { background: #34d399; }
.toast-success { border-color: rgba(52,211,153,0.15); }
/* Type: error */
.toast-error .toast-icon { background: rgba(248,113,113,0.12); color: #f87171; }
.toast-error .toast-progress { background: #f87171; }
.toast-error { border-color: rgba(248,113,113,0.15); }
/* Type: warning */
.toast-warning .toast-icon { background: rgba(251,191,36,0.12); color: #fbbf24; }
.toast-warning .toast-progress { background: #fbbf24; }
.toast-warning { border-color: rgba(251,191,36,0.15); }
/* Type: info */
.toast-info .toast-icon { background: rgba(96,165,250,0.12); color: #60a5fa; }
.toast-info .toast-progress { background: #60a5fa; }
.toast-info { border-color: rgba(96,165,250,0.15); }
/* Light theme overrides */
:root[data-theme="light"] .toast {
  background: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.06);
}
/* Mobile */
@media (max-width: 480px) {
  .toast-container { top: 8px; right: 8px; width: calc(100% - 16px); }
  .toast { padding: 12px 14px; gap: 10px; border-radius: 12px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN MODAL — shared between landing page and auth-guard teaser
   ═══════════════════════════════════════════════════════════════════════════ */
.lp-login-overlay {
  position: fixed; inset: 0;
  background: var(--overlay-bg, rgba(0,0,0,0.6));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}
.lp-login-overlay.open { display: flex; }
.lp-login-dialog {
  width: 420px;
  max-width: calc(100vw - 32px);
  background: var(--bg-elevated, #11141b);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  position: relative;
  animation: fadeIn 0.3s ease both;
}
.lp-login-dismiss {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-tertiary); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.lp-login-dismiss:hover { background: var(--tint-5); color: var(--text-primary); }
.lp-login-content { padding: 40px 36px 36px; }
.lp-login-logo { text-align: center; margin-bottom: 28px; }
.lp-login-logo img { border-radius: 10px; margin-bottom: 14px; }
.lp-login-logo h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; font-family: var(--font-heading); }
.lp-login-logo p { font-size: 13px; color: var(--text-tertiary); margin-top: 6px; }
.lp-login-form { display: flex; flex-direction: column; gap: 12px; }
.lp-login-field {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card-bg);
  transition: border-color 0.2s;
}
.lp-login-field:focus-within { border-color: var(--accent); }
.lp-login-field svg { color: var(--text-tertiary); flex-shrink: 0; }
.lp-login-field .lp-login-prefix { font-size: 13px; font-weight: 600; color: var(--text-secondary); padding-right: 8px; border-right: 1px solid var(--border); }
.lp-login-field input { flex: 1; border: none; background: transparent; outline: none; color: var(--text-primary); font-size: 14px; font-family: inherit; }
.lp-login-field input::placeholder { color: var(--text-tertiary); }
.lp-login-submit {
  padding: 14px; border-radius: 12px; border: none;
  background: var(--accent); color: var(--on-accent);
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all 0.2s; font-family: inherit; margin-top: 4px;
}
.lp-login-submit:hover { filter: brightness(1.1); transform: translateY(-1px); }
.lp-login-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.lp-login-note { text-align: center; font-size: 11px; color: var(--text-tertiary); margin-top: 16px; line-height: 1.5; }
@media (max-width: 480px) {
  .lp-login-content { padding: 32px 24px 28px; }
  .lp-login-logo h2 { font-size: 18px; }
}
